use of org.olat.core.util.mail.ContactMessage in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method doAskToLeaveGroup.
private void doAskToLeaveGroup(UserRequest ureq, BusinessGroup businessGroup, ContactList contacts) {
String[] args = new String[] { businessGroup.getName(), businessGroup.getKey().toString(), // courses
"", getIdentity().getUser().getProperty(UserConstants.FIRSTNAME, getLocale()), getIdentity().getUser().getProperty(UserConstants.LASTNAME, getLocale()) };
ContactMessage msg = new ContactMessage(getIdentity());
msg.setSubject(translate("request.leaving.subject", args));
msg.setBodyText(translate("request.leaving.body", args));
msg.addEmailTo(contacts);
contactCtrl = new ContactFormController(ureq, getWindowControl(), true, false, true, msg);
listenTo(contactCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", contactCtrl.getInitialComponent(), true, translate("dialog.modal.bg.asktoleave.title"));
cmc.activate();
listenTo(cmc);
}
use of org.olat.core.util.mail.ContactMessage in project OpenOLAT by OpenOLAT.
the class AbstractMemberListController method doOpenContact.
protected void doOpenContact(UserRequest ureq, MemberView member) {
removeAsListenerAndDispose(contactCtrl);
Identity choosenIdentity = securityManager.loadIdentityByKey(member.getIdentityKey());
String fullname = userManager.getUserDisplayName(choosenIdentity);
ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
ContactList emailList = new ContactList(fullname);
emailList.add(choosenIdentity);
cmsg.addEmailTo(emailList);
OLATResourceable ores = OresHelper.createOLATResourceableType("Contact");
WindowControl bwControl = addToHistory(ureq, ores, null);
contactCtrl = new ContactFormController(ureq, bwControl, true, false, false, cmsg);
listenTo(contactCtrl);
toolbarPanel.pushController(fullname, contactCtrl);
}
use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.
the class CatalogNodeManagerController method doContact.
private void doContact(UserRequest ureq) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(contactCtrl);
ContactList caretaker = new ContactList(translate("contact.to.groupname.caretaker"));
List<Identity> owners = new ArrayList<Identity>();
CatalogEntry parent = catalogEntry;
while (parent != null && owners.isEmpty()) {
SecurityGroup parentOwner = parent.getOwnerGroup();
if (parentOwner != null) {
owners = securityManager.getIdentitiesOfSecurityGroup(parentOwner);
}
parent = parent.getParent();
}
for (int i = owners.size(); i-- > 0; ) {
caretaker.add(owners.get(i));
}
// create e-mail Message
ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
cmsg.addEmailTo(caretaker);
contactCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
listenTo(contactCtrl);
// open form in dialog
cmc = new CloseableModalController(getWindowControl(), "close", contactCtrl.getInitialComponent(), true, translate("contact.caretaker"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.
the class MembersTableController method doSendEmailToMember.
private void doSendEmailToMember(ContactList contactList, UserRequest ureq) {
if (contactList.getEmailsAsStrings().size() > 0) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(emailController);
ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
cmsg.addEmailTo(contactList);
// preset body template from i18n
cmsg.setBodyText(createBodyTemplate());
emailController = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
listenTo(emailController);
String title = translate("members.email.title");
cmc = new CloseableModalController(getWindowControl(), translate("close"), emailController.getInitialComponent(), true, title);
listenTo(cmc);
cmc.activate();
}
}
use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.
the class DENManager method sendParticipantsMessage.
/**
* Generates the mail window
* @param ureq
* @param wControl
* @param listener
* @param velocity_root
* @param trans
* @param participants
* @return VelocityContainer
*/
protected VelocityContainer sendParticipantsMessage(UserRequest ureq, WindowControl wControl, DefaultController listener, String velocity_root, Translator trans, List<Identity> participants) {
VelocityContainer sendMessageVC = new VelocityContainer("sendmessage", velocity_root + "/sendmessage.html", trans, listener);
ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
ContactList contactList = null;
if (participants.size() == 1) {
contactList = new ContactList(participants.get(0).getUser().getProperty(UserConstants.EMAIL, ureq.getLocale()));
} else {
contactList = new ContactList(trans.translate("participants.message.to"));
}
contactList.addAllIdentites(participants);
cmsg.addEmailTo(contactList);
ContactFormController contactCtr = new ContactFormController(ureq, wControl, false, false, false, cmsg);
contactCtr.addControllerListener(listener);
sendMessageVC.contextPut("title", trans.translate("participants.message"));
sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
return sendMessageVC;
}
Aggregations