Search in sources :

Example 16 with ControllerCreator

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

the class DmzBFWCParts method createFooterController.

@Override
public LockableController createFooterController(UserRequest ureq, WindowControl wControl) {
    Controller footerCtr = null;
    // ----------- footer, optional (e.g. for copyright, powered by) ------------------
    if (CoreSpringFactory.containsBean("fullWebApp.DMZFooterControllerCreator")) {
        ControllerCreator footerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.DMZFooterControllerCreator");
        footerCtr = footerCreator.createController(ureq, wControl);
    } else {
        footerCtr = new OlatFooterController(ureq, wControl);
    }
    return (LockableController) footerCtr;
}
Also used : LockableController(org.olat.core.commons.fullWebApp.LockableController) OlatFooterController(org.olat.gui.control.OlatFooterController) LockableController(org.olat.core.commons.fullWebApp.LockableController) Controller(org.olat.core.gui.control.Controller) OlatFooterController(org.olat.gui.control.OlatFooterController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 17 with ControllerCreator

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

the class DmzBFWCParts method createHeaderController.

@Override
public Controller createHeaderController(UserRequest ureq, WindowControl wControl) {
    Controller headerCtr = null;
    // ----------- header, optional (e.g. for logo, advertising ) ------------------
    if (CoreSpringFactory.containsBean("fullWebApp.DMZHeaderControllerCreator")) {
        ControllerCreator headerControllerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.DMZHeaderControllerCreator");
        headerCtr = headerControllerCreator.createController(ureq, wControl);
    }
    return headerCtr;
}
Also used : LockableController(org.olat.core.commons.fullWebApp.LockableController) Controller(org.olat.core.gui.control.Controller) OlatFooterController(org.olat.gui.control.OlatFooterController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 18 with ControllerCreator

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

the class DisplayPortraitController method showUserInfo.

/**
 * Method to open the users visiting card in a new tab. Public to call it also from the patrent controller
 * @param ureq
 */
public void showUserInfo(UserRequest ureq) {
    ControllerCreator ctrlCreator = new ControllerCreator() {

        @Override
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            return new UserInfoMainController(lureq, lwControl, portraitIdent, true, false);
        }
    };
    // 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 : PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) WindowControl(org.olat.core.gui.control.WindowControl) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 19 with ControllerCreator

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

the class AssessmentResultController method doPrint.

private void doPrint(UserRequest ureq) {
    ControllerCreator creator = (uureq, wwControl) -> {
        AssessmentResultController printViewCtrl = new AssessmentResultController(uureq, wwControl, assessedIdentity, anonym, candidateSession, fUnzippedDirRoot, mapperUri, submissionMapperUri, options, false, true, false);
        printViewCtrl.flc.contextPut("printCommand", Boolean.TRUE);
        listenTo(printViewCtrl);
        return printViewCtrl;
    };
    openInNewBrowserWindow(ureq, creator);
}
Also used : Date(java.util.Date) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) Autowired(org.springframework.beans.factory.annotation.Autowired) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) ItemVariable(uk.ac.ed.ph.jqtiplus.node.result.ItemVariable) MediaResource(org.olat.core.gui.media.MediaResource) BigDecimal(java.math.BigDecimal) ControlObjectSessionState(uk.ac.ed.ph.jqtiplus.state.ControlObjectSessionState) Map(java.util.Map) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) URI(java.net.URI) ImsQTI21Resource(org.olat.fileresource.types.ImsQTI21Resource) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) AssessmentResult(uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult) TestNodeType(uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType) SessionStatus(uk.ac.ed.ph.jqtiplus.node.result.SessionStatus) WindowControl(org.olat.core.gui.control.WindowControl) UserShortDescription(org.olat.admin.user.UserShortDescription) Component(org.olat.core.gui.components.Component) Value(uk.ac.ed.ph.jqtiplus.value.Value) Mapper(org.olat.core.dispatcher.mapper.Mapper) FeedbackResultFormItem(org.olat.ims.qti21.ui.components.FeedbackResultFormItem) QTI21Service(org.olat.ims.qti21.QTI21Service) OutcomeVariable(uk.ac.ed.ph.jqtiplus.node.result.OutcomeVariable) List(java.util.List) QtiNodesExtractor(org.olat.ims.qti21.model.xml.QtiNodesExtractor) Identity(org.olat.core.id.Identity) NumberValue(uk.ac.ed.ph.jqtiplus.value.NumberValue) TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) ItemResult(uk.ac.ed.ph.jqtiplus.node.result.ItemResult) TestResult(uk.ac.ed.ph.jqtiplus.node.result.TestResult) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) ItemBodyResultFormItem(org.olat.ims.qti21.ui.components.ItemBodyResultFormItem) AssessmentSectionSessionState(uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) HashMap(java.util.HashMap) QTI21Constants(org.olat.ims.qti21.QTI21Constants) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) QTI21QuestionType(org.olat.ims.qti21.model.QTI21QuestionType) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ArrayList(java.util.ArrayList) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) HttpServletRequest(javax.servlet.http.HttpServletRequest) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions) BooleanValue(uk.ac.ed.ph.jqtiplus.value.BooleanValue) Controller(org.olat.core.gui.control.Controller) CodeHelper(org.olat.core.util.CodeHelper) File(java.io.File) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) UserManager(org.olat.user.UserManager) AssessmentHelper(org.olat.course.assessment.AssessmentHelper) TerminatedStaticCandidateSessionContext(org.olat.ims.qti21.ui.assessment.TerminatedStaticCandidateSessionContext) UserRequest(org.olat.core.gui.UserRequest) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 20 with ControllerCreator

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

