Search in sources :

Example 1 with FolderToolSettingsController

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

the class BGConfigToolsStepController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    boolean first = true;
    String containerPage = velocity_root + "/tool_config_container.html";
    String[] availableTools = CollaborationToolsFactory.getInstance().getAvailableTools().clone();
    for (String k : availableTools) {
        if (k.equals(CollaborationTools.TOOL_CHAT) || k.equals(CollaborationTools.TOOL_NEWS)) {
            continue;
        }
        String[] keys = new String[] { "on" };
        String[] values = new String[] { translate("collabtools.named." + k) };
        String i18n = first ? "config.tools.desc" : null;
        MultipleSelectionElement selectEl = uifactory.addCheckboxesHorizontal(k, i18n, formLayout, keys, values);
        selectEl.addActionListener(FormEvent.ONCHANGE);
        toolList.add(selectEl);
        ToolConfig config = new ToolConfig(k);
        config.configContainer = FormLayoutContainer.createCustomFormLayout("config.container." + k, getTranslator(), containerPage);
        config.configContainer.contextPut("tool", k);
        config.configContainer.setVisible(false);
        config.configContainer.setRootForm(mainForm);
        formLayout.add(config.configContainer);
        config.enableEl = uifactory.addRadiosHorizontal("config.enable." + k, null, config.configContainer, enableKeys, enableValues);
        config.enableEl.addActionListener(FormEvent.ONCHANGE);
        config.enableEl.select("off", true);
        enableList.add(config.enableEl);
        config.enableEl.setUserObject(config);
        if (k.equals(CollaborationTools.TOOL_CALENDAR)) {
            config.calendarCtrl = new CalendarToolSettingsController(ureq, getWindowControl(), mainForm, CollaborationTools.CALENDAR_ACCESS_OWNERS);
            config.configContainer.add("calendar", config.calendarCtrl.getInitialFormItem());
            config.calendarCtrl.getInitialFormItem().setVisible(false);
        } else if (k.equals(CollaborationTools.TOOL_FOLDER)) {
            // add folder access configuration
            config.folderCtrl = new FolderToolSettingsController(ureq, getWindowControl(), mainForm, CollaborationTools.FOLDER_ACCESS_OWNERS);
            config.configContainer.add("folder", config.folderCtrl.getInitialFormItem());
            config.folderCtrl.getInitialFormItem().setVisible(false);
            // add quota configuration for admin only
            if (ureq.getUserSession().getRoles().isOLATAdmin()) {
                Quota quota = quotaManager.createQuota(null, null, null);
                config.quotaCtrl = new BGConfigQuotaController(ureq, getWindowControl(), quota, mainForm);
                config.configContainer.add("quota", config.quotaCtrl.getInitialFormItem());
                config.quotaCtrl.getInitialFormItem().setVisible(false);
            }
        }
        selectEl.setUserObject(config);
        first = false;
    }
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Quota(org.olat.core.util.vfs.Quota) FolderToolSettingsController(org.olat.collaboration.FolderToolSettingsController) CalendarToolSettingsController(org.olat.collaboration.CalendarToolSettingsController)

Example 2 with FolderToolSettingsController

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

the class BGConfigToolsStepController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    boolean first = true;
    String containerPage = velocity_root + "/tool_config_container.html";
    String[] availableTools = CollaborationToolsFactory.getInstance().getAvailableTools().clone();
    for (String k : availableTools) {
        if (k.equals(CollaborationTools.TOOL_CHAT) || k.equals(CollaborationTools.TOOL_NEWS)) {
            continue;
        }
        String[] keys = new String[] { "on" };
        String[] values = new String[] { translate("collabtools.named." + k) };
        String i18n = first ? "config.tools.desc" : null;
        MultipleSelectionElement selectEl = uifactory.addCheckboxesHorizontal(k, i18n, formLayout, keys, values);
        selectEl.addActionListener(FormEvent.ONCHANGE);
        toolList.add(selectEl);
        ToolConfig config = new ToolConfig(k);
        config.configContainer = FormLayoutContainer.createCustomFormLayout("config.container." + k, getTranslator(), containerPage);
        config.configContainer.contextPut("tool", k);
        config.configContainer.setVisible(false);
        config.configContainer.setRootForm(mainForm);
        formLayout.add(config.configContainer);
        config.enableEl = uifactory.addRadiosHorizontal("config.enable." + k, null, config.configContainer, enableKeys, enableValues);
        config.enableEl.addActionListener(FormEvent.ONCHANGE);
        config.enableEl.select("off", true);
        enableList.add(config.enableEl);
        config.enableEl.setUserObject(config);
        if (k.equals(CollaborationTools.TOOL_CALENDAR)) {
            config.calendarCtrl = new CalendarToolSettingsController(ureq, getWindowControl(), mainForm, CollaborationTools.CALENDAR_ACCESS_OWNERS);
            config.configContainer.add("calendar", config.calendarCtrl.getInitialFormItem());
            config.calendarCtrl.getInitialFormItem().setVisible(false);
        } else if (k.equals(CollaborationTools.TOOL_FOLDER)) {
            // add folder access configuration
            config.folderCtrl = new FolderToolSettingsController(ureq, getWindowControl(), mainForm, CollaborationTools.FOLDER_ACCESS_OWNERS);
            config.configContainer.add("folder", config.folderCtrl.getInitialFormItem());
            config.folderCtrl.getInitialFormItem().setVisible(false);
            // add quota configuration for admin only
            if (ureq.getUserSession().getRoles().isOLATAdmin()) {
                Quota quota = quotaManager.createQuota(null, null, null);
                config.quotaCtrl = new BGConfigQuotaController(ureq, getWindowControl(), quota, mainForm);
                config.configContainer.add("quota", config.quotaCtrl.getInitialFormItem());
                config.quotaCtrl.getInitialFormItem().setVisible(false);
            }
        }
        selectEl.setUserObject(config);
        first = false;
    }
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Quota(org.olat.core.util.vfs.Quota) FolderToolSettingsController(org.olat.collaboration.FolderToolSettingsController) CalendarToolSettingsController(org.olat.collaboration.CalendarToolSettingsController)

Aggregations

CalendarToolSettingsController (org.olat.collaboration.CalendarToolSettingsController)2 FolderToolSettingsController (org.olat.collaboration.FolderToolSettingsController)2 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)2 Quota (org.olat.core.util.vfs.Quota)2