Search in sources :

Example 96 with UserRequest

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

the class BlogHandler method createLaunchController.

/**
 * @see org.olat.repository.handlers.RepositoryHandler#getLaunchController(org.olat.core.id.OLATResourceable,
 *      java.lang.String, org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl)
 */
@Override
public MainLayoutController createLaunchController(final RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
    final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
    SubscriptionContext subsContext = new SubscriptionContext(re.getOlatResource(), re.getSoftkey());
    callback.setSubscriptionContext(subsContext);
    return new FeedRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            return new FeedMainController(entry.getOlatResource(), uureq, wwControl, null, null, BlogUIFactory.getInstance(uureq.getLocale()), callback, null);
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) FeedResourceSecurityCallback(org.olat.modules.webFeed.FeedResourceSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserRequest(org.olat.core.gui.UserRequest)

Example 97 with UserRequest

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

the class CourseHandler method createWizardController.

@Override
public StepsMainRunController createWizardController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    // load the course structure
    final RepositoryEntry repoEntry = (RepositoryEntry) res;
    ICourse course = CourseFactory.loadCourse(repoEntry);
    Translator cceTranslator = Util.createPackageTranslator(CourseCreationHelper.class, ureq.getLocale());
    final CourseCreationConfiguration courseConfig = new CourseCreationConfiguration(course.getCourseTitle(), Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + repoEntry.getKey());
    // wizard finish callback called after "finish" is called
    final CourseCreationHelper ccHelper = new CourseCreationHelper(ureq.getLocale(), repoEntry, courseConfig, course);
    StepRunnerCallback finishCallback = new StepRunnerCallback() {

        public Step execute(UserRequest uureq, WindowControl control, StepsRunContext runContext) {
            // retrieve access and properties
            CourseAccessAndProperties accessAndProps = (CourseAccessAndProperties) runContext.get("accessAndProperties");
            courseConfig.setAccessAndProperties(accessAndProps);
            // here goes the code which reads out the wizards data from the runContext and then does some wizardry
            ccHelper.finalizeWorkflow(uureq);
            control.setInfo(CourseCreationMailHelper.getSuccessMessageString(uureq));
            // send notification mail
            final MailerResult mr = CourseCreationMailHelper.sentNotificationMail(uureq, ccHelper.getConfiguration());
            MailHelper.printErrorsAndWarnings(mr, control, uureq.getUserSession().getRoles().isOLATAdmin(), uureq.getLocale());
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    Step start = new CcStep00(ureq, courseConfig, repoEntry);
    StepsMainRunController ccSMRC = new StepsMainRunController(ureq, wControl, start, finishCallback, null, cceTranslator.translate("coursecreation.title"), "o_sel_course_create_wizard");
    return ccSMRC;
}
Also used : CcStep00(de.tuchemnitz.wizard.workflows.coursecreation.steps.CcStep00) MailerResult(org.olat.core.util.mail.MailerResult) CourseCreationHelper(de.tuchemnitz.wizard.workflows.coursecreation.CourseCreationHelper) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) Step(org.olat.core.gui.control.generic.wizard.Step) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) CourseAccessAndProperties(org.olat.course.editor.CourseAccessAndProperties) Translator(org.olat.core.gui.translator.Translator) CourseCreationConfiguration(de.tuchemnitz.wizard.workflows.coursecreation.model.CourseCreationConfiguration) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 98 with UserRequest

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

the class ImsCPHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    OLATResource res = re.getOlatResource();
    File cpRoot = FileResourceManager.getInstance().unzipFileResource(res);
    final LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
    CPPackageConfig packageConfig = CPManager.getInstance().getCPPackageConfig(res);
    final DeliveryOptions deliveryOptions = (packageConfig == null ? null : packageConfig.getDeliveryOptions());
    return new CPRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            boolean activateFirstPage = true;
            String initialUri = null;
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            CPDisplayController cpCtr = new CPDisplayController(uureq, wwControl, vfsWrapper, true, true, activateFirstPage, true, deliveryOptions, initialUri, entry.getOlatResource(), "", false);
            MainLayout3ColumnsController ctr = new LayoutMain3ColsController(uureq, wwControl, cpCtr.getMenuComponent(), cpCtr.getInitialComponent(), vfsWrapper.getName());
            ctr.addDisposableChildController(cpCtr);
            return ctr;
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) MainLayout3ColumnsController(org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController) CPDisplayController(org.olat.modules.cp.CPDisplayController) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) MainLayout3ColumnsController(org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController) CPContentController(org.olat.ims.cp.ui.CPContentController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CPDisplayController(org.olat.modules.cp.CPDisplayController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) CPRuntimeController(org.olat.ims.cp.ui.CPRuntimeController) CPEditMainController(org.olat.ims.cp.ui.CPEditMainController) Controller(org.olat.core.gui.control.Controller) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) CPRuntimeController(org.olat.ims.cp.ui.CPRuntimeController) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CPPackageConfig(org.olat.ims.cp.ui.CPPackageConfig) File(java.io.File) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) UserRequest(org.olat.core.gui.UserRequest)

