Search in sources :

Example 86 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project openolat by klemens.

the class LearningGroupWebService method deleteNews.

/**
 * Deletes the news of the group if the news tool is enabled.
 * @response.representation.200.doc The news are deleted
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @response.representation.404.doc The business group cannot be found or hte news tool is not enabled
 * @param groupKey The key of the group
 * @param request The HTTP request
 * @return
 */
@DELETE
@Path("{groupKey}/news")
public Response deleteNews(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) {
    BusinessGroup bg = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(groupKey);
    if (bg == null) {
        return Response.serverError().status(Status.NOT_FOUND).build();
    }
    if (!isGroupManager(request)) {
        return Response.serverError().status(Status.UNAUTHORIZED).build();
    }
    CollaborationTools tools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(bg);
    if (tools.isToolEnabled(CollaborationTools.TOOL_NEWS)) {
        tools.saveNews(null);
        return Response.ok().build();
    } else {
        return Response.serverError().status(Status.NOT_FOUND).build();
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) BusinessGroupService(org.olat.group.BusinessGroupService) CollaborationTools(org.olat.collaboration.CollaborationTools) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 87 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project openolat by klemens.

the class CourseCalendars method addCalendars.

private static void addCalendars(UserRequest ureq, UserCourseEnvironment courseEnv, List<BusinessGroup> groups, boolean isOwner, LinkProvider linkProvider, List<KalendarRenderWrapper> calendars) {
    if (groups == null || groups.isEmpty())
        return;
    CollaborationToolsFactory collabFactory = CollaborationToolsFactory.getInstance();
    CalendarManager calendarManager = CoreSpringFactory.getImpl(CalendarManager.class);
    Map<CalendarKey, CalendarUserConfiguration> configMap = calendarManager.getCalendarUserConfigurationsMap(ureq.getIdentity(), CalendarManager.TYPE_GROUP);
    for (BusinessGroup bGroup : groups) {
        CollaborationTools collabTools = collabFactory.getOrCreateCollaborationTools(bGroup);
        if (!collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR)) {
            continue;
        }
        boolean member = courseEnv.isIdentityInCourseGroup(bGroup.getKey());
        KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
        groupCalendarWrapper.setPrivateEventsVisible(member || isOwner);
        // set calendar access
        int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
        Long lCalAccess = collabTools.lookupCalendarAccess();
        if (lCalAccess != null)
            iCalAccess = lCalAccess.intValue();
        if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
            groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
        } else {
            groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
        }
        CalendarUserConfiguration config = configMap.get(groupCalendarWrapper.getCalendarKey());
        if (config != null) {
            groupCalendarWrapper.setConfiguration(config);
        }
        groupCalendarWrapper.setLinkProvider(linkProvider);
        calendars.add(groupCalendarWrapper);
    }
}
Also used : CalendarManager(org.olat.commons.calendar.CalendarManager) CalendarKey(org.olat.commons.calendar.model.CalendarKey) BusinessGroup(org.olat.group.BusinessGroup) CollaborationTools(org.olat.collaboration.CollaborationTools) CalendarUserConfiguration(org.olat.commons.calendar.model.CalendarUserConfiguration) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) CollaborationToolsFactory(org.olat.collaboration.CollaborationToolsFactory)

Example 88 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project openolat by klemens.

the class CourseCalendarController method addCalendars.

private void addCalendars(List<BusinessGroup> groups, boolean isOwner, LinkProvider linkProvider, List<KalendarRenderWrapper> calendars) {
    CollaborationToolsFactory collabFactory = CollaborationToolsFactory.getInstance();
    for (BusinessGroup bGroup : groups) {
        CollaborationTools collabTools = collabFactory.getOrCreateCollaborationTools(bGroup);
        if (!collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR))
            continue;
        KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
        groupCalendarWrapper.setPrivateEventsVisible(true);
        // set calendar access
        int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
        Long lCalAccess = collabTools.lookupCalendarAccess();
        if (lCalAccess != null)
            iCalAccess = lCalAccess.intValue();
        if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
            groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
        } else {
            groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
        }
        CalendarUserConfiguration config = calendarManager.findCalendarConfigForIdentity(groupCalendarWrapper.getKalendar(), getIdentity());
        if (config != null) {
            groupCalendarWrapper.setConfiguration(config);
        }
        groupCalendarWrapper.setLinkProvider(linkProvider);
        calendars.add(groupCalendarWrapper);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) CollaborationTools(org.olat.collaboration.CollaborationTools) CalendarUserConfiguration(org.olat.commons.calendar.model.CalendarUserConfiguration) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) CollaborationToolsFactory(org.olat.collaboration.CollaborationToolsFactory)

