use of org.olat.collaboration.CollaborationTools in project openolat by klemens.
the class AbstractBusinessGroupListController method doConfiguration.
/**
* @param ureq
* @param items
*/
private void doConfiguration(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
removeAsListenerAndDispose(businessGroupWizard);
if (selectedItems == null || selectedItems.isEmpty()) {
showWarning("error.select.one");
return;
}
final List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
if (groups.isEmpty()) {
showWarning("msg.alleastone.editable.group");
return;
}
if (selectedItems.size() != groups.size()) {
showWarning("msg.only.editable.group");
return;
}
if (CollaborationToolsFactory.getInstance().getAvailableTools() == null) {
// init the available tools
CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(groups.get(0));
}
StringBuilder managedNames = new StringBuilder();
for (BusinessGroup group : groups) {
String gname = group.getName() == null ? "???" : group.getName();
if (BusinessGroupManagedFlag.isManaged(group, BusinessGroupManagedFlag.resources) || BusinessGroupManagedFlag.isManaged(group, BusinessGroupManagedFlag.tools)) {
if (managedNames.length() > 0)
managedNames.append(", ");
managedNames.append(gname);
}
}
if (managedNames.length() > 0) {
showWarning("error.managed.group", managedNames.toString());
return;
}
boolean isAuthor = ureq.getUserSession().getRoles().isAuthor() || ureq.getUserSession().getRoles().isInstitutionalResourceManager();
Step start = new BGConfigToolsStep(ureq, isAuthor);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
// configuration
BGConfigBusinessGroup configuration = (BGConfigBusinessGroup) runContext.get("configuration");
if (!configuration.getToolsToEnable().isEmpty() || !configuration.getToolsToDisable().isEmpty()) {
for (BusinessGroup group : groups) {
CollaborationTools tools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
for (String enabledTool : configuration.getToolsToEnable()) {
tools.setToolEnabled(enabledTool, true);
if (CollaborationTools.TOOL_FOLDER.equals(enabledTool)) {
tools.saveFolderAccess(new Long(configuration.getFolderAccess()));
Quota quota = configuration.getQuota();
if (quota != null) {
String path = tools.getFolderRelPath();
Quota fQuota = QuotaManager.getInstance().createQuota(path, quota.getQuotaKB(), quota.getUlLimitKB());
QuotaManager.getInstance().setCustomQuotaKB(fQuota);
}
} else if (CollaborationTools.TOOL_CALENDAR.equals(enabledTool)) {
tools.saveCalendarAccess(new Long(configuration.getCalendarAccess()));
}
}
for (String disabledTool : configuration.getToolsToDisable()) {
tools.setToolEnabled(disabledTool, false);
}
}
}
if (configuration.getResources() != null && !configuration.getResources().isEmpty()) {
businessGroupService.addResourcesTo(groups, configuration.getResources());
}
return StepsMainRunController.DONE_MODIFIED;
}
};
businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("config.group"), "o_sel_groups_config_wizard");
listenTo(businessGroupWizard);
getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
use of org.olat.collaboration.CollaborationTools in project openolat by klemens.
the class BusinessGroupMainRunController method doPortfolio.
private Activateable2 doPortfolio(UserRequest ureq) {
addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLPORTFOLIO, OlatResourceableType.portfolio));
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLPORTFOLIO);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable()));
addToHistory(ureq, bwControl);
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
collabToolCtr = collabTools.createPortfolioController(ureq, bwControl, toolbarPanel, businessGroup);
listenTo(collabToolCtr);
toolbarPanel.popUpToRootController(ureq);
toolbarPanel.pushController("Portfolio", collabToolCtr);
List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType("Toc");
((Activateable2) collabToolCtr).activate(ureq, entries, null);
return (Activateable2) collabToolCtr;
}
use of org.olat.collaboration.CollaborationTools in project openolat by klemens.
the class BusinessGroupMainRunController method doOpenMeetings.
private void doOpenMeetings(UserRequest ureq) {
addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLOPENMEETINGS, OlatResourceableType.portfolio));
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLOPENMEETINGS);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable()));
addToHistory(ureq, bwControl);
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
collabToolCtr = collabTools.createOpenMeetingsController(ureq, bwControl, businessGroup, isAdmin);
listenTo(collabToolCtr);
mainPanel.setContent(collabToolCtr.getInitialComponent());
}
use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.
the class CourseGroupWebService method getFolder.
@Path("{groupKey}/folder")
public VFSWebservice getFolder(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) {
BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
BusinessGroup bg = bgs.loadBusinessGroup(groupKey);
if (bg == null) {
return null;
}
if (!isGroupManager(request)) {
Identity identity = RestSecurityHelper.getIdentity(request);
if (!bgs.isIdentityInBusinessGroup(identity, bg)) {
return null;
}
}
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(bg);
if (!collabTools.isToolEnabled(CollaborationTools.TOOL_FOLDER)) {
return null;
}
String relPath = collabTools.getFolderRelPath();
QuotaManager qm = QuotaManager.getInstance();
Quota folderQuota = qm.getCustomQuota(relPath);
if (folderQuota == null) {
Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
folderQuota = QuotaManager.getInstance().createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
SubscriptionContext subsContext = null;
VFSWebServiceSecurityCallback secCallback = new VFSWebServiceSecurityCallback(true, true, true, folderQuota, subsContext);
OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(relPath, null);
rootContainer.setLocalSecurityCallback(secCallback);
return new VFSWebservice(rootContainer);
}
use of org.olat.collaboration.CollaborationTools in project OpenOLAT by OpenOLAT.
the class CourseGroupWebService method getForum.
/**
* Return the Forum web service
* @param groupKey The key of the group
* @param request The HTTP Request
* @return
*/
@Path("{groupKey}/forum")
public ForumWebService getForum(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) {
BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
BusinessGroup bg = bgs.loadBusinessGroup(groupKey);
if (bg == null) {
return null;
}
if (!isGroupManager(request)) {
Identity identity = RestSecurityHelper.getIdentity(request);
if (!bgs.isIdentityInBusinessGroup(identity, bg)) {
return null;
}
}
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(bg);
if (collabTools.isToolEnabled(CollaborationTools.TOOL_FORUM)) {
Forum forum = collabTools.getForum();
return new ForumWebService(forum);
}
return null;
}
Aggregations