Search in sources :

Example 61 with NameValuePair

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

the class URLBuilder method openXHRNoResponseEvent.

public StringOutput openXHRNoResponseEvent(StringOutput sb, String urlEnding, NameValuePair... commands) {
    sb.append("o_XHRNFEvent('").append(uriPrefix);
    encodeParams(sb, AJAXFlags.MODE_TOBGIFRAME);
    sb.append("/");
    if (StringHelper.containsNonWhitespace(urlEnding)) {
        sb.append(urlEnding);
    }
    sb.append("'");
    commandParameters(sb, commands);
    // no response marker
    commandParameters(sb, new NameValuePair(Window.NO_RESPONSE_PARAMETER_MARKER, Window.NO_RESPONSE_VALUE_MARKER));
    return sb;
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair)

Example 62 with NameValuePair

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

the class MediaCollectorComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    MediaCollectorComponent cmp = (MediaCollectorComponent) source;
    sb.append("<a class='o_portfolio_collector' ");
    if (cmp.getItem() == null) {
        ubu.buildHrefAndOnclick(sb, null, true, false, true, new NameValuePair(VelocityContainer.COMMAND_ID, "pfcollect"));
    }
    sb.append("><i class='o_icon o_icon-lg o_icon_eportfolio_add'> </i></a>");
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair)

Example 63 with NameValuePair

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

the class FlexiTableClassicRenderer method renderHeader.

private void renderHeader(StringOutput sb, FlexiTableComponent ftC, FlexiColumnModel fcm, Translator translator) {
    String header = getHeader(fcm, translator);
    sb.append("<th");
    // append sort key to make column width set via css
    if (fcm.getSortKey() != null) {
        sb.append(" class='o_col_").append(fcm.getSortKey()).append("'");
    }
    sb.append(">");
    // sort is not defined
    if (!fcm.isSortable() || fcm.getSortKey() == null) {
        sb.append(header);
    } else {
        FlexiTableElementImpl ftE = ftC.getFlexiTableElement();
        Boolean asc = null;
        String sortKey = fcm.getSortKey();
        SortKey[] orderBy = ftE.getOrderBy();
        if (orderBy != null && orderBy.length > 0) {
            for (int i = orderBy.length; i-- > 0; ) {
                if (sortKey.equals(orderBy[i].getKey())) {
                    asc = new Boolean(orderBy[i].isAsc());
                }
            }
        }
        Form theForm = ftE.getRootForm();
        if (asc == null) {
            sb.append("<a class='o_orderby' href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, true, new NameValuePair("sort", sortKey), new NameValuePair("asc", "asc"))).append("\">");
        } else if (asc.booleanValue()) {
            sb.append("<a class='o_orderby o_orderby_asc' href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, true, new NameValuePair("sort", sortKey), new NameValuePair("asc", "desc"))).append("\">");
        } else {
            sb.append("<a class='o_orderby o_orderby_desc' href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, true, new NameValuePair("sort", sortKey), new NameValuePair("asc", "asc"))).append("\">");
        }
        sb.append(header).append("</a>");
    }
    sb.append("</th>");
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) SortKey(org.olat.core.commons.persistence.SortKey)

Example 64 with NameValuePair

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

the class SelectSectionsCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
    if (cellValue instanceof SharedItemRow) {
        SharedItemRow itemRow = (SharedItemRow) cellValue;
        List<AssessedBinderSection> sections = itemRow.getSections();
        if (sections != null && sections.size() > 0) {
            FlexiTableElementImpl ftE = source.getFlexiTableElement();
            String id = source.getFormDispatchId();
            Form rootForm = ftE.getRootForm();
            boolean expand = itemRow.isExpandSections();
            for (int i = 0; i < sections.size(); i++) {
                if (i > 0) {
                    if (expand)
                        target.append("<br />");
                    else
                        target.append(" | ");
                }
                NameValuePair pair1 = new NameValuePair("select-section", Integer.toString(row));
                NameValuePair pair2 = new NameValuePair("section", Integer.toString(i));
                String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair1, pair2);
                target.append("<a href=\"javascript:").append(jsCode).append(";\"").append(">");
                if (expand) {
                    target.append(StringHelper.escapeHtml(sections.get(i).getSectionTitle()));
                } else {
                    target.append(i + 1);
                }
                target.append("</a>");
            }
            NameValuePair pair = new NameValuePair("expand-section", Integer.toString(row));
            String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair);
            target.append(" <a href=\"javascript:").append(jsCode).append(";\"").append(">");
            if (itemRow.isExpandSections()) {
                target.append("<i class='o_icon o_icon-sm o_icon_expand'> </i>");
            } else {
                target.append("<i class='o_icon o_icon-sm o_icon_compress'> </i>");
            }
            target.append("</a>");
        }
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) AssessedBinderSection(org.olat.modules.portfolio.model.AssessedBinderSection) FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)

Example 65 with NameValuePair

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

the class MediaCollectorComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    MediaCollectorComponent cmp = (MediaCollectorComponent) source;
    sb.append("<a class='o_portfolio_collector' ");
    if (cmp.getItem() == null) {
        ubu.buildHrefAndOnclick(sb, null, true, false, true, new NameValuePair(VelocityContainer.COMMAND_ID, "pfcollect"));
    }
    sb.append("><i class='o_icon o_icon-lg o_icon_eportfolio_add'> </i></a>");
}
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