Search in sources :

Example 31 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class SPRunController method doInlineIntegration.

private void doInlineIntegration(UserRequest ureq, boolean hasEditRightsTo) {
    boolean allowRelativeLinks = config.getBooleanSafe(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS);
    // create the possibility to float
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(ICourse.class, userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS);
    spCtr = new SinglePageController(ureq, getWindowControl(), courseFolderContainer, fileName, allowRelativeLinks, null, ores, deliveryOptions, userCourseEnv.getCourseEnvironment().isPreview());
    spCtr.setAllowDownload(true);
    // only for inline integration: register for controller event to forward a olatcmd to the course,
    // and also to remember latest position in the script
    listenTo(spCtr);
    // enable edit mode if user has the according rights
    if (hasEditRightsTo) {
        spCtr.allowPageEditing();
        // set the link tree model to internal for the HTML editor
        if (linkTreeModel != null) {
            spCtr.setInternalLinkTreeModel(linkTreeModel);
        }
    }
    // create clone wrapper layout
    CloneLayoutControllerCreatorCallback clccc = new CloneLayoutControllerCreatorCallback() {

        public ControllerCreator createLayoutControllerCreator(UserRequest uureq, final ControllerCreator contentControllerCreator) {
            return BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(uureq, new ControllerCreator() {

                public Controller createController(UserRequest lureq, WindowControl lwControl) {
                    // Wrap in column layout, popup window needs a layout controller
                    Controller ctr = contentControllerCreator.createController(lureq, lwControl);
                    LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
                    layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), userCourseEnv.getCourseEnvironment()));
                    // Controller titledCtrl = TitledWrapperHelper.getWrapper(lureq, lwControl, ctr, courseNode, "o_sp_icon");
                    layoutCtr.addDisposableChildController(ctr);
                    return layoutCtr;
                }
            });
        }
    };
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), spCtr, courseNode, "o_sp_icon");
    if (ctrl instanceof CloneableController) {
        cloneC = new CloneController(ureq, getWindowControl(), (CloneableController) ctrl, clccc);
        listenTo(cloneC);
        main.setContent(cloneC.getInitialComponent());
    } else {
        throw new AssertException("Controller must be cloneable");
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) OLATResourceable(org.olat.core.id.OLATResourceable) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) SinglePageController(org.olat.core.commons.modules.singlepage.SinglePageController) WindowControl(org.olat.core.gui.control.WindowControl) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CloneController(org.olat.core.gui.control.generic.clone.CloneController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) SinglePageController(org.olat.core.commons.modules.singlepage.SinglePageController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) CloneController(org.olat.core.gui.control.generic.clone.CloneController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CloneLayoutControllerCreatorCallback(org.olat.core.gui.control.generic.clone.CloneLayoutControllerCreatorCallback) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) UserRequest(org.olat.core.gui.UserRequest)

Example 32 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class ProjectDetailsDisplayController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Component source, Event event) {
    if (projectBrokerManager.existsProject(project.getKey())) {
        if (source == editProjectButton) {
            fireEvent(ureq, new Event("switchToEditMode"));
        } else if (source == deleteProjectButton) {
            OLATResourceable projectOres = OresHelper.createOLATResourceableInstance(Project.class, project.getKey());
            this.lock = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(projectOres, ureq.getIdentity(), null);
            if (lock.isSuccess()) {
                deleteConfirmController = activateOkCancelDialog(ureq, null, translate("delete.confirm", project.getTitle()), deleteConfirmController);
            } else {
                this.showInfo("info.project.already.edit", project.getTitle());
            }
            return;
        } else if (event.getCommand().equals(CMD_OPEN_PROJECT_LEADER_DETAIL)) {
            if (source instanceof Link) {
                Link projectLeaderLink = (Link) source;
                final Identity identity = (Identity) projectLeaderLink.getUserObject();
                ControllerCreator ctrlCreator = new ControllerCreator() {

                    @Override
                    public Controller createController(UserRequest lureq, WindowControl lwControl) {
                        return new UserInfoMainController(lureq, lwControl, identity, true, false);
                    }
                };
                // wrap the content controller into a full header layout
                ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
                // open in new browser window
                this.openInNewBrowserWindow(ureq, layoutCtrlr);
            }
        } else if (source == attachedFileLink) {
            doFileDelivery(ureq, project, courseEnv, courseNode);
        } else if (source == changeProjectStateToNotAssignButton) {
            projectBrokerManager.setProjectState(project, Project.STATE_NOT_ASSIGNED);
            myContent.remove(changeProjectStateToNotAssignButton);
            changeProjectStateToAssignButton = LinkFactory.createButtonSmall("change.project.state.assign.button", myContent, this);
        } else if (source == changeProjectStateToAssignButton) {
            projectBrokerManager.setProjectState(project, Project.STATE_ASSIGNED);
            myContent.remove(changeProjectStateToAssignButton);
            changeProjectStateToNotAssignButton = LinkFactory.createButtonSmall("change.project.state.not_assign.button", myContent, this);
        }
    } else {
        this.showInfo("info.project.nolonger.exist", project.getTitle());
    }
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) OLATResourceable(org.olat.core.id.OLATResourceable) UserInfoMainController(org.olat.user.UserInfoMainController) Event(org.olat.core.gui.control.Event) ProjectEvent(org.olat.course.nodes.projectbroker.datamodel.ProjectEvent) Identity(org.olat.core.id.Identity) WindowControl(org.olat.core.gui.control.WindowControl) Link(org.olat.core.gui.components.link.Link) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 33 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class EfficiencyStatementsPortletRunController method event.

