Search in sources :

Example 36 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project OpenOLAT by OpenOLAT.

the class MessageListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == exportCtrl) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            if (event == Event.CHANGED_EVENT) {
                StepsRunContext runContext = exportCtrl.getRunContext();
                Message originTopMessage = (Message) runContext.get(SendMailStepForm.START_THREADTOP);
                originTopMessage = forumManager.loadMessage(originTopMessage.getKey());
                if (originTopMessage != null) {
                    // refresh origin thread
                    fireEvent(ureq, new SelectMessageEvent(SelectMessageEvent.SELECT_THREAD, originTopMessage.getKey()));
                } else {
                    fireEvent(ureq, Event.BACK_EVENT);
                }
            }
            getWindowControl().pop();
            removeAsListenerAndDispose(exportCtrl);
            exportCtrl = null;
        }
    } else if (source == confirmDeleteCtrl) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView deletedMessage = (MessageView) confirmDeleteCtrl.getUserObject();
            doDeleteMessage(ureq, deletedMessage);
        }
    } else if (editMessageCtrl == source) {
        // edit done -> save
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message message = editMessageCtrl.getMessage();
            if (message != null) {
                if (thread != null && thread.getKey().equals(message.getKey())) {
                    thread = message;
                }
                reloadModel(ureq, message);
            } else {
                showInfo("header.cannoteditmessage");
            }
        }
        cmc.deactivate();
    } else if (replyMessageCtrl == source) {
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message reply = replyMessageCtrl.getMessage();
            if (reply != null) {
                reloadModel(ureq, reply);
            } else {
                showInfo("header.cannotsavemessage");
            }
        }
        cmc.deactivate();
    } else if (messageTableCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doSelectTheOne(ureq, sme.getMessageKey());
        }
    } else if (moveCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doFinalizeMove(ureq, moveCtrl.getSelectView(), sme.getMessageKey());
            cmc.deactivate();
        }
    } else if (confirmSplitCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView splitedMessage = (MessageView) confirmSplitCtrl.getUserObject();
            doSplitThread(ureq, splitedMessage);
        }
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) Message(org.olat.modules.fo.Message) SelectMessageEvent(org.olat.modules.fo.ui.events.SelectMessageEvent) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext)

Example 37 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project OpenOLAT by OpenOLAT.

the class GroupController method doImportUsers.

private void doImportUsers(UserRequest ureq) {
    removeAsListenerAndDispose(userToGroupWizard);
    Step start = new UsersToGroupWizardStep00(ureq, addUserMailDefaultTempl, mandatoryEmail);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            @SuppressWarnings("unchecked") List<Identity> choosenIdentities = (List<Identity>) runContext.get("members");
            MailTemplate customTemplate = (MailTemplate) runContext.get("mailTemplate");
            if (choosenIdentities == null || choosenIdentities.size() == 0) {
                showError("msg.selectionempty");
            } else {
                doAddIdentitiesToGroup(uureq, choosenIdentities, customTemplate);
            }
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    userToGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("overview.addusers"), "o_sel_secgroup_import_logins_wizard");
    listenTo(userToGroupWizard);
    getWindowControl().pushAsModalDialog(userToGroupWizard.getInitialComponent());
}
Also used : UsersToGroupWizardStep00(org.olat.admin.securitygroup.gui.multi.UsersToGroupWizardStep00) MailTemplate(org.olat.core.util.mail.MailTemplate) List(java.util.List) ArrayList(java.util.ArrayList) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Step(org.olat.core.gui.control.generic.wizard.Step) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Identity(org.olat.core.id.Identity) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 38 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project OpenOLAT by OpenOLAT.

the class GroupController method doImportUsers.

