Search in sources :

Example 1 with ComponentCollection

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

the class FormWrapperContainerRenderer method renderHeaderIncludes.

/**
 * @see org.olat.core.gui.components.ComponentRenderer#renderHeaderIncludes(org.olat.core.gui.render.Renderer,
 *      org.olat.core.gui.render.StringOutput,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.render.URLBuilder,
 *      org.olat.core.gui.translator.Translator,
 *      org.olat.core.gui.render.RenderingState)
 */
@Override
public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) {
    FormWrapperContainer formC = (FormWrapperContainer) source;
    ComponentCollection toRender = formC.getFormLayout();
    if (toRender != null) {
        renderer.renderHeaderIncludes(sb, toRender, rstate);
    }
}
Also used : ComponentCollection(org.olat.core.gui.components.ComponentCollection)

Example 2 with ComponentCollection

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

the class FormWrapperContainerRenderer method renderBodyOnLoadJSFunctionCall.

/**
 * @see org.olat.core.gui.components.ComponentRenderer#renderBodyOnLoadJSFunctionCall(org.olat.core.gui.render.Renderer,
 *      org.olat.core.gui.render.StringOutput,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.render.RenderingState)
 */
@Override
public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) {
    FormWrapperContainer formC = (FormWrapperContainer) source;
    ComponentCollection toRender = formC.getFormLayout();
    if (toRender != null) {
        renderer.renderBodyOnLoadJSFunctionCall(sb, toRender, rstate);
    }
}
Also used : ComponentCollection(org.olat.core.gui.components.ComponentCollection)

Example 3 with ComponentCollection

use of org.olat.core.gui.components.ComponentCollection in project openolat by klemens.

the class FormWrapperContainerRenderer method renderBodyOnLoadJSFunctionCall.

/**
 * @see org.olat.core.gui.components.ComponentRenderer#renderBodyOnLoadJSFunctionCall(org.olat.core.gui.render.Renderer,
 *      org.olat.core.gui.render.StringOutput,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.render.RenderingState)
 */
@Override
public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) {
    FormWrapperContainer formC = (FormWrapperContainer) source;
    ComponentCollection toRender = formC.getFormLayout();
    if (toRender != null) {
        renderer.renderBodyOnLoadJSFunctionCall(sb, toRender, rstate);
    }
}
Also used : ComponentCollection(org.olat.core.gui.components.ComponentCollection)

Example 4 with ComponentCollection

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

the class FormWrapperContainerRenderer method render.

/**
 * @see org.olat.core.gui.components.ComponentRenderer#render(org.olat.core.gui.render.Renderer,
 *      org.olat.core.gui.render.StringOutput,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.render.URLBuilder,
 *      org.olat.core.gui.translator.Translator,
 *      org.olat.core.gui.render.RenderResult, java.lang.String[])
 */
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    FormWrapperContainer formC = (FormWrapperContainer) source;
    ComponentCollection toRender = formC.getFormLayout();
    /*
		 * extract check for render instruction to the form wrapper
		 */
    boolean hasRenderInstr = (args != null && args.length > 0);
    if (toRender != null) {
        AJAXFlags flags = renderer.getGlobalSettings().getAjaxFlags();
        boolean iframePostEnabled = flags.isIframePostEnabled();
        /*
			 * FORM HEADER
			 */
        sb.append("<form ");
        if (hasRenderInstr) {
            // append render instructions if available
            // flexi form supports only class
            FormJSHelper.appendRenderInstructions(sb, args[0], acceptedInstructions);
        }
        sb.append(" method=\"post\"");
        // transfer and parameter extracing overhead
        if (formC.isMultipartEnabled()) {
            sb.append(" enctype=\"multipart/form-data\"");
        }
        sb.append(" id=\"");
        sb.append(formC.getFormName());
        sb.append("\" name=\"");
        sb.append(formC.getFormName());
        sb.append("\" action=\"");
        ubu.buildURI(sb, new String[] { Form.FORMID }, new String[] { Form.FORMCMD }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        sb.append("\" ");
        // check if ready to accept a new request
        if (iframePostEnabled) {
            sb.append(" onsubmit=\"return o_XHRSubmit('").append(formC.getFormName()).append("');\" ");
        } else {
            sb.append(" onsubmit=\"if(o_info.linkbusy) return false; else o_beforeserver(); return true;\" ");
        }
        sb.append(">");
        // hidden input field for dispatch uri
        sb.append("<input type=\"hidden\" id=\"").append(formC.getDispatchFieldId()).append("\" name=\"dispatchuri\" value=\"").append(Form.FORM_UNDEFINED).append("\" />").append("<input type=\"hidden\" id=\"").append(formC.getEventFieldId()).append("\" name=\"dispatchevent\" value=\"").append(Form.FORM_UNDEFINED).append("\" />");
        /*
			 * FORM CONTAINER
			 */
        renderer.render(sb, toRender, args);
        /*
			 * FORM FOOTER
			 */
        sb.append("</form>");
        /*
			 * FORM SUBMIT on keypress enter
			 */
        sb.append(FormJSHelper.submitOnKeypressEnter(formC.getFormName()));
    }
}
Also used : AJAXFlags(org.olat.core.gui.control.winmgr.AJAXFlags) ComponentCollection(org.olat.core.gui.components.ComponentCollection)

