use of org.olat.modules.qpool.ui.events.QPoolEvent in project openolat by klemens.
the class QuestionListController method doDeleteItemCollection.
private void doDeleteItemCollection(UserRequest ureq) {
qpoolService.deleteCollection(itemCollection);
fireEvent(ureq, new QPoolEvent(QPoolEvent.COLL_DELETED));
}
use of org.olat.modules.qpool.ui.events.QPoolEvent in project openolat by klemens.
the class QuestionListController method doPostCopy.
private void doPostCopy(UserRequest ureq, Event event) {
if (event instanceof QItemsProcessedEvent) {
QItemsProcessedEvent ipEvent = (QItemsProcessedEvent) event;
int numberOfCopies = ipEvent.getNumberOfItems();
showInfo("item.copied", Integer.toString(numberOfCopies));
getItemsTable().reset();
fireEvent(ureq, new QPoolEvent(QPoolEvent.EDIT));
}
}
use of org.olat.modules.qpool.ui.events.QPoolEvent in project openolat by klemens.
the class QuestionPoolMainEditorController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (shareItemsCtrl == source) {
if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
List<QuestionItemShort> items = shareItemsCtrl.getItems();
if (items.size() > 0) {
// can only drop one item
QuestionItemShort item = items.get(0);
if (shareItemsCtrl.getGroups() != null) {
showInfo("item.shared", item.getTitle());
} else if (shareItemsCtrl.getPools() != null) {
showInfo("item.pooled", item.getTitle());
}
}
treeModel.buildShareSubTreeModel();
menuTree.setDirty(true);
}
cmc.deactivate();
cleanUp();
} else if (event instanceof QPoolEvent) {
if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
treeModel.buildShareSubTreeModel();
menuTree.setDirty(true);
} else if (QPoolEvent.COLL_CREATED.equals(event.getCommand()) || QPoolEvent.COLL_CHANGED.equals(event.getCommand())) {
treeModel.buildMySubTreeModel();
Long collKey = ((QPoolEvent) event).getObjectKey();
CollectionTreeNode qNode = (CollectionTreeNode) findNodeByPersistableUserObject(treeModel.getMyNode(), collKey);
if (qNode != null) {
menuTree.setSelectedNode(qNode);
doSelectQuestionsNode(ureq, qNode, null, null);
}
menuTree.setDirty(true);
} else if (QPoolEvent.COLL_DELETED.equals(event.getCommand())) {
treeModel.buildMySubTreeModel();
menuTree.setSelectedNode(treeModel.getMyNode());
doSelectControllerTreeNode(ureq, treeModel.getMyNode(), null, null);
} else if (QPoolEvent.POOL_CREATED.equals(event.getCommand()) || QPoolEvent.POOL_DELETED.equals(event.getCommand())) {
treeModel.buildShareSubTreeModel();
menuTree.setDirty(true);
} else if (QPoolEvent.ITEMS_RELOADED.equals(event.getCommand())) {
treeModel.reloadReviewCounts();
}
} else if (copyToMyCtrl == source) {
if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
QuestionItemShort item = (QuestionItemShort) copyToMyCtrl.getUserObject();
doCopyToMy(item);
}
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.modules.qpool.ui.events.QPoolEvent in project openolat by klemens.
the class PoolsAdminController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == poolEditCtrl) {
if (event == Event.DONE_EVENT) {
reloadModel();
fireEvent(ureq, new QPoolEvent(QPoolEvent.POOL_CREATED));
}
cmc.deactivate();
cleanUp();
} else if (source == groupCtrl) {
Pool selectedPool = (Pool) groupCtrl.getUserObject();
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
List<Identity> list = identitiesAddedEvent.getAddIdentities();
qpoolService.addOwners(list, Collections.singletonList(selectedPool));
identitiesAddedEvent.getAddedIdentities().addAll(list);
} else if (event instanceof IdentitiesRemoveEvent) {
IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
qpoolService.removeOwners(list, Collections.singletonList(selectedPool));
}
} else if (source == confirmDeleteCtrl) {
if (DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
Pool pool = (Pool) confirmDeleteCtrl.getUserObject();
doDelete(ureq, pool);
}
} else if (source == cmc) {
cleanUp();
}
}
use of org.olat.modules.qpool.ui.events.QPoolEvent in project openolat by klemens.
the class ShareItemSourceOptionController method formOK.
@Override
protected void formOK(UserRequest ureq) {
boolean editable = editableEl.isOneSelected() && editableEl.isSelected(0);
int count = source.postImport(items, editable);
fireEvent(ureq, new QPoolEvent(QPoolEvent.ITEM_SHARED));
if (count == 0) {
showWarning("import.failed");
} else {
showInfo("import.success", Integer.toString(count));
}
}
Aggregations