/**
 * @see org.olat.core.gui.control.ControllerEventListener#dispatchEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    super.event(ureq, source, event);
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            String actionid = te.getActionId();
            if (actionid.equals(CMD_LAUNCH)) {
                int rowid = te.getRowId();
                final UserEfficiencyStatementLight statement = efficiencyStatementsListModel.getEfficiencyStatementAt(rowid);
                // will not be disposed on course run dispose, popus up as new browserwindow
                ControllerCreator ctrlCreator = new ControllerCreator() {

                    public Controller createController(UserRequest lureq, WindowControl lwControl) {
                        CertificateAndEfficiencyStatementController efficiencyCtrl = new CertificateAndEfficiencyStatementController(lwControl, lureq, statement.getArchivedResourceKey());
                        return new LayoutMain3ColsController(lureq, getWindowControl(), efficiencyCtrl);
                    }
                };
                // wrap the content controller into a full header layout
                ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
                // open in new browser window
                PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
                pbw.open(ureq);
            // 
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) UserEfficiencyStatementLight(org.olat.course.assessment.model.UserEfficiencyStatementLight) CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) WindowControl(org.olat.core.gui.control.WindowControl) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 34 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class ParticipantLectureBlocksController method doPrint.

private void doPrint(UserRequest ureq) {
    ControllerCreator printControllerCreator = (lureq, lwControl) -> {
        lwControl.getWindowBackOffice().getChiefController().addBodyCssClass("o_lectures_print");
        Controller printCtrl = new ParticipantLectureBlocksController(lureq, lwControl, entry, assessedIdentity, false, false);
        listenTo(printCtrl);
        return printCtrl;
    };
    ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createPrintPopupLayout(printControllerCreator);
    openInNewBrowserWindow(ureq, layoutCtrlr);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) RepositoryService(org.olat.repository.RepositoryService) Date(java.util.Date) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) LectureBlockAuditLog(org.olat.modules.lecture.LectureBlockAuditLog) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) Map(java.util.Map) SortKey(org.olat.core.commons.persistence.SortKey) ContactList(org.olat.core.util.mail.ContactList) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LectureBlock(org.olat.modules.lecture.LectureBlock) ParticipantCols(org.olat.modules.lecture.ui.ParticipantLectureBlocksDataModel.ParticipantCols) WindowControl(org.olat.core.gui.control.WindowControl) Component(org.olat.core.gui.components.Component) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) LectureService(org.olat.modules.lecture.LectureService) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Identity(org.olat.core.id.Identity) ContactFormController(org.olat.modules.co.ContactFormController) LecturesCompulsoryRenderer(org.olat.modules.lecture.ui.component.LecturesCompulsoryRenderer) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) LectureBlockAndRollCall(org.olat.modules.lecture.model.LectureBlockAndRollCall) Action(org.olat.modules.lecture.LectureBlockAuditLog.Action) HashMap(java.util.HashMap) RepositoryEntry(org.olat.repository.RepositoryEntry) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) CalendarUtils(org.olat.commons.calendar.CalendarUtils) Calendar(java.util.Calendar) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) GroupRoles(org.olat.basesecurity.GroupRoles) DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) StringHelper(org.olat.core.util.StringHelper) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall) LectureBlockRollCallStatusCellRenderer(org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) LectureBlockStatus(org.olat.modules.lecture.LectureBlockStatus) ContactMessage(org.olat.core.util.mail.ContactMessage) Formatter(org.olat.core.util.Formatter) LectureModule(org.olat.modules.lecture.LectureModule) Link(org.olat.core.gui.components.link.Link) Controller(org.olat.core.gui.control.Controller) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserManager(org.olat.user.UserManager) BaseFullWebappPopupLayoutFactory(org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory) NewControllerFactory(org.olat.NewControllerFactory) DB(org.olat.core.commons.persistence.DB) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) UserRequest(org.olat.core.gui.UserRequest) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) Controller(org.olat.core.gui.control.Controller) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 35 with ControllerCreator

use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.

the class ParticipantListRepositoryController method doPrint.

private void doPrint(UserRequest ureq) {
    ControllerCreator printControllerCreator = new ControllerCreator() {

        @Override
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            lwControl.getWindowBackOffice().getChiefController().addBodyCssClass("o_lectures_print");
            Controller printCtrl = new ParticipantListRepositoryController(lureq, lwControl, entry, true, admin);
            listenTo(printCtrl);
            return printCtrl;
        }
    };
    ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createPrintPopupLayout(printControllerCreator);
    openInNewBrowserWindow(ureq, layoutCtrlr);
}
Also used : WindowControl(org.olat.core.gui.control.WindowControl) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) Controller(org.olat.core.gui.control.Controller) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)92 UserRequest (org.olat.core.gui.UserRequest)72 WindowControl (org.olat.core.gui.control.WindowControl)72 Controller (org.olat.core.gui.control.Controller)42 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)28 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)28 LockableController (org.olat.core.commons.fullWebApp.LockableController)20 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)12 Identity (org.olat.core.id.Identity)12 ArrayList (java.util.ArrayList)10 List (java.util.List)10 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)10 TableEvent (org.olat.core.gui.components.table.TableEvent)10 AssertException (org.olat.core.logging.AssertException)10 UserInfoMainController (org.olat.user.UserInfoMainController)10 OlatFooterController (org.olat.gui.control.OlatFooterController)8 HashMap (java.util.HashMap)6 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)6 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)6 Event (org.olat.core.gui.control.Event)6