Search in sources :

Example 1 with BusinessGroupSelectionEvent

use of org.olat.group.model.BusinessGroupSelectionEvent in project OpenOLAT by OpenOLAT.

the class QuestionItemDetailsController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == copyConfirmationCtrl) {
        doPostCopy(ureq, event);
        cmc.deactivate();
        cleanUp();
    } else if (source == conversionConfirmationCtrl) {
        doPostConvert(ureq, event);
        cmc.deactivate();
        cleanUp();
    } else if (source == selectGroupCtrl) {
        if (event instanceof BusinessGroupSelectionEvent) {
            BusinessGroupSelectionEvent bge = (BusinessGroupSelectionEvent) event;
            List<BusinessGroup> groups = bge.getGroups();
            if (groups.size() > 0) {
                QuestionItem item = (QuestionItem) ((SelectBusinessGroupController) source).getUserObject();
                doShareItemsWithGroup(ureq, item, groups);
                metadatasCtrl.updateShares();
            }
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == selectPoolCtrl) {
        cmc.deactivate();
        if (event instanceof QPoolSelectionEvent) {
            QPoolSelectionEvent qpe = (QPoolSelectionEvent) event;
            List<Pool> pools = qpe.getPools();
            if (pools.size() > 0) {
                QuestionItemShort item = (QuestionItemShort) selectPoolCtrl.getUserObject();
                doShareItemsWithPool(ureq, item, pools);
                metadatasCtrl.updateShares();
            }
        }
        cleanUp();
    } else if (source == reviewActionCtrl) {
        if (QItemReviewEvent.START.equals(event.getCommand())) {
            doConfirmStartReview(ureq);
        } else if (QItemReviewEvent.DO.equals(event.getCommand())) {
            openReview(ureq);
        }
    } else if (source == reviewStartCtrl) {
        if (event == Event.DONE_EVENT) {
            TaxonomyLevel taxonomyLevel = reviewStartCtrl.getSelectedTaxonomyLevel();
            doStartReview(ureq, taxonomyLevel);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == reviewCtrl) {
        if (event == Event.DONE_EVENT) {
            float rating = reviewCtrl.getCurrentRatting();
            String comment = reviewCtrl.getComment();
            doRate(ureq, rating, comment);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == confirmEndOfLifeCtrl) {
        boolean endOfLife = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event);
        if (endOfLife) {
            QuestionItem item = (QuestionItem) confirmEndOfLifeCtrl.getUserObject();
            doEndOfLife(ureq, item);
        }
        cleanUp();
    } else if (source == deleteConfirmationCtrl) {
        if (event == Event.DONE_EVENT) {
            List<QuestionItemShort> items = deleteConfirmationCtrl.getItemsToDelete();
            doDelete(ureq, items);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == cmc) {
        cleanUp();
    } else if (source == questionCtrl) {
        if (event instanceof QItemEdited) {
            questionEdited = true;
            fireEvent(ureq, event);
        }
    } else if (source == metadatasCtrl) {
        if (event instanceof QItemEdited) {
            reloadData(ureq);
            fireEvent(ureq, event);
        }
    }
    super.event(ureq, source, event);
}
Also used : QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) BusinessGroup(org.olat.group.BusinessGroup) QPoolSelectionEvent(org.olat.modules.qpool.ui.events.QPoolSelectionEvent) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) List(java.util.List) ArrayList(java.util.ArrayList) QuestionItem(org.olat.modules.qpool.QuestionItem)

Example 2 with BusinessGroupSelectionEvent

use of org.olat.group.model.BusinessGroupSelectionEvent in project OpenOLAT by OpenOLAT.