private void doImportUsers(UserRequest ureq) {
    removeAsListenerAndDispose(userToGroupWizard);
    Step start = new UsersToGroupWizardStep00(ureq, addUserMailDefaultTempl, mandatoryEmail);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest ureq, WindowControl wControl, StepsRunContext runContext) {
            @SuppressWarnings("unchecked") List<Identity> choosenIdentities = (List<Identity>) runContext.get("members");
            MailTemplate customTemplate = (MailTemplate) runContext.get("mailTemplate");
            if (choosenIdentities == null || choosenIdentities.size() == 0) {
                showError("msg.selectionempty");
            } else {
                doAddIdentitiesToGroup(ureq, choosenIdentities, customTemplate);
            }
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    userToGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("overview.addusers"), "o_sel_secgroup_import_logins_wizard");
    listenTo(userToGroupWizard);
    getWindowControl().pushAsModalDialog(userToGroupWizard.getInitialComponent());
}
Also used : UsersToGroupWizardStep00(org.olat.admin.securitygroup.gui.multi.UsersToGroupWizardStep00) MailTemplate(org.olat.core.util.mail.MailTemplate) List(java.util.List) ArrayList(java.util.ArrayList) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Step(org.olat.core.gui.control.generic.wizard.Step) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Identity(org.olat.core.id.Identity) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 39 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project OpenOLAT by OpenOLAT.

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());
}
Also used : BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BusinessGroup(org.olat.group.BusinessGroup) Step(org.olat.core.gui.control.generic.wizard.Step) BGCopyPreparationStep(org.olat.group.ui.wizard.BGCopyPreparationStep) BGMergeStep(org.olat.group.ui.wizard.BGMergeStep) BGConfigToolsStep(org.olat.group.ui.wizard.BGConfigToolsStep) BGEmailSelectReceiversStep(org.olat.group.ui.wizard.BGEmailSelectReceiversStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Quota(org.olat.core.util.vfs.Quota) BGConfigToolsStep(org.olat.group.ui.wizard.BGConfigToolsStep) CollaborationTools(org.olat.collaboration.CollaborationTools) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 40 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project OpenOLAT by OpenOLAT.

the class BusinessGroupMembersController method doImportMembers.

private void doImportMembers(UserRequest ureq) {
    removeAsListenerAndDispose(importMembersWizard);
    Step start = new ImportMember_1a_LoginListStep(ureq, null, businessGroup, false);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            addMembers(runContext);
            if (runContext.containsKey("notFounds")) {
                showWarning("user.notfound", runContext.get("notFounds").toString());
            }
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    importMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("import.member"), "o_sel_group_import_logins_wizard");
    listenTo(importMembersWizard);
    getWindowControl().pushAsModalDialog(importMembersWizard.getInitialComponent());
}
Also used : StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) ImportMember_1a_LoginListStep(org.olat.course.member.wizard.ImportMember_1a_LoginListStep) Step(org.olat.core.gui.control.generic.wizard.Step) ImportMember_1b_ChooseMemberStep(org.olat.course.member.wizard.ImportMember_1b_ChooseMemberStep) ImportMember_1a_LoginListStep(org.olat.course.member.wizard.ImportMember_1a_LoginListStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)62 Step (org.olat.core.gui.control.generic.wizard.Step)58 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)58 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)58 UserRequest (org.olat.core.gui.UserRequest)56 WindowControl (org.olat.core.gui.control.WindowControl)56 ArrayList (java.util.ArrayList)16 List (java.util.List)14 ImportMember_1a_LoginListStep (org.olat.course.member.wizard.ImportMember_1a_LoginListStep)12 ImportMember_1b_ChooseMemberStep (org.olat.course.member.wizard.ImportMember_1b_ChooseMemberStep)12 Identity (org.olat.core.id.Identity)10 BusinessGroup (org.olat.group.BusinessGroup)10 QImport_1_InputStep (org.olat.ims.qti21.questionimport.QImport_1_InputStep)10 BGConfigBusinessGroup (org.olat.group.ui.wizard.BGConfigBusinessGroup)8 BGConfigToolsStep (org.olat.group.ui.wizard.BGConfigToolsStep)8 BGCopyBusinessGroup (org.olat.group.ui.wizard.BGCopyBusinessGroup)8 BGCopyPreparationStep (org.olat.group.ui.wizard.BGCopyPreparationStep)8 BGEmailSelectReceiversStep (org.olat.group.ui.wizard.BGEmailSelectReceiversStep)8 BGMergeStep (org.olat.group.ui.wizard.BGMergeStep)8 Export_1_TypeStep (org.olat.modules.qpool.ui.wizard.Export_1_TypeStep)8