Search in sources :

Example 6 with NameValuePair

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

the class AbstractFlexiTableRenderer method appendPagenNumberLink.

private void appendPagenNumberLink(StringOutput sb, FlexiTableComponent ftC, int page, int i) {
    FlexiTableElementImpl ftE = ftC.getFlexiTableElement();
    Form theForm = ftE.getRootForm();
    sb.append("<li").append(" class='active'", (page == i)).append("><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, true, new NameValuePair("page", Integer.toString(i)))).append(";\">").append(i + 1).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 7 with NameValuePair

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

the class AbstractFlexiTableRenderer method renderHeaderButtons.

protected void renderHeaderButtons(Renderer renderer, StringOutput sb, FlexiTableElementImpl ftE, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    Component searchCmp = ftE.getExtendedSearchComponent();
    if (searchCmp == null && !ftE.isExtendedSearchExpanded() && !ftE.isNumOfRowsEnabled() && !ftE.isFilterEnabled() && !ftE.isSortEnabled() && !ftE.isExportEnabled() && !ftE.isCustomizeColumns() && ftE.getAvailableRendererTypes().length <= 1) {
        return;
    }
    if (searchCmp != null && ftE.isExtendedSearchExpanded()) {
        renderer.render(searchCmp, sb, args);
    }
    sb.append("<div class='row clearfix o_table_toolbar'>").append("<div class='col-sm-6 col-xs-12 o_table_toolbar_left'>");
    if (searchCmp == null || !ftE.isExtendedSearchExpanded()) {
        renderHeaderSearch(renderer, sb, ftE, ubu, translator, renderResult, args);
    }
    sb.append("</div>");
    sb.append("<div class='col-sm-2 col-xs-4 o_table_row_count'>");
    if (ftE.isNumOfRowsEnabled()) {
        int rowCount = ftE.getTableDataModel().getRowCount();
        if (rowCount == 1) {
            sb.append(rowCount).append(" ").append(ftE.getTranslator().translate("table.entry"));
        } else if (rowCount > 1) {
            sb.append(rowCount).append(" ").append(ftE.getTranslator().translate("table.entries"));
        }
    }
    sb.append("</div><div class='col-sm-4 col-xs-8'><div class='pull-right'><div class='o_table_tools o_noprint'>");
    boolean empty = ftE.getTableDataModel().getRowCount() == 0;
    String filterIndication = null;
    // filter
    if (ftE.isFilterEnabled()) {
        List<FlexiTableFilter> filters = ftE.getFilters();
        if (filters != null && filters.size() > 0) {
            filterIndication = renderFilterDropdown(sb, ftE, filters);
        }
    }
    // sort
    if (ftE.isSortEnabled()) {
        List<FlexiTableSort> sorts = ftE.getSorts();
        if (sorts != null && sorts.size() > 0) {
            renderSortDropdown(sb, ftE, sorts);
        }
    }
    if (ftE.getExportButton() != null && ftE.isExportEnabled()) {
        sb.append("<div class='btn-group'>");
        ftE.getExportButton().setEnabled(!empty);
        renderFormItem(renderer, sb, ftE.getExportButton(), ubu, translator, renderResult, args);
        sb.append("</div> ");
    }
    if (ftE.getCustomButton() != null && ftE.isCustomizeColumns() && (ftE.getRendererType() == null || ftE.getRendererType() == FlexiTableRendererType.classic)) {
        sb.append("<div class='btn-group'>");
        renderFormItem(renderer, sb, ftE.getCustomButton(), ubu, translator, renderResult, args);
        sb.append("</div> ");
    }
    // switch type of tables
    FlexiTableRendererType[] types = ftE.getAvailableRendererTypes();
    if (types.length > 1) {
        sb.append("<div class='btn-group'>");
        for (FlexiTableRendererType type : types) {
            renderHeaderSwitchType(type, renderer, sb, ftE, ubu, translator, renderResult, args);
        }
        sb.append("</div> ");
    }
    sb.append("</div>");
    if (StringHelper.containsNonWhitespace(filterIndication)) {
        Form theForm = ftE.getRootForm();
        String dispatchId = ftE.getFormDispatchId();
        sb.append("<div class='o_table_tools_indications'>").append(filterIndication).append(" <a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("rm-filter", "true"))).append("\" title=\"").append(translator.translate("remove.filters")).append("\">").append("<i class='o_icon o_icon_remove o_icon-fw'> </i></a></div>");
    }
    sb.append("</div>");
    sb.append("</div></div>");
}
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) Component(org.olat.core.gui.components.Component) FlexiTableSort(org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)

Example 8 with NameValuePair

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

the class AbstractFlexiTableRenderer method renderSortDropdown.

