use of org.olat.core.gui.render.URLBuilder in project openolat by klemens.
the class RESTDispatcher method getRedirectToURL.
private String getRedirectToURL(UserSession usess) {
ChiefController cc = Windows.getWindows(usess).getChiefController();
Window w = cc.getWindow();
URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, w.getInstanceId(), String.valueOf(w.getTimestamp()));
StringOutput sout = new StringOutput(30);
ubu.buildURI(sout, null, null);
return sout.toString();
}
use of org.olat.core.gui.render.URLBuilder in project openolat by klemens.
the class RemoteLoginformDispatcher method getRedirectToURL.
private String getRedirectToURL(UserSession usess) {
Window w = Windows.getWindows(usess).getChiefController().getWindow();
URLBuilder ubu = new URLBuilder("", w.getInstanceId(), String.valueOf(w.getTimestamp()));
StringOutput sout = new StringOutput(30);
ubu.buildURI(sout, null, null);
return WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED + sout.toString();
}
use of org.olat.core.gui.render.URLBuilder in project openolat by klemens.
the class GuiDebugDispatcherController method createInterceptComponentRenderer.
/*
* (non-Javadoc)
*
* @see org.olat.core.gui.render.debug.DebugHandler#createDebugComponentRenderer(org.olat.core.gui.components.ComponentRenderer)
*/
@Override
public ComponentRenderer createInterceptComponentRenderer(final ComponentRenderer originalRenderer) {
return new ComponentRenderer() {
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
if (debugURLBuilder != null && !DebugHelper.isProtected(source)) {
// remember source for later debug info access
String did = source.getDispatchID();
String didS = String.valueOf(did);
idToComponent.put(didS, source);
int lev = renderResult.getNestedLevel();
String cname = source.getClass().getName();
String cnameShort = cname.substring(cname.lastIndexOf('.') + 1);
// header before component
sb.append("<div class='o_dev_w'>");
sb.append("<div class='o_dev_h'><span id='o_guidebugst").append(did).append("' onmouseover=\"o_debu_show(this.parentNode.parentNode, jQuery('#o_guidebugtt").append(did).append("'))\">");
sb.append(source.getComponentName()).append(" (").append(cnameShort).append(")");
sb.append("</span></div>");
sb.append("<div class='o_dev_c'><div id='o_guidebugtt").append(did).append("' class='o_dev_i'>");
sb.append("Info: <b>").append(source.getComponentName()).append("</b> (" + cnameShort + ") id:");
sb.append(String.valueOf(source.getDispatchID())).append(" level:").append(lev);
Controller listC = Util.getListeningControllerFor(source);
if (listC != null) {
sb.append("<br /><b>controller:</b> <a target=\"_blank\" href=\"");
String controllerClassName = listC.getClass().getName();
debugURLBuilder.buildURI(sb, new String[] { "cid", "com", "class" }, new String[] { String.valueOf(did), "ojava", controllerClassName });
sb.append("\">");
sb.append(controllerClassName);
sb.append("</a>");
}
sb.append("<br /><i>listeners</i>: ");
if (!source.isEnabled()) {
sb.append(" NOT ENABLED");
}
String listeners = source.getListenerInfo();
sb.append(listeners);
if (!source.isVisible()) {
sb.append("<br />INVISIBLE");
}
sb.append("<br />");
// we must let the original renderer do its work so that the collecting translator is callbacked.
// we save the result in a new var since it is too early to append it to the 'stream' right now.
StringOutput sbOrig = new StringOutput();
try {
originalRenderer.render(renderer, sbOrig, source, ubu, translator, renderResult, args);
} catch (Exception e) {
String emsg = "exception while rendering component '" + source.getComponentName() + "' (" + source.getClass().getName() + ") " + source.getListenerInfo() + "<br />Message of exception: " + e.getMessage();
sbOrig.append("<span style=\"color:red\">Exception</span><br /><pre>" + emsg + "</pre>");
}
sb.append("</div>");
// add original component
sb.append(sbOrig);
sb.append("</div></div>");
} else {
// e.g. when the render process take place before the delegating
// component of this controller here was rendered.
// the delegating component should be placed near the <html> tag in
// order to be rendered first.
// the contentpane of the window and the first implementing container
// will not be provided with debug info, which is on purpose,
// since those are contents from the chiefcontroller which control the
// window.
// render original component
originalRenderer.render(renderer, sb, source, ubu, translator, renderResult, args);
}
}
@Override
public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) {
originalRenderer.renderHeaderIncludes(renderer, sb, source, ubu, translator, rstate);
}
@Override
public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) {
originalRenderer.renderBodyOnLoadJSFunctionCall(renderer, sb, source, rstate);
}
};
}
use of org.olat.core.gui.render.URLBuilder in project openolat by klemens.
the class AssessmentObjectComponentRenderer method renderBlock.
public void renderBlock(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, ResolvedAssessmentItem resolvedAssessmentItem, ItemSessionState itemSessionState, Block block, URLBuilder ubu, Translator translator) {
switch(block.getQtiClassName()) {
case AssociateInteraction.QTI_CLASS_NAME:
case ChoiceInteraction.QTI_CLASS_NAME:
case DrawingInteraction.QTI_CLASS_NAME:
case ExtendedTextInteraction.QTI_CLASS_NAME:
case GapMatchInteraction.QTI_CLASS_NAME:
case GraphicAssociateInteraction.QTI_CLASS_NAME:
case GraphicGapMatchInteraction.QTI_CLASS_NAME:
case GraphicOrderInteraction.QTI_CLASS_NAME:
case HotspotInteraction.QTI_CLASS_NAME:
case SelectPointInteraction.QTI_CLASS_NAME:
case HottextInteraction.QTI_CLASS_NAME:
case MatchInteraction.QTI_CLASS_NAME:
case MediaInteraction.QTI_CLASS_NAME:
case OrderInteraction.QTI_CLASS_NAME:
case PositionObjectInteraction.QTI_CLASS_NAME:
case SliderInteraction.QTI_CLASS_NAME:
case UploadInteraction.QTI_CLASS_NAME:
{
renderInteraction(renderer, sb, (FlowInteraction) block, resolvedAssessmentItem, itemSessionState, component, ubu, translator);
break;
}
case CustomInteraction.QTI_CLASS_NAME:
{
renderCustomInteraction(renderer, sb, (CustomInteraction<?>) block, resolvedAssessmentItem, itemSessionState, component, ubu, translator);
break;
}
case PositionObjectStage.QTI_CLASS_NAME:
{
renderPositionObjectStage(renderer, sb, (PositionObjectStage) block, resolvedAssessmentItem, itemSessionState, component, ubu, translator);
break;
}
// never rendered
case TemplateBlock.QTI_CLASS_NAME:
break;
case InfoControl.QTI_CLASS_NAME:
{
renderInfoControl(renderer, sb, component, resolvedAssessmentItem, itemSessionState, (InfoControl) block, ubu, translator);
break;
}
case FeedbackBlock.QTI_CLASS_NAME:
{
FeedbackBlock feedbackBlock = (FeedbackBlock) block;
if (component.isFeedback(feedbackBlock, itemSessionState)) {
sb.append("<div class='o_info feedbackBlock '").append(getAtClass(feedbackBlock)).append(">");
feedbackBlock.getBlocks().forEach((child) -> renderBlock(renderer, sb, component, resolvedAssessmentItem, itemSessionState, child, ubu, translator));
sb.append("</div>");
}
break;
}
// never rendered automatically
case RubricBlock.QTI_CLASS_NAME:
break;
case Math.QTI_CLASS_NAME:
{
renderMath(renderer, sb, component, resolvedAssessmentItem, itemSessionState, (Math) block);
break;
}
case Div.QTI_CLASS_NAME:
renderStartHtmlTag(sb, component, resolvedAssessmentItem, block, null);
((Div) block).getFlows().forEach((flow) -> renderFlow(renderer, sb, component, resolvedAssessmentItem, itemSessionState, flow, ubu, translator));
renderEndTag(sb, block);
break;
case Ul.QTI_CLASS_NAME:
renderStartHtmlTag(sb, component, resolvedAssessmentItem, block, null);
((Ul) block).getLis().forEach((li) -> renderLi(renderer, sb, component, resolvedAssessmentItem, itemSessionState, li, ubu, translator));
renderEndTag(sb, block);
break;
case Ol.QTI_CLASS_NAME:
renderStartHtmlTag(sb, component, resolvedAssessmentItem, block, null);
((Ol) block).getLis().forEach((li) -> renderLi(renderer, sb, component, resolvedAssessmentItem, itemSessionState, li, ubu, translator));
renderEndTag(sb, block);
break;
case Dl.QTI_CLASS_NAME:
renderStartHtmlTag(sb, component, resolvedAssessmentItem, block, null);
((Dl) block).getDlElements().forEach((dlElement) -> renderDlElement(renderer, sb, component, resolvedAssessmentItem, itemSessionState, dlElement, ubu, translator));
renderEndTag(sb, block);
break;
case Table.QTI_CLASS_NAME:
renderTable(renderer, sb, component, resolvedAssessmentItem, itemSessionState, (Table) block, ubu, translator);
break;
case Object.QTI_CLASS_NAME:
System.out.println("1");
break;
default:
{
renderStartHtmlTag(sb, component, resolvedAssessmentItem, block, null);
if (block instanceof AtomicBlock) {
AtomicBlock atomicBlock = (AtomicBlock) block;
atomicBlock.getInlines().forEach((child) -> renderInline(renderer, sb, component, resolvedAssessmentItem, itemSessionState, child, ubu, translator));
} else if (block instanceof SimpleBlock) {
SimpleBlock simpleBlock = (SimpleBlock) block;
simpleBlock.getBlocks().forEach((child) -> renderBlock(renderer, sb, component, resolvedAssessmentItem, itemSessionState, child, ubu, translator));
}
renderEndTag(sb, block);
}
}
}
use of org.olat.core.gui.render.URLBuilder in project openolat by klemens.
the class ExportBinderAsPDFResource method createResultHTML.
private String createResultHTML(Component content) {
String pagePath = Util.getPackageVelocityRoot(this.getClass()) + "/export.html";
VelocityContainer mainVC = new VelocityContainer("html", pagePath, translator, null);
mainVC.put("cmp", content);
mainVC.contextPut("bodyCssClass", "o_portfolio_export");
StringOutput sb = new StringOutput(32000);
URLBuilder ubu = new URLBuilder("auth", "1", "0");
Renderer renderer = Renderer.getInstance(mainVC, translator, ubu, new RenderResult(), new EmptyGlobalSettings());
VelocityRenderDecorator vrdec = new VelocityRenderDecorator(renderer, mainVC, sb);
mainVC.contextPut("r", vrdec);
renderer.render(sb, mainVC, null);
return sb.toString();
}
Aggregations