Search in sources :

Example 1 with SharedItemsSource

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);
        }
    }
}
Also used : PoolItemsSource(org.olat.modules.qpool.ui.datasource.PoolItemsSource) SharedItemsSource(org.olat.modules.qpool.ui.datasource.SharedItemsSource) BusinessGroup(org.olat.group.BusinessGroup) Roles(org.olat.core.id.Roles) Pool(org.olat.modules.qpool.Pool)

Example 2 with SharedItemsSource

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;
}
Also used : SharedItemsSource(org.olat.modules.qpool.ui.datasource.SharedItemsSource) QuestionItemsSource(org.olat.modules.qpool.ui.QuestionItemsSource) WindowControl(org.olat.core.gui.control.WindowControl) QuestionsController(org.olat.modules.qpool.ui.QuestionsController)

Example 3 with SharedItemsSource

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);
    }
}
Also used : SharedItemsSource(org.olat.modules.qpool.ui.datasource.SharedItemsSource) BusinessGroup(org.olat.group.BusinessGroup) EmptyItemsSource(org.olat.modules.qpool.ui.datasource.EmptyItemsSource)

Example 4 with SharedItemsSource

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);
        }
    }
}
Also used : PoolItemsSource(org.olat.modules.qpool.ui.datasource.PoolItemsSource) SharedItemsSource(org.olat.modules.qpool.ui.datasource.SharedItemsSource) BusinessGroup(org.olat.group.BusinessGroup) Roles(org.olat.core.id.Roles) Pool(org.olat.modules.qpool.Pool)

Example 5 with SharedItemsSource

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);
    }
}
Also used : SharedItemsSource(org.olat.modules.qpool.ui.datasource.SharedItemsSource) BusinessGroup(org.olat.group.BusinessGroup) EmptyItemsSource(org.olat.modules.qpool.ui.datasource.EmptyItemsSource)

Aggregations

SharedItemsSource (org.olat.modules.qpool.ui.datasource.SharedItemsSource)6 BusinessGroup (org.olat.group.BusinessGroup)4 WindowControl (org.olat.core.gui.control.WindowControl)2 Roles (org.olat.core.id.Roles)2 Pool (org.olat.modules.qpool.Pool)2 QuestionItemsSource (org.olat.modules.qpool.ui.QuestionItemsSource)2 QuestionsController (org.olat.modules.qpool.ui.QuestionsController)2 EmptyItemsSource (org.olat.modules.qpool.ui.datasource.EmptyItemsSource)2 PoolItemsSource (org.olat.modules.qpool.ui.datasource.PoolItemsSource)2