Skip to content
Snippets Groups Projects
Commit 5b72b09e authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 11.2 to OpenOLAT default branch with f33716194102a1ed252596fbb49be07537446ea3

parents 2d0c9ef8 d61dff1e
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,9 @@ import de.bps.course.nodes.DENCourseNode; ...@@ -63,6 +63,9 @@ import de.bps.course.nodes.DENCourseNode;
public class DENManageParticipantsController extends BasicController { public class DENManageParticipantsController extends BasicController {
public static final String ADD_ACTION = "denAddParticipants";
public static final String REMOVE_ACTION = "denRemoveParticipants";
private DENCourseNode courseNode; private DENCourseNode courseNode;
private OLATResourceable ores; private OLATResourceable ores;
private DENStatus status; private DENStatus status;
...@@ -82,11 +85,10 @@ public class DENManageParticipantsController extends BasicController { ...@@ -82,11 +85,10 @@ public class DENManageParticipantsController extends BasicController {
private KalendarEvent selectedEvent; private KalendarEvent selectedEvent;
//mail notification //mail notification
private MailNotificationEditController addedNotificationCtr, removedNotificationCtr; private MailNotificationEditController notificationCtr;
private ContactFormController contactCtr; private ContactFormController contactCtr;
private CloseableModalController notificationCmc; private CloseableModalController notificationCmc;
private List<Identity> added = new ArrayList<Identity>(); private List<Identity> selectedIds = new ArrayList<Identity>();
private List<Identity> removed = new ArrayList<Identity>();
private CloseableModalController manageParticipantsModalCntrl; private CloseableModalController manageParticipantsModalCntrl;
...@@ -157,11 +159,11 @@ public class DENManageParticipantsController extends BasicController { ...@@ -157,11 +159,11 @@ public class DENManageParticipantsController extends BasicController {
BitSet selection = tmse.getSelection(); BitSet selection = tmse.getSelection();
//delete all users from the selected dates //delete all users from the selected dates
if(tmse.getAction().equals(DENListTableDataModel.DELETE_ACTION) && selection.cardinality() > 0) { if(tmse.getAction().equals(DENListTableDataModel.DELETE_ACTION) && selection.cardinality() > 0) {
removed = denManager.getSelectedEventParticipants(dateList, selection); selectedIds = denManager.getSelectedEventParticipants(dateList, selection);
dateList = denManager.deleteParticipants(ores, courseNode, denManager.getSelectedEventIDs(dateList, selection)); dateList = denManager.deleteParticipants(ores, courseNode, denManager.getSelectedEventIDs(dateList, selection));
listTableData.setObjects(dateList); listTableData.setObjects(dateList);
//send notification mail //send notification mail
createRemovedNotificationMail(ureq, courseNode.getShortTitle()); createNotificationMail(ureq, courseNode.getShortTitle(), REMOVE_ACTION);
} else if(tmse.getAction().equals(DENListTableDataModel.MAIL_ACTION) && selection.cardinality() > 0) { } else if(tmse.getAction().equals(DENListTableDataModel.MAIL_ACTION) && selection.cardinality() > 0) {
//send email to all users from the selected dates //send email to all users from the selected dates
List<Identity> participants = denManager.getSelectedEventParticipants(dateList, selection); List<Identity> participants = denManager.getSelectedEventParticipants(dateList, selection);
...@@ -175,7 +177,7 @@ public class DENManageParticipantsController extends BasicController { ...@@ -175,7 +177,7 @@ public class DENManageParticipantsController extends BasicController {
userSearchCMC.deactivate(); userSearchCMC.deactivate();
} else { } else {
List<Identity> toAdd = null; List<Identity> toAdd = null;
added = new ArrayList<Identity>(); selectedIds = new ArrayList<Identity>();
if (event instanceof SingleIdentityChosenEvent) { if (event instanceof SingleIdentityChosenEvent) {
SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event; SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event;
Identity choosenIdentity = singleEvent.getChosenIdentity(); Identity choosenIdentity = singleEvent.getChosenIdentity();
...@@ -192,16 +194,16 @@ public class DENManageParticipantsController extends BasicController { ...@@ -192,16 +194,16 @@ public class DENManageParticipantsController extends BasicController {
if(!status.isEnrolled() && status.getErrorMessage().equals(DENStatus.ERROR_ALREADY_ENROLLED)) if(!status.isEnrolled() && status.getErrorMessage().equals(DENStatus.ERROR_ALREADY_ENROLLED))
showMessage = true; showMessage = true;
else else
added.add(identity); selectedIds.add(identity);
} }
if(showMessage) if(showMessage)
showWarning("enrollment.warning.manual"); showWarning("enrollment.warning.manual");
refreshTables(); refreshTables();
} }
userSearchCMC.deactivate(); userSearchCMC.deactivate();
if(added.size() > 0) { if(selectedIds.size() > 0) {
//write notification mail //write notification mail
createAddedNotificationMail(ureq, selectedEvent.getSubject()); createNotificationMail(ureq, selectedEvent.getSubject(), ADD_ACTION);
} }
} }
...@@ -215,9 +217,9 @@ public class DENManageParticipantsController extends BasicController { ...@@ -215,9 +217,9 @@ public class DENManageParticipantsController extends BasicController {
if(!status.isCancelled()) showError(); if(!status.isCancelled()) showError();
//send notification mail //send notification mail
else { else {
removed.clear(); selectedIds.clear();
removed.add(identity); selectedIds.add(identity);
createRemovedNotificationMail(ureq, selectedEvent.getSubject()); createNotificationMail(ureq, selectedEvent.getSubject(), REMOVE_ACTION);
} }
refreshTables(); refreshTables();
//write email to single user //write email to single user
...@@ -227,40 +229,22 @@ public class DENManageParticipantsController extends BasicController { ...@@ -227,40 +229,22 @@ public class DENManageParticipantsController extends BasicController {
createParticipantsMail(ureq, participants); createParticipantsMail(ureq, participants);
} }
} }
} else if(source == addedNotificationCtr && event == Event.DONE_EVENT) { } else if(source == notificationCtr && event == Event.DONE_EVENT) {
if(addedNotificationCtr.getMailTemplate() != null) { if(notificationCtr.getMailTemplate() != null) {
Identity sender = ureq.getIdentity(); Identity sender = ureq.getIdentity();
MailerResult result = new MailerResult(); MailerResult result = new MailerResult();
String metaId = UUID.randomUUID().toString().replace("-", ""); String metaId = UUID.randomUUID().toString().replace("-", "");
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString()); MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
MailBundle[] bundles = mailManager.makeMailBundles(context, added, addedNotificationCtr.getMailTemplate(), sender, metaId, result); MailBundle[] bundles = mailManager.makeMailBundles(context, selectedIds, notificationCtr.getMailTemplate(), sender, metaId, result);
result.append(mailManager.sendMessage(bundles)); result.append(mailManager.sendMessage(bundles));
if(addedNotificationCtr.getMailTemplate().getCpfrom()) { if(notificationCtr.getMailTemplate().getCpfrom()) {
MailBundle ccBundles = mailManager.makeMailBundle(context, sender, addedNotificationCtr.getMailTemplate(), sender, metaId, result); MailBundle ccBundles = mailManager.makeMailBundle(context, sender, notificationCtr.getMailTemplate(), sender, metaId, result);
result.append(mailManager.sendMessage(ccBundles)); result.append(mailManager.sendMessage(ccBundles));
} }
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getLocale()); MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getLocale());
} }
notificationCmc.deactivate(); notificationCmc.deactivate();
added.clear(); selectedIds.clear();
} else if(source == removedNotificationCtr && event == Event.DONE_EVENT) {
if(removedNotificationCtr.getMailTemplate() != null) {
//fxdiff VCRP-16: intern mail system
Identity sender = ureq.getIdentity();
MailerResult result = new MailerResult();
String metaId = UUID.randomUUID().toString().replace("-", "");
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
MailBundle[] bundles = mailManager.makeMailBundles(context, added, addedNotificationCtr.getMailTemplate(), sender, metaId, result);
result.append(mailManager.sendMessage(bundles));
if(addedNotificationCtr.getMailTemplate().getCpfrom()) {
MailBundle ccBundle = mailManager.makeMailBundle(context, sender, addedNotificationCtr.getMailTemplate(), sender, metaId, result);
result.append(mailManager.sendMessage(ccBundle));
}
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getLocale());
}
notificationCmc.deactivate();
removed.clear();
} else if(source == contactCtr) { } else if(source == contactCtr) {
notificationCmc.deactivate(); notificationCmc.deactivate();
} }
...@@ -304,28 +288,21 @@ public class DENManageParticipantsController extends BasicController { ...@@ -304,28 +288,21 @@ public class DENManageParticipantsController extends BasicController {
tableListParticipants.setTableDataModel(listTableData); tableListParticipants.setTableDataModel(listTableData);
} }
private void createAddedNotificationMail(UserRequest ureq, String subjectStr) { private void createNotificationMail(UserRequest ureq, String subjectStr, String action) {
MailTemplate mailTempl = denManager.getAddedMailTemplate(ureq, subjectStr, getTranslator()); MailTemplate mailTempl;
removeAsListenerAndDispose(addedNotificationCtr); if (action.equals(REMOVE_ACTION)) {
mailTempl = denManager.getRemovedMailTemplate(ureq, subjectStr, getTranslator());
addedNotificationCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTempl, false, false, true); } else {
listenTo(addedNotificationCtr); mailTempl = denManager.getAddedMailTemplate(ureq, subjectStr, getTranslator());
}
removeAsListenerAndDispose(notificationCmc);
notificationCmc = new CloseableModalController(getWindowControl(), "close", addedNotificationCtr.getInitialComponent());
listenTo(notificationCmc);
notificationCmc.activate(); removeAsListenerAndDispose(notificationCtr);
}
private void createRemovedNotificationMail(UserRequest ureq, String subjectStr) { notificationCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTempl, false, false, true);
MailTemplate mailTempl = denManager.getRemovedMailTemplate(ureq, subjectStr, getTranslator()); listenTo(notificationCtr);
removeAsListenerAndDispose(addedNotificationCtr);
addedNotificationCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTempl, false, false, true);
listenTo(addedNotificationCtr);
removeAsListenerAndDispose(notificationCmc); removeAsListenerAndDispose(notificationCmc);
notificationCmc = new CloseableModalController(getWindowControl(), "close", addedNotificationCtr.getInitialComponent()); notificationCmc = new CloseableModalController(getWindowControl(), "close", notificationCtr.getInitialComponent());
listenTo(notificationCmc); listenTo(notificationCmc);
notificationCmc.activate(); notificationCmc.activate();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment