Search in sources :

Example 1 with JSAndCSSComponent

use of org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent in project OpenOLAT by OpenOLAT.

the class EdubaseViewerController method createRunComponent.

private Component createRunComponent(UserRequest ureq) {
    VelocityContainer container = createVelocityContainer("viewer");
    backLink = LinkFactory.createLinkBack(container, this);
    JSAndCSSComponent js = new JSAndCSSComponent("js", new String[] { "js/iframeResizer/iframeResizer.min.js" }, null);
    container.put("js", js);
    String mapperUri = createMapperUri(ureq);
    container.contextPut("mapperUri", mapperUri);
    return container;
}
Also used : JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 2 with JSAndCSSComponent

use of org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent in project OpenOLAT by OpenOLAT.

the class Card2BrainRunController method runCard2Brain.

private void runCard2Brain(UserRequest ureq) {
    VelocityContainer container = createVelocityContainer("run");
    String url = String.format(card2BrainModule.getBaseUrl(), config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
    String oauth_consumer_key;
    String oauth_secret;
    if (config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN)) {
        oauth_consumer_key = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
        oauth_secret = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
    } else {
        oauth_consumer_key = card2BrainModule.getEnterpriseKey();
        oauth_secret = card2BrainModule.getEnterpriseSecret();
    }
    LTIContext context = new Card2BrainContext();
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
    Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, false);
    String mapperUri = registerMapper(ureq, contentMapper);
    container.contextPut("mapperUri", mapperUri + "/");
    JSAndCSSComponent js = new JSAndCSSComponent("js", new String[] { "js/iframeResizer/iframeResizer.min.js" }, null);
    container.put("js", js);
    main.setContent(container);
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 3 with JSAndCSSComponent

use of org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent 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 4 with JSAndCSSComponent

use of org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent in project openolat by klemens.

the class Card2BrainRunController method runCard2Brain.

private void runCard2Brain(UserRequest ureq) {
    VelocityContainer container = createVelocityContainer("run");
    String url = String.format(card2BrainModule.getBaseUrl(), config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
    String oauth_consumer_key;
    String oauth_secret;
    if (config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN)) {
        oauth_consumer_key = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
        oauth_secret = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
    } else {
        oauth_consumer_key = card2BrainModule.getEnterpriseKey();
        oauth_secret = card2BrainModule.getEnterpriseSecret();
    }
    LTIContext context = new Card2BrainContext();
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
    Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, false);
    String mapperUri = registerMapper(ureq, contentMapper);
    container.contextPut("mapperUri", mapperUri + "/");
    JSAndCSSComponent js = new JSAndCSSComponent("js", new String[] { "js/iframeResizer/iframeResizer.min.js" }, null);
    container.put("js", js);
    main.setContent(container);
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 5 with JSAndCSSComponent

use of org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent in project openolat by klemens.

the class GlossaryMarkupItemController method init.

private void init(Component tmComponent) {
    // add dom id for wrapper div
    tmContainer.contextPut("domId", domId);
    String[] js = new String[] { "js/openolat/glossaryhelper.js", "js/openolat/glossaryhighlighter.js" };
    glossHelpJs = new JSAndCSSComponent("glossHelpJs", js, null);
    tmContainer.put("glossHelpJs", glossHelpJs);
    String glossFolderString = ((LocalFolderImpl) glossaryFolder).getBasefile().toString();
    tmContainer.contextPut("glossaryFolder", glossFolderString.replace("/", "."));
    tmContainer.contextPut("glossaryDefinitionMapperPath", glossaryDefinitionMapperPath);
    tmContainer.contextPut("glossaryTermMapperPath", glossaryTermMapperPath);
    tmContainer.contextPut("glossaryId", glossaryId);
    // finally add the wrapped content to the velocity container
    tmContainer.put("tmComponent", tmComponent);
    putInitialPanel(tmContainer);
}
Also used : JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)

Aggregations

JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)12 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 Mapper (org.olat.core.dispatcher.mapper.Mapper)2 Panel (org.olat.core.gui.components.panel.Panel)2 ProgressBar (org.olat.core.gui.components.progressbar.ProgressBar)2 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)2 MenuTree (org.olat.core.gui.components.tree.MenuTree)2 WindowControl (org.olat.core.gui.control.WindowControl)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 AssertException (org.olat.core.logging.AssertException)2 Memento (org.olat.core.util.memento.Memento)2 LTIContext (org.olat.ims.lti.LTIContext)2 PostDataMapper (org.olat.ims.lti.ui.PostDataMapper)2 AssessmentContext (org.olat.ims.qti.container.AssessmentContext)2 SectionContext (org.olat.ims.qti.container.SectionContext)2 QTIEditorTreeModel (org.olat.ims.qti.editor.tree.QTIEditorTreeModel)2 Navigator (org.olat.ims.qti.navigator.Navigator)2 AssessmentInstance (org.olat.ims.qti.process.AssessmentInstance)2 ImsRepositoryResolver (org.olat.ims.qti.process.ImsRepositoryResolver)2