Search in sources :

Example 41 with RedirectMediaResource

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

the class PaypalMapper method handle.

@Override
public MediaResource handle(String relPath, HttpServletRequest request) {
    List<ContextEntry> entries = null;
    UserSession usess = CoreSpringFactory.getImpl(UserSessionManager.class).getUserSession(request);
    try {
        entries = BusinessControlFactory.getInstance().createCEListFromString(businessPath);
        if (relPath.indexOf(';') > 0) {
            relPath = relPath.substring(0, relPath.indexOf(';'));
        }
        if (relPath.indexOf('?') > 0) {
            relPath = relPath.substring(0, relPath.indexOf('?'));
        }
        String uuid = relPath.substring(1, relPath.length() - 5);
        paypalManager.updateTransaction(uuid);
        usess.putEntryInNonClearedStore("paypal-uuid", uuid);
    } catch (Exception e) {
        log.error("", e);
        usess.putEntryInNonClearedStore("paypal-mapper-error", Boolean.TRUE);
    }
    String resourceUrl = BusinessControlFactory.getInstance().getBusinessPathAsURIFromCEList(entries);
    MediaResource redirect = new RedirectMediaResource(Settings.getServerContextPathURI() + "/auth/" + resourceUrl);
    return redirect;
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) UserSession(org.olat.core.util.UserSession) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 42 with RedirectMediaResource

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

the class WimbaConfigController method openWimbaUrl.

private void openWimbaUrl(UserRequest ureq, String target) {
    boolean success = wimba.createModerator(ureq.getIdentity(), roomId);
    if (success) {
        wimba.login(ureq.getIdentity(), null);
        String url = wimba.createServiceUrl(target, roomId);
        RedirectMediaResource rmr = new RedirectMediaResource(url);
        ureq.getDispatchResult().setResultingMediaResource(rmr);
    } else {
        // could not create moderator or update the rights
        getWindowControl().setError(translate("error.update.rights"));
        return;
    }
}
Also used : RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource)

Example 43 with RedirectMediaResource

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

the class RecordingsTableModel method joinMeeting.

private void joinMeeting(UserRequest ureq, boolean guest) {
    URL url;
    if (guest) {
        url = wimba.createClassroomGuestUrl(roomId, ureq.getIdentity(), config);
    } else {
        boolean success = wimba.login(ureq.getIdentity(), null);
        // no success, maybe the user account doesn't exist, create it and try the login again
        if (!success)
            wimba.createUser(ureq.getIdentity(), roomId);
        wimba.login(ureq.getIdentity(), null);
        url = wimba.createClassroomUrl(roomId, ureq.getIdentity(), config);
    }
    RedirectMediaResource rmr = new RedirectMediaResource(url.toString());
    ureq.getDispatchResult().setResultingMediaResource(rmr);
}
Also used : RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) URL(java.net.URL)

Example 44 with RedirectMediaResource

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

the class RecordingsTableModel method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == recTable) {
        if (event instanceof TableEvent) {
            TableEvent tEvent = (TableEvent) event;
            String action = tEvent.getActionId();
            int row = tEvent.getRowId();
            String key = (String) recTable.getTableDataModel().getValueAt(row, 0);
            if (action.equals(COMMAND_OPEN_RECORDING)) {
                wimba.login(ureq.getIdentity(), null);
                URL url = wimba.createClassroomRecordingUrl(key, ureq.getIdentity());
                RedirectMediaResource rmr = new RedirectMediaResource(url.toString());
                ureq.getDispatchResult().setResultingMediaResource(rmr);
                return;
            } else if (action.equals(COMMAND_TOGGLESTATUS_RECORDING)) {
                Object[] entry = (Object[]) recTable.getTableDataModel().getObject(row);
                Boolean preview = (Boolean) entry[2];
                if (wimba.setPreviewMode(key, !preview, true)) {
                    String text = preview ? "table.recordings.unclose.success" : "table.recordings.close.success";
                    getWindowControl().setInfo(translate(text));
                    recTableModel.toggleStatus(row);
                    recTable.modelChanged();
                    runVC.setDirty(true);
                } else {
                    String text = preview ? "table.recordings.unclose.error" : "table.recordings.close.error";
                    getWindowControl().setError(translate(text));
                }
            } else if (action.equals(COMMAND_DELETE_RECORDING)) {
                if (wimba.removeClassroomRecording(key)) {
                    getWindowControl().setInfo(translate("table.recordings.delete.success"));
                    recTableModel.removeRecording(row);
                    recTable.modelChanged();
                    runVC.setDirty(true);
                } else {
                    getWindowControl().setError(translate("table.recordings.delete.error"));
                }
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) URL(java.net.URL)

Example 45 with RedirectMediaResource

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

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)

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