Search in sources :

Example 11 with WindowControl

use of org.olat.core.gui.control.WindowControl in project OpenOLAT by OpenOLAT.

the class PublishController method doAddAccessRights.

private void doAddAccessRights(UserRequest ureq) {
    removeAsListenerAndDispose(addMembersWizard);
    Step start = new AddMember_1_ChooseMemberStep(ureq, binder);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            AccessRightsContext rightsContext = (AccessRightsContext) runContext.get("rightsContext");
            MailTemplate mailTemplate = (MailTemplate) runContext.get("mailTemplate");
            addMembers(rightsContext, mailTemplate);
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    addMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("add.member"), "o_sel_course_member_import_1_wizard");
    listenTo(addMembersWizard);
    getWindowControl().pushAsModalDialog(addMembersWizard.getInitialComponent());
}
Also used : AccessRightsContext(org.olat.modules.portfolio.ui.wizard.AccessRightsContext) MailTemplate(org.olat.core.util.mail.MailTemplate) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) AddMember_1_ChooseMemberStep(org.olat.modules.portfolio.ui.wizard.AddMember_1_ChooseMemberStep) Step(org.olat.core.gui.control.generic.wizard.Step) AddMember_1_ChooseMemberStep(org.olat.modules.portfolio.ui.wizard.AddMember_1_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 12 with WindowControl

use of org.olat.core.gui.control.WindowControl in project OpenOLAT by OpenOLAT.

the class TableOfContentController method doOpenPage.

private PageRunController doOpenPage(UserRequest ureq, Page page) {
    removeAsListenerAndDispose(pageCtrl);
    OLATResourceable pageOres = OresHelper.createOLATResourceableInstance("Entry", page.getKey());
    WindowControl swControl = addToHistory(ureq, pageOres, null);
    Page reloadedPage = portfolioService.getPageByKey(page.getKey());
    boolean openInEditMode = (secCallback.canEditPage(reloadedPage) && (reloadedPage.getPageStatus() == null || reloadedPage.getPageStatus() == PageStatus.draft || reloadedPage.getPageStatus() == PageStatus.inRevision));
    pageCtrl = new PageRunController(ureq, swControl, stackPanel, secCallback, reloadedPage, openInEditMode);
    listenTo(pageCtrl);
    stackPanel.pushController(page.getTitle(), pageCtrl);
    return pageCtrl;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) Page(org.olat.modules.portfolio.Page) WindowControl(org.olat.core.gui.control.WindowControl)

Example 13 with WindowControl

use of org.olat.core.gui.control.WindowControl in project OpenOLAT by OpenOLAT.

the class PortfolioSite method createController.

@Override
protected Controller createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(PortfolioSite.class, 0l);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
    PortfolioPersonalToolController mainController = new PortfolioPersonalToolController(ureq, bwControl);
    return mainController;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) StateSite(org.olat.core.id.context.StateSite) WindowControl(org.olat.core.gui.control.WindowControl) PortfolioPersonalToolController(org.olat.modules.portfolio.ui.PortfolioPersonalToolController)

Example 14 with WindowControl

use of org.olat.core.gui.control.WindowControl in project OpenOLAT by OpenOLAT.

the class EditorMainController method launchPublishingWizard.