Example 89 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project openolat by klemens.

the class BusinessGroupImportExport method exportGroup.

private Group exportGroup(File fExportFile, BusinessGroup group, String groupName, boolean runtimeDatas, boolean backwardsCompatible) {
    Group newGroup = new Group();
    newGroup.key = backwardsCompatible ? null : group.getKey();
    newGroup.name = StringHelper.containsNonWhitespace(groupName) ? groupName : group.getName();
    if (group.getMinParticipants() != null) {
        newGroup.minParticipants = group.getMinParticipants();
    }
    if (group.getMaxParticipants() != null) {
        newGroup.maxParticipants = group.getMaxParticipants();
    }
    if (group.getWaitingListEnabled() != null) {
        newGroup.waitingList = group.getWaitingListEnabled();
    }
    if (group.getAutoCloseRanksEnabled() != null) {
        newGroup.autoCloseRanks = group.getAutoCloseRanksEnabled();
    }
    if (StringHelper.containsNonWhitespace(group.getDescription())) {
        newGroup.description = Collections.singletonList(group.getDescription());
    }
    // collab tools
    String[] availableTools = CollaborationToolsFactory.getInstance().getAvailableTools().clone();
    CollabTools toolsConfig = new CollabTools();
    CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
    for (int i = 0; i < availableTools.length; i++) {
        try {
            Field field = toolsConfig.getClass().getField(availableTools[i]);
            field.setBoolean(toolsConfig, ct.isToolEnabled(availableTools[i]));
        } catch (NoSuchFieldException e) {
        // no field to fill (hasOpenMeetings is not set for backwards compatibility)
        } catch (Exception e) {
            log.error("", e);
        }
    }
    newGroup.tools = toolsConfig;
    Long calendarAccess = ct.lookupCalendarAccess();
    if (calendarAccess != null) {
        newGroup.calendarAccess = calendarAccess;
    }
    // fxdiff VCRP-8: collaboration tools folder access control
    Long folderAccess = ct.lookupFolderAccess();
    if (folderAccess != null) {
        newGroup.folderAccess = folderAccess;
    }
    String info = ct.lookupNews();
    if (info != null && !info.trim().equals("")) {
        newGroup.info = info.trim();
    }
    log.debug("fExportFile.getParent()=" + fExportFile.getParent());
    if (runtimeDatas) {
        ct.archive(fExportFile.getParent());
    }
    // export membership
    List<BGArea> bgAreas = areaManager.findBGAreasOfBusinessGroup(group);
    newGroup.areaRelations = new ArrayList<String>();
    for (BGArea areaRelation : bgAreas) {
        newGroup.areaRelations.add(areaRelation.getName());
    }
    // export properties
    boolean showOwners = group.isOwnersVisibleIntern();
    boolean showParticipants = group.isParticipantsVisibleIntern();
    boolean showWaitingList = group.isWaitingListVisibleIntern();
    newGroup.showOwners = showOwners;
    newGroup.showParticipants = showParticipants;
    newGroup.showWaitingList = showWaitingList;
    return newGroup;
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) AssertException(org.olat.core.logging.AssertException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) IOException(java.io.IOException) Field(java.lang.reflect.Field) BGArea(org.olat.group.area.BGArea) CollaborationTools(org.olat.collaboration.CollaborationTools)

Example 90 with CollaborationTools

use of org.olat.collaboration.CollaborationTools in project openolat by klemens.

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)

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