the class UsermanagerUserSearchForm method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(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) {
    if (source == searchform) {
        if (event == Event.DONE_EVENT) {
            // form validation was ok
            identitiesList = findIdentitiesFromSearchForm();
            initUserListCtr(ureq, identitiesList, null);
            userListVC.put("userlist", tableCtr.getInitialComponent());
            userListVC.contextPut("emptyList", (identitiesList.size() == 0 ? Boolean.TRUE : Boolean.FALSE));
            panel.setContent(userListVC);
            // fxdiff BAKS-7 Resume function
            ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
            if (currentEntry != null) {
                currentEntry.setTransientState(searchform.getStateEntry());
            }
            addToHistory(ureq, tableCtr);
        } else if (event == Event.CANCELLED_EVENT) {
            fireEvent(ureq, Event.CANCELLED_EVENT);
        }
    } else if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            String actionid = te.getActionId();
            if (actionid.equals(ExtendedIdentitiesTableDataModel.COMMAND_SELECTUSER)) {
                int rowid = te.getRowId();
                Identity foundIdentity = tdm.getObject(rowid);
                // Tell parentController that a subject has been found
                fireEvent(ureq, new SingleIdentityChosenEvent(foundIdentity));
            } else if (actionid.equals(ExtendedIdentitiesTableDataModel.COMMAND_VCARD)) {
                // get identity and open new visiting card controller in new window
                int rowid = te.getRowId();
                final Identity identity = tdm.getObject(rowid);
                ControllerCreator userInfoMainControllerCreator = 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, userInfoMainControllerCreator);
                // open in new browser window
                PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
                pbw.open(ureq);
            }
        }
        if (event instanceof TableMultiSelectEvent) {
            // Multiselect events
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals(CMD_BULKEDIT)) {
                if (tmse.getSelection().isEmpty()) {
                    // empty selection
                    showWarning("msg.selectionempty");
                    return;
                }
                selectedIdentities = tdm.getIdentities(tmse.getSelection());
                // valid selection: load in wizard
                Step start = new UserBulkChangeStep00(ureq, selectedIdentities);
                // callback executed in case wizard is finished.
                StepRunnerCallback finish = new StepRunnerCallback() {

                    public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
                        // all information to do now is within the runContext saved
                        boolean hasChanges = false;
                        try {
                            if (runContext.containsKey("validChange") && ((Boolean) runContext.get("validChange")).booleanValue()) {
                                HashMap<String, String> attributeChangeMap = (HashMap<String, String>) runContext.get("attributeChangeMap");
                                HashMap<String, String> roleChangeMap = (HashMap<String, String>) runContext.get("roleChangeMap");
                                List<Long> ownGroups = (List<Long>) runContext.get("ownerGroups");
                                List<Long> partGroups = (List<Long>) runContext.get("partGroups");
                                // List<Long> mailGroups = (List<Long>) runContext.get("mailGroups");
                                if (attributeChangeMap.size() != 0 || roleChangeMap.size() != 0 || ownGroups.size() != 0 || partGroups.size() != 0) {
                                    Identity addingIdentity = ureq1.getIdentity();
                                    ubcMan.changeSelectedIdentities(selectedIdentities, attributeChangeMap, roleChangeMap, notUpdatedIdentities, isAdministrativeUser, ownGroups, partGroups, getTranslator(), addingIdentity);
                                    hasChanges = true;
                                }
                            }
                        } catch (Exception any) {
                        // return new ErrorStep
                        }
                        // signal correct completion and tell if changes were made or not.
                        return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
                    }
                };
                removeAsListenerAndDispose(userBulkChangeStepsController);
                userBulkChangeStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("bulkChange.title"), "o_sel_user_bulk_change_wizard");
                listenTo(userBulkChangeStepsController);
                getWindowControl().pushAsModalDialog(userBulkChangeStepsController.getInitialComponent());
            } else if (tmse.getAction().equals(CMD_MAIL)) {
                if (tmse.getSelection().isEmpty()) {
                    // empty selection
                    showWarning("msg.selectionempty");
                    return;
                }
                // create e-mail message
                ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
                selectedIdentities = tdm.getIdentities(tmse.getSelection());
                ContactList contacts = new ContactList(translate("mailto.userlist"));
                contacts.addAllIdentites(selectedIdentities);
                cmsg.addEmailTo(contacts);
                // create contact form controller with ContactMessage
                removeAsListenerAndDispose(contactCtr);
                contactCtr = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
                listenTo(contactCtr);
                mailVC.put("mailform", contactCtr.getInitialComponent());
                panel.setContent(mailVC);
            }
        }
    } else if (source == contactCtr) {
        // in any case go back to list (events: done, failed or cancel)
        panel.setContent(userListVC);
    } else if (source == userBulkChangeStepsController) {
        if (event == Event.CANCELLED_EVENT) {
            getWindowControl().pop();
        } else if (event == Event.CHANGED_EVENT) {
            getWindowControl().pop();
            Integer selIdentCount = selectedIdentities.size();
            if (notUpdatedIdentities.size() > 0) {
                Integer notUpdatedIdentCount = notUpdatedIdentities.size();
                Integer sucChanges = selIdentCount - notUpdatedIdentCount;
                String changeErrors = "";
                for (String err : notUpdatedIdentities) {
                    changeErrors += err + "<br />";
                }
                getWindowControl().setError(translate("bulkChange.partialsuccess", new String[] { sucChanges.toString(), selIdentCount.toString(), changeErrors }));
            } else {
                showInfo("bulkChange.success");
            }
            // update table model - has changed
            reloadDataModel(ureq);
        } else if (event == Event.DONE_EVENT) {
            showError("bulkChange.failed");
        }
    }
}
Also used : HashMap(java.util.HashMap) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) 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) ContextEntry(org.olat.core.id.context.ContextEntry) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) ContactFormController(org.olat.modules.co.ContactFormController) ContactList(org.olat.core.util.mail.ContactList) List(java.util.List) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) UserRequest(org.olat.core.gui.UserRequest) ContactList(org.olat.core.util.mail.ContactList) UserBulkChangeStep00(org.olat.admin.user.bulkChange.UserBulkChangeStep00) ContactMessage(org.olat.core.util.mail.ContactMessage) TableEvent(org.olat.core.gui.components.table.TableEvent) UserInfoMainController(org.olat.user.UserInfoMainController) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback)

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