use of org.olat.modules.qpool.ui.datasource.SharedItemsSource in project OpenOLAT by OpenOLAT.
the class ItemListMySharesController method initButtons.
@Override
protected void initButtons(UserRequest ureq, FormItemContainer formLayout) {
getItemsTable().setMultiSelect(true);
selectLink = uifactory.addFormLink("select-to-import", "select", null, formLayout, Link.BUTTON);
Roles roles = ureq.getUserSession().getRoles();
if (qpoolModule.isPoolsEnabled()) {
myPools = qpoolService.getPools(getIdentity(), roles);
} else {
myPools = Collections.emptyList();
}
if (qpoolModule.isSharesEnabled()) {
myGroups = qpoolService.getResourcesWithSharedItems(getIdentity());
} else {
myGroups = Collections.emptyList();
}
String[] myShareKeys;
String[] myShareValues;
if (myPools.isEmpty() && myGroups.isEmpty()) {
myShareKeys = new String[1];
myShareValues = new String[1];
myShareKeys[0] = "";
myShareValues[0] = "";
} else {
int numOfShares = myPools.size() + myGroups.size();
myShareKeys = new String[numOfShares];
myShareValues = new String[numOfShares];
int pos = 0;
for (Pool myPool : myPools) {
myShareKeys[pos] = "pool" + myPool.getKey().toString();
myShareValues[pos++] = myPool.getName();
}
for (BusinessGroup group : myGroups) {
myShareKeys[pos] = "grou" + group.getKey().toString();
myShareValues[pos++] = group.getName();
}
}
myShareEl = uifactory.addDropdownSingleselect("source.selector", "my.list", formLayout, myShareKeys, myShareValues, null);
myShareEl.setDomReplacementWrapperRequired(false);
myShareEl.getLabelC().setDomReplaceable(false);
myShareEl.addActionListener(FormEvent.ONCHANGE);
if (myPools.isEmpty() && myGroups.isEmpty()) {
myShareEl.setEnabled(false);
} else {
myShareEl.select(myShareKeys[0], true);
if (myPools.size() > 0) {
Pool firstPool = myPools.get(0);
PoolItemsSource source = new PoolItemsSource(getIdentity(), roles, firstPool);
source.getDefaultParams().setFormat(restrictToFormat);
updateSource(source);
} else if (myGroups.size() > 0) {
BusinessGroup firstGroup = myGroups.get(0);
SharedItemsSource source = new SharedItemsSource(firstGroup, getIdentity(), roles, false);
source.setRestrictToFormat(restrictToFormat);
updateSource(source);
}
}
}
use of org.olat.modules.qpool.ui.datasource.SharedItemsSource in project OpenOLAT by OpenOLAT.
the class BusinessGroupTreeNode method getController.
@Override
public Controller getController(UserRequest ureq, WindowControl wControl) {
if (questionsCtrl == null) {
boolean shareAdmin = isShareAdmin(ureq, group);
QuestionItemsSource source = new SharedItemsSource(group, ureq.getIdentity(), ureq.getUserSession().getRoles(), shareAdmin);
WindowControl swControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, group, null, wControl, true);
questionsCtrl = new QuestionsController(ureq, swControl, stackPanel, source, securityCallback, TABLE_PREFERENCE_PREFIX + group.getKey(), false);
} else {
questionsCtrl.updateSource();
}
return questionsCtrl;
}
use of org.olat.modules.qpool.ui.datasource.SharedItemsSource in project OpenOLAT by OpenOLAT.
the class ItemListMySharesController method doSelectBusinessGroup.
private void doSelectBusinessGroup(UserRequest ureq, Long businessGroupKey) {
BusinessGroup myGroup = null;
for (BusinessGroup group : myGroups) {
if (businessGroupKey.equals(group.getKey())) {
myGroup = group;
}
}
if (myGroup == null) {
updateSource(new EmptyItemsSource());
} else {
SharedItemsSource source = new SharedItemsSource(myGroup, getIdentity(), ureq.getUserSession().getRoles(), false);
source.setRestrictToFormat(restrictToFormat);
updateSource(source);
}
}
use of org.olat.modules.qpool.ui.datasource.SharedItemsSource in project openolat by klemens.
the class ItemListMySharesController method initButtons.
@Override
protected void initButtons(UserRequest ureq, FormItemContainer formLayout) {
getItemsTable().setMultiSelect(true);
selectLink = uifactory.addFormLink("select-to-import", "select", null, formLayout, Link.BUTTON);
Roles roles = ureq.getUserSession().getRoles();
if (qpoolModule.isPoolsEnabled()) {
myPools = qpoolService.getPools(getIdentity(), roles);
} else {
myPools = Collections.emptyList();
}
if (qpoolModule.isSharesEnabled()) {
myGroups = qpoolService.getResourcesWithSharedItems(getIdentity());
} else {
myGroups = Collections.emptyList();
}
String[] myShareKeys;
String[] myShareValues;
if (myPools.isEmpty() && myGroups.isEmpty()) {
myShareKeys = new String[1];
myShareValues = new String[1];
myShareKeys[0] = "";
myShareValues[0] = "";
} else {
int numOfShares = myPools.size() + myGroups.size();
myShareKeys = new String[numOfShares];
myShareValues = new String[numOfShares];
int pos = 0;
for (Pool myPool : myPools) {
myShareKeys[pos] = "pool" + myPool.getKey().toString();
myShareValues[pos++] = myPool.getName();
}
for (BusinessGroup group : myGroups) {
myShareKeys[pos] = "grou" + group.getKey().toString();
myShareValues[pos++] = group.getName();
}
}
myShareEl = uifactory.addDropdownSingleselect("source.selector", "my.list", formLayout, myShareKeys, myShareValues, null);
myShareEl.setDomReplacementWrapperRequired(false);
myShareEl.getLabelC().setDomReplaceable(false);
myShareEl.addActionListener(FormEvent.ONCHANGE);
if (myPools.isEmpty() && myGroups.isEmpty()) {
myShareEl.setEnabled(false);
} else {
myShareEl.select(myShareKeys[0], true);
if (myPools.size() > 0) {
Pool firstPool = myPools.get(0);
PoolItemsSource source = new PoolItemsSource(getIdentity(), roles, firstPool);
source.getDefaultParams().setFormat(restrictToFormat);
updateSource(source);
} else if (myGroups.size() > 0) {
BusinessGroup firstGroup = myGroups.get(0);
SharedItemsSource source = new SharedItemsSource(firstGroup, getIdentity(), roles, false);
source.setRestrictToFormat(restrictToFormat);
updateSource(source);
}
}
}
use of org.olat.modules.qpool.ui.datasource.SharedItemsSource in project openolat by klemens.
the class ItemListMySharesController method doSelectBusinessGroup.
private void doSelectBusinessGroup(UserRequest ureq, Long businessGroupKey) {
BusinessGroup myGroup = null;
for (BusinessGroup group : myGroups) {
if (businessGroupKey.equals(group.getKey())) {
myGroup = group;
}
}
if (myGroup == null) {
updateSource(new EmptyItemsSource());
} else {
SharedItemsSource source = new SharedItemsSource(myGroup, getIdentity(), ureq.getUserSession().getRoles(), false);
source.setRestrictToFormat(restrictToFormat);
updateSource(source);
}
}
Aggregations