Search in sources :

Example 6 with VelocityContainer

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

the class GuiStackNiceImpl method pushCallout.

@Override
public void pushCallout(Component content, String targetId, CalloutSettings settings) {
    // wrap the component into a modal foreground dialog with alpha-blended-background
    final Panel guiMsgPlace = new Panel("guimsgplace_for_callout");
    VelocityContainer inset = new VelocityContainer("inset", VELOCITY_ROOT + "/callout.html", null, null) {

        public void validate(UserRequest ureq, ValidationResult vr) {
            super.validate(ureq, vr);
            // just before rendering, we need to tell the windowbackoffice that we are a favorite for accepting gui-messages.
            // the windowbackoffice doesn't know about guimessages, it is only a container that keeps them for one render cycle
            List<ZIndexWrapper> zindexed = wbo.getGuiMessages();
            zindexed.add(new ZIndexWrapper(guiMsgPlace, 10));
        }
    };
    inset.put("cont", content);
    inset.put("guimsgplace", guiMsgPlace);
    inset.contextPut("guimsgtarget", targetId);
    int zindex = 900 + (modalLayers * 100) + 5;
    inset.contextPut("zindexoverlay", zindex + 1);
    inset.contextPut("zindexshim", zindex);
    inset.contextPut("zindexarea", zindex + 5);
    inset.contextPut("zindexextwindows", zindex + 50);
    if (settings != null) {
        inset.contextPut("arrow", settings.isArrow());
        inset.contextPut("orientation", settings.getOrientation().name());
    } else {
        inset.contextPut("arrow", Boolean.TRUE);
        inset.contextPut("orientation", CalloutOrientation.bottom.name());
    }
    modalPanel.pushContent(inset);
    modalLayers++;
}
Also used : SimpleStackedPanel(org.olat.core.gui.components.panel.SimpleStackedPanel) LayeredPanel(org.olat.core.gui.components.panel.LayeredPanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) ZIndexWrapper(org.olat.core.gui.control.util.ZIndexWrapper) ValidationResult(org.olat.core.gui.render.ValidationResult) UserRequest(org.olat.core.gui.UserRequest) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 7 with VelocityContainer

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

the class GuiStackNiceImpl method pushModalDialog.

/**
 * @param title the title of the modal dialog, can be null
 * @param content the component to push as modal dialog
 */
@Override
public void pushModalDialog(Component content) {
    wbo.sendCommandTo(new ScrollTopCommand());
    // wrap the component into a modal foreground dialog with alpha-blended-background
    final Panel guiMsgPlace = new Panel("guimsgplace_for_modaldialog");
    VelocityContainer inset = new VelocityContainer("inset", VELOCITY_ROOT + "/modalDialog.html", null, null) {

        @Override
        public void validate(UserRequest ureq, ValidationResult vr) {
            super.validate(ureq, vr);
            // just before rendering, we need to tell the windowbackoffice that we are a favorite for accepting gui-messages.
            // the windowbackoffice doesn't know about guimessages, it is only a container that keeps them for one render cycle
            List<ZIndexWrapper> zindexed = wbo.getGuiMessages();
            zindexed.add(new ZIndexWrapper(guiMsgPlace, 10));
        }
    };
    inset.put("cont", content);
    inset.put("guimsgplace", guiMsgPlace);
    int zindex = 900 + (modalLayers * 100) + 5;
    inset.contextPut("zindexoverlay", zindex + 1);
    inset.contextPut("zindexshim", zindex);
    inset.contextPut("zindexarea", zindex + 5);
    inset.contextPut("zindexextwindows", zindex + 50);
    modalPanel.pushContent(inset);
    // the links in the panel cannot be clicked because of the alpha-blended background over it, but if user chooses own css style ->
    // FIXME:fj:b panel.setEnabled(false) causes effects if there is an image component in the panel -> the component is not dispatched
    // and thus renders inline and wastes the timestamp.
    // Needed:solution (a) a flag (a bit of the mode indicator of the urlbuilder can be used) to indicate that a request always needs to be delivered even
    // if the component or a parent is not enabled.
    // alternative solution(b): wrap the imagecomponent into a controller and use a mapper
    // alternative solution(c): introduce a flag to the component to say "dispatch always", even if a parent component is not enabled
    // 
    // - solution a would be easy, but would allow for forced dispatching by manipulating the url's flag.
    // for e.g. a Link button ("make me admin") that is disabled this is a security breach.
    // - solution b needs some wrapping, the advantage (for images) would be that they are cached by the browser if requested more than once
    // within a controller
    // - solution c is a safe and easy way to allow dispatching (only in case a mediaresource is returned as a result of the dispatching) even
    // if parent elements are not enabled
    // proposal: fix for 5.1.0 with solution c; for 5.0.1 the uncommenting of the line below is okay.
    // if (modalLayers == 0) panel.setEnabled(false);
    modalLayers++;
}
Also used : SimpleStackedPanel(org.olat.core.gui.components.panel.SimpleStackedPanel) LayeredPanel(org.olat.core.gui.components.panel.LayeredPanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) ZIndexWrapper(org.olat.core.gui.control.util.ZIndexWrapper) ValidationResult(org.olat.core.gui.render.ValidationResult) ScrollTopCommand(org.olat.core.gui.control.winmgr.ScrollTopCommand) UserRequest(org.olat.core.gui.UserRequest) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 8 with VelocityContainer

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

