Search in sources :

Example 11 with CollaborationTools

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

the class BusinessGroupMainRunController method doForum.

private Activateable2 doForum(UserRequest ureq) {
    addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLFORUM, OlatResourceableType.forum));
    SubscriptionContext sc = new SubscriptionContext(businessGroup, INITVIEW_TOOLFORUM);
    // calculate the new businesscontext for the forum clicked
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFORUM);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
    addToHistory(ureq, bwControl);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    collabToolCtr = collabTools.createForumController(ureq, bwControl, isAdmin, ureq.getUserSession().getRoles().isGuestOnly(), sc);
    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) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 12 with CollaborationTools

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

the class BusinessGroupMainRunController method buildTreeModel.

/**
 * @return The menu tree model
 */
private TreeModel buildTreeModel() {
    GenericTreeNode gtnChild, root;
    GenericTreeModel gtm = new GenericTreeModel();
    root = new GenericTreeNode(nodeIdPrefix.concat("-root"));
    root.setTitle(businessGroup.getName());
    root.setUserObject(ACTIVITY_MENUSELECT_OVERVIEW);
    root.setAltText(translate("menutree.top.alt") + " " + businessGroup.getName());
    root.setIconCssClass("o_icon o_icon_group");
    gtm.setRootNode(root);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(this.businessGroup);
    if (collabTools.isToolEnabled(CollaborationTools.TOOL_NEWS)) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("new"));
        gtnChild.setTitle(translate("menutree.news"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_INFORMATION);
        gtnChild.setAltText(translate("menutree.news.alt"));
        gtnChild.setIconCssClass("o_icon_news");
        gtnChild.setCssClass("o_sel_group_news");
        root.addChild(gtnChild);
        nodeInformation = gtnChild;
    }
    if (calendarModule.isEnabled() && calendarModule.isEnableGroupCalendar() && collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR)) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("cal"));
        gtnChild.setTitle(translate("menutree.calendar"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_CALENDAR);
        gtnChild.setAltText(translate("menutree.calendar.alt"));
        gtnChild.setIconCssClass("o_calendar_icon");
        gtnChild.setCssClass("o_sel_group_calendar");
        root.addChild(gtnChild);
        nodeCal = gtnChild;
    }
    boolean hasResources = businessGroupService.hasResources(businessGroup);
    if (hasResources) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("courses"));
        gtnChild.setTitle(translate("menutree.resources"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_SHOW_RESOURCES);
        gtnChild.setAltText(translate("menutree.resources.alt"));
        gtnChild.setIconCssClass("o_CourseModule_icon");
        gtnChild.setCssClass("o_sel_group_resources");
        root.addChild(gtnChild);
        nodeResources = gtnChild;
    }
    if (businessGroup.isOwnersVisibleIntern() || businessGroup.isParticipantsVisibleIntern() || businessGroup.isWaitingListVisibleIntern()) {
        // either owners, participants, the waiting list or all three are visible
        // otherwise the node is not visible
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("members"));
        gtnChild.setTitle(translate("menutree.members"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_MEMBERSLIST);
        gtnChild.setAltText(translate("menutree.members.alt"));
        gtnChild.setIconCssClass("o_icon_group");
        gtnChild.setCssClass("o_sel_group_members");
        root.addChild(gtnChild);
        nodeGroupOwners = gtnChild;
    }
    if (collabTools.isToolEnabled(CollaborationTools.TOOL_CONTACT)) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("contact"));
        gtnChild.setTitle(translate("menutree.contactform"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_CONTACTFORM);
        gtnChild.setAltText(translate("menutree.contactform.alt"));
        gtnChild.setIconCssClass("o_co_icon");
        gtnChild.setCssClass("o_sel_group_contact");
        root.addChild(gtnChild);
        nodeContact = gtnChild;
    }
    if (collabTools.isToolEnabled(CollaborationTools.TOOL_FOLDER)) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("folder"));
        gtnChild.setTitle(translate("menutree.folder"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_FOLDER);
        gtnChild.setAltText(translate("menutree.folder.alt"));
        gtnChild.setIconCssClass("o_bc_icon");
        gtnChild.setCssClass("o_sel_group_folder");
        root.addChild(gtnChild);
        nodeFolder = gtnChild;
    }
    if (collabTools.isToolEnabled(CollaborationTools.TOOL_FORUM)) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("forum"));
        gtnChild.setTitle(translate("menutree.forum"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_FORUM);
        gtnChild.setAltText(translate("menutree.forum.alt"));
        gtnChild.setIconCssClass("o_fo_icon");
        gtnChild.setCssClass("o_sel_group_forum");
        root.addChild(gtnChild);
        nodeForum = gtnChild;
    }
    if (chatAvailable) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("chat"));
        gtnChild.setTitle(translate("menutree.chat"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_CHAT);
        gtnChild.setAltText(translate("menutree.chat.alt"));
        gtnChild.setIconCssClass("o_icon_chat");
        gtnChild.setCssClass("o_sel_group_chat");
        root.addChild(gtnChild);
    }
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (collabTools.isToolEnabled(CollaborationTools.TOOL_WIKI) && securityModule.isWikiEnabled()) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("wiki"));
        gtnChild.setTitle(translate("menutree.wiki"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_WIKI);
        gtnChild.setAltText(translate("menutree.wiki.alt"));
        gtnChild.setIconCssClass("o_wiki_icon");
        gtnChild.setCssClass("o_sel_group_wiki");
        root.addChild(gtnChild);
        nodeWiki = gtnChild;
    }
    if (collabTools.isToolEnabled(CollaborationTools.TOOL_PORTFOLIO) && (portfolioModule.isEnabled() || portfolioV2Module.isEnabled())) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("eportfolio"));
        gtnChild.setTitle(translate("menutree.portfolio"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_PORTFOLIO);
        gtnChild.setAltText(translate("menutree.portfolio.alt"));
        gtnChild.setIconCssClass("o_ep_icon");
        gtnChild.setCssClass("o_sel_group_portfolio");
        root.addChild(gtnChild);
        nodePortfolio = gtnChild;
    }
    OpenMeetingsModule openMeetingsModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class);
    if (openMeetingsModule.isEnabled() && collabTools.isToolEnabled(CollaborationTools.TOOL_OPENMEETINGS)) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("meetings"));
        gtnChild.setTitle(translate("menutree.openmeetings"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_OPENMEETINGS);
        gtnChild.setAltText(translate("menutree.openmeetings.alt"));
        gtnChild.setIconCssClass("o_openmeetings_icon");
        root.addChild(gtnChild);
        nodeOpenMeetings = gtnChild;
    }
    if (isAdmin) {
        gtnChild = new GenericTreeNode(nodeIdPrefix.concat("admin"));
        gtnChild.setTitle(translate("menutree.administration"));
        gtnChild.setUserObject(ACTIVITY_MENUSELECT_ADMINISTRATION);
        gtnChild.setIdent(ACTIVITY_MENUSELECT_ADMINISTRATION);
        gtnChild.setAltText(translate("menutree.administration.alt"));
        gtnChild.setIconCssClass("o_icon_settings");
        root.addChild(gtnChild);
        adminNodeId = gtnChild.getIdent();
        nodeAdmin = gtnChild;
        AccessControlModule acModule = (AccessControlModule) CoreSpringFactory.getBean("acModule");
        if (acModule.isEnabled() && acService.isResourceAccessControled(businessGroup.getResource(), null)) {
            gtnChild = new GenericTreeNode(nodeIdPrefix.concat("ac"));
            gtnChild.setTitle(translate("menutree.ac"));
            gtnChild.setUserObject(ACTIVITY_MENUSELECT_AC);
            gtnChild.setIdent(ACTIVITY_MENUSELECT_AC);
            gtnChild.setAltText(translate("menutree.ac.alt"));
            gtnChild.setIconCssClass("o_icon_booking");
            root.addChild(gtnChild);
        }
    }
    return gtm;
}
Also used : AccessControlModule(org.olat.resource.accesscontrol.AccessControlModule) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) CollaborationTools(org.olat.collaboration.CollaborationTools) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) OpenMeetingsModule(org.olat.modules.openmeetings.OpenMeetingsModule)