private void launchPublishingWizard(UserRequest ureq, ICourse course, boolean requestOnClose) {
    // ignore enter
    if (publishStepsController != null)
        return;
    /*
		 * start follwoing steps -> cancel wizardf does not touch data
		 * (M) Mandatory (O) Optional
		 * - (M)Step 00  -> show selection tree to choose changed nodes to be published
		 * ...........-> calculate errors & warnings
		 * ...........(next|finish) available if no errors or nothing to publish
		 * - (O)Step 00A -> review errors & warnings
		 * ...........(previous|next|finish) available
		 * - (O)Step 00B -> review publish changes that will happen
		 * ...........(previous|next|finish) available
		 * - (O)Step 01  -> change general access to course
		 * ...........(previous|finish) available
		 * - FinishCallback -> apply course nodes change set
		 * .................-> apply general access changes.
		 */
    Step start = new PublishStep00(ureq, cetm, course);
    /*
		 * callback executed in case wizard is finished.
		 */
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
            // all information to do now is within the runContext saved
            boolean hasChanges = false;
            PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
            PublishEvents publishEvents = publishManager.getPublishEvents();
            if (runContext.containsKey("validPublish") && ((Boolean) runContext.get("validPublish")).booleanValue()) {
                @SuppressWarnings("unchecked") Collection<String> selectedNodeIds = (Collection<String>) runContext.get("publishSetCreatedFor");
                hasChanges = (selectedNodeIds != null) && (selectedNodeIds.size() > 0);
                if (hasChanges) {
                    publishManager.applyPublishSet(ureq1.getIdentity(), ureq1.getLocale(), false);
                }
            }
            if (runContext.containsKey("accessAndProperties")) {
                CourseAccessAndProperties accessAndProperties = (CourseAccessAndProperties) runContext.get("accessAndProperties");
                // fires an EntryChangedEvent for repository entry notifying
                // about modification.
                publishManager.changeAccessAndProperties(getIdentity(), accessAndProperties);
                hasChanges = true;
            }
            CourseCatalog courseCatalog = (CourseCatalog) runContext.get("categories");
            if (courseCatalog != null) {
                publishManager.publishToCatalog(courseCatalog.getChoiceValue(), courseCatalog.getCategoryLabels());
            }
            if (publishEvents.getPostPublishingEvents().size() > 0) {
                for (MultiUserEvent event : publishEvents.getPostPublishingEvents()) {
                    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, ores);
                }
            }
            // signal correct completion and tell if changes were made or not.
            return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
        }
    };
    publishStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("publish.wizard.title"), "o_sel_course_publish_wizard");
    listenTo(publishStepsController);
    publishStepsController.getRunContext().put("requestOnClose", requestOnClose);
    getWindowControl().pushAsModalDialog(publishStepsController.getInitialComponent());
}
Also used : Step(org.olat.core.gui.control.generic.wizard.Step) CheckList_1_CheckboxStep(org.olat.course.nodes.cl.ui.wizard.CheckList_1_CheckboxStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Collection(java.util.Collection) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MultiUserEvent(org.olat.core.util.event.MultiUserEvent) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) CheckListStepRunnerCallback(org.olat.course.nodes.cl.ui.wizard.CheckListStepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 15 with WindowControl

use of org.olat.core.gui.control.WindowControl in project OpenOLAT by OpenOLAT.

the class MembersManagementMainController method selectMenuItem.

private Controller selectMenuItem(UserRequest ureq, String cmd) {
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(cmd, 0l);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    addToHistory(ureq, bwControl);
    Controller selectedCtrl = null;
    if (CMD_MEMBERS.equals(cmd)) {
        if (entryAdmin || memberManagementRight) {
            if (membersOverviewCtrl == null) {
                membersOverviewCtrl = new MembersOverviewController(ureq, bwControl, toolbarPanel, repoEntry, coachCourseEnv);
                listenTo(membersOverviewCtrl);
            } else if (membersDirty) {
                membersOverviewCtrl.reloadMembers();
            }
            mainVC.put("content", membersOverviewCtrl.getInitialComponent());
            selectedCtrl = membersOverviewCtrl;
        }
    } else if (CMD_GROUPS.equals(cmd)) {
        if (entryAdmin || memberManagementRight || groupManagementRight) {
            if (groupsCtrl == null) {
                groupsCtrl = new CourseBusinessGroupListController(ureq, bwControl, repoEntry, entryAdmin || groupManagementRight, coachCourseEnv.isCourseReadOnly());
                listenTo(groupsCtrl);
            }
            groupsCtrl.reloadModel();
            mainVC.put("content", groupsCtrl.getInitialComponent());
            selectedCtrl = groupsCtrl;
        }
    } else if (CMD_BOOKING.equals(cmd)) {
        if (acModule.isEnabled() && (entryAdmin || memberManagementRight)) {
            if (ordersController == null) {
                ordersController = new OrdersAdminController(ureq, bwControl, toolbarPanel, repoEntry.getOlatResource());
                listenTo(ordersController);
            }
            mainVC.put("content", ordersController.getInitialComponent());
            selectedCtrl = ordersController;
        }
    } else if (CMD_RIGHTS.equals(cmd)) {
        if (entryAdmin) {
            if (rightsController == null) {
                rightsController = new GroupsAndRightsController(ureq, bwControl, repoEntry, coachCourseEnv.isCourseReadOnly());
                listenTo(rightsController);
            }
            mainVC.put("content", rightsController.getInitialComponent());
            selectedCtrl = rightsController;
        }
    }
    TreeNode selTreeNode = TreeHelper.findNodeByUserObject(cmd, menuTree.getTreeModel().getRootNode());
    if (selTreeNode != null && !selTreeNode.getIdent().equals(menuTree.getSelectedNodeId())) {
        menuTree.setSelectedNodeId(selTreeNode.getIdent());
    }
    return selectedCtrl;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) OrdersAdminController(org.olat.resource.accesscontrol.ui.OrdersAdminController) GroupsAndRightsController(org.olat.course.groupsandrights.GroupsAndRightsController) WindowControl(org.olat.core.gui.control.WindowControl) GroupsAndRightsController(org.olat.course.groupsandrights.GroupsAndRightsController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Controller(org.olat.core.gui.control.Controller) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController) OrdersAdminController(org.olat.resource.accesscontrol.ui.OrdersAdminController)

Aggregations

WindowControl (org.olat.core.gui.control.WindowControl)628 OLATResourceable (org.olat.core.id.OLATResourceable)300 UserRequest (org.olat.core.gui.UserRequest)136 Controller (org.olat.core.gui.control.Controller)70 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)68 RepositoryEntry (org.olat.repository.RepositoryEntry)68 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)64 ContextEntry (org.olat.core.id.context.ContextEntry)58 Step (org.olat.core.gui.control.generic.wizard.Step)56 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)56 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)56 BusinessControl (org.olat.core.id.context.BusinessControl)56 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)46 ArrayList (java.util.ArrayList)42 Identity (org.olat.core.id.Identity)38 StateSite (org.olat.core.id.context.StateSite)32 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)28 AssertException (org.olat.core.logging.AssertException)24 QuestionsController (org.olat.modules.qpool.ui.QuestionsController)22 List (java.util.List)20