Search in sources :

Example 11 with UserCommentsController

use of org.olat.core.commons.services.commentAndRating.ui.UserCommentsController in project openolat by klemens.

the class RepositoryEntryListController method doOpenComments.

protected void doOpenComments(UserRequest ureq, RepositoryEntryRow row) {
    if (commentsCtrl != null)
        return;
    boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
    CommentAndRatingSecurityCallback secCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
    commentsCtrl = new UserCommentsController(ureq, getWindowControl(), row.getRepositoryEntryResourceable(), null, secCallback);
    commentsCtrl.setUserObject(row);
    listenTo(commentsCtrl);
    cmc = new CloseableModalController(getWindowControl(), "close", commentsCtrl.getInitialComponent(), true, translate("comments"));
    listenTo(cmc);
    cmc.activate();
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) 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 12 with UserCommentsController

use of org.olat.core.commons.services.commentAndRating.ui.UserCommentsController 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)

Aggregations

CommentAndRatingSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback)12 UserCommentsController (org.olat.core.commons.services.commentAndRating.ui.UserCommentsController)12 OLATResourceable (org.olat.core.id.OLATResourceable)10 CommentAndRatingDefaultSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 ReadOnlyCommentsSecurityCallback (org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback)8 Component (org.olat.core.gui.components.Component)4 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)4 PageController (org.olat.modules.portfolio.ui.editor.PageController)4 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