Search in sources :

Example 76 with StringOutput

use of org.olat.core.gui.render.StringOutput in project openolat by klemens.

the class VelocityRenderDecorator method contextHelpJSCommand.

/**
 * Create a js command to open a specific page in the manual.
 *
 * @param page Help page name
 * @return
 */
public StringOutput contextHelpJSCommand(String page) {
    StringOutput sb = new StringOutput(100);
    if (helpModule.isHelpEnabled()) {
        Locale locale = renderer.getTranslator().getLocale();
        String url = helpModule.getHelpProvider().getURL(locale, page);
        sb.append("contextHelpWindow('").append(url).append("')");
    }
    return sb;
}
Also used : Locale(java.util.Locale) StringOutput(org.olat.core.gui.render.StringOutput)

Example 77 with StringOutput

use of org.olat.core.gui.render.StringOutput in project openolat by klemens.

the class VelocityRenderDecorator method renderForce.

/**
 * renders the component.
 * if the component cannot be found, there is no error, but an empty String is returned. Not recommended to use normally, but rather use @see render(String componentName)
 *
 * @param componentName
 * @return
 */
public StringOutput renderForce(String componentName) {
    Component source = renderer.findComponent(componentName);
    StringOutput sb;
    if (source == null) {
        sb = new StringOutput(1);
    } else if (target == null) {
        sb = new StringOutput(10000);
        renderer.render(source, sb, null);
    } else {
        renderer.render(source, target, null);
    }
    return new StringOutput(1);
}
Also used : StringOutput(org.olat.core.gui.render.StringOutput) Component(org.olat.core.gui.components.Component)

Example 78 with StringOutput

use of org.olat.core.gui.render.StringOutput in project openolat by klemens.

the class VelocityRenderDecorator method contextHelpLink.

/**
 * Create a link to a specific page in the manual. The link points to the
 * corresponding page in the manual.
 *
 * @param page
 *            Help page name
 */
public StringOutput contextHelpLink(String page) {
    StringOutput sb = new StringOutput(100);
    if (helpModule.isHelpEnabled()) {
        String url = helpModule.getHelpProvider().getURL(renderer.getTranslator().getLocale(), page);
        sb.append(url);
    }
    return sb;
}
Also used : StringOutput(org.olat.core.gui.render.StringOutput)

Example 79 with StringOutput

use of org.olat.core.gui.render.StringOutput in project openolat by klemens.

the class VelocityRenderDecorator method formURIbg.

/**
 * Use it to create the action for a handmade form in a velocity template,
 * e.g. '<form method="post" action="$r.formURIgb("viewswitch")">'
 * @param command
 * @return
 */
public StringOutput formURIbg(String command) {
    StringOutput sb = new StringOutput(100);
    renderer.getUrlBuilder().buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    return sb;
}
Also used : StringOutput(org.olat.core.gui.render.StringOutput)

Example 80 with StringOutput

use of org.olat.core.gui.render.StringOutput in project openolat by klemens.

the class VelocityRenderDecorator method contextHelpWithWrapper.

/**
 * Create a link wrapped with some markup to render a nice help button. The
 * link points to the corresponding page in the manual.
 *
 * @param page Help page name
 * @return
 */
public StringOutput contextHelpWithWrapper(String page) {
    StringOutput sb = new StringOutput(192);
    if (helpModule.isHelpEnabled()) {
        Locale locale = renderer.getTranslator().getLocale();
        String url = helpModule.getHelpProvider().getURL(locale, page);
        if (url != null) {
            String title = StringEscapeUtils.escapeHtml(renderer.getTranslator().translate("help.button"));
            sb.append("<span class=\"o_chelp_wrapper\">").append("<a href=\"").append(url).append("\" class=\"o_chelp\" target=\"_blank\" title=\"").append(title).append("\"><i class='o_icon o_icon_help'></i> ").append(renderer.getTranslator().translate("help")).append("</a></span>");
        }
    }
    return sb;
}
Also used : Locale(java.util.Locale) StringOutput(org.olat.core.gui.render.StringOutput)

Aggregations

StringOutput (org.olat.core.gui.render.StringOutput)188 IOException (java.io.IOException)48 URLBuilder (org.olat.core.gui.render.URLBuilder)30 Renderer (org.olat.core.gui.render.Renderer)26 Block (uk.ac.ed.ph.jqtiplus.node.content.basic.Block)24 RenderResult (org.olat.core.gui.render.RenderResult)22 Component (org.olat.core.gui.components.Component)10 Translator (org.olat.core.gui.translator.Translator)10 Locale (java.util.Locale)8 Window (org.olat.core.gui.components.Window)8 Form (org.olat.core.gui.components.form.flexible.impl.Form)8 VelocityRenderDecorator (org.olat.core.gui.render.velocity.VelocityRenderDecorator)8 ArrayList (java.util.ArrayList)6 StreamResult (javax.xml.transform.stream.StreamResult)6 Test (org.junit.Test)6 GlobalSettings (org.olat.core.gui.GlobalSettings)6 ComponentRenderer (org.olat.core.gui.components.ComponentRenderer)6 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)6 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)6 Matcher (java.util.regex.Matcher)5