use of org.olat.core.util.mail.MailPackage in project openolat by klemens.
the class AbstractBusinessGroupListController method finishUserManagement.
private void finishUserManagement(MembershipModification mod, List<BusinessGroup> groups, MailTemplate template, boolean sendMail) {
MailPackage mailing = new MailPackage(template, getWindowControl().getBusinessControl().getAsString(), sendMail);
businessGroupService.updateMembership(getIdentity(), mod, groups, mailing);
MailHelper.printErrorsAndWarnings(mailing.getResult(), getWindowControl(), false, getLocale());
}
use of org.olat.core.util.mail.MailPackage in project openolat by klemens.
the class CourseRuntimeController method doLeave.
private void doLeave(UserRequest ureq) {
if (roles.isGuestOnly())
return;
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), true);
// leave course
LeavingStatusList status = new LeavingStatusList();
repositoryManager.leave(getIdentity(), getRepositoryEntry(), status, reMailing);
// leave groups
businessGroupService.leave(getIdentity(), getRepositoryEntry(), status, reMailing);
if (status.isWarningManagedGroup() || status.isWarningManagedCourse()) {
showWarning("sign.out.warning.managed");
} else if (status.isWarningGroupWithMultipleResources()) {
showWarning("sign.out.warning.mutiple.resources");
} else {
showInfo("sign.out.success", new String[] { getRepositoryEntry().getDisplayname() });
}
doClose(ureq);
}
use of org.olat.core.util.mail.MailPackage in project openolat by klemens.
the class CourseOverviewController method doChangePermission.
private void doChangePermission(UserRequest ureq, MemberPermissionChangeEvent e, RepositoryEntry re, boolean sendMail) {
MailPackage mailing = new MailPackage(sendMail);
if (re != null) {
List<RepositoryEntryPermissionChangeEvent> changes = Collections.singletonList((RepositoryEntryPermissionChangeEvent) e);
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), re, changes, mailing);
}
businessGroupService.updateMemberships(getIdentity(), e.getGroupChanges(), mailing);
// make sure all is committed before loading the model again (I see issues without)
DBFactory.getInstance().commitAndCloseSession();
updateModel();
}
use of org.olat.core.util.mail.MailPackage in project openolat by klemens.
the class CourseOverviewController method doAddToRepositoryEntry.
private void doAddToRepositoryEntry(UserRequest ureq, Collection<RepositoryEntry> res, SearchType type, boolean sendEmail) {
// commit changes to the repository entry
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), sendEmail);
RepositoryEntryPermissionChangeEvent changeEvent = new RepositoryEntryPermissionChangeEvent(editedIdentity);
switch(type) {
case owner:
changeEvent.setRepoOwner(Boolean.TRUE);
break;
case tutor:
changeEvent.setRepoTutor(Boolean.TRUE);
break;
case participant:
changeEvent.setRepoParticipant(Boolean.TRUE);
break;
}
List<RepositoryEntryPermissionChangeEvent> repoChanges = Collections.singletonList(changeEvent);
for (RepositoryEntry repoEntry : res) {
repositoryManager.updateRepositoryEntryMemberships(getIdentity(), ureq.getUserSession().getRoles(), repoEntry, repoChanges, reMailing);
}
// make sure all is committed before loading the model again (I see issues without)
DBFactory.getInstance().commitAndCloseSession();
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), getLocale());
}
use of org.olat.core.util.mail.MailPackage in project openolat by klemens.
the class CourseOverviewController method removeUserFromCourse.
private void removeUserFromCourse(UserRequest ureq, List<RepositoryEntry> repoEntriesToLeave, List<BusinessGroup> groupsToLeave, List<BusinessGroup> groupsToDelete, boolean doSendMail) {
List<Identity> membersToRemove = Collections.singletonList(editedIdentity);
for (BusinessGroup group : groupsToLeave) {
if (groupsToDelete.contains(group)) {
// really delete the group as it has no more owners/participants
if (doSendMail) {
String businessPath = getWindowControl().getBusinessControl().getAsString();
businessGroupService.deleteBusinessGroupWithMail(group, businessPath, getIdentity(), getLocale());
} else {
businessGroupService.deleteBusinessGroup(group);
}
} else {
// 1) remove as owner
if (businessGroupService.hasRoles(editedIdentity, group, GroupRoles.coach.name())) {
businessGroupService.removeOwners(ureq.getIdentity(), membersToRemove, group);
}
MailPackage mailing = new MailPackage(doSendMail);
// 2) remove as participant
businessGroupService.removeParticipants(getIdentity(), membersToRemove, group, mailing);
MailHelper.printErrorsAndWarnings(mailing.getResult(), getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), getLocale());
}
}
for (RepositoryEntry repoEntry : repoEntriesToLeave) {
if (isRepoMember(repoEntry)) {
MailPackage mailing = new MailPackage(doSendMail);
repositoryManager.removeMembers(getIdentity(), membersToRemove, repoEntry, mailing);
}
}
updateModel();
StringBuilder groupNames = new StringBuilder();
for (BusinessGroup group : groupsToLeave) {
if (groupNames.length() > 0)
groupNames.append(", ");
groupNames.append(group.getName());
}
showInfo("unsubscribe.successful");
}
Aggregations