Search in sources :

Example 51 with Form

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

the class AssessmentTimerComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    AssessmentTimerComponent cmp = (AssessmentTimerComponent) source;
    QtiWorksStatus qtiWorksStatus = cmp.getQtiWorksStatus();
    if (qtiWorksStatus.isAssessmentTestTimeLimit() && !qtiWorksStatus.isEnded()) {
        AssessmentTimerFormItem atf = cmp.getFormItem();
        AssessmentObjectFormItem qtiRun = atf.getQtiRun();
        Form form = atf.getRootForm();
        sb.append("<div id='o_c").append(cmp.getDispatchID()).append("'><div id='o_qti_assessment_test_timer' class='clearfix'><i class='o_icon o_icon_timelimit'> </i> ");
        String[] attrs = new String[] { "<span class='o_qti_timer'></span>", "<span class='o_qti_timer_duration'></span>", qtiWorksStatus.getAssessmentTestEndTime() };
        sb.append(translator.translate("timelimit.running", attrs)).append("<span class='o_qti_times_up' style='display:none;'>").append(translator.translate("timelimit.finished")).append("</span>").append("<span class='o_qti_times_message o_10_minutes' style='display:none;'><i class='o_icon o_icon_timelimit_start'> </i> ").append(translator.translate("timelimit.10.minutes")).append("</span>").append("<span class='o_qti_times_message o_5_minutes' style='display:none;'><i class='o_icon o_icon_timelimit_half'> </i> ").append(translator.translate("timelimit.5.minutes")).append("</span>").append("<span class='o_qti_times_message o_panic' style='display:none;'><i class='o_icon o_icon_timelimit_end'> </i> ").append(translator.translate("timelimit.1.minute")).append("</span>").append("</div>").append("<script>").append("/*<![CDATA[ */\n").append("jQuery(function() {\n").append("  jQuery('#o_qti_assessment_test_timer').qtiTimer({\n").append("    startTime:").append(qtiWorksStatus.getAssessmentTestDuration()).append(",\n").append("    availableTime:").append(qtiWorksStatus.getAssessmentTestMaximumTimeLimits()).append(",\n").append("    formName: '").append(form.getFormName()).append(// forn name
        "',\n").append("    dispIdField: '").append(form.getDispatchFieldId()).append(// form dispatch id
        "',\n").append("    dispId: '").append(qtiRun.getFormDispatchId()).append(// item id
        "',\n").append("    eventIdField: '").append(form.getEventFieldId()).append(// form eventFieldId
        "'\n").append("  })\n").append("});\n").append("/* ]]> */\n").append("</script>\n").append("</div>");
    }
}
Also used : QtiWorksStatus(org.olat.ims.qti21.ui.AssessmentTestDisplayController.QtiWorksStatus) Form(org.olat.core.gui.components.form.flexible.impl.Form)

Example 52 with Form

use of org.olat.core.gui.components.form.flexible.impl.Form 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 53 with Form

use of org.olat.core.gui.components.form.flexible.impl.Form 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 54 with Form

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

the class UserInterestsElement method evalFormRequest.

@Override
public void evalFormRequest(UserRequest ureq) {
    Form form = getRootForm();
    String dispatchuri = form.getRequestParameter("dispatchuri");
    if (editLink != null && editLink.getFormDispatchId().equals(dispatchuri)) {
        doEdit(ureq);
    }
}
Also used : Form(org.olat.core.gui.components.form.flexible.impl.Form)

Example 55 with Form

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

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)

Aggregations

Form (org.olat.core.gui.components.form.flexible.impl.Form)64 NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)42 AssessmentRenderFunctions.contentAsString (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString)10 Component (org.olat.core.gui.components.Component)4 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 TestSessionController (uk.ac.ed.ph.jqtiplus.running.TestSessionController)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 HashSet (java.util.HashSet)2 Matcher (java.util.regex.Matcher)2 SortKey (org.olat.core.commons.persistence.SortKey)2 TextBoxListElementComponent (org.olat.core.gui.components.form.flexible.impl.elements.TextBoxListElementComponent)2 TextBoxListElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.TextBoxListElementImpl)2 TextModeState (org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl.TextModeState)2 FlexiTableElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 AJAXFlags (org.olat.core.gui.control.winmgr.AJAXFlags)2