Search in sources :

Example 11 with ContactList

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

the class CORunController method retrieveParticipantsFromAreas.

private ContactList retrieveParticipantsFromAreas(List<Long> areaKeys) {
    List<Identity> participiants = cgm.getParticipantsFromAreas(areaKeys);
    ContactList cl = new ContactList(translate("form.message.chckbx.partips"));
    cl.addAllIdentites(participiants);
    return cl;
}
Also used : ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity)

Example 12 with ContactList

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

the class CORunController method retrieveCoachesFromGroups.

private ContactList retrieveCoachesFromGroups(List<Long> groupKeys) {
    List<Identity> coaches = new ArrayList<Identity>(new HashSet<Identity>(cgm.getCoachesFromBusinessGroups(groupKeys)));
    ContactList cl = new ContactList(translate("form.message.chckbx.coaches"));
    cl.addAllIdentites(coaches);
    return cl;
}
Also used : ArrayList(java.util.ArrayList) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity)

Example 13 with ContactList

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

the class CORunController method retrieveCoachesFromAreas.

private ContactList retrieveCoachesFromAreas(List<Long> areaKeys) {
    List<Identity> coaches = cgm.getCoachesFromAreas(areaKeys);
    Set<Identity> coachesWithoutDuplicates = new HashSet<Identity>(coaches);
    coaches = new ArrayList<Identity>(coachesWithoutDuplicates);
    ContactList cl = new ContactList(translate("form.message.chckbx.coaches"));
    cl.addAllIdentites(coaches);
    return cl;
}
Also used : ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet)

Example 14 with ContactList

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

the class CORunController method retrieveOwnersFromCourse.

private ContactList retrieveOwnersFromCourse() {
    ;
    List<Identity> ownerList = repositoryService.getMembers(cgm.getCourseEntry(), GroupRoles.owner.name());
    ContactList cl = new ContactList(translate("form.message.chckbx.owners"));
    cl.addAllIdentites(ownerList);
    return cl;
}
Also used : ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity)

Example 15 with ContactList

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

the class BGEmailCompositionStepController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    StringBuilder groupNames = new StringBuilder();
    for (int i = 0; i < 5 && i < groups.size(); i++) {
        if (groupNames.length() > 0)
            groupNames.append(" - ");
        groupNames.append(groups.get(i).getName());
    }
    String contactsName;
    if (groups.size() > 5) {
        String otherGroups = Integer.toString(groups.size() - 5);
        contactsName = translate("email.other.groups", new String[] { groupNames.toString(), otherGroups });
    } else {
        contactsName = groupNames.toString();
    }
    ContactList contacts = new ContactList(contactsName);
    Boolean sendToTutorObj = (Boolean) getFromRunContext("tutors");
    boolean sendToTutors = sendToTutorObj == null ? false : sendToTutorObj.booleanValue();
    if (sendToTutors) {
        List<Identity> coaches = businessGroupService.getMembers(groups, GroupRoles.coach.name());
        contacts.addAllIdentites(coaches);
    }
    Boolean sendToParticipantObj = (Boolean) getFromRunContext("participants");
    boolean sendToParticipants = sendToParticipantObj == null ? false : sendToParticipantObj.booleanValue();
    if (sendToParticipants) {
        List<Identity> participants = businessGroupService.getMembers(groups, GroupRoles.participant.name());
        contacts.addAllIdentites(participants);
    }
    contactForm = new ContactForm(ureq, getWindowControl(), mainForm, getIdentity(), false, false, false, false);
    contactForm.addEmailTo(contacts);
    formLayout.add("wrapped", contactForm.getInitialFormItem());
}
Also used : ContactForm(org.olat.modules.co.ContactForm) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity)

Aggregations

ContactList (org.olat.core.util.mail.ContactList)92 Identity (org.olat.core.id.Identity)66 ContactMessage (org.olat.core.util.mail.ContactMessage)28 MailBundle (org.olat.core.util.mail.MailBundle)26 ContactFormController (org.olat.modules.co.ContactFormController)22 MailContextImpl (org.olat.core.util.mail.MailContextImpl)18 MailerResult (org.olat.core.util.mail.MailerResult)18 MailContext (org.olat.core.util.mail.MailContext)16 ArrayList (java.util.ArrayList)14 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)14 RepositoryEntry (org.olat.repository.RepositoryEntry)10 HashSet (java.util.HashSet)8 Test (org.junit.Test)8 BusinessGroup (org.olat.group.BusinessGroup)7 Locale (java.util.Locale)6 WindowControl (org.olat.core.gui.control.WindowControl)6 Translator (org.olat.core.gui.translator.Translator)6 File (java.io.File)4 Date (java.util.Date)4 Address (javax.mail.Address)4