Search in sources :

Example 6 with URLBuilder

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);
        }
    }
}
Also used : RenderResult(org.olat.core.gui.render.RenderResult) Link(org.olat.core.gui.components.link.Link) ContextPair(org.olat.core.util.mail.ui.MailDataModel.ContextPair) URLBuilder(org.olat.core.gui.render.URLBuilder)

Example 7 with URLBuilder

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;
}
Also used : Window(org.olat.core.gui.components.Window) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) StringOutput(org.olat.core.gui.render.StringOutput) ChiefController(org.olat.core.gui.control.ChiefController) URLBuilder(org.olat.core.gui.render.URLBuilder)

Example 8 with URLBuilder

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();
}
Also used : Renderer(org.olat.core.gui.render.Renderer) RenderResult(org.olat.core.gui.render.RenderResult) StringOutput(org.olat.core.gui.render.StringOutput) URLBuilder(org.olat.core.gui.render.URLBuilder) VelocityRenderDecorator(org.olat.core.gui.render.velocity.VelocityRenderDecorator)

Example 9 with URLBuilder

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();
}
Also used : Renderer(org.olat.core.gui.render.Renderer) RenderResult(org.olat.core.gui.render.RenderResult) StringOutput(org.olat.core.gui.render.StringOutput) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) URLBuilder(org.olat.core.gui.render.URLBuilder) VelocityRenderDecorator(org.olat.core.gui.render.velocity.VelocityRenderDecorator)

Example 10 with URLBuilder

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;
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement) URLBuilder(org.olat.core.gui.render.URLBuilder)

Aggregations

URLBuilder (org.olat.core.gui.render.URLBuilder)36 StringOutput (org.olat.core.gui.render.StringOutput)30 RenderResult (org.olat.core.gui.render.RenderResult)24 Renderer (org.olat.core.gui.render.Renderer)20 IOException (java.io.IOException)10 Translator (org.olat.core.gui.translator.Translator)10 ArrayList (java.util.ArrayList)6 Component (org.olat.core.gui.components.Component)6 ComponentRenderer (org.olat.core.gui.components.ComponentRenderer)6 Window (org.olat.core.gui.components.Window)6 Link (org.olat.core.gui.components.link.Link)6 ChiefController (org.olat.core.gui.control.ChiefController)6 RenderingState (org.olat.core.gui.render.RenderingState)6 VelocityRenderDecorator (org.olat.core.gui.render.velocity.VelocityRenderDecorator)6 GlobalSettings (org.olat.core.gui.GlobalSettings)4 DelegatingComponent (org.olat.core.gui.components.delegating.DelegatingComponent)4 InvalidRequestParameterException (org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException)4 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)4 Command (org.olat.core.gui.control.winmgr.Command)4 JSCommand (org.olat.core.gui.control.winmgr.JSCommand)4