use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project OpenOLAT by OpenOLAT.
the class RightsMetadataEditController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == groupController) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
List<Identity> list = identitiesAddedEvent.getAddIdentities();
qpoolService.addAuthors(list, Collections.<QuestionItemShort>singletonList(item));
identitiesAddedEvent.getAddedIdentities().addAll(list);
} else if (event instanceof IdentitiesRemoveEvent) {
IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
qpoolService.removeAuthors(list, Collections.<QuestionItemShort>singletonList(item));
}
reloadAuthors();
// cmc.deactivate();
// cleanUp();
} else if (source == cmc) {
fireEvent(ureq, new QItemEdited(item));
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project openolat by klemens.
the class GroupController method doRemoveIdentitiesFromGroup.
private void doRemoveIdentitiesFromGroup(UserRequest ureq, List<Identity> toBeRemoved, MailTemplate mailTemplate) {
fireEvent(ureq, new IdentitiesRemoveEvent(toBeRemoved));
identitiesTableModel.remove(toBeRemoved);
if (tableCtr != null) {
// can be null in the follwoing case.
// the user which does the removal is also in the list of toBeRemoved
// hence the fireEvent does trigger a disposal of a GroupController, which
// in turn nullifies the tableCtr... see also OLAT-3331
tableCtr.modelChanged();
}
// send the notification mail
if (mailTemplate != null) {
// means no sender in footer
Identity sender = null;
if (showSenderInRemovMailFooter) {
sender = ureq.getIdentity();
}
String metaId = UUID.randomUUID().toString();
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
MailerResult result = new MailerResult();
MailBundle[] bundles = mailManager.makeMailBundles(context, toBeRemoved, mailTemplate, sender, metaId, result);
result.append(mailManager.sendMessage(bundles));
if (mailTemplate.getCpfrom()) {
MailBundle ccBundle = mailManager.makeMailBundle(context, ureq.getIdentity(), mailTemplate, sender, metaId, result);
result.append(mailManager.sendMessage(ccBundle));
}
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), ureq.getLocale());
}
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent in project openolat by klemens.
the class FolderCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest urequest, Controller source, Event event) {
if (source == projectBrokerConditionController) {
if (event == Event.CHANGED_EVENT) {
node.setConditionProjectBroker(projectBrokerConditionController.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == dialogBoxController) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// ok: open task folder
String relPath = TACourseNode.getTaskFolderPathRelToFolderRoot(CourseFactory.loadCourse(courseId), node);
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(relPath, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(translate("taskfolder"), rootFolder);
namedFolder.setLocalSecurityCallback(new FolderCallback(relPath, false));
removeAsListenerAndDispose(frc);
frc = new FolderRunController(namedFolder, false, urequest, getWindowControl());
listenTo(frc);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("folder.close"), frc.getInitialComponent());
listenTo(cmc);
cmc.activate();
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == scoringController) {
if (event == Event.CANCELLED_EVENT) {
if (hasLogEntries) {
scoringController.setDisplayOnly(true);
}
editScoring.contextPut("isOverwriting", new Boolean(false));
return;
} else if (event == Event.DONE_EVENT) {
scoringController.updateModuleConfiguration(config);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == modulesForm) {
boolean onoff = event.getCommand().endsWith("true");
if (event.getCommand().startsWith("dropbox")) {
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_ENABLED, onoff);
} else if (event.getCommand().startsWith("returnbox")) {
config.set(ProjectBrokerCourseNode.CONF_RETURNBOX_ENABLED, onoff);
}
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
} else if (source == accountManagerGroupController) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), urequest.getUserSession().getRoles(), identitiesAddedEvent.getAddIdentities(), accountManagerGroup, null);
identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities());
identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission());
identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup());
getLogger().info("Add users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT);
} else if (event instanceof IdentitiesRemoveEvent) {
businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), accountManagerGroup, null);
getLogger().info("Remove users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == optionsForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
projectBrokerModuleConfiguration.setNbrParticipantsPerTopic(optionsForm.getNnbrOfAttendees());
if (projectBrokerModuleConfiguration.isAcceptSelectionManually() && !optionsForm.getSelectionAccept()) {
// change 'Accept manually' to 'Accept automatically' => enroll all candidates
projectGroupManager.acceptAllCandidates(projectBrokerId, urequest.getIdentity(), projectBrokerModuleConfiguration.isAutoSignOut(), optionsForm.getSelectionAccept());
}
projectBrokerModuleConfiguration.setAcceptSelectionManaually(optionsForm.getSelectionAccept());
projectBrokerModuleConfiguration.setSelectionAutoSignOut(optionsForm.getSelectionAutoSignOut());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == customfieldsForm || source == projectEventForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (event == NodeEditController.NODECONFIG_CHANGED_EVENT) {
getLogger().debug("NODECONFIG_CHANGED_node.shortTitle=" + node.getShortTitle());
String groupName = translate("account.manager.groupname", node.getShortTitle());
String groupDescription = translate("account.manager.groupdescription", node.getShortTitle());
accountManagerGroup = projectGroupManager.updateAccountManagerGroupName(getIdentity(), groupName, groupDescription, accountManagerGroup);
} else if (source == dropboxForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_ENABLEMAIL, dropboxForm.mailEnabled());
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_CONFIRMATION, dropboxForm.getConfirmation());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
}
} else {
getLogger().warn("Can not handle event in ProjectBrokerCourseEditorController source=" + source + " " + event.toString());
}
}
use of org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent 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.admin.securitygroup.gui.IdentitiesRemoveEvent in project openolat by klemens.
the class CatalogNodeManagerController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (addEntryCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
loadNodesChildren();
}
cmc.deactivate();
cleanUp();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (editEntryCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
catalogEntry = editEntryCtrl.getEditedCatalogEntry();
loadEntryInfos();
}
cmc.deactivate();
cleanUp();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (categoryMoveCtrl == source) {
cmc.deactivate();
CatalogEntry moveMe = null;
if (event.equals(Event.DONE_EVENT)) {
showInfo("tools.move.catalog.entry.success", catalogEntry.getName());
moveMe = categoryMoveCtrl.getMoveMe();
} else if (event.equals(Event.FAILED_EVENT)) {
showError("tools.move.catalog.entry.failed");
loadNodesChildren();
}
cleanUp();
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
// only after jump to the moved entry
if (moveMe != null) {
launchCatalogEntry(ureq, moveMe);
}
} else if (dialogDeleteSubtree == source) {
// from remove subtree dialog -> yes or no
if (DialogBoxUIFactory.isYesEvent(event)) {
catalogManager.deleteCatalogEntry(catalogEntry);
fireEvent(ureq, Event.BACK_EVENT);
}
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
} else if (childNodeCtrl == source) {
if (event == Event.BACK_EVENT) {
toolbarPanel.popUpToController(this);
removeAsListenerAndDispose(childNodeCtrl);
childNodeCtrl = null;
loadNodesChildren();
}
} else if (entrySearchCtrl == source) {
if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
// successfully selected a repository entry which will be a link within
// the current Category
RepositoryEntry selectedEntry = entrySearchCtrl.getSelectedEntry();
doAddResource(ureq, selectedEntry);
fireEvent(ureq, Event.CHANGED_EVENT);
}
cmc.deactivate();
cleanUp();
} else if (groupCtrl == source) {
if (event instanceof IdentitiesAddEvent || event instanceof IdentitiesRemoveEvent) {
doAddRemoveOwners(event);
}
} else if (contactCtrl == source) {
cmc.deactivate();
cleanUp();
} else if (dialogDeleteLink == source) {
if (DialogBoxUIFactory.isYesEvent(event)) {
CatalogEntryRow row = (CatalogEntryRow) dialogDeleteLink.getUserObject();
catalogManager.deleteCatalogEntry(row, catalogEntry);
loadResources(ureq);
}
} else if (entryResourceMoveCtrl == source) {
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
CatalogEntry moveMe = entryResourceMoveCtrl.getMoveMe();
showInfo("tools.move.catalog.entry.success", moveMe.getName());
loadResources(ureq);
}
cmc.deactivate();
cleanUp();
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
Aggregations