Example 99 with UserRequest

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

the class PodcastHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOwner = reSecurity.isOwner();
    final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
    SubscriptionContext subsContext = new SubscriptionContext(re.getOlatResource(), re.getSoftkey());
    callback.setSubscriptionContext(subsContext);
    return new FeedRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            return new FeedMainController(entry.getOlatResource(), uureq, wwControl, null, null, PodcastUIFactory.getInstance(uureq.getLocale()), callback, null);
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) FeedResourceSecurityCallback(org.olat.modules.webFeed.FeedResourceSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) FeedRuntimeController(org.olat.modules.webFeed.ui.FeedRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserRequest(org.olat.core.gui.UserRequest)

Example 100 with UserRequest

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

the class WikiHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    // first handle special case: disabled wiki for security (XSS Attacks) reasons
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (!securityModule.isWikiEnabled()) {
        return RepositoyUIFactory.createRepoEntryDisabledDueToSecurityMessageController(ureq, wControl);
    }
    // check role
    boolean isOLatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isResourceOwner = false;
    if (isOLatAdmin) {
        isResourceOwner = true;
    } else {
        isResourceOwner = reSecurity.isOwner();
    }
    OLATResource res = re.getOlatResource();
    BusinessControl bc = wControl.getBusinessControl();
    final ContextEntry ce = bc.popLauncherContextEntry();
    SubscriptionContext subsContext = new SubscriptionContext(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    final WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOLatAdmin, isGuestOnly, false, isResourceOwner, subsContext);
    RepositoryEntryRuntimeController runtime = new RepositoryEntryRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            Controller controller;
            if (ce != null) {
                // jump to a certain context
                OLATResourceable ores = ce.getOLATResourceable();
                String typeName = ores.getResourceableTypeName();
                String page = typeName.substring("page=".length());
                controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, page);
            } else {
                controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, null);
            }
            return new OLATResourceableListeningWrapperController(uureq, wwControl, entry.getOlatResource(), controller, null, uureq.getIdentity());
        }
    });
    return runtime;
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) OLATResourceable(org.olat.core.id.OLATResourceable) WikiMainController(org.olat.modules.wiki.WikiMainController) BusinessControl(org.olat.core.id.context.BusinessControl) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) Controller(org.olat.core.gui.control.Controller) WikiMainController(org.olat.modules.wiki.WikiMainController) ContextEntry(org.olat.core.id.context.ContextEntry) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) WikiSecurityCallbackImpl(org.olat.modules.wiki.WikiSecurityCallbackImpl) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WikiSecurityCallback(org.olat.modules.wiki.WikiSecurityCallback) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

UserRequest (org.olat.core.gui.UserRequest)314 WindowControl (org.olat.core.gui.control.WindowControl)154 Identity (org.olat.core.id.Identity)92 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)74 RestSecurityHelper.getUserRequest (org.olat.restapi.security.RestSecurityHelper.getUserRequest)68 Path (javax.ws.rs.Path)64 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)64 Controller (org.olat.core.gui.control.Controller)62 RepositoryEntry (org.olat.repository.RepositoryEntry)58 Step (org.olat.core.gui.control.generic.wizard.Step)56 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)56 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)56 ArrayList (java.util.ArrayList)46 ICourse (org.olat.course.ICourse)44 Produces (javax.ws.rs.Produces)40 List (java.util.List)36 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)36 PUT (javax.ws.rs.PUT)32 UserRequestImpl (org.olat.core.gui.UserRequestImpl)30 RestSecurityHelper.getIdentity (org.olat.restapi.security.RestSecurityHelper.getIdentity)30