protected void renderSortDropdown(StringOutput sb, FlexiTableElementImpl ftE, List<FlexiTableSort> sorts) {
    Form theForm = ftE.getRootForm();
    String dispatchId = ftE.getFormDispatchId();
    sb.append("<div class='btn-group'>").append("<button id='table-button-sorters-").append(dispatchId).append("' type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown'>").append("<i class='o_icon o_icon_sort_menu o_icon-lg'> </i> <b class='caret'></b></button>").append("<div id='table-sorters-").append(dispatchId).append("' class='hide'><ul class='o_dropdown list-unstyled' role='menu'>");
    for (FlexiTableSort sort : sorts) {
        if (FlexiTableSort.SPACER.equals(sort)) {
            sb.append("<li class='divider'></li>");
        } else {
            sb.append("<li><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("sort", sort.getSortKey().getKey()), new NameValuePair("asc", sort.getSortKey().isAsc() ? "desc" : "asc"))).append("\">");
            if (sort.isSelected()) {
                if (sort.getSortKey().isAsc()) {
                    sb.append("<i class='o_icon o_icon_sort_desc o_icon-fw'> </i> ");
                } else {
                    sb.append("<i class='o_icon o_icon_sort_asc o_icon-fw'> </i> ");
                }
            }
            sb.append(sort.getLabel()).append("</a></li>");
        }
    }
    sb.append("</ul></div></div> ").append("<script type='text/javascript'>\n").append("/* <![CDATA[ */\n").append("jQuery(function() { o_popover('table-button-sorters-").append(dispatchId).append("','table-sorters-").append(dispatchId).append("'); });\n").append("/* ]]> */\n").append("</script>");
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) FlexiTableSort(org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)

Example 9 with NameValuePair

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

the class MultipleSelectionRenderer method getAjaxOnlyJs.

private StringBuilder getAjaxOnlyJs(MultipleSelectionElement stF, MultipleSelectionComponent stC, String key) {
    StringBuilder sb = new StringBuilder();
    if (stF.isAjaxOnly()) {
        sb.append("if ($check) {");
        sb.append(FormJSHelper.getXHRFnCallFor(stF.getRootForm(), stC.getFormDispatchId(), 1, false, false, false, new NameValuePair("achkbox", key), new NameValuePair("checked", "true"))).append(";");
        sb.append("} else {");
        sb.append(FormJSHelper.getXHRFnCallFor(stF.getRootForm(), stC.getFormDispatchId(), 1, false, false, false, new NameValuePair("achkbox", key), new NameValuePair("checked", "false"))).append(";");
        sb.append("}");
    }
    return sb;
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair)

Example 10 with NameValuePair

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

the class RichTextElementRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    RichTextElementComponent teC = (RichTextElementComponent) source;
    RichTextElementImpl te = teC.getRichTextElementImpl();
    // DOM ID used to identify the rich text element in the browser DOM
    String domID = teC.getFormDispatchId();
    if (!source.isEnabled()) {
        renderDisabled(sb, domID, teC);
    } else {
        sb.append("<div id='").append(domID).append("_diw' class='o_richtext_mce");
        if (!te.getEditorConfiguration().isPathInStatusBar()) {
            sb.append(" o_richtext_mce_without_path");
        }
        sb.append("'>");
        // switches
        TextMode currentTextMode;
        if (te.getEditorConfiguration().getTextModes().size() > 1) {
            TextModeState textModeState = te.getAvailableTextModes();
            currentTextMode = textModeState.getCurrentMode();
            List<TextMode> modes = textModeState.getAvailableTextModes();
            if (modes.size() > 0) {
                Form form = te.getRootForm();
                sb.append("<div class='o_richtext_mce_modes'><div class='btn-group'>");
                for (TextMode mode : modes) {
                    sb.append("<a href='javascript:;' class='btn btn-default btn-xs").append(" active", currentTextMode == mode).append("'").append(" onclick=\"").append(FormJSHelper.getXHRFnCallFor(form, teC.getFormDispatchId(), 1, false, false, true, new NameValuePair("cmd", mode.name()))).append("\">").append(source.getTranslator().translate(mode.name())).append("</a>");
                }
                sb.append("</div></div>");
            }
        } else {
            currentTextMode = TextMode.formatted;
        }
        switch(currentTextMode) {
            case formatted:
                renderTinyMCE_4(sb, domID, teC, ubu, source.getTranslator());
                break;
            case multiLine:
                renderMultiLine(sb, domID, teC);
                break;
            case oneLine:
                renderOneLine(sb, domID, teC);
                break;
        }
        sb.append("</div>");
    }
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) TextModeState(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl.TextModeState)

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