use of org.olat.core.gui.media.RedirectMediaResource in project OpenOLAT by OpenOLAT.
the class OpenMeetingsRecordingController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == downloadLink) {
try {
String url = openMeetingsManager.getRecordingURL(recording);
MediaResource downloadUrl = new RedirectMediaResource(url);
ureq.getDispatchResult().setResultingMediaResource(downloadUrl);
} catch (OpenMeetingsException e) {
logError("", e);
}
}
}
use of org.olat.core.gui.media.RedirectMediaResource in project OpenOLAT by OpenOLAT.
the class GoToMeetingController method doConfirm.
private void doConfirm(UserRequest ureq) {
if (registrant != null) {
String confirmUrl = registrant.getConfirmUrl();
if (confirmUrl != null) {
RedirectMediaResource redirect = new RedirectMediaResource(confirmUrl);
ureq.getDispatchResult().setResultingMediaResource(redirect);
}
}
updateButtons();
}
use of org.olat.core.gui.media.RedirectMediaResource in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class HtmlStaticPageComponent method getAsyncMediaResource.
/**
* @see org.olat.core.gui.media.AsyncMediaResponsible#getAsyncMediaResource(org.olat.core.gui.UserRequest)
*/
public MediaResource getAsyncMediaResource(UserRequest ureq) {
// is the path to the desired resource (put together by the webbrowser by
// combining latesturl and relative link)
String moduleURI = ureq.getModuleURI();
MediaResource mr = null;
if (moduleURI != null) {
// 1. check for an olat command (special link to indicate a command)
if (moduleURI.startsWith(OLAT_CMD_PREFIX)) {
String cmdAndSub = moduleURI.substring(OLAT_CMD_PREFIX.length());
int slpos = cmdAndSub.indexOf('/');
if (slpos != -1) {
String cmd = cmdAndSub.substring(0, slpos);
String subcmd = cmdAndSub.substring(slpos + 1);
OlatCmdEvent aev = new OlatCmdEvent(cmd, subcmd);
fireEvent(ureq, aev);
// Mediaresourse)
if (aev.isAccepted())
return null;
}
// else ignore (syntax error in command
}
// make sure moduleURI does not contain ".." or such (hack attempt)
// -> ok, userrequest class asserts this.
VFSItem sourceItem = rootContainer.resolve(moduleURI);
// return 404 if the requested file does not exist
if (sourceItem == null || (sourceItem instanceof VFSContainer)) {
return new NotFoundMediaResource();
}
// we know the file exists.
boolean checkRegular = true;
// check for special case: render the follwing link in a new (server) window and all following clicks as well
if ((ureq.getParameter("olatsite") != null) || ((moduleURI.endsWith(".html") || moduleURI.endsWith(".htm")) && (ureq.getParameter("olatraw") != null))) {
log.debug("moduleURI=" + moduleURI);
ExternalSiteEvent ese = new ExternalSiteEvent(moduleURI);
fireEvent(ureq, ese);
if (ese.isAccepted()) {
mr = ese.getResultingMediaResource();
log.debug("ExternalSiteEvent is accepted");
checkRegular = false;
} else {
// it is a html page with olatraw parameter => redirect to mapper
Mapper mapper = new HtmlStaticMapper(rootContainer);
// NOTE: do not deregister this mapper, since it could be used a lot later (since it is opened in a new browser window)
// Register mapper as cacheable
String mapperID = VFSManager.getRealPath(rootContainer);
if (mapperID == null) {
// Can't cache mapper, no cacheable context available
amapPath = CoreSpringFactory.getImpl(MapperService.class).register(ureq.getUserSession(), mapper);
} else {
// Add classname to the file path to remove conflicts with other
// usages of the same file path
mapperID = this.getClass().getSimpleName() + ":" + mapperID;
amapPath = CoreSpringFactory.getImpl(MapperService.class).register(ureq.getUserSession(), mapperID, mapper);
}
String path = amapPath.getUrl() + "/" + moduleURI;
ese.setResultingMediaResource(new RedirectMediaResource(path));
if (log.isDebug())
log.debug("RedirectMediaResource=" + path);
ese.accept();
mr = ese.getResultingMediaResource();
checkRegular = false;
}
}
if (checkRegular) {
// mediaresource (raw inputstream)
if ((moduleURI.endsWith(".html") || moduleURI.endsWith(".htm")) && (ureq.getParameter("olatraw") == null)) {
// we remember what to render inline later and return null to indicate
// inline rendering
currentURI = moduleURI;
getFileContent((VFSLeaf) sourceItem);
fireEvent(ureq, new NewInlineUriEvent(currentURI));
} else {
// it is indeed an image or such -> serve it
mr = new VFSMediaResource((VFSLeaf) sourceItem);
}
}
}
// -> do a normal inline rendering (reload)
return mr;
}
use of org.olat.core.gui.media.RedirectMediaResource in project openolat by klemens.
the class UserPrefsResetForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (resetElements.isAtLeastSelected(1)) {
// Log out user first if logged in
boolean logout = false;
Set<UserSession> sessions = sessionManager.getAuthenticatedUserSessions();
for (UserSession session : sessions) {
Identity ident = session.getIdentity();
if (ident != null && tobeChangedIdentity.equalsByPersistableKey(ident)) {
sessionManager.signOffAndClear(session);
logout = true;
break;
}
}
// Delete gui prefs
if (resetElements.isSelected(0)) {
PropertyManager pm = PropertyManager.getInstance();
pm.deleteProperties(tobeChangedIdentity, null, null, null, "v2guipreferences");
}
// Reset preferences
if (resetElements.isSelected(1)) {
UserManager um = UserManager.getInstance();
User user = um.loadUserByKey(tobeChangedIdentity.getUser().getKey());
org.olat.core.id.Preferences preferences = user.getPreferences();
preferences.setFontsize(null);
preferences.setNotificationInterval(null);
preferences.setPresenceMessagesPublic(false);
preferences.setReceiveRealMail(null);
um.updateUser(user);
PropertyManager pm = PropertyManager.getInstance();
pm.deleteProperties(tobeChangedIdentity, null, null, null, "charset");
}
// Reset history
if (resetElements.isSelected(2)) {
HistoryManager.getInstance().deleteHistory(tobeChangedIdentity);
}
// reset form buttons
resetElements.uncheckAll();
if (logout) {
// if logout, need a redirect to the login page
String lang = i18nModule.getLocaleKey(ureq.getLocale());
ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(WebappHelper.getServletContextPath() + "/dmz/?lang=" + lang + "&logout=true"));
}
}
}
Aggregations