Search in sources :

Example 56 with StepsRunContext

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

the class BulkAssessmentOverviewController method doEditBulkAssessment.

private void doEditBulkAssessment(UserRequest ureq, TaskData data) {
    removeAsListenerAndDispose(bulkAssessmentCtrl);
    if (editedTask != null) {
        // only for security purpose
        taskManager.returnTaskAfterEdition(editedTask, null);
    }
    AssessableCourseNode courseNode = data.getCourseNode();
    final Task editableTask = taskManager.pickTaskForEdition(data.getTask());
    editedTask = editableTask;
    if (editableTask == null) {
        showWarning("task.edited");
    } else {
        BulkAssessmentTask runnable = taskManager.getPersistedRunnableTask(editableTask, BulkAssessmentTask.class);
        BulkAssessmentDatas datas = runnable.getDatas();
        Step start = new BulkAssessment_2_DatasStep(ureq, courseNode, datas, editableTask);
        StepRunnerCallback finish = new StepRunnerCallback() {

            @Override
            public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
                Task task = (Task) runContext.get("task");
                Date scheduledDate = (Date) runContext.get("scheduledDate");
                AssessableCourseNode assessableCourseNode = (AssessableCourseNode) runContext.get("courseNode");
                BulkAssessmentDatas bulkDatas = (BulkAssessmentDatas) runContext.get("datas");
                Feedback feedback = doUpdateBulkAssessment(task, assessableCourseNode, scheduledDate, bulkDatas);
                runContext.put("feedback", feedback);
                editedTask = null;
                return StepsMainRunController.DONE_MODIFIED;
            }
        };
        StepRunnerCallback cancel = new StepRunnerCallback() {

            @Override
            public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
                taskManager.returnTaskAfterEdition(editableTask, null);
                editedTask = null;
                return Step.NOSTEP;
            }
        };
        bulkAssessmentCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, cancel, translate("bulk.wizard.title"), "o_sel_bulk_assessment_wizard");
        listenTo(bulkAssessmentCtrl);
        getWindowControl().pushAsModalDialog(bulkAssessmentCtrl.getInitialComponent());
    }
}
Also used : Task(org.olat.core.commons.services.taskexecutor.Task) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask) 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) Date(java.util.Date) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas) BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 57 with StepsRunContext

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

the class AbstractBusinessGroupListController method doMerge.

/**
 * @param ureq
 * @param items
 */
private void doMerge(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
    removeAsListenerAndDispose(businessGroupWizard);
    if (selectedItems == null || selectedItems.size() < 2) {
        showWarning("error.select.one");
        return;
    }
    final List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
    if (groups.size() < 2) {
        showWarning("msg.alleasttwo.editable.group");
        return;
    }
    if (selectedItems.size() != groups.size()) {
        showWarning("msg.only.editable.group");
        return;
    }
    StringBuilder managedNames = new StringBuilder();
    for (BusinessGroup group : groups) {
        String gname = group.getName() == null ? "???" : StringHelper.escapeHtml(group.getName());
        if (StringHelper.containsNonWhitespace(group.getManagedFlagsString())) {
            if (managedNames.length() > 0)
                managedNames.append(", ");
            managedNames.append(gname);
        }
    }
    if (managedNames.length() > 0) {
        showWarning("error.managed.group", managedNames.toString());
        return;
    }
    Step start = new BGMergeStep(ureq, groups);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            BusinessGroup targetGroup = (BusinessGroup) runContext.get("targetGroup");
            groups.remove(targetGroup);
            businessGroupService.mergeBusinessGroups(getIdentity(), targetGroup, groups, null);
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("merge.group"), "o_sel_groups_merge_wizard");
    listenTo(businessGroupWizard);
    getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
Also used : BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BusinessGroup(org.olat.group.BusinessGroup) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) 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) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest) BGMergeStep(org.olat.group.ui.wizard.BGMergeStep)

Example 58 with StepsRunContext

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

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)

Example 59 with StepsRunContext

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

the class BusinessGroupMembersController method doChooseMembers.

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

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            addMembers(runContext);
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    importMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("add.member"), "o_sel_group_import_1_wizard");
    listenTo(importMembersWizard);
    getWindowControl().pushAsModalDialog(importMembersWizard.getInitialComponent());
}
Also used : ImportMember_1b_ChooseMemberStep(org.olat.course.member.wizard.ImportMember_1b_ChooseMemberStep) 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) 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)

Example 60 with StepsRunContext

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

the class QTIEditorMainController method doImportTable.

private void doImportTable(UserRequest ureq) {
    removeAsListenerAndDispose(importTableWizard);
    final ItemsPackage importPackage = new ItemsPackage();
    final ImportOptions options = new ImportOptions();
    options.setShuffle(!qtiPackage.getQTIDocument().isSurvey());
    Step start = new QImport_1_InputStep(ureq, importPackage, options, null);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            runContext.put("importPackage", importPackage);
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    importTableWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("tools.import.table"), "o_mi_table_import_wizard");
    listenTo(importTableWizard);
    getWindowControl().pushAsModalDialog(importTableWizard.getInitialComponent());
}
Also used : StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) QImport_1_InputStep(org.olat.ims.qti.questionimport.QImport_1_InputStep) 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) ItemsPackage(org.olat.ims.qti.questionimport.ItemsPackage) ImportOptions(org.olat.ims.qti.questionimport.ImportOptions) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest) QImport_1_InputStep(org.olat.ims.qti.questionimport.QImport_1_InputStep)

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