Example 13 with CollaborationTools

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

the class BusinessGroupMainRunController method doChat.

private void doChat(UserRequest ureq) {
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCHAT);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
    addToHistory(ureq, bwControl);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    collabToolCtr = collabTools.createChatController(ureq, bwControl, businessGroup, isAdmin);
    if (collabToolCtr == null) {
        showWarning("groupchat.not.available");
        mainPanel.setContent(new Panel("empty"));
    } else {
        mainPanel.setContent(collabToolCtr.getInitialComponent());
    }
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) CollaborationTools(org.olat.collaboration.CollaborationTools) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 14 with CollaborationTools

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

the class BusinessGroupServiceTest method testEnableDisableAndCheckForTool.

/**
 * checks if tools can be enabled disabled or checked against being enabled.
 * TOols are configured with the help of the generic properties storage.
 *
 * @throws Exception
 */
@Test
public void testEnableDisableAndCheckForTool() throws Exception {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("coll-tools");
    BusinessGroup found = businessGroupService.createBusinessGroup(coach, "Collaboration", "Collaboration", -1, -1, false, false, null);
    dbInstance.commitAndCloseSession();
    CollaborationTools myCTSMngr = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(found);
    String[] availableTools = CollaborationToolsFactory.getInstance().getAvailableTools().clone();
    for (int i = 0; i < availableTools.length; i++) {
        String msg = "Tool " + availableTools[i] + " is enabled";
        boolean enabled = myCTSMngr.isToolEnabled(availableTools[i]);
        // all tools are disabled by default exept the news tool
        assertTrue(msg, !enabled);
    }
    for (int i = 0; i < availableTools.length; i++) {
        myCTSMngr.setToolEnabled(availableTools[i], true);
    }
    for (int i = 0; i < availableTools.length; i++) {
        String msg = "Tool " + availableTools[i] + " is enabled";
        boolean enabled = myCTSMngr.isToolEnabled(availableTools[i]);
        assertTrue(msg, enabled);
    }
    for (int i = 0; i < availableTools.length; i++) {
        myCTSMngr.setToolEnabled(availableTools[i], false);
    }
    for (int i = 0; i < availableTools.length; i++) {
        String msg = "Tool " + availableTools[i] + " is disabled";
        boolean enabled = myCTSMngr.isToolEnabled(availableTools[i]);
        assertTrue(msg, !enabled);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) CollaborationTools(org.olat.collaboration.CollaborationTools) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 15 with CollaborationTools

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

the class BusinessGroupServiceImpl method deleteBusinessGroup.

@Override
public void deleteBusinessGroup(BusinessGroup group) {
    try {
        OLATResourceableJustBeforeDeletedEvent delEv = new OLATResourceableJustBeforeDeletedEvent(group);
        // notify all (currently running) BusinessGroupXXXcontrollers
        // about the deletion which will occur.
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(delEv, group);
        // refresh object to avoid stale object exceptions
        group = loadBusinessGroup(group);
        // 0) Loop over all deletableGroupData
        Map<String, DeletableGroupData> deleteListeners = CoreSpringFactory.getBeansOfType(DeletableGroupData.class);
        for (DeletableGroupData deleteListener : deleteListeners.values()) {
            if (log.isDebug()) {
                log.debug("deleteBusinessGroup: call deleteListener=" + deleteListener);
            }
            deleteListener.deleteGroupDataFor(group);
        }
        // 1) Delete all group properties
        CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
        // deletes everything concerning properties&collabTools
        ct.deleteTools(group);
        // 1.c)delete user in security groups
        // removeFromRepositoryEntrySecurityGroup(group);
        // 2) Delete the group areas
        areaManager.deleteBGtoAreaRelations(group);
        // 3) Delete the relations
        businessGroupRelationDAO.deleteRelationsToRepositoryEntry(group);
        assessmentModeDao.deleteAssessmentModesToGroup(group);
        // 4) delete properties
        propertyManager.deleteProperties(null, group, null, null, null);
        propertyManager.deleteProperties(null, null, group, null, null);
        // 5) delete the publisher attached to this group (e.g. the forum and folder
        // publisher)
        notificationsManager.deletePublishersOf(group);
        // 6) delete info messages and subscription context associated with this group
        infoMessageManager.removeInfoMessagesAndSubscriptionContext(group);
        // 7) the group
        businessGroupDAO.delete(group);
        // 8) delete the associated security groups
        // TODO group
        dbInstance.commit();
        log.audit("Deleted Business Group", group.toString());
    } catch (DBRuntimeException dbre) {
        Throwable th = dbre.getCause();
        if ((th instanceof ObjectNotFoundException) && th.getMessage().contains("org.olat.group.BusinessGroupImpl")) {
            // group already deleted
            return;
        }
        if ((th instanceof StaleObjectStateException) && (th.getMessage().startsWith("Row was updated or deleted by another transaction"))) {
            // known issue OLAT-3654
            log.info("Group was deleted by another user in the meantime. Known issue OLAT-3654");
            throw new KnownIssueException("Group was deleted by another user in the meantime", 3654);
        } else {
            throw dbre;
        }
    }
}
Also used : DeletableGroupData(org.olat.group.DeletableGroupData) DBRuntimeException(org.olat.core.logging.DBRuntimeException) KnownIssueException(org.olat.core.logging.KnownIssueException) ObjectNotFoundException(org.hibernate.ObjectNotFoundException) CollaborationTools(org.olat.collaboration.CollaborationTools) OLATResourceableJustBeforeDeletedEvent(org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent) StaleObjectStateException(org.hibernate.StaleObjectStateException)

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