Search in sources :

Example 6 with ReadOnlyCommentsSecurityCallback

use of org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback in project OpenOLAT by OpenOLAT.

the class AbstractPageListController method doComment.

private void doComment(UserRequest ureq, Page page) {
    CommentAndRatingSecurityCallback commentSecCallback;
    if (PageStatus.isClosed(page)) {
        commentSecCallback = new ReadOnlyCommentsSecurityCallback();
    } else {
        commentSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, false);
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, page.getKey());
    commentsCtrl = new UserCommentsController(ureq, getWindowControl(), ores, null, commentSecCallback);
    listenTo(commentsCtrl);
    String title = translate("comment.title");
    cmc = new CloseableModalController(getWindowControl(), null, commentsCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)

Example 7 with ReadOnlyCommentsSecurityCallback

use of org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback in project OpenOLAT by OpenOLAT.

the class TableOfContentController method doOpenComments.

private void doOpenComments(UserRequest ureq, PageRow pageRow) {
    CommentAndRatingSecurityCallback commentSecCallback;
    if (PageStatus.isClosed(pageRow.getPage())) {
        commentSecCallback = new ReadOnlyCommentsSecurityCallback();
    } else {
        commentSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, false);
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, pageRow.getKey());
    commentsCtrl = new UserCommentsController(ureq, getWindowControl(), ores, null, commentSecCallback);
    listenTo(commentsCtrl);
    String title = translate("comment.title");
    cmc = new CloseableModalController(getWindowControl(), null, commentsCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)

Example 8 with ReadOnlyCommentsSecurityCallback

use of org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback in project OpenOLAT by OpenOLAT.

the class PageRunController method loadModel.

private void loadModel(UserRequest ureq, boolean reloadComments) {
    mainVC.contextPut("pageTitle", page.getTitle());
    pageCtrl.loadElements(ureq);
    dirtyMarker = false;
    if (secCallback.canComment(page)) {
        if (reloadComments && commentsCtrl != null) {
            mainVC.remove(commentsCtrl.getInitialComponent());
            removeAsListenerAndDispose(commentsCtrl);
            commentsCtrl = null;
        }
        if (commentsCtrl == null) {
            CommentAndRatingSecurityCallback commentSecCallback;
            if (PageStatus.isClosed(page)) {
                commentSecCallback = new ReadOnlyCommentsSecurityCallback();
            } else {
                commentSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, false);
            }
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, page.getKey());
            commentsCtrl = new UserCommentsAndRatingsController(ureq, getWindowControl(), ores, null, commentSecCallback, true, false, true);
            commentsCtrl.expandComments(ureq);
            listenTo(commentsCtrl);
        }
        mainVC.put("comments", commentsCtrl.getInitialComponent());
    } else if (commentsCtrl != null) {
        mainVC.remove(commentsCtrl.getInitialComponent());
        removeAsListenerAndDispose(commentsCtrl);
        commentsCtrl = null;
    }
    if (editLink != null) {
        editLink.setVisible(secCallback.canEditPage(page));
    }
    if (editMetadataLink != null) {
        editMetadataLink.setVisible(secCallback.canEditMetadataBinder());
    }
    if (moveToTrashLink != null) {
        moveToTrashLink.setVisible(secCallback.canDeletePage(page));
    }
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) UserCommentsAndRatingsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)

Example 9 with ReadOnlyCommentsSecurityCallback

use of org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback in project openolat by klemens.

the class TableOfContentController method doOpenComments.

private void doOpenComments(UserRequest ureq, PageRow pageRow) {
    CommentAndRatingSecurityCallback commentSecCallback;
    if (PageStatus.isClosed(pageRow.getPage())) {
        commentSecCallback = new ReadOnlyCommentsSecurityCallback();
    } else {
        commentSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, false);
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, pageRow.getKey());
    commentsCtrl = new UserCommentsController(ureq, getWindowControl(), ores, null, commentSecCallback);
    listenTo(commentsCtrl);
    String title = translate("comment.title");
    cmc = new CloseableModalController(getWindowControl(), null, commentsCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)

Example 10 with ReadOnlyCommentsSecurityCallback

use of org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback in project openolat by klemens.

the class PageRunController method loadModel.

private void loadModel(UserRequest ureq, boolean reloadComments) {
    mainVC.contextPut("pageTitle", page.getTitle());
    pageCtrl.loadElements(ureq);
    dirtyMarker = false;
    if (secCallback.canComment(page)) {
        if (reloadComments && commentsCtrl != null) {
            mainVC.remove(commentsCtrl.getInitialComponent());
            removeAsListenerAndDispose(commentsCtrl);
            commentsCtrl = null;
        }
        if (commentsCtrl == null) {
            CommentAndRatingSecurityCallback commentSecCallback;
            if (PageStatus.isClosed(page)) {
                commentSecCallback = new ReadOnlyCommentsSecurityCallback();
            } else {
                commentSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, false);
            }
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, page.getKey());
            commentsCtrl = new UserCommentsAndRatingsController(ureq, getWindowControl(), ores, null, commentSecCallback, true, false, true);
            commentsCtrl.expandComments(ureq);
            listenTo(commentsCtrl);
        }
        mainVC.put("comments", commentsCtrl.getInitialComponent());
    } else if (commentsCtrl != null) {
        mainVC.remove(commentsCtrl.getInitialComponent());
        removeAsListenerAndDispose(commentsCtrl);
        commentsCtrl = null;
    }
    if (editLink != null) {
        editLink.setVisible(secCallback.canEditPage(page));
    }
    if (editMetadataLink != null) {
        editMetadataLink.setVisible(secCallback.canEditMetadataBinder());
    }
    if (moveToTrashLink != null) {
        moveToTrashLink.setVisible(secCallback.canDeletePage(page));
    }
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) UserCommentsAndRatingsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)

Aggregations

CommentAndRatingSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback)10 OLATResourceable (org.olat.core.id.OLATResourceable)10 ReadOnlyCommentsSecurityCallback (org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback)10 UserCommentsController (org.olat.core.commons.services.commentAndRating.ui.UserCommentsController)8 CommentAndRatingDefaultSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)6 Component (org.olat.core.gui.components.Component)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)4 PageController (org.olat.modules.portfolio.ui.editor.PageController)4 UserCommentsAndRatingsController (org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 WindowControl (org.olat.core.gui.control.WindowControl)2 WindowControlMocker (org.olat.core.gui.util.WindowControlMocker)2 PageMetadataController (org.olat.modules.portfolio.ui.PageMetadataController)2