Search in sources :

Example 51 with NameValuePair

use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.

the class AbstractFlexiTableRenderer method renderPageBackLink.

private void renderPageBackLink(StringOutput sb, FlexiTableComponent ftC, int page) {
    boolean disabled = (page <= 0);
    FlexiTableElementImpl ftE = ftC.getFlexiTableElement();
    Form theForm = ftE.getRootForm();
    sb.append("<li").append(" class='disabled'", disabled).append("><a href=\"");
    if (disabled) {
        sb.append("#");
    } else {
        sb.append("javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, true, new NameValuePair("page", Integer.toString(page - 1))));
    }
    sb.append("\">").append("&laquo;").append("</a></li>");
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form)

Example 52 with NameValuePair

use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.

the class AbstractFlexiTableRenderer method renderFilterDropdown.

protected String renderFilterDropdown(StringOutput sb, FlexiTableElementImpl ftE, List<FlexiTableFilter> filters) {
    Form theForm = ftE.getRootForm();
    String dispatchId = ftE.getFormDispatchId();
    StringBuilder selected = new StringBuilder(256);
    sb.append("<div class='btn-group'>").append("<button id='table-button-filters-").append(dispatchId).append("' type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown'>").append("<i class='o_icon o_icon_filter o_icon-lg'> </i> <b class='caret'></b></button>").append("<div id='table-filters-").append(dispatchId).append("' class='hide'><ul class='o_dropdown list-unstyled' role='menu'>");
    for (FlexiTableFilter filter : filters) {
        if (FlexiTableFilter.SPACER.equals(filter)) {
            sb.append("<li class='divider'></li>");
        } else {
            sb.append("<li><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("filter", filter.getFilter()))).append("\">").append("<i class='o_icon o_icon_check o_icon-fw'> </i> ", filter.isSelected());
            if (filter.getIconLeftCSS() != null) {
                sb.append("<i class='o_icon ").append(filter.getIconLeftCSS()).append("'> </i> ");
            }
            if (filter.getIconRenderer() != null) {
                filter.getIconRenderer().render(sb, filter, ftE.getComponent(), ftE.getTranslator());
            }
            sb.append(filter.getLabel()).append("</a></li>");
            if (filter.isSelected() && !filter.isShowAll()) {
                if (selected.length() > 0)
                    selected.append(", ");
                selected.append(filter.getLabel());
            }
        }
    }
    sb.append("</ul></div></div> ").append("<script type='text/javascript'>\n").append("/* <![CDATA[ */\n").append("jQuery(function() { o_popover('table-button-filters-").append(dispatchId).append("','table-filters-").append(dispatchId).append("'); });\n").append("/* ]]> */\n").append("</script>");
    return selected.toString();
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)

Example 53 with NameValuePair

use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.

the class AbstractFlexiTableRenderer method renderBreadcrumbs.

protected void renderBreadcrumbs(StringOutput sb, FlexiTableElementImpl ftE, FlexiTreeTableNode crumb, String index) {
    Form theForm = ftE.getRootForm();
    String dispatchId = ftE.getFormItemComponent().getDispatchID();
    sb.append("<li><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("tt-crumb", index))).append("\">").append(crumb.getCrump()).append("</a></li>");
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form)

Example 54 with NameValuePair

use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.

the class MenuTreeRenderer method renderInsertionPoint.

private void renderInsertionPoint(StringOutput sb, Position positionToRender, int level, TreeNode node, URLBuilder ubu, AJAXFlags flags, MenuTree tree) {
    if (tree.getInsertionPoint() != null && tree.getInsertionPoint().getPosition() == positionToRender && tree.getInsertionPoint().getNodeId().equals(node.getIdent())) {
        sb.append("<li><div class='o_tree_l").append(level).append("'>").append("<span class=\"o_tree_leaf o_tree_oc_l").append(level).append("\">&nbsp;</span>").append("<span class='o_tree_link o_tree_l").append(level).append(" o_insertion_point'><a href=\"");
        ubu.buildHrefAndOnclick(sb, null, flags.isIframePostEnabled(), false, false, new NameValuePair(COMMAND_ID, COMMAND_TREENODE_INSERT_REMOVE), new NameValuePair(NODE_IDENT, node.getIdent()));
        Translator pointTranslator = Util.createPackageTranslator(MenuTreeRenderer.class, tree.getTranslator().getLocale());
        String pointTranslation = pointTranslator.translate("insertion.point");
        sb.append("><span>").append(pointTranslation).append(" <i class='o_icon o_icon_remove'> </i></span>").append("</a></span></div></li>");
    }
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Translator(org.olat.core.gui.translator.Translator)

Example 55 with NameValuePair

use of org.olat.core.gui.components.form.flexible.impl.NameValuePair in project OpenOLAT by OpenOLAT.

the class MenuTreeRenderer method renderLink.

private void renderLink(Renderer renderer, TreeNode curRoot, int level, boolean selected, boolean renderChildren, INode curSel, StringOutput target, URLBuilder ubu, AJAXFlags flags, MenuTree tree) {
    int chdCnt = curRoot.getChildCount();
    boolean iframePostEnabled = flags.isIframePostEnabled();
    if (tree.getMenuTreeItem() != null) {
        tree.getMenuTreeItem().trackVisibleNode(curRoot);
    }
    target.append("<span class='o_tree_link o_tree_l").append(level);
    // add icon css class
    if (selected) {
        // add css class to identify active element
        target.append(" active");
    } else if (curSel == curRoot) {
        // add css class to identify parents of active element
        target.append(" active_parent");
    }
    boolean insertionSource = (tree.getTreeModel() instanceof InsertionTreeModel && ((InsertionTreeModel) tree.getTreeModel()).isSource(curRoot));
    if (insertionSource) {
        target.append(" o_insertion_source");
    }
    // reapply the same rules to the second link
    if (level != 0 && chdCnt > 0) {
        if (renderChildren) {
            target.append(" o_tree_level_label_close");
        } else {
            target.append(" o_tree_level_label_open");
        }
    } else if (level != 0 && chdCnt == 0) {
        target.append(" o_tree_level_label_leaf");
    }
    target.append("'>");
    if (tree.isMultiSelect() && tree.getMenuTreeItem() != null) {
        renderCheckbox(target, curRoot, tree);
    }
    // Build menu item URI
    target.append("<a ");
    boolean dirtyCheck = tree.getMenuTreeItem() == null || !tree.getMenuTreeItem().isNoDirtyCheckOnClick();
    ubu.buildHrefAndOnclick(target, null, iframePostEnabled, dirtyCheck, true, new NameValuePair(COMMAND_ID, COMMAND_TREENODE_CLICKED), new NameValuePair(NODE_IDENT, curRoot.getIdent()));
    // Add menu item title as alt hoover text
    String alt = curRoot.getAltText();
    if (alt != null) {
        target.append(" title=\"").append(StringEscapeUtils.escapeHtml(alt).toString()).append("\"");
    }
    target.append(">");
    String iconCssClass = curRoot.getIconCssClass();
    if (iconCssClass != null) {
        target.append("<i class='o_icon o_icon-fw ").append(iconCssClass).append("'></i> ");
    }
    renderDisplayTitle(renderer, target, curRoot, tree);
    // display title and close menu item
    appendDecorators(curRoot, target);
    target.append("</a></span>");
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair)

Aggregations

NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)80 Form (org.olat.core.gui.components.form.flexible.impl.Form)42 AssessmentRenderFunctions.contentAsString (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString)12 Component (org.olat.core.gui.components.Component)8 TestSessionController (uk.ac.ed.ph.jqtiplus.running.TestSessionController)6 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)6 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)4 FlexiTableSort (org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)4 StringOutput (org.olat.core.gui.render.StringOutput)4 Translator (org.olat.core.gui.translator.Translator)4 VFSItem (org.olat.core.util.vfs.VFSItem)4 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)4 EffectiveItemSessionControl (uk.ac.ed.ph.jqtiplus.state.EffectiveItemSessionControl)3 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)3 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Matcher (java.util.regex.Matcher)2 FolderLicenseHandler (org.olat.core.commons.modules.bc.FolderLicenseHandler)2