the class QuestionListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == shareTargetCtrl) {
        List<QuestionItemShort> items = getSelectedShortItems();
        calloutCtrl.deactivate();
        if (items.isEmpty()) {
            showWarning("error.select.one");
        } else if (ShareTargetController.SHARE_GROUP_CMD.equals(event.getCommand())) {
            doSelectGroup(ureq, items);
        } else if (ShareTargetController.SHARE_POOL_CMD.equals(event.getCommand())) {
            doSelectPool(ureq, items);
        }
    } else if (source == selectPoolCtrl) {
        cmc.deactivate();
        if (event instanceof QPoolSelectionEvent) {
            QPoolSelectionEvent qpe = (QPoolSelectionEvent) event;
            List<Pool> pools = qpe.getPools();
            if (pools.size() > 0) {
                @SuppressWarnings("unchecked") List<QuestionItemShort> items = (List<QuestionItemShort>) selectPoolCtrl.getUserObject();
                doShareItemsToPools(ureq, items, pools);
            }
        }
    } else if (source == importSourcesCtrl) {
        calloutCtrl.deactivate();
        if (ImportSourcesController.IMPORT_FILE.equals(event.getCommand())) {
            doOpenFileImport(ureq);
        } else if (ImportSourcesController.IMPORT_REPO.equals(event.getCommand())) {
            doOpenRepositoryImport(ureq);
        } else if (ImportSourcesController.IMPORT_EXCEL_QTI_12.equals(event.getCommand())) {
            doOpenExcelImportQTI12(ureq);
        } else if (ImportSourcesController.IMPORT_EXCEL_QTI_21.equals(event.getCommand())) {
            doOpenExcelImportQTI21(ureq);
        }
    } else if (source == newItemOptionsCtrl) {
        cmc.deactivate();
        if (event instanceof QItemCreationCmdEvent) {
            QItemCreationCmdEvent qicce = (QItemCreationCmdEvent) event;
            doCreateNewItem(ureq, qicce.getTitle(), qicce.getTaxonomyLevel(), qicce.getFactory());
        }
    } else if (source == selectGroupCtrl) {
        cmc.deactivate();
        if (event instanceof BusinessGroupSelectionEvent) {
            BusinessGroupSelectionEvent bge = (BusinessGroupSelectionEvent) event;
            List<BusinessGroup> groups = bge.getGroups();
            if (groups.size() > 0) {
                @SuppressWarnings("unchecked") List<QuestionItemShort> items = (List<QuestionItemShort>) selectGroupCtrl.getUserObject();
                doShareItemsToGroups(ureq, items, groups);
            }
        }
    } else if (source == shareItemsCtrl) {
        if (event instanceof QPoolEvent) {
            fireEvent(ureq, event);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == listTargetCtrl) {
        List<QuestionItemShort> items = getSelectedShortItems();
        calloutCtrl.deactivate();
        if (CollectionTargetController.ADD_TO_LIST_POOL_CMD.equals(event.getCommand())) {
            if (items.isEmpty()) {
                showWarning("error.select.one");
            } else {
                doChooseCollection(ureq, items);
            }
        } else if (CollectionTargetController.NEW_LIST_CMD.equals(event.getCommand())) {
            doAskCollectionName(ureq, items);
        } else if (CollectionTargetController.RENAME_LIST_CMD.equals(event.getCommand())) {
            doOpenRenameCallout(ureq);
        } else if (CollectionTargetController.DELETE_LIST_CMD.equals(event.getCommand())) {
            doConfirmDeleteSource(ureq);
        }
    } else if (source == createCollectionCtrl) {
        if (Event.DONE_EVENT == event) {
            List<QuestionItemShort> items = createCollectionCtrl.getUserObject();
            String collectionName = createCollectionCtrl.getName();
            doCreateCollection(ureq, collectionName, items);
        }
        cmc.deactivate();
        cleanUp();
    }
    if (source == confirmDeleteSourceBox) {
        boolean delete = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event);
        if (delete) {
            doDeleteItemCollection(ureq);
        }
    } else if (source == renameCtrl) {
        cmc.deactivate();
        if (Event.CHANGED_EVENT == event) {
            String newName = renameCtrl.getName();
            doRenameItemCollection(ureq, newName);
        }
    } else if (source == chooseCollectionCtrl) {
        cmc.deactivate();
        cleanUp();
    } else if (source == createTestTargetCtrl && event instanceof ExportFormatSelectionEvent) {
        calloutCtrl.deactivate();
        ExportFormatSelectionEvent efsEvent = (ExportFormatSelectionEvent) event;
        ExportFormatOptions format = efsEvent.getFormat();
        List<QuestionItemShort> items = getSelectedShortItems();
        doShowCreateTestOverview(ureq, items, format);
    } else if (source == createTestOverviewCtrl) {
        List<QuestionItemShort> items = createTestOverviewCtrl.getExportableQuestionItems();
        String typeFormat = createTestOverviewCtrl.getResourceTypeFormat();
        cmc.deactivate();
        cleanUp();
        if (event == Event.DONE_EVENT) {
            doOpenCreateRepositoryTest(ureq, items, typeFormat);
        }
    } else if (source == exportWizard) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            getWindowControl().pop();
            removeAsListenerAndDispose(exportWizard);
            StepsRunContext runContext = exportWizard.getRunContext();
            exportWizard = null;
            if (event == Event.CHANGED_EVENT) {
                doExecuteExport(ureq, runContext);
            }
        }
    } else if (source == excelImportWizard) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            getWindowControl().pop();
            removeAsListenerAndDispose(excelImportWizard);
            excelImportWizard = null;
        }
    } else if (source == importAuthorsWizard) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            getWindowControl().pop();
            removeAsListenerAndDispose(importAuthorsWizard);
            importAuthorsWizard = null;
        }
    } else if (source == importItemCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            getItemsTable().reset();
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == importTestCtrl) {
        RepositoryEntry re = importTestCtrl.getSelectedEntry();
        cmc.deactivate();
        cleanUp();
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            doImportResource(ureq, re);
        }
    } else if (source == shareItemsToSourceCtrl) {
        if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
            getItemsTable().reset();
        }
        cmcShareItemToSource.deactivate();
        cleanUp();
    } else if (source == bulkChangeCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            updateRows(bulkChangeCtrl.getUpdatedItems());
            fireEvent(ureq, new QPoolEvent(QPoolEvent.BULK_CHANGE));
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == copyConfirmationCtrl) {
        doPostCopy(ureq, event);
        cmc.deactivate();
        cleanUp();
    } else if (source == conversionConfirmationCtrl) {
        doPostConvert(ureq, event);
        cmc.deactivate();
        cleanUp();
    } else if (source == deleteConfirmationCtrl) {
        if (event == Event.DONE_EVENT) {
            List<QuestionItemShort> items = deleteConfirmationCtrl.getItemsToDelete();
            doDelete(items);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == confirmRemoveBox) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            @SuppressWarnings("unchecked") List<QuestionItemShort> items = (List<QuestionItemShort>) confirmRemoveBox.getUserObject();
            doRemove(items);
        }
    } else if (source == currentDetailsCtrl) {
        if (event instanceof QItemEvent) {
            QItemEvent qce = (QItemEvent) event;
            if ("copy-item".equals(qce.getCommand()) || "convert-item".equals(qce.getCommand())) {
                stackPanel.popUpToRootController(ureq);
                doOpenDetails(ureq, qce.getItem());
            } else if ("previous".equals(qce.getCommand())) {
                doPrevious(ureq, qce.getItem());
            } else if ("next".equals(qce.getCommand())) {
                doNext(ureq, qce.getItem());
            }
        } else if (event instanceof QItemEdited) {
            String title = ((QItemEdited) event).getItem().getTitle();
            stackPanel.changeDisplayname(title, null, currentDetailsCtrl);
            itemCollectionDirty = true;
        } else if (event instanceof QPoolEvent) {
            QPoolEvent qce = (QPoolEvent) event;
            if (QPoolEvent.ITEM_DELETED.equals(qce.getCommand())) {
                fireEvent(ureq, qce);
            } else if (QPoolEvent.ITEM_STATUS_CHANGED.equals(qce.getCommand())) {
                itemCollectionDirty = true;
            }
        }
    } else if (source == addController) {
        if (event instanceof EntryChangedEvent) {
            cmc.deactivate();
            cleanUp();
            EntryChangedEvent addEvent = (EntryChangedEvent) event;
            Long repoEntryKey = addEvent.getRepositoryEntryKey();
            doCreateRepositoryTest(ureq, repoEntryKey);
        } else if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
            cleanUp();
        }
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent) QPoolEvent(org.olat.modules.qpool.ui.events.QPoolEvent) RepositoryEntry(org.olat.repository.RepositoryEntry) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) ExportFormatSelectionEvent(org.olat.modules.qpool.ui.events.ExportFormatSelectionEvent) QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) ExportFormatOptions(org.olat.modules.qpool.ExportFormatOptions) EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) QPoolSelectionEvent(org.olat.modules.qpool.ui.events.QPoolSelectionEvent) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) QItemCreationCmdEvent(org.olat.modules.qpool.ui.events.QItemCreationCmdEvent) QItemEvent(org.olat.modules.qpool.ui.events.QItemEvent) QItemList(org.olat.modules.qpool.model.QItemList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with BusinessGroupSelectionEvent

use of org.olat.group.model.BusinessGroupSelectionEvent in project OpenOLAT by OpenOLAT.

the class AbstractBusinessGroupListController method doSelect.

private void doSelect(UserRequest ureq, List<? extends BusinessGroupRef> items) {
    List<BusinessGroup> selection = toBusinessGroups(ureq, items, false);
    fireEvent(ureq, new BusinessGroupSelectionEvent(selection));
}
Also used : BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BusinessGroup(org.olat.group.BusinessGroup) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent)

