Search in sources :

Example 1 with Step_1_SelectCourse

use of org.olat.modules.fo.export.Step_1_SelectCourse in project OpenOLAT by OpenOLAT.

the class MessageListController method doExportForumItem.

private void doExportForumItem(UserRequest ureq, MessageView messageToMove) {
    if (foCallback.mayEditMessageAsModerator()) {
        StepRunnerCallback finish = new FinishCallback();
        Translator trans = Util.createPackageTranslator(Step_1_SelectCourse.class, getLocale());
        Step start = new Step_1_SelectCourse(ureq);
        Message message = forumManager.getMessageById(messageToMove.getKey());
        String wizardTitle = trans.translate("title.wizard.movethread", new String[] { message.getTitle() });
        exportCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, wizardTitle, "o_sel_bulk_assessment_wizard");
        StepsRunContext runContext = exportCtrl.getRunContext();
        // can be threadtop message
        runContext.put(SendMailStepForm.MESSAGE_TO_MOVE, message);
        // starting thread
        runContext.put(SendMailStepForm.START_THREADTOP, message.getThreadtop() == null ? message : message.getThreadtop());
        // get start course
        PropertyManager propertyManager = PropertyManager.getInstance();
        Long forumResourceableId = forum.getResourceableId();
        Property forumproperty = propertyManager.getPropertyByLongValue(forumResourceableId, FOCourseNode.FORUM_KEY);
        if (forumproperty != null) {
            Long resourcetypeId = forumproperty.getResourceTypeId();
            String resourcetypeName = forumproperty.getResourceTypeName();
            OLATResourceable olatResourceable = olatManager.findResourceable(resourcetypeId, resourcetypeName);
            RepositoryEntry startCourse = repositoryManager.lookupRepositoryEntry(olatResourceable, false);
            if (startCourse != null) {
                runContext.put(SendMailStepForm.START_COURSE, startCourse);
            }
        }
        listenTo(exportCtrl);
        getWindowControl().pushAsModalDialog(exportCtrl.getInitialComponent());
    } else {
        showWarning("may.not.move.message");
    }
}
Also used : ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) Message(org.olat.modules.fo.Message) OLATResourceable(org.olat.core.id.OLATResourceable) PropertyManager(org.olat.properties.PropertyManager) Step(org.olat.core.gui.control.generic.wizard.Step) RepositoryEntry(org.olat.repository.RepositoryEntry) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Step_1_SelectCourse(org.olat.modules.fo.export.Step_1_SelectCourse) Translator(org.olat.core.gui.translator.Translator) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Property(org.olat.properties.Property) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) FinishCallback(org.olat.modules.fo.export.FinishCallback)

Example 2 with Step_1_SelectCourse

use of org.olat.modules.fo.export.Step_1_SelectCourse in project openolat by klemens.

the class MessageListController method doExportForumItem.

private void doExportForumItem(UserRequest ureq, MessageView messageToMove) {
    if (foCallback.mayEditMessageAsModerator()) {
        StepRunnerCallback finish = new FinishCallback();
        Translator trans = Util.createPackageTranslator(Step_1_SelectCourse.class, getLocale());
        Step start = new Step_1_SelectCourse(ureq);
        Message message = forumManager.getMessageById(messageToMove.getKey());
        String wizardTitle = trans.translate("title.wizard.movethread", new String[] { message.getTitle() });
        exportCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, wizardTitle, "o_sel_bulk_assessment_wizard");
        StepsRunContext runContext = exportCtrl.getRunContext();
        // can be threadtop message
        runContext.put(SendMailStepForm.MESSAGE_TO_MOVE, message);
        // starting thread
        runContext.put(SendMailStepForm.START_THREADTOP, message.getThreadtop() == null ? message : message.getThreadtop());
        // get start course
        PropertyManager propertyManager = PropertyManager.getInstance();
        Long forumResourceableId = forum.getResourceableId();
        Property forumproperty = propertyManager.getPropertyByLongValue(forumResourceableId, FOCourseNode.FORUM_KEY);
        if (forumproperty != null) {
            Long resourcetypeId = forumproperty.getResourceTypeId();
            String resourcetypeName = forumproperty.getResourceTypeName();
            OLATResourceable olatResourceable = olatManager.findResourceable(resourcetypeId, resourcetypeName);
            RepositoryEntry startCourse = repositoryManager.lookupRepositoryEntry(olatResourceable, false);
            if (startCourse != null) {
                runContext.put(SendMailStepForm.START_COURSE, startCourse);
            }
        }
        listenTo(exportCtrl);
        getWindowControl().pushAsModalDialog(exportCtrl.getInitialComponent());
    } else {
        showWarning("may.not.move.message");
    }
}
Also used : ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) Message(org.olat.modules.fo.Message) OLATResourceable(org.olat.core.id.OLATResourceable) PropertyManager(org.olat.properties.PropertyManager) Step(org.olat.core.gui.control.generic.wizard.Step) RepositoryEntry(org.olat.repository.RepositoryEntry) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Step_1_SelectCourse(org.olat.modules.fo.export.Step_1_SelectCourse) Translator(org.olat.core.gui.translator.Translator) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Property(org.olat.properties.Property) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) FinishCallback(org.olat.modules.fo.export.FinishCallback)

Aggregations

Step (org.olat.core.gui.control.generic.wizard.Step)2 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)2 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)2 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Translator (org.olat.core.gui.translator.Translator)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 Message (org.olat.modules.fo.Message)2 FinishCallback (org.olat.modules.fo.export.FinishCallback)2 Step_1_SelectCourse (org.olat.modules.fo.export.Step_1_SelectCourse)2 ErrorEditMessage (org.olat.modules.fo.ui.events.ErrorEditMessage)2 Property (org.olat.properties.Property)2 PropertyManager (org.olat.properties.PropertyManager)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2