Search in sources :

Example 16 with FeedSecurityCallback

use of org.olat.modules.webFeed.FeedSecurityCallback in project openolat by klemens.

the class LiveBlogArtefactHandler method createDetailsController.

@Override
public Controller createDetailsController(UserRequest ureq, WindowControl wControl, AbstractArtefact artefact, boolean readOnlyMode) {
    FeedSecurityCallback callback = new FeedResourceSecurityCallback(false, false);
    String businessPath = artefact.getBusinessPath();
    Long resid = Long.parseLong(businessPath.substring(10, businessPath.length() - 1));
    OLATResource ores = OLATResourceManager.getInstance().findResourceable(resid, BlogFileResource.TYPE_NAME);
    FeedItemDisplayConfig displayConfig = new FeedItemDisplayConfig(false, false, readOnlyMode);
    FeedMainController detailsController = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(ores, ureq, wControl, callback, displayConfig);
    return detailsController;
}
Also used : FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) OLATResource(org.olat.resource.OLATResource) FeedItemDisplayConfig(org.olat.modules.webFeed.ui.FeedItemDisplayConfig) FeedResourceSecurityCallback(org.olat.modules.webFeed.FeedResourceSecurityCallback)

Example 17 with FeedSecurityCallback

use of org.olat.modules.webFeed.FeedSecurityCallback in project openolat by klemens.

the class BlogCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.AbstractAccessableCourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation, java.lang.String)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    RepositoryEntry entry = getReferencedRepositoryEntry();
    // create business path courseID:nodeID
    // userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    // getIdent();
    Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    String nodeId = this.getIdent();
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
    FeedSecurityCallback callback;
    if (userCourseEnv.isCourseReadOnly()) {
        callback = new FeedReadOnlySecurityCallback();
    } else {
        callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
    }
    SubscriptionContext subsContext = CourseModule.createSubscriptionContext(userCourseEnv.getCourseEnvironment(), this);
    callback.setSubscriptionContext(subsContext);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(this));
    FeedMainController blogCtr = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId);
    List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(nodecmd);
    blogCtr.activate(ureq, entries, null);
    Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, blogCtr, this, "o_blog_icon");
    NodeRunConstructionResult result = new NodeRunConstructionResult(wrapperCtrl);
    return result;
}
Also used : FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) BlogNodeEditController(org.olat.course.nodes.feed.blog.BlogNodeEditController) FeedNodeEditController(org.olat.course.nodes.feed.FeedNodeEditController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) FeedPeekviewController(org.olat.course.nodes.feed.FeedPeekviewController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) ContextEntry(org.olat.core.id.context.ContextEntry) FeedNodeSecurityCallback(org.olat.course.nodes.feed.FeedNodeSecurityCallback) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) FeedReadOnlySecurityCallback(org.olat.modules.webFeed.FeedReadOnlySecurityCallback)

Example 18 with FeedSecurityCallback

use of org.olat.modules.webFeed.FeedSecurityCallback in project openolat by klemens.

the class PodcastCourseNode method createPeekViewRunController.

/**
 * @see org.olat.course.nodes.GenericCourseNode#createPeekViewRunController(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
    if (ne.isAtLeastOneAccessible()) {
        // Create a feed peekview controller that shows the latest two entries
        RepositoryEntry entry = getReferencedRepositoryEntry();
        Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
        String nodeId = this.getIdent();
        boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
        boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
        // fxdiff BAKS-18
        boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
        FeedSecurityCallback callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
        FeedUIFactory uiFactory = PodcastUIFactory.getInstance(ureq.getLocale());
        Controller peekViewController = new FeedPeekviewController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId, uiFactory, 2, "o_podcast_peekview");
        return peekViewController;
    } else {
        // use standard peekview
        return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
    }
}
Also used : FeedNodeSecurityCallback(org.olat.course.nodes.feed.FeedNodeSecurityCallback) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) FeedPeekviewController(org.olat.course.nodes.feed.FeedPeekviewController) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) PodcastNodeEditController(org.olat.course.nodes.feed.podcast.PodcastNodeEditController) FeedNodeEditController(org.olat.course.nodes.feed.FeedNodeEditController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) FeedPeekviewController(org.olat.course.nodes.feed.FeedPeekviewController) FeedUIFactory(org.olat.modules.webFeed.ui.FeedUIFactory)

Aggregations

FeedSecurityCallback (org.olat.modules.webFeed.FeedSecurityCallback)18 FeedMainController (org.olat.modules.webFeed.ui.FeedMainController)14 RepositoryEntry (org.olat.repository.RepositoryEntry)14 Controller (org.olat.core.gui.control.Controller)12 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)8 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)8 NodeEditController (org.olat.course.editor.NodeEditController)8 FeedNodeEditController (org.olat.course.nodes.feed.FeedNodeEditController)8 FeedNodeSecurityCallback (org.olat.course.nodes.feed.FeedNodeSecurityCallback)8 FeedPeekviewController (org.olat.course.nodes.feed.FeedPeekviewController)8 FeedResourceSecurityCallback (org.olat.modules.webFeed.FeedResourceSecurityCallback)8 UserRequest (org.olat.core.gui.UserRequest)4 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)4 WindowControl (org.olat.core.gui.control.WindowControl)4 MainLayoutController (org.olat.core.gui.control.generic.layout.MainLayoutController)4 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 AssessmentMode (org.olat.course.assessment.AssessmentMode)4 BlogNodeEditController (org.olat.course.nodes.feed.blog.BlogNodeEditController)4 PodcastNodeEditController (org.olat.course.nodes.feed.podcast.PodcastNodeEditController)4