Package org.olat.core.commons.services.commentAndRating

Examples of org.olat.core.commons.services.commentAndRating.CommentAndRatingService


  private void addPageRating(UserRequest ureq) {
    if ( ! ContextHelpModule.isContextRatingEnabled()
      || ! ureq.getUserSession().isAuthenticated()
      || contextHelpPageVC == null ) return;
   
    CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
    if (commentAndRatingService != null) {       
      Roles roles = ureq.getUserSession().getRoles();
      OLATResourceable helpOres = OresHelper.createOLATResourceableType("contexthelp");
      String key = ContextHelpManager.getInstance().calculateCombinedKey(pageTranslator.getLocale(), bundleName, page);
      commentAndRatingService.init(getIdentity(), helpOres, key, roles.isOLATAdmin(), roles.isGuestOnly());
      UserCommentsAndRatingsController commentsAndRatingCtr = commentAndRatingService.createUserCommentsAndRatingControllerExpandable(ureq, getWindowControl());
      listenTo(commentsAndRatingCtr);
      contextHelpWrapperVC.put("commentsAndRatingCtr", commentsAndRatingCtr.getInitialComponent());   
    }
  }
View Full Code Here


    // Add date component
    if(item.getDate() != null) {
      DateComponentFactory.createDateComponentWithYear("dateComp", item.getDate(), vcItem);
    }
    // Add rating and commenting controller - only when configured
    CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
    if (commentAndRatingService != null) {       
      commentAndRatingService.init(getIdentity(), feed, item.getGuid(), callback.mayEditMetadata(), ureq.getUserSession().getRoles().isGuestOnly());
      commentsCtr = commentAndRatingService.createUserCommentsAndRatingControllerExpandable(ureq, getWindowControl());
      listenTo(commentsCtr);
      vcItem.put("commentsAndRating", commentsCtr.getInitialComponent());       
    }
    //
    this.putInitialPanel(vcItem);
View Full Code Here

   * @param ureq
   * @param feed
   * @param item
   */
  private void createCommentsAndRatingsLink(UserRequest ureq, Feed feed, Item item) {
    CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
    if (commentAndRatingService != null) {       
      commentAndRatingService.init(getIdentity(), feed, item.getGuid(), callback.mayEditMetadata(), ureq.getUserSession().getRoles().isGuestOnly());
      UserCommentsAndRatingsController commentsAndRatingCtr = commentAndRatingService.createUserCommentsAndRatingControllerMinimized(ureq, getWindowControl());
      commentsAndRatingCtr.addUserObject(item);
      listenTo(commentsAndRatingCtr);
      String guid = item.getGuid();
      vcItems.put("commentsAndRating." + guid, commentsAndRatingCtr.getInitialComponent());
    }
View Full Code Here

   */
  @Override
  public void delete(OLATResourceable feed) {
    FileResourceManager.getInstance().deleteFileResource(feed);
    // Delete comments and ratings
    CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
    if (commentAndRatingService != null) {       
      commentAndRatingService.init(null, feed, null, true, false);
      commentAndRatingService.deleteAllIgnoringSubPath();
    }
    //
    feed = null;
  }
View Full Code Here

        // Update feed
        reloadedFeed.setLastModified(new Date());
        update(reloadedFeed, false);
       
        // Delete comments and ratings
        CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
        if (commentAndRatingService != null) {       
          commentAndRatingService.init(null, feed, item.getGuid(), true, false);
          commentAndRatingService.deleteAll();
        }
        //
        return null;
      }
    });
View Full Code Here

      ident1 = JunitTestHelper.createAndPersistIdentityAsUser(identityTest1Name);
      ident2 = JunitTestHelper.createAndPersistIdentityAsUser(identityTest2Name);
      ident3 = JunitTestHelper.createAndPersistIdentityAsUser(identityTest3Name);
      DBFactory.getInstance().closeSession();
      //   
      CommentAndRatingService service = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
      if (service != null) {       
        service.init(ident1, ores, null, true, false);
      }
      CommentAndRatingService serviceWithSubPath = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
      if (serviceWithSubPath != null) {
        serviceWithSubPath.init(ident1, ores, "blubli", true, false);       
      }
      //
      isInitialized = true;
    }
  }
View Full Code Here

TOP

Related Classes of org.olat.core.commons.services.commentAndRating.CommentAndRatingService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.