Example #1
0
 public void onEvent(
     Event<UIModerationForum> event, UIModerationForum moderationForum, final String objectId)
     throws Exception {
   ForumSearch forumSearch = moderationForum.getObject(objectId);
   UIPopupContainer popupContainer = moderationForum.getAncestorOfType(UIPopupContainer.class);
   UIPopupAction popupAction = popupContainer.getChild(UIPopupAction.class);
   if (forumSearch.getType().equals(Utils.TOPIC)) {
     try {
       Topic topic =
           moderationForum.getForumService().getTopicByPath(forumSearch.getPath(), false);
       UIViewTopic viewTopic = popupAction.activate(UIViewTopic.class, 700);
       viewTopic.setTopic(topic);
       viewTopic.setActionForm(new String[] {"Approve", "DeleteTopic", "Close"});
       event.getRequestContext().addUIComponentToUpdateByAjax(popupAction);
     } catch (Exception e) {
       moderationForum.log.warn("Failed to view topic: ", e);
     }
   } else {
     try {
       Post post =
           moderationForum
               .getForumService()
               .getPost(
                   ForumUtils.EMPTY_STR,
                   ForumUtils.EMPTY_STR,
                   ForumUtils.EMPTY_STR,
                   forumSearch.getPath());
       UIViewPost viewPost = popupAction.activate(UIViewPost.class, 700);
       viewPost.setPostView(post);
       viewPost.setViewUserInfo(false);
       viewPost.setActionForm(new String[] {"Approve", "DeletePost", "Close", "OpenTopicLink"});
       event.getRequestContext().addUIComponentToUpdateByAjax(popupAction);
     } catch (Exception e) {
       moderationForum.log.warn("Failed to view post: ", e);
     }
   }
 }
Example #2
0
 private ForumSearch getObject(String id) throws Exception {
   for (ForumSearch obj : list_) {
     if (obj.getId().equals(id)) return obj;
   }
   return null;
 }