Search in sources :

Example 16 with ContactMessage

use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.

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 17 with ContactMessage

use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.

the class GroupContactController method createContactMessage.

private ContactMessage createContactMessage(Identity from, String contactListName, BusinessGroup businessGroup) {
    ContactMessage contactMessage = new ContactMessage(from);
    ContactList contactList = new ContactList(translate(contactListName));
    List<Identity> members = businessGroupService.getMembers(businessGroup, GroupRoles.coach.name());
    for (Identity member : members) {
        contactList.add(member);
    }
    contactMessage.addEmailTo(contactList);
    return contactMessage;
}
Also used : ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 18 with ContactMessage

use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.

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 19 with ContactMessage

use of org.olat.core.util.mail.ContactMessage in project openolat by klemens.

the class QTIEditorMainController method createReferenceesMsg.

/**
 * helper method to create the message about qti resource stakeholders and
 * from where the qti resource is referenced.
 *
 * @return
 */
private String createReferenceesMsg(UserRequest ureq) {
    /*
		 * problems: A tries to reference this test, after test editor has been
		 * started
		 */
    changeEmail = new ContactMessage(ureq.getIdentity());
    // the owners of this qtiPkg
    RepositoryEntry myEntry = repositoryManager.lookupRepositoryEntry(qtiPackage.getRepresentingResourceable(), false);
    // add qti resource owners as group
    ContactList cl = new ContactList("qtiPkgOwners");
    cl.addAllIdentites(repositoryService.getMembers(myEntry, GroupRoles.owner.name()));
    changeEmail.addEmailTo(cl);
    StringBuilder result = new StringBuilder();
    result.append(translate("qti.restricted.leading"));
    for (Iterator<Reference> iter = referencees.iterator(); iter.hasNext(); ) {
        Reference element = iter.next();
        if ("CourseModule".equals(element.getSource().getResourceableTypeName())) {
            ICourse course = null;
            try {
                course = CourseFactory.loadCourse(element.getSource().getResourceableId());
                if (course == null) {
                    continue;
                }
            } catch (CorruptedCourseException ex) {
                logError("", ex);
                continue;
            }
            CourseNode cn = course.getEditorTreeModel().getCourseNode(element.getUserdata());
            if (cn == null) {
                logError("Cannot find course element " + element.getUserdata() + " in course " + course, null);
                continue;
            }
            String courseTitle = course.getCourseTitle();
            StringBuilder stakeHolders = new StringBuilder();
            // the course owners
            RepositoryEntry entry = repositoryManager.lookupRepositoryEntry(course, false);
            if (entry != null) {
                // OO-1300
                List<Identity> stakeHoldersIds = repositoryService.getMembers(entry, GroupRoles.owner.name());
                if (stakeHoldersIds != null && stakeHoldersIds.size() > 0) {
                    // add stakeholders as group
                    cl = new ContactList(courseTitle);
                    cl.addAllIdentites(stakeHoldersIds);
                    changeEmail.addEmailTo(cl);
                    for (Identity stakeHoldersId : stakeHoldersIds) {
                        if (stakeHolders.length() > 0)
                            stakeHolders.append(", ");
                        User user = stakeHoldersId.getUser();
                        stakeHolders.append(user.getProperty(UserConstants.FIRSTNAME, getLocale())).append(" ").append(user.getProperty(UserConstants.LASTNAME, getLocale()));
                    }
                }
            }
            String courseNodeTitle = cn.getShortTitle();
            result.append(translate("qti.restricted.course", StringHelper.escapeHtml(courseTitle)));
            result.append(translate("qti.restricted.node", StringHelper.escapeHtml(courseNodeTitle)));
            result.append(translate("qti.restricted.owners", stakeHolders.toString()));
        }
    }
    return result.toString();
}
Also used : User(org.olat.core.id.User) Reference(org.olat.resource.references.Reference) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) ContactList(org.olat.core.util.mail.ContactList) ContactMessage(org.olat.core.util.mail.ContactMessage) CorruptedCourseException(org.olat.course.CorruptedCourseException) CourseNode(org.olat.course.nodes.CourseNode) Identity(org.olat.core.id.Identity)

Example 20 with ContactMessage

use of org.olat.core.util.mail.ContactMessage in project OpenOLAT by OpenOLAT.

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)

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