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();
}
}
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);
}
}
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);
}
}
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;
}
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());
}
}
Aggregations