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);
}
}
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();
}
}
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);
}
}
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();
}
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));
}
Aggregations