Search in sources :

Example 16 with RedirectMediaResource

use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.

the class GoToRecordingController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == downloadLink) {
        String url = recording.getDownloadUrl();
        MediaResource downloadUrl = new RedirectMediaResource(url);
        ureq.getDispatchResult().setResultingMediaResource(downloadUrl);
    }
}
Also used : RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource)

Example 17 with RedirectMediaResource

use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.

the class OlatMinimalTopNavController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == closeLink) {
        // close window (a html page which calls Window.close onLoad
        ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(StaticMediaDispatcher.createStaticURIFor("closewindow.html")));
        // release all resources and close window
        WindowBackOffice wbo = getWindowControl().getWindowBackOffice();
        Window w = wbo.getWindow();
        Windows.getWindows(ureq).deregisterWindow(w);
        wbo.dispose();
    }
}
Also used : Window(org.olat.core.gui.components.Window) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice)

Example 18 with RedirectMediaResource

use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.

the class GoToMeetingController method doStart.

private void doStart(UserRequest ureq) {
    if (registrant == null) {
        GoToError error = new GoToError();
        registrant = meetingMgr.registerTraining(meeting, getIdentity(), error);
    }
    GoToError error = new GoToError();
    String startUrl = meetingMgr.startTraining(meeting, error);
    if (startUrl != null) {
        RedirectMediaResource redirect = new RedirectMediaResource(startUrl);
        ureq.getDispatchResult().setResultingMediaResource(redirect);
    } else if (error.getError() == GoToErrors.TrainingInSession) {
        String joinUrl = registrant.getJoinUrl();
        RedirectMediaResource redirect = new RedirectMediaResource(joinUrl);
        ureq.getDispatchResult().setResultingMediaResource(redirect);
    }
}
Also used : GoToError(org.olat.modules.gotomeeting.model.GoToError) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource)

Example 19 with RedirectMediaResource

use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.

the class GoToMeetingController method doJoin.

private void doJoin(UserRequest ureq) {
    boolean join = false;
    GoToError error = new GoToError();
    if (registrant == null) {
        registrant = meetingMgr.registerTraining(meeting, getIdentity(), error);
    }
    if (registrant != null) {
        String joinUrl = registrant.getJoinUrl();
        if (joinUrl != null) {
            RedirectMediaResource redirect = new RedirectMediaResource(joinUrl);
            ureq.getDispatchResult().setResultingMediaResource(redirect);
            join = true;
        }
    }
    if (!join) {
        final String errorMessage;
        if (error.hasError()) {
            if (error.getError() != null) {
                errorMessage = translate(error.getError().i18nKey());
            } else {
                errorMessage = translate("error.code.unkown");
            }
        } else {
            errorMessage = translate("error.code.unkown");
        }
        ControllerCreator creator = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, new ControllerCreator() {

            @Override
            public Controller createController(UserRequest lureq, WindowControl lwControl) {
                // Wrap in column layout, popup window needs a layout controller
                String title = "";
                String text = errorMessage;
                Controller ctr = MessageUIFactory.createErrorMessage(lureq, lwControl, title, text);
                LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
                layoutCtr.addDisposableChildController(ctr);
                return layoutCtr;
            }
        });
        openInNewBrowserWindow(ureq, creator);
    }
    updateButtons();
}
Also used : GoToError(org.olat.modules.gotomeeting.model.GoToError) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) WindowControl(org.olat.core.gui.control.WindowControl) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 20 with RedirectMediaResource

use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.

the class AuthHelper method doLogout.

/**
 * This is a convenience method to log out. IMPORTANT: This method initiates a
 * redirect and RETURN. Make sure you return the call hierarchy gracefully.
 * Most of all, don't touch HttpServletRequest or the Session after you call
 * this method.
 *
 * @param ureq
 */
public static void doLogout(UserRequest ureq) {
    if (ureq == null)
        return;
    boolean wasGuest = false;
    UserSession usess = ureq.getUserSession();
    if (usess != null && usess.getRoles() != null) {
        wasGuest = usess.getRoles().isGuestOnly();
    }
    String lang = CoreSpringFactory.getImpl(I18nModule.class).getLocaleKey(ureq.getLocale());
    HttpSession session = ureq.getHttpReq().getSession(false);
    // stuff on logout
    if (session != null) {
        try {
            session.invalidate();
            deleteShibsessionCookie(ureq);
        } catch (IllegalStateException ise) {
        // thrown when session already invalidated. fine. ignore.
        }
    }
    // redirect to logout page in dmz realm, set info that DMZ is shown because of logout
    // if it was a guest user, do not set logout=true. The parameter must be evaluated
    // by the implementation of the AuthenticationProvider.
    String setWarning = wasGuest ? "" : "&logout=true";
    ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(WebappHelper.getServletContextPath() + "/dmz/?lang=" + lang + setWarning));
}
Also used : I18nModule(org.olat.core.util.i18n.I18nModule) HttpSession(javax.servlet.http.HttpSession) UserSession(org.olat.core.util.UserSession) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource)

Aggregations

RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)48 MediaResource (org.olat.core.gui.media.MediaResource)16 Identity (org.olat.core.id.Identity)8 URL (java.net.URL)6 UserRequest (org.olat.core.gui.UserRequest)6 Window (org.olat.core.gui.components.Window)6 UserSession (org.olat.core.util.UserSession)6 IOException (java.io.IOException)4 HttpSession (javax.servlet.http.HttpSession)4 ChiefController (org.olat.core.gui.control.ChiefController)4 WindowBackOffice (org.olat.core.gui.control.WindowBackOffice)4 StringOutput (org.olat.core.gui.render.StringOutput)4 URLBuilder (org.olat.core.gui.render.URLBuilder)4 AssertException (org.olat.core.logging.AssertException)4 UserRequestImpl (org.olat.core.gui.UserRequestImpl)3 GoToError (org.olat.modules.gotomeeting.model.GoToError)3 OpenMeetingsException (org.olat.modules.openmeetings.manager.OpenMeetingsException)3 ArrayList (java.util.ArrayList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2