use of org.olat.core.gui.render.URLBuilder in project OpenOLAT by OpenOLAT.
the class MailContextCellRenderer method render.
@Override
public void render(StringOutput sb, Renderer renderer, Object val, Locale locale, int alignment, String action) {
if (val instanceof ContextPair) {
ContextPair context = (ContextPair) val;
if (renderer == null) {
StringHelper.escapeHtml(sb, context.getName());
} else {
String contextName = StringHelper.escapeHtml(context.getName());
Link link = LinkFactory.createLink("bp_" + UUID.randomUUID().toString(), container, listeningController);
link.setCustomDisplayText(contextName);
link.setUserObject(context.getBusinessPath());
URLBuilder ubu = renderer.getUrlBuilder().createCopyFor(link);
RenderResult renderResult = new RenderResult();
link.getHTMLRendererSingleton().render(renderer, sb, link, ubu, translator, renderResult, null);
}
}
}
use of org.olat.core.gui.render.URLBuilder in project OpenOLAT by OpenOLAT.
the class AuthHelper method doLogin.
/**
* Used by DMZDispatcher to do regular logins and by ShibbolethDispatcher
* which is somewhat special because logins are handled asynchronuous ->
* therefore a dedicated dispatcher is needed which also has to have access to
* the doLogin() method.
*
* @param identity
* @param authProvider
* @param ureq
* @return True if success, false otherwise.
*/
public static int doLogin(Identity identity, String authProvider, UserRequest ureq) {
int initializeStatus = initializeLogin(identity, authProvider, ureq, false);
if (initializeStatus != LOGIN_OK) {
// login not successfull
return initializeStatus;
}
// do logging
ThreadLocalUserActivityLogger.log(OlatLoggingAction.OLAT_LOGIN, AuthHelper.class, LoggingResourceable.wrap(identity));
// brasato:: fix it
// successfull login, reregister window
ChiefController occ;
if (ureq.getUserSession().getRoles().isGuestOnly()) {
occ = createGuestHome(ureq);
} else {
occ = createAuthHome(ureq);
}
Window currentWindow = occ.getWindow();
currentWindow.setUriPrefix(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED);
Windows.getWindows(ureq).registerWindow(currentWindow);
RedirectMediaResource redirect;
String redirectTo = (String) ureq.getUserSession().getEntry("redirect-bc");
if (StringHelper.containsNonWhitespace(redirectTo)) {
String url = WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED + redirectTo;
redirect = new RedirectMediaResource(url);
} else {
// redirect to AuthenticatedDispatcher
// IMPORTANT: windowID has changed due to re-registering current window -> do not use ureq.getWindowID() to build new URLBuilder.
URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, currentWindow.getInstanceId(), "1");
StringOutput sout = new StringOutput(30);
ubu.buildURI(sout, null, null);
redirect = new RedirectMediaResource(sout.toString());
}
ureq.getDispatchResult().setResultingMediaResource(redirect);
return LOGIN_OK;
}
use of org.olat.core.gui.render.URLBuilder in project OpenOLAT by OpenOLAT.
the class ExportBinderAsCPResource method renderVelocityContainer.
private String renderVelocityContainer(VelocityContainer mainVC) {
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();
}
use of org.olat.core.gui.render.URLBuilder in project OpenOLAT by OpenOLAT.
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();
}
use of org.olat.core.gui.render.URLBuilder in project OpenOLAT by OpenOLAT.
the class FolderPage method assertOnDirectory.
public FolderPage assertOnDirectory(String name) {
// encode name same was as in UI
URLBuilder urlBuilder = new URLBuilder("", "", "");
String escapedName = urlBuilder.encodeUrl(name);
By directoryBy = By.xpath("//table[contains(@class,'o_bc_table')]//a[contains(@onclick,'" + escapedName + "')]");
List<WebElement> directoryEls = browser.findElements(directoryBy);
Assert.assertFalse(directoryEls.isEmpty());
return this;
}
Aggregations