Search in sources :

Example 71 with UserRequest

use of org.olat.core.gui.UserRequest in project OpenOLAT by OpenOLAT.

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 72 with UserRequest

use of org.olat.core.gui.UserRequest in project OpenOLAT by OpenOLAT.

the class TaxonomyLevelOverviewController method initTabPane.

private void initTabPane() {
    tabPane.addTab(translate("taxonomy.level.competences"), new TabCreator() {

        @Override
        public Component create(UserRequest uureq) {
            competencesCtrl = new TaxonomyLevelCompetenceController(uureq, getWindowControl(), taxonomyLevel);
            listenTo(competencesCtrl);
            return competencesCtrl.getInitialComponent();
        }
    });
    tabPane.addTab(translate("taxonomy.level.relations"), new TabCreator() {

        @Override
        public Component create(UserRequest uureq) {
            relationsCtrl = new TaxonomyLevelRelationsController(uureq, getWindowControl(), taxonomyLevel);
            listenTo(relationsCtrl);
            return relationsCtrl.getInitialComponent();
        }
    });
}
Also used : TabCreator(org.olat.core.gui.components.tabbedpane.TabCreator) Component(org.olat.core.gui.components.Component) UserRequest(org.olat.core.gui.UserRequest)

Example 73 with UserRequest

use of org.olat.core.gui.UserRequest in project OpenOLAT by OpenOLAT.

the class DisplayPortraitController method showUserInfo.

/**
 * Method to open the users visiting card in a new tab. Public to call it also from the patrent controller
 * @param ureq
 */
public void showUserInfo(UserRequest ureq) {
    ControllerCreator ctrlCreator = new ControllerCreator() {

        @Override
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            return new UserInfoMainController(lureq, lwControl, portraitIdent, true, false);
        }
    };
    // wrap the content controller into a full header layout
    ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
    // open in new browser window
    PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
    pbw.open(ureq);
}
Also used : PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) WindowControl(org.olat.core.gui.control.WindowControl) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 74 with UserRequest

use of org.olat.core.gui.UserRequest in project OpenOLAT by OpenOLAT.

the class CourseDbWebService method getValuePlain.

/**
 * Retrieve a value of an authenticated user.
 * @response.representation.200.qname {http://www.example.com}keyValuePair
 * @response.representation.200.mediaType text/plain, text/html
 * @response.representation.200.doc A value of the course
 * @response.representation.200.example Green
 * @response.representation.404.doc The entry cannot be found
 * @param courseId The course resourceable's id
 * @param category The name of the database
 * @param name The name of the key value pair
 * @param request The HTTP request
 * @return
 */
@GET
@Path("values/{name}")
@Produces({ MediaType.TEXT_PLAIN, MediaType.TEXT_HTML })
public Response getValuePlain(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @Context HttpServletRequest request) {
    ICourse course = loadCourse(courseId);
    UserRequest ureq = RestSecurityHelper.getUserRequest(request);
    CourseDBEntry entry = CoreSpringFactory.getImpl(CourseDBManager.class).getValue(course, ureq.getIdentity(), category, name);
    if (entry == null) {
        return Response.serverError().status(Status.NOT_FOUND).build();
    }
    Object value = entry.getValue();
    String val = value == null ? "" : value.toString();
    return Response.ok(val).build();
}
Also used : CourseDBManager(org.olat.course.db.CourseDBManager) ICourse(org.olat.course.ICourse) UserRequest(org.olat.core.gui.UserRequest) CourseDBEntry(org.olat.course.db.CourseDBEntry) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 75 with UserRequest

use of org.olat.core.gui.UserRequest in project OpenOLAT by OpenOLAT.

the class CourseDbWebService method getValue.

/**
 * Retrieve a value of an authenticated user.
 * @response.representation.200.qname {http://www.example.com}keyValuePair
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc The value in the course
 * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_KEYVALUEVO}
 * @response.representation.404.doc The entry cannot be found
 * @param courseId The course resourceable's id
 * @param category The name of the database
 * @parma name The name of the key value pair
 * @param request The HTTP request
 * @return
 */
@GET
@Path("values/{name}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getValue(@PathParam("courseId") Long courseId, @PathParam("category") String category, @PathParam("name") String name, @Context HttpServletRequest request) {
    ICourse course = loadCourse(courseId);
    UserRequest ureq = RestSecurityHelper.getUserRequest(request);
    CourseDBEntry entry = CoreSpringFactory.getImpl(CourseDBManager.class).getValue(course, ureq.getIdentity(), category, name);
    if (entry == null) {
        return Response.serverError().status(Status.NOT_FOUND).build();
    }
    Object value = entry.getValue();
    KeyValuePair pair = new KeyValuePair(name, value == null ? "" : value.toString());
    return Response.ok(pair).build();
}
Also used : CourseDBManager(org.olat.course.db.CourseDBManager) KeyValuePair(org.olat.restapi.support.vo.KeyValuePair) ICourse(org.olat.course.ICourse) UserRequest(org.olat.core.gui.UserRequest) CourseDBEntry(org.olat.course.db.CourseDBEntry) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

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