Search in sources :

Example 71 with VelocityContainer

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

the class ObjectivesHelper method createLearningObjectivesComponent.

// fxdiff FXOLAT-116: SCORM improvements
public static Component createLearningObjectivesComponent(String learningObjectives, Locale locale) {
    Translator trans = Util.createPackageTranslator(ObjectivesHelper.class, locale);
    VelocityContainer vc = new VelocityContainer("learningObjs", VELOCITY_ROOT + "/objectives.html", trans, null);
    vc.contextPut("learningObjectives", learningObjectives);
    return vc;
}
Also used : Translator(org.olat.core.gui.translator.Translator) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 72 with VelocityContainer

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

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 73 with VelocityContainer

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

the class FlexiTableClassicRenderer method renderRow.

@Override
protected void renderRow(Renderer renderer, StringOutput target, FlexiTableComponent ftC, String rowIdPrefix, int row, URLBuilder ubu, Translator translator, RenderResult renderResult) {
    FlexiTableElementImpl ftE = ftC.getFlexiTableElement();
    FlexiTableColumnModel columnsModel = ftE.getTableDataModel().getTableColumnModel();
    int numOfCols = columnsModel.getColumnCount();
    Form theForm = ftE.getRootForm();
    // use alternating css class
    int numOfColumns = 0;
    target.append("<tr id='").append(rowIdPrefix).append(row).append("'");
    if (ftE.getCssDelegate() != null) {
        String cssClass = ftE.getCssDelegate().getRowCssClass(FlexiTableRendererType.classic, row);
        if (StringHelper.containsNonWhitespace(cssClass)) {
            target.append(" class='").append(cssClass).append("'");
        }
    }
    target.append(">");
    if (ftE.isMultiSelect()) {
        target.append("<td>").append("<input type='checkbox' name='tb_ms' value='").append(rowIdPrefix).append(row).append("'").append(" onclick=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, false, false, false, new NameValuePair("chkbox", Integer.toString(row)))).append(";\"");
        if (ftE.isMultiSelectedIndex(row)) {
            target.append(" checked='checked'");
        }
        boolean selectable = ftE.getTableDataModel().isSelectable(row);
        if (!selectable) {
            target.append(" disabled='disabled'");
        }
        target.append("/></td>");
    }
    for (int j = 0; j < numOfCols; j++) {
        FlexiColumnModel fcm = columnsModel.getColumnModel(j);
        if (ftE.isColumnModelVisible(fcm)) {
            renderCell(renderer, target, ftC, fcm, row, ubu, translator, renderResult);
            numOfColumns++;
        }
    }
    target.append("</tr>");
    if (ftE.isDetailsExpended(row)) {
        target.append("<tr id='").append(rowIdPrefix).append(row).append("_details' class='o_table_row_details'>");
        VelocityContainer container = ftE.getDetailsRenderer();
        Object rowObject = ftE.getTableDataModel().getObject(row);
        container.contextPut("row", rowObject);
        FlexiTableComponentDelegate cmpDelegate = ftE.getComponentDelegate();
        if (cmpDelegate != null) {
            Iterable<Component> cmps = cmpDelegate.getComponents(row, rowObject);
            if (cmps != null) {
                for (Component cmp : cmps) {
                    container.put(cmp.getComponentName(), cmp);
                }
            }
        }
        if (ftE.isMultiSelect()) {
            target.append("<td></td>");
        }
        target.append("<td colspan='").append(numOfColumns).append("'>");
        container.getHTMLRendererSingleton().render(renderer, target, container, ubu, translator, renderResult, null);
        container.contextRemove("row");
        target.append("</td></tr>");
    }
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) Component(org.olat.core.gui.components.Component)

Example 74 with VelocityContainer

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

the class GTAParticipantController method setSolutions.

private void setSolutions(UserRequest ureq, Task assignedTask) {
    DueDate availableDate = getSolutionDueDate(assignedTask);
    boolean visible = availableDate == null || (availableDate.getDueDate() != null && availableDate.getDueDate().compareTo(new Date()) <= 0);
    if (visible) {
        File documentsDir = gtaManager.getSolutionsDirectory(courseEnv, gtaNode);
        VFSContainer documentsContainer = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
        if ((availableDate != null && !availableDate.isRelative() && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_ALL, false)) || TaskHelper.hasDocuments(documentsDir)) {
            solutionsCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "run.solutions.description", "bulk.solutions", "solutions");
            listenTo(solutionsCtrl);
            mainVC.put("solutions", solutionsCtrl.getInitialComponent());
        }
    } else {
        VelocityContainer waitVC = createVelocityContainer("wait_for_solutions");
        mainVC.put("solutions", waitVC);
    }
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) DueDate(org.olat.course.nodes.gta.model.DueDate) File(java.io.File) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 75 with VelocityContainer

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

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