the class CourseLogsArchiveController method showExportFinished.

protected void showExportFinished() {
    ICourse course = CourseFactory.loadCourse(ores);
    VelocityContainer vcFeedback = createVelocityContainer("courselogs_feedback");
    showFileButton = LinkFactory.createButton("showfile", vcFeedback, this);
    vcFeedback.contextPut("body", translate("course.logs.feedback", course.getCourseTitle()));
    myPanel.setContent(vcFeedback);
    // note: polling can't be switched off unfortunatelly
    // this is due to the fact that the jsandcsscomponent can only modify
    // certain parts of the page and it would require a full page refresh
    // to get rid of the poller - and that's not possible currently
    showInfo("course.logs.finished", course.getCourseTitle());
}
Also used : ICourse(org.olat.course.ICourse) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 9 with VelocityContainer

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

the class ChecklistAuthorOptionsForm method displayChecklist.

private void displayChecklist(UserRequest ureq) {
    // add title
    VelocityContainer displayChecklistVC = createVelocityContainer("display");
    String title = checklist.getTitle() == null ? "" : checklist.getTitle();
    displayChecklistVC.contextPut("checklistTitle", title);
    // add edit and manage button
    if ((canEdit | canManage) && course != null) {
        displayChecklistVC.contextPut("showAuthorBtns", Boolean.TRUE);
        removeAsListenerAndDispose(authorOptions);
        authorOptions = new ChecklistAuthorOptionsForm(ureq, getWindowControl(), canEdit && !readOnly, canManage);
        listenTo(authorOptions);
        displayChecklistVC.put("authorOptions", authorOptions.getInitialComponent());
    } else {
        displayChecklistVC.contextPut("showAuthorBtns", Boolean.FALSE);
    }
    panel = new Panel("runTable");
    initTable(ureq);
    displayChecklistVC.put("runTable", panel);
    putInitialPanel(displayChecklistVC);
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 10 with VelocityContainer

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

the class GroupChoiceForm method displayChecklist.

private void displayChecklist(UserRequest ureq, boolean isAdmin) {
    // add title
    VelocityContainer displayChecklistVC = createVelocityContainer("manage");
    String listTitle = checklist.getTitle() == null ? "" : checklist.getTitle();
    displayChecklistVC.contextPut("checklistTitle", listTitle);
    // group choice
    removeAsListenerAndDispose(groupForm);
    groupForm = new GroupChoiceForm(ureq, getWindowControl(), lstGroups, isAdmin);
    listenTo(groupForm);
    displayChecklistVC.put("groupForm", groupForm.getInitialComponent());
    // the table
    panel = new Panel("manageTable");
    initManageTable(ureq);
    displayChecklistVC.put("manageTable", panel);
    // save and close
    closeManageButton = LinkFactory.createButton("cl.close", displayChecklistVC, this);
    putInitialPanel(displayChecklistVC);
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) 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