Example 4 with BusinessGroupSelectionEvent

use of org.olat.group.model.BusinessGroupSelectionEvent in project OpenOLAT by OpenOLAT.

the class EPShareListController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == selectGroupCtrl) {
        cmc.deactivate();
        secureListBox();
        if (event instanceof BusinessGroupSelectionEvent) {
            BusinessGroupSelectionEvent bge = (BusinessGroupSelectionEvent) event;
            List<BusinessGroup> groups = bge.getGroups();
            if (groups.size() > 0) {
                EPSharePolicyWrapper policyWrapper = (EPSharePolicyWrapper) selectGroupCtrl.getUserObject();
                policyWrapper.getGroups().addAll(groups);
                initPolicyUI();
            }
        }
    } else if (source.equals(selectUserCtrl)) {
        cmc.deactivate();
        secureListBox();
        EPSharePolicyWrapper policyWrapper = (EPSharePolicyWrapper) selectUserCtrl.getUserObject();
        if (event instanceof SingleIdentityChosenEvent) {
            SingleIdentityChosenEvent foundEvent = (SingleIdentityChosenEvent) event;
            Identity chosenIdentity = foundEvent.getChosenIdentity();
            if (chosenIdentity != null) {
                policyWrapper.getIdentities().add(chosenIdentity);
            }
        } else if (event instanceof MultiIdentityChosenEvent) {
            MultiIdentityChosenEvent foundEvent = (MultiIdentityChosenEvent) event;
            List<Identity> chosenIdentities = foundEvent.getChosenIdentities();
            if (chosenIdentities != null && !chosenIdentities.isEmpty()) {
                policyWrapper.getIdentities().addAll(chosenIdentities);
            }
        }
        initPolicyUI();
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent)

