use of org.olat.modules.qpool.ui.datasource.PoolItemsSource 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.PoolItemsSource in project OpenOLAT by OpenOLAT.
the class PoolTreeNode method getController.
@Override
public Controller getController(UserRequest ureq, WindowControl wControl) {
if (questionsCtrl == null) {
PoolItemsSource source = new PoolItemsSource(ureq.getIdentity(), ureq.getUserSession().getRoles(), pool);
source.setRemoveEnabled(isRemoveEnabled(ureq, pool));
WindowControl swControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, pool, null, wControl, true);
questionsCtrl = new QuestionsController(ureq, swControl, stackPanel, source, securityCallback, TABLE_PREFERENCE_PREFIX + pool.getKey(), false);
} else {
questionsCtrl.updateSource();
}
return questionsCtrl;
}
use of org.olat.modules.qpool.ui.datasource.PoolItemsSource in project openolat by klemens.
the class PoolTreeNode method getController.
@Override
public Controller getController(UserRequest ureq, WindowControl wControl) {
if (questionsCtrl == null) {
PoolItemsSource source = new PoolItemsSource(ureq.getIdentity(), ureq.getUserSession().getRoles(), pool);
source.setRemoveEnabled(isRemoveEnabled(ureq, pool));
WindowControl swControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, pool, null, wControl, true);
questionsCtrl = new QuestionsController(ureq, swControl, stackPanel, source, securityCallback, TABLE_PREFERENCE_PREFIX + pool.getKey(), false);
} else {
questionsCtrl.updateSource();
}
return questionsCtrl;
}
use of org.olat.modules.qpool.ui.datasource.PoolItemsSource in project OpenOLAT by OpenOLAT.
the class ItemListMySharesController method doSelectPool.
private void doSelectPool(UserRequest ureq, Long poolKey) {
Pool myPool = null;
for (Pool pool : myPools) {
if (poolKey.equals(pool.getKey())) {
myPool = pool;
}
}
if (myPool == null) {
updateSource(new EmptyItemsSource());
} else {
PoolItemsSource source = new PoolItemsSource(getIdentity(), ureq.getUserSession().getRoles(), myPool);
source.getDefaultParams().setFormat(restrictToFormat);
updateSource(source);
}
}
use of org.olat.modules.qpool.ui.datasource.PoolItemsSource 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);
}
}
}
Aggregations