Example 5 with ComponentCollection

use of org.olat.core.gui.components.ComponentCollection in project openolat by klemens.

the class FormWrapperContainerRenderer method render.

/**
 * @see org.olat.core.gui.components.ComponentRenderer#render(org.olat.core.gui.render.Renderer,
 *      org.olat.core.gui.render.StringOutput,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.render.URLBuilder,
 *      org.olat.core.gui.translator.Translator,
 *      org.olat.core.gui.render.RenderResult, java.lang.String[])
 */
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    FormWrapperContainer formC = (FormWrapperContainer) source;
    ComponentCollection toRender = formC.getFormLayout();
    /*
		 * extract check for render instruction to the form wrapper
		 */
    boolean hasRenderInstr = (args != null && args.length > 0);
    if (toRender != null) {
        AJAXFlags flags = renderer.getGlobalSettings().getAjaxFlags();
        boolean iframePostEnabled = flags.isIframePostEnabled();
        /*
			 * FORM HEADER
			 */
        sb.append("<form ");
        if (hasRenderInstr) {
            // append render instructions if available
            // flexi form supports only class
            FormJSHelper.appendRenderInstructions(sb, args[0], acceptedInstructions);
        }
        sb.append(" method=\"post\"");
        // transfer and parameter extracing overhead
        if (formC.isMultipartEnabled()) {
            sb.append(" enctype=\"multipart/form-data\"");
        }
        sb.append(" id=\"");
        sb.append(formC.getFormName());
        sb.append("\" name=\"");
        sb.append(formC.getFormName());
        sb.append("\" action=\"");
        ubu.buildURI(sb, new String[] { Form.FORMID }, new String[] { Form.FORMCMD }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        sb.append("\" ");
        // check if ready to accept a new request
        if (iframePostEnabled) {
            sb.append(" onsubmit=\"return o_XHRSubmit('").append(formC.getFormName()).append("');\" ");
        } else {
            sb.append(" onsubmit=\"if(o_info.linkbusy) return false; else o_beforeserver(); return true;\" ");
        }
        sb.append(">");
        // hidden input field for dispatch uri
        sb.append("<input type=\"hidden\" id=\"").append(formC.getDispatchFieldId()).append("\" name=\"dispatchuri\" value=\"").append(Form.FORM_UNDEFINED).append("\" />").append("<input type=\"hidden\" id=\"").append(formC.getEventFieldId()).append("\" name=\"dispatchevent\" value=\"").append(Form.FORM_UNDEFINED).append("\" />");
        /*
			 * FORM CONTAINER
			 */
        renderer.render(sb, toRender, args);
        /*
			 * FORM FOOTER
			 */
        sb.append("</form>");
        /*
			 * FORM SUBMIT on keypress enter
			 */
        sb.append(FormJSHelper.submitOnKeypressEnter(formC.getFormName()));
    }
}
Also used : AJAXFlags(org.olat.core.gui.control.winmgr.AJAXFlags) ComponentCollection(org.olat.core.gui.components.ComponentCollection)

Aggregations

ComponentCollection (org.olat.core.gui.components.ComponentCollection)6 AJAXFlags (org.olat.core.gui.control.winmgr.AJAXFlags)2