Search in sources :

Example 26 with ContactMessage

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);
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 27 with ContactMessage

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);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ContactFormController(org.olat.modules.co.ContactFormController) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) WindowControl(org.olat.core.gui.control.WindowControl) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 28 with ContactMessage

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();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ArrayList(java.util.ArrayList) CatalogEntry(org.olat.repository.CatalogEntry) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) SecurityGroup(org.olat.basesecurity.SecurityGroup) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 29 with ContactMessage

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();
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 30 with ContactMessage

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;
}
Also used : ContactFormController(org.olat.modules.co.ContactFormController) ContactList(org.olat.core.util.mail.ContactList) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) ContactMessage(org.olat.core.util.mail.ContactMessage)

Aggregations

ContactMessage (org.olat.core.util.mail.ContactMessage)34 ContactList (org.olat.core.util.mail.ContactList)28 ContactFormController (org.olat.modules.co.ContactFormController)28 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)20 Identity (org.olat.core.id.Identity)18 ArrayList (java.util.ArrayList)6 WindowControl (org.olat.core.gui.control.WindowControl)6 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 HashMap (java.util.HashMap)2 List (java.util.List)2 UserBulkChangeStep00 (org.olat.admin.user.bulkChange.UserBulkChangeStep00)2 SecurityGroup (org.olat.basesecurity.SecurityGroup)2 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)2 CollaborationTools (org.olat.collaboration.CollaborationTools)2 UserRequest (org.olat.core.gui.UserRequest)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)2 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)2 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)2