Package org.olat.modules.fo

Examples of org.olat.modules.fo.Message


      // => it is a file element, typeName format: 'path=/test1/test2/readme.txt'
      return true;
    } else if ((ores != null) && ores.getResourceableTypeName().equals( OresHelper.calculateTypeName(Message.class) ) ) {
      // it is message => check message access
      Long resourceableId = ores.getResourceableId();
      Message message = ForumManager.getInstance().loadMessage(resourceableId);
      Message threadtop = message.getThreadtop();
      if(threadtop==null) {
        threadtop = message;
      }
      boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
      //assumes that if is owner then is moderator so it is allowed to see the hidden forum threads   
      //TODO: (LD) fix this!!! - the contextEntry is not the right context for this check
      boolean isOwner = ManagerFactory.getManager().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS,  contextEntry.getOLATResourceable());
      if(isMessageHidden && !isOwner) {
        return false;
View Full Code Here


    Long l = new Long(forumId);
    Forum f = fm.loadForum(l);
    messages = fm.getMessagesByForum(f);
   
    for (Iterator iterTop = messages.iterator(); iterTop.hasNext();) {
      Message msg = (Message) iterTop.next();
      if (msg.getParent() == null) {
        iterTop.remove();
        MessageNode topNode = new MessageNode(msg);
        if(topNode.isHidden() && (forumCallback==null || (forumCallback!=null && forumCallback.mayEditMessageAsModerator()))) {
          addChildren(messages, topNode);
          topNodeList.add(topNode);
View Full Code Here

    MessageNode topNode = null;
    ForumManager fm = ForumManager.getInstance();
    Long l = new Long(topMessageId);
    messages = fm.getThread(l);
    for (Iterator iterTop = messages.iterator(); iterTop.hasNext();) {
      Message msg = (Message) iterTop.next();
      if (msg.getParent() == null) {
        iterTop.remove();
        topNode = new MessageNode(msg);
        addChildren(messages, topNode);
      }
    }
View Full Code Here

    return topNode;
  }
 
  private void addChildren(List messages, MessageNode mn){
    for(Iterator iterMsg = messages.iterator();iterMsg.hasNext();){
      Message msg = (Message) iterMsg.next();
      if ((msg.getParent() != null) && (msg.getParent().getKey() == mn.getKey())){
        MessageNode childNode = new MessageNode(msg);
        mn.addChild(childNode);
        //FIXME:as:c next line is not necessary
        childNode.setParent(mn);
        addChildren(messages, childNode);
View Full Code Here

   */
  public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
    //   TODO:chg: check with collabTools if forum is enabled
    ContextEntry ce = businessControl.popLauncherContextEntry();
    Long resourceableId = ce.getOLATResourceable().getResourceableId();
    Message message = ForumManager.getInstance().loadMessage(resourceableId);
    Message threadtop = message.getThreadtop();
    if(threadtop==null) {
      threadtop = message;
    }
    boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
    //assumes that if is owner then is moderator so it is allowed to see the hidden forum threads
    //TODO: (LD) fix this!!!
    //here it is checked if the identity is owner of the forum tool but it has no way to find out whether is owner of the group that owns the forum tool
    boolean isOwner = ManagerFactory.getManager().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS,  contextEntry.getOLATResourceable());
    if(isMessageHidden && !isOwner) {
View Full Code Here

  }
 
  public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
    ContextEntry ce = businessControl.popLauncherContextEntry();
    Long resourceableId = ce.getOLATResourceable().getResourceableId();
    Message message = ForumManager.getInstance().loadMessage(resourceableId);
    Message threadtop = message.getThreadtop();
    if(threadtop==null) {
      threadtop = message;
    }
    boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
    //assumes that if is owner then is moderator so it is allowed to see the hidden forum threads
     //TODO: (LD) fix this!!! - the contextEntry is not the right context for this check
    boolean isOwner = ManagerFactory.getManager().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS,  contextEntry.getOLATResourceable());
    if(isMessageHidden && !isOwner) {
      return false;
View Full Code Here

    List<Message> messages = new ArrayList<Message>();
    for (int i = 0; i < allMessages.size(); i++) {
      if (messages.size() == itemsToDisplay) {
        break;
      }
      Message message = allMessages.get(i);
      messages.add(message);
      // add link to item
      // Add link to jump to course node
      Link nodeLink = LinkFactory.createLink("nodeLink_" + message.getKey(), peekviewVC, this);
      nodeLink.setCustomDisplayText(message.getTitle());
      nodeLink.setCustomEnabledLinkCSS("b_with_small_icon_left o_forum_message_icon o_gotoNode");
      nodeLink.setUserObject(Long.toString(message.getKey()));       
    }
    peekviewVC.contextPut("messages", messages);
    // Add link to show all items (go to node)
    Link allItemsLink = LinkFactory.createLink("peekview.allItemsLink", peekviewVC, this);
    allItemsLink.setCustomEnabledLinkCSS("b_float_right");
View Full Code Here

          List<Message> allMessages = fMgr.getMessagesByForumID(forumKey);
          fCounter++;
          int mCounter = 0;
          for (Iterator<Message> iterator2 = allMessages.iterator(); iterator2.hasNext();) {
            try{
              Message message = iterator2.next();
              if (log.isDebug()){
                log.audit("    - Message inside: " + message.getTitle() + " key: " + message.getKey());
              }
              String oldValue = message.getBody();
              String newMsgBody = migrateStringSavely(oldValue);
              message.setBody(newMsgBody);
              // Update message without ForumManager to prevent resetting the lastModifiedTime
              DBFactory.getInstance().updateObject(message);
              mCounter ++;
              DBFactory.getInstance().intermediateCommit();
            } catch (Exception e) {
View Full Code Here

      List<Message> allMessages = fMgr.getMessagesByForumID(forumKey);
      fCounter++;
      int mCounter = 0;
      for (Iterator<Message> iterator2 = allMessages.iterator(); iterator2.hasNext();) {
        try {
          Message message = iterator2.next();
          if (log.isDebug()) {
            log.audit("    - Message inside: " + message.getTitle() + " key: " + message.getKey());
          }
          String msgBody = message.getBody();
          String filteredVal = xssFilter.filter(msgBody);
          if (msgBody.equals(filteredVal)){
            sucCounter++;
          } else {
            String errMsg = xssFilter.getOrPrintErrorMessages();
View Full Code Here

TOP

Related Classes of org.olat.modules.fo.Message

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.