Search in sources :

Example 36 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class QTIEditorMainController method init.

private void init(UserRequest ureq) {
    main = createVelocityContainer("index");
    JSAndCSSComponent jsAndCss;
    // Add html header js
    jsAndCss = new JSAndCSSComponent("qitjsandcss", new String[] { "js/openolat/qti.js" }, null);
    main.put("qitjsandcss", jsAndCss);
    mainPanel = new Panel("p_qti_editor");
    mainPanel.setContent(main);
    if (notEditable) {
        // test not editable
        VelocityContainer notEditableVc = createVelocityContainer("notEditable");
        notEditableButton = LinkFactory.createButton("ok", notEditableVc, this);
        Panel panel = new Panel("notEditable");
        panel.setContent(notEditableVc);
        columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, panel, null);
        putInitialPanel(columnLayoutCtr.getInitialComponent());
        return;
    }
    stackedPanel = new TooledStackedPanel("qtiEditorStackedPanel", getTranslator(), this);
    stackedPanel.setCssClass("o_edit_mode");
    // initialize the history
    if (qtiPackage.isResumed() && qtiPackage.hasSerializedChangelog()) {
        // there were already changes made -> reload!
        history = qtiPackage.loadChangelog();
    } else {
        // start with a fresh history. Editor is resumed but no changes were made
        // so far.
        history = new HashMap<String, Memento>();
    }
    // The menu tree model represents the structure of the qti document.
    // All insert/move operations on the model are propagated to the structure
    // by the node
    menuTreeModel = new QTIEditorTreeModel(qtiPackage);
    menuTree = new MenuTree("QTIDocumentTree");
    menuTree.setTreeModel(menuTreeModel);
    menuTree.setSelectedNodeId(menuTree.getTreeModel().getRootNode().getIdent());
    // listen to the tree
    menuTree.addListener(this);
    // remember the qtidoc title when we started this editor, to correctly name
    // the history report
    startedWithTitle = menuTree.getSelectedNode().getAltText();
    // 
    main.put("tabbedPane", menuTreeModel.getQtiRootNode().createEditTabbedPane(ureq, getWindowControl(), getTranslator(), this));
    main.contextPut("qtititle", menuTreeModel.getQtiRootNode().getAltText());
    main.contextPut("isRestrictedEdit", restrictedEdit ? Boolean.TRUE : Boolean.FALSE);
    // 
    columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), menuTree, mainPanel, "qtieditor" + qtiPackage.getRepresentingResourceable());
    listenTo(columnLayoutCtr);
    stackedPanel.pushController("Editor", columnLayoutCtr);
    // qtiPackage must be loaded previousely
    populateToolC();
    // Add css background
    if (restrictedEdit) {
        addSectionLink.setEnabled(false);
        addSCLink.setEnabled(false);
        addMCLink.setEnabled(false);
        addPoolLink.setEnabled(false);
        addFIBLink.setEnabled(false);
        if (!qtiPackage.getQTIDocument().isSurvey()) {
            addKPrimLink.setEnabled(false);
        }
        addEssayLink.setEnabled(false);
        columnLayoutCtr.addCssClassToMain("o_editor_qti_correct");
    } else {
        columnLayoutCtr.addCssClassToMain("o_editor_qti");
    }
    deleteLink.setEnabled(false);
    moveLink.setEnabled(false);
    copyLink.setEnabled(false);
    putInitialPanel(stackedPanel);
    if (restrictedEdit) {
        // we would like to us a modal dialog here, but this does not work! we
        // can't push to stack because the outher workflows pushes us after the
        // controller to the stack. Thus, if we used a modal dialog here the
        // dialog would never show up.
        columnLayoutCtr.setCol3(new Panel("empty"));
        columnLayoutCtr.hideCol1(true);
        columnLayoutCtr.hideCol2(true);
        String text = translate("qti.restricted.edit.warning") + "<br/><br/>" + createReferenceesMsg(ureq);
        proceedRestricedEditDialog = DialogBoxUIFactory.createYesNoDialog(ureq, getWindowControl(), null, text);
        listenTo(proceedRestricedEditDialog);
        proceedRestricedEditDialog.activate();
    }
}
Also used : QTIEditorTreeModel(org.olat.ims.qti.editor.tree.QTIEditorTreeModel) MenuTree(org.olat.core.gui.components.tree.MenuTree) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Memento(org.olat.core.util.memento.Memento) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 37 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class EPMapRunController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == createMapLink) {
        // if only normal maps can be created, show popup immediately, else present selection in callout
        if (option.equals(EPMapRunViewOption.MY_DEFAULTS_MAPS)) {
            VelocityContainer mapCreateVC = createVelocityContainer("createMapCallout");
            createMapCalloutLink = LinkFactory.createLink("create.map.default", mapCreateVC, this);
            createMapCalloutLink.setElementCssClass("o_sel_create_default_map");
            createMapFromTemplateLink = LinkFactory.createLink("create.map.fromTemplate", mapCreateVC, this);
            createMapFromTemplateLink.setElementCssClass("o_sel_create_template_map");
            String title = translate("create.map");
            removeAsListenerAndDispose(mapCreateCalloutCtrl);
            mapCreateCalloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(), mapCreateVC, createMapLink, title, true, null);
            listenTo(mapCreateCalloutCtrl);
            mapCreateCalloutCtrl.activate();
        } else {
            popUpCreateMapBox(ureq);
        }
    } else if (source == createMapFromTemplateLink) {
        closeCreateMapCallout();
        popUpCreateMapFromTemplateBox(ureq);
    } else if (source == createMapCalloutLink) {
        closeCreateMapCallout();
        popUpCreateMapBox(ureq);
    }
}
Also used : CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 38 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class ConditionEditController method getWrappedDefaultAccessConditionVC.