Example 5 with BusinessGroupSelectionEvent

use of org.olat.group.model.BusinessGroupSelectionEvent in project OpenOLAT by OpenOLAT.

the class AbstractBusinessGroupListController method doSelect.

private void doSelect(UserRequest ureq, BusinessGroup group) {
    List<BusinessGroup> selection = Collections.singletonList(group);
    fireEvent(ureq, new BusinessGroupSelectionEvent(selection));
}
Also used : BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BusinessGroup(org.olat.group.BusinessGroup) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent)

Aggregations

BusinessGroup (org.olat.group.BusinessGroup)12 BusinessGroupSelectionEvent (org.olat.group.model.BusinessGroupSelectionEvent)12 ArrayList (java.util.ArrayList)6 List (java.util.List)6 BGConfigBusinessGroup (org.olat.group.ui.wizard.BGConfigBusinessGroup)4 BGCopyBusinessGroup (org.olat.group.ui.wizard.BGCopyBusinessGroup)4 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)4 QItemEdited (org.olat.modules.qpool.ui.events.QItemEdited)4 QPoolSelectionEvent (org.olat.modules.qpool.ui.events.QPoolSelectionEvent)4 MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)2 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)2 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Identity (org.olat.core.id.Identity)2 BusinessGroupRow (org.olat.group.model.BusinessGroupRow)2 StatisticsBusinessGroupRow (org.olat.group.model.StatisticsBusinessGroupRow)2 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)2 QuestionItem (org.olat.modules.qpool.QuestionItem)2 QItemList (org.olat.modules.qpool.model.QItemList)2 ExportFormatSelectionEvent (org.olat.modules.qpool.ui.events.ExportFormatSelectionEvent)2 QItemCreationCmdEvent (org.olat.modules.qpool.ui.events.QItemCreationCmdEvent)2