use of org.olat.group.ui.wizard.BGUserMailTemplate in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == deleteDialogBox) {
if (event == Event.DONE_EVENT) {
boolean withEmail = deleteDialogBox.isSendMail();
List<BusinessGroup> groupsToDelete = deleteDialogBox.getGroupsToDelete();
doDelete(ureq, withEmail, groupsToDelete);
tableEl.deselectAll();
reloadModel();
}
cmc.deactivate();
cleanUpPopups();
} else if (source == leaveDialogBox) {
if (event != Event.CANCELLED_EVENT && DialogBoxUIFactory.isYesEvent(event)) {
doLeave((BusinessGroup) leaveDialogBox.getUserObject());
tableEl.deselectAll();
reloadModel();
}
} else if (source == groupCreateController) {
BusinessGroup group = null;
if (event == Event.DONE_EVENT) {
Set<BusinessGroup> groups = groupCreateController.getCreatedGroups();
if (groups.size() == 1) {
group = groups.iterator().next();
}
if (groups.size() > 0) {
tableEl.deselectAll();
reloadModel();
}
}
cmc.deactivate();
cleanUpPopups();
// if new group -> go to the tab
if (group != null) {
String businessPath = "[BusinessGroup:" + group.getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (source == businessGroupWizard) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
getWindowControl().pop();
removeAsListenerAndDispose(businessGroupWizard);
businessGroupWizard = null;
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
reloadModel();
}
}
} else if (source == emailWizard) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
getWindowControl().pop();
removeAsListenerAndDispose(emailWizard);
emailWizard = null;
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
tableEl.deselectAll();
}
}
} else if (source == userManagementController) {
cmc.deactivate();
if (event == Event.DONE_EVENT) {
// confirm sending emails
MembershipModification mod = userManagementController.getModifications();
List<BusinessGroup> groups = userManagementController.getGroups();
confirmUserManagementEmail(ureq, mod, groups);
} else {
cleanUpPopups();
}
} else if (source == userManagementSendMailController) {
if (event == Event.DONE_EVENT) {
BGUserMailTemplate sendMail = (BGUserMailTemplate) userManagementSendMailController.getTemplate();
MembershipModification mod = sendMail.getModifications();
List<BusinessGroup> groups = sendMail.getGroups();
finishUserManagement(mod, groups, sendMail, userManagementSendMailController.isSendMail());
reloadModel();
}
cmc.deactivate();
cleanUpPopups();
} else if (source == searchCtrl) {
if (event instanceof SearchEvent) {
doSearch(ureq, (SearchEvent) event);
}
} else if (source == contactCtrl) {
cmc.deactivate();
cleanUpPopups();
} else if (source == cmc) {
cleanUpPopups();
}
super.event(ureq, source, event);
}
use of org.olat.group.ui.wizard.BGUserMailTemplate in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method confirmUserManagementEmail.
private void confirmUserManagementEmail(UserRequest ureq, MembershipModification mod, List<BusinessGroup> groups) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(userManagementSendMailController);
MailTemplate defaultTemplate = null;
int totalModification = (mod.size() * groups.size());
if (totalModification == 1) {
MailType type = BusinessGroupMailing.getDefaultTemplateType(mod);
if (type != null) {
defaultTemplate = BusinessGroupMailing.getDefaultTemplate(type, groups.get(0), ureq.getIdentity());
}
}
MailTemplate template = new BGUserMailTemplate(groups, mod, defaultTemplate);
boolean mandatoryEmail = !mod.getAddParticipants().isEmpty() && groupModule.isMandatoryEnrolmentEmail(ureq.getUserSession().getRoles());
userManagementSendMailController = new BGMailNotificationEditController(getWindowControl(), ureq, template, totalModification == 1, totalModification == 1, false, mandatoryEmail);
Component cmp = userManagementSendMailController.getInitialComponent();
listenTo(userManagementSendMailController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), cmp, true, translate("users.group"));
cmc.activate();
listenTo(cmc);
}
use of org.olat.group.ui.wizard.BGUserMailTemplate in project openolat by klemens.
the class AbstractBusinessGroupListController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == deleteDialogBox) {
if (event == Event.DONE_EVENT) {
boolean withEmail = deleteDialogBox.isSendMail();
List<BusinessGroup> groupsToDelete = deleteDialogBox.getGroupsToDelete();
doDelete(ureq, withEmail, groupsToDelete);
tableEl.deselectAll();
reloadModel();
}
cmc.deactivate();
cleanUpPopups();
} else if (source == leaveDialogBox) {
if (event != Event.CANCELLED_EVENT && DialogBoxUIFactory.isYesEvent(event)) {
doLeave((BusinessGroup) leaveDialogBox.getUserObject());
tableEl.deselectAll();
reloadModel();
}
} else if (source == groupCreateController) {
BusinessGroup group = null;
if (event == Event.DONE_EVENT) {
Set<BusinessGroup> groups = groupCreateController.getCreatedGroups();
if (groups.size() == 1) {
group = groups.iterator().next();
}
if (groups.size() > 0) {
tableEl.deselectAll();
reloadModel();
}
}
cmc.deactivate();
cleanUpPopups();
// if new group -> go to the tab
if (group != null) {
String businessPath = "[BusinessGroup:" + group.getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (source == businessGroupWizard) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
getWindowControl().pop();
removeAsListenerAndDispose(businessGroupWizard);
businessGroupWizard = null;
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
reloadModel();
}
}
} else if (source == emailWizard) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
getWindowControl().pop();
removeAsListenerAndDispose(emailWizard);
emailWizard = null;
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
tableEl.deselectAll();
}
}
} else if (source == userManagementController) {
cmc.deactivate();
if (event == Event.DONE_EVENT) {
// confirm sending emails
MembershipModification mod = userManagementController.getModifications();
List<BusinessGroup> groups = userManagementController.getGroups();
confirmUserManagementEmail(ureq, mod, groups);
} else {
cleanUpPopups();
}
} else if (source == userManagementSendMailController) {
if (event == Event.DONE_EVENT) {
BGUserMailTemplate sendMail = (BGUserMailTemplate) userManagementSendMailController.getTemplate();
MembershipModification mod = sendMail.getModifications();
List<BusinessGroup> groups = sendMail.getGroups();
finishUserManagement(mod, groups, sendMail, userManagementSendMailController.isSendMail());
reloadModel();
}
cmc.deactivate();
cleanUpPopups();
} else if (source == searchCtrl) {
if (event instanceof SearchEvent) {
doSearch(ureq, (SearchEvent) event);
}
} else if (source == contactCtrl) {
cmc.deactivate();
cleanUpPopups();
} else if (source == cmc) {
cleanUpPopups();
}
super.event(ureq, source, event);
}
use of org.olat.group.ui.wizard.BGUserMailTemplate in project openolat by klemens.
the class AbstractBusinessGroupListController method confirmUserManagementEmail.
private void confirmUserManagementEmail(UserRequest ureq, MembershipModification mod, List<BusinessGroup> groups) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(userManagementSendMailController);
MailTemplate defaultTemplate = null;
int totalModification = (mod.size() * groups.size());
if (totalModification == 1) {
MailType type = BusinessGroupMailing.getDefaultTemplateType(mod);
if (type != null) {
defaultTemplate = BusinessGroupMailing.getDefaultTemplate(type, groups.get(0), ureq.getIdentity());
}
}
MailTemplate template = new BGUserMailTemplate(groups, mod, defaultTemplate);
boolean mandatoryEmail = !mod.getAddParticipants().isEmpty() && groupModule.isMandatoryEnrolmentEmail(ureq.getUserSession().getRoles());
userManagementSendMailController = new BGMailNotificationEditController(getWindowControl(), ureq, template, totalModification == 1, totalModification == 1, false, mandatoryEmail);
Component cmp = userManagementSendMailController.getInitialComponent();
listenTo(userManagementSendMailController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), cmp, true, translate("users.group"));
cmc.activate();
listenTo(cmc);
}
Aggregations