/**
 * Get the condition editor wrapped as a generic accessability condition editor
 * @param title The title of this access condition, displayed as header in the surrounding fieldset
 * @return The wrapped condition editor component
 */
public VelocityContainer getWrappedDefaultAccessConditionVC(String title) {
    Translator accessTranslator = Util.createPackageTranslator(EditorMainController.class, getLocale());
    VelocityContainer defaultAccessConditionView = new VelocityContainer("defaultAccessConditionView", VELOCITY_ROOT + "/defaultaccessedit.html", accessTranslator, null);
    defaultAccessConditionView.put("defaultAccessConditionView", myContent);
    if (passwordConditionEditController != null) {
        defaultAccessConditionView.put("pwcond", passwordConditionEditController.getInitialComponent());
        defaultAccessConditionView.contextPut("renderPW", true);
    }
    defaultAccessConditionView.contextPut("title", title);
    return defaultAccessConditionView;
}
Also used : Translator(org.olat.core.gui.translator.Translator) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 39 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method getNoAccessMessage.

private Component getNoAccessMessage(UserRequest ureq, BusinessGroup group) {
    VelocityContainer vc = createVelocityContainer("access_denied");
    vc.contextPut("name", group.getName());
    columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, vc, "grouprun");
    // cleanup on dispose
    listenTo(columnLayoutCtr);
    return columnLayoutCtr.getInitialComponent();
}
Also used : LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 40 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class GuiDemoFlexiFormMainController 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) {
    // there are only events of type link from the demos navigation
    if (source instanceof Link) {
        Link sl = (Link) source;
        // userobject tells which demo to activate
        String uob = (String) sl.getUserObject();
        if (uob != null) {
            ControllerCreator cc = demos.get(uob);
            // update source
            VelocityContainer sourceVC = createVelocityContainer(uob);
            ShrinkController sc = new ShrinkController(false, sourceVC, "toggle source");
            sourceP.setContent(sc.getInitialComponent());
            // cleanup former democontroller
            if (demoController != null)
                demoController.dispose();
            contentP.popContent();
            // create new demo controller
            demoController = cc.createController(ureq, getWindowControl());
            contentP.pushContent(demoController.getInitialComponent());
        }
    }
}
Also used : Link(org.olat.core.gui.components.link.Link) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) ShrinkController(org.olat.core.gui.control.generic.spacesaver.ShrinkController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Aggregations

VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)162 Component (org.olat.core.gui.components.Component)22 ArrayList (java.util.ArrayList)16 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)14 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)14 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)14 Link (org.olat.core.gui.components.link.Link)12 Panel (org.olat.core.gui.components.panel.Panel)12 UserRequest (org.olat.core.gui.UserRequest)10 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)10 List (java.util.List)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)8 WindowControl (org.olat.core.gui.control.WindowControl)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 Translator (org.olat.core.gui.translator.Translator)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 HashMap (java.util.HashMap)6 Collectors (java.util.stream.Collectors)6 Mapper (org.olat.core.dispatcher.mapper.Mapper)6 BarSeries (org.olat.core.gui.components.chart.BarSeries)6