Search in sources :

Example 56 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method createContactFormController.

/**
 * generates the email adress list.
 *
 * @param ureq
 * @return a contact form controller for this group
 */
private ContactFormController createContactFormController(UserRequest ureq) {
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    // two named ContactLists, the new way using the contact form
    // the same name as in the checkboxes are taken as contactlist names
    // = new ContactList(translate("sendtochooser.form.chckbx.owners"));
    ContactList ownerCntctLst;
    // = new ContactList(translate("sendtochooser.form.chckbx.partip"));
    ContactList partipCntctLst;
    // = new ContactList(translate("sendtochooser.form.chckbx.waitingList"));
    ContactList waitingListContactList;
    if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.all"));
        List<Identity> ownerList = businessGroupService.getMembers(businessGroup, GroupRoles.coach.name());
        ownerCntctLst.addAllIdentites(ownerList);
        cmsg.addEmailTo(ownerCntctLst);
    } else {
        if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
            ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.choose"));
            List<Identity> ownerList = businessGroupService.getMembers(businessGroup, GroupRoles.coach.name());
            List<Identity> changeableOwnerList = new ArrayList<>(ownerList);
            for (Identity identity : ownerList) {
                boolean keyIsSelected = false;
                for (Long key : sendToChooserForm.getSelectedOwnerKeys()) {
                    if (key.equals(identity.getKey())) {
                        keyIsSelected = true;
                        break;
                    }
                }
                if (!keyIsSelected) {
                    changeableOwnerList.remove(changeableOwnerList.indexOf(identity));
                }
            }
            ownerCntctLst.addAllIdentites(changeableOwnerList);
            cmsg.addEmailTo(ownerCntctLst);
        }
    }
    if (sendToChooserForm != null) {
        if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
            partipCntctLst = new ContactList(translate("sendtochooser.form.radio.partip.all"));
            List<Identity> participantsList = businessGroupService.getMembers(businessGroup, GroupRoles.participant.name());
            partipCntctLst.addAllIdentites(participantsList);
            cmsg.addEmailTo(partipCntctLst);
        } else {
            if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
                partipCntctLst = new ContactList(translate("sendtochooser.form.radio.partip.choose"));
                List<Identity> participantsList = businessGroupService.getMembers(businessGroup, GroupRoles.participant.name());
                List<Identity> changeableParticipantsList = new ArrayList<>(participantsList);
                for (Identity identity : participantsList) {
                    boolean keyIsSelected = false;
                    for (Long key : sendToChooserForm.getSelectedPartipKeys()) {
                        if (key.equals(identity.getKey())) {
                            keyIsSelected = true;
                            break;
                        }
                    }
                    if (!keyIsSelected) {
                        changeableParticipantsList.remove(changeableParticipantsList.indexOf(identity));
                    }
                }
                partipCntctLst.addAllIdentites(changeableParticipantsList);
                cmsg.addEmailTo(partipCntctLst);
            }
        }
    }
    if (sendToChooserForm != null && isAdmin && businessGroup.getWaitingListEnabled().booleanValue()) {
        if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
            waitingListContactList = new ContactList(translate("sendtochooser.form.radio.waitings.all"));
            List<Identity> waitingListIdentities = businessGroupService.getMembers(businessGroup, GroupRoles.waiting.name());
            waitingListContactList.addAllIdentites(waitingListIdentities);
            cmsg.addEmailTo(waitingListContactList);
        } else {
            if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
                waitingListContactList = new ContactList(translate("sendtochooser.form.radio.waitings.choose"));
                List<Identity> waitingListIdentities = businessGroupService.getMembers(businessGroup, GroupRoles.waiting.name());
                List<Identity> changeableWaitingListIdentities = new ArrayList<>(waitingListIdentities);
                for (Identity indentity : waitingListIdentities) {
                    boolean keyIsSelected = false;
                    for (Long key : sendToChooserForm.getSelectedWaitingKeys()) {
                        if (key.equals(indentity.getKey())) {
                            keyIsSelected = true;
                            break;
                        }
                    }
                    if (!keyIsSelected) {
                        changeableWaitingListIdentities.remove(changeableWaitingListIdentities.indexOf(indentity));
                    }
                }
                waitingListContactList.addAllIdentites(changeableWaitingListIdentities);
                cmsg.addEmailTo(waitingListContactList);
            }
        }
    }
    cmsg.setSubject(translate("businessgroup.contact.subject", businessGroup.getName()));
    if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_NOTHING)) {
        String restUrl = BusinessControlFactory.getInstance().getAsURIString(getWindowControl().getBusinessControl(), true);
        cmsg.setBodyText(getTranslator().translate("businessgroup.contact.bodytext", new String[] { businessGroup.getName(), "<a href='" + restUrl + "'>" + restUrl + "</a>" }));
    } else {
        cmsg.setBodyText("");
    }
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    return collabTools.createContactFormController(ureq, getWindowControl(), cmsg);
}
Also used : ArrayList(java.util.ArrayList) CollaborationTools(org.olat.collaboration.CollaborationTools) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 57 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method doInformations.

private void doInformations(UserRequest ureq) {
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLMSG);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable()));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
    addToHistory(ureq, bwControl);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    collabToolCtr = collabTools.createInfoMessageController(ureq, bwControl, isAdmin);
    listenTo(collabToolCtr);
    mainPanel.setContent(collabToolCtr.getInitialComponent());
}
Also used : CollaborationTools(org.olat.collaboration.CollaborationTools) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 58 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method doCalendar.

private Activateable2 doCalendar(UserRequest ureq) {
    addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLCAL, OlatResourceableType.calendar));
    // calculate the new businesscontext for the forum clicked
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCAL);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable()));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
    addToHistory(ureq, bwControl);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    collabToolCtr = collabTools.createCalendarController(ureq, bwControl, businessGroup, isAdmin, true);
    listenTo(collabToolCtr);
    mainPanel.setContent(collabToolCtr.getInitialComponent());
    return (Activateable2) collabToolCtr;
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) CollaborationTools(org.olat.collaboration.CollaborationTools) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 59 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method doShowMembers.

private void doShowMembers(UserRequest ureq) {
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(this.businessGroup);
    boolean canEmail = collabTools.isToolEnabled(CollaborationTools.TOOL_CONTACT);
    groupMembersToggleViewController = new GroupMembersRunController(ureq, getWindowControl(), businessGroup, canEmail);
    listenTo(groupMembersToggleViewController);
    mainPanel.setContent(groupMembersToggleViewController.getInitialComponent());
    collabToolCtr = null;
    addToHistory(ureq, ORES_TOOLMEMBERS, null);
}
Also used : CollaborationTools(org.olat.collaboration.CollaborationTools)

Example 60 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method doWiki.

private Activateable2 doWiki(UserRequest ureq) {
    addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLWIKI, OlatResourceableType.wiki));
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLWIKI);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapWikiOres(ce.getOLATResourceable()));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
    addToHistory(ureq, bwControl);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    collabToolCtr = collabTools.createWikiController(ureq, bwControl);
    listenTo(collabToolCtr);
    mainPanel.setContent(collabToolCtr.getInitialComponent());
    return (Activateable2) collabToolCtr;
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) CollaborationTools(org.olat.collaboration.CollaborationTools) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

CollaborationTools (org.olat.collaboration.CollaborationTools)98 BusinessGroup (org.olat.group.BusinessGroup)58 Identity (org.olat.core.id.Identity)30 Test (org.junit.Test)28 HttpResponse (org.apache.http.HttpResponse)22 BusinessGroupService (org.olat.group.BusinessGroupService)22 Path (javax.ws.rs.Path)18 WindowControl (org.olat.core.gui.control.WindowControl)18 URI (java.net.URI)16 HttpGet (org.apache.http.client.methods.HttpGet)16 ContextEntry (org.olat.core.id.context.ContextEntry)16 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)14 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)14 Forum (org.olat.modules.fo.Forum)12 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)10 RepositoryEntry (org.olat.repository.RepositoryEntry)10 IOException (java.io.IOException)8 VFSContainer (org.olat.core.util.vfs.VFSContainer)8 InputStream (java.io.InputStream)7 ArrayList (java.util.ArrayList)6