Changeset 7450

Show
Ignore:
Timestamp:
03/17/09 16:36:12 (17 months ago)
Author:
josowski
Message:

Reworked logic for what displays when on the article comments page. This improves the UI a bit, and fixes at least one bug.

References #1137

Location:
head/ambra/webapp/src/main
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • head/ambra/webapp/src/main/java/org/topazproject/ambra/article/action/FetchArticleAction.java

    r7401 r7450  
    8484  private String transformedArticle; 
    8585  private String annotationId = ""; 
     86  private String annotationSet = ""; 
    8687 
    8788  private int numDiscussions = 0; 
     
    143144    try { 
    144145      setCommonData(); 
     146 
     147      annotationSet = "comments"; 
    145148      setAnnotations(annotationService.COMMENT_SET); 
    146149 
     
    165168    try { 
    166169      setCommonData(); 
     170 
     171      annotationSet = "corrections"; 
    167172      setAnnotations(annotationService.CORRECTION_SET); 
    168173 
     
    360365 
    361366  /** 
     367   * Get the type of annotations currently being listed 
     368   * @return the annotation set either "comments" or "corrections" 
     369   */ 
     370  public String getAnnotationSet() { 
     371     return annotationSet; 
     372  } 
     373 
     374  /** 
    362375   * Return the ArticleInfo from the Browse cache. 
    363376   * 
  • head/ambra/webapp/src/main/webapp/article/article_comments.ftl

    r7442 r7450  
    2525<@s.url namespace="/article" includeParams="none" id="commentsURL" action="fetchArticleComments" articleURI="${articleInfo.id}"/> 
    2626 
    27 <#assign nonComments=false/> 
    28 <#list commentary as comment> 
    29   <#if (comment.annotation.isComment() == false)> 
    30     <#assign nonComments=true /> 
    31   </#if> 
    32 </#list> 
    33  
    3427<div id="content" class="article" style="visibility:visible;"> 
    3528  <#include "article_rhc.ftl"> 
    3629 
    3730  <div id="articleContainer"> 
    38    <#if nonComments == true> 
    39     <div id="researchArticle" class="content corrections"> 
     31   <#if annotationSet == "corrections"> 
     32    <div id="researchArticle" class="content corrections comments"> 
    4033   <#else> 
    4134    <div id="researchArticle" class="content comments"> 
     
    4740      <#include "article_tabs.ftl"> 
    4841      <div class="rss"><a href="#">Comments RSS</a></div> 
    49       <#if commentary?size == 0> 
    50         <p>There are currently no notes or comments yet on this article. You can <a href="${startDiscussionUrl}" title="Click to make a new comment on this article" class="discuss icon">add a comment</a> or return to the original article to add a note.</p> 
     42      <ul> 
     43      <#if ((numDiscussions + numComments) > 0 && annotationSet != "comments")> 
     44        <li><a href="${commentsURL}" title="View all Comments" class="discuss icon">View all Comments</a></li> 
     45      </#if> 
     46      <#if (numRetractions > 0 && annotationSet != "corrections")> 
     47        <li><a href="${correctionsURL}" title="View Retraction" class="corrections icon">View Retraction</a></li> 
    5148      <#else> 
    52         <ul> 
    53         <#if nonComments == true> 
    54           <li><a href="${commentsURL}" title="View all Comments" class="discuss icon">View all Comments</a></li> 
    55         <#else> 
    56           <#if (numRetractions > 0)> 
    57             <li><a href="${correctionsURL}" title="View Retraction" class="corrections icon">View Retraction</a></li> 
     49        <#if ((numFormalCorrections + numMinorCorrections) > 0 && annotationSet != "corrections")> 
     50        <li><a href="${correctionsURL}" title="View all corrections" class="corrections icon">View all corrections</a></li> 
     51        </#if> 
     52      </#if> 
     53        <li><a href="${startDiscussionUrl}" title="Click to make a new comment on this article" class="discuss icon">Make a new comment on this article</a></li> 
     54      </ul> 
     55      <#if (commentary?size > 0)> 
     56      <table class="directory" cellpadding="0" cellspacing="0"> 
     57        <#list commentary as comment> 
     58          <@s.url namespace="/annotation" includeParams="none" id="listThreadURL" action="listThread" root="${comment.annotation.id}" inReplyTo="${comment.annotation.id}"/> 
     59          <@s.url namespace="/user" includeParams="none" id="showUserURL" action="showUser" userId="${comment.annotation.creator}"/> 
     60 
     61          <#if ((comment.annotation.context)!"")?length == 0> 
     62            <#assign class="discuss"/> 
    5863          <#else> 
    59             <#if ((numFormalCorrections + numMinorCorrections) > 0)> 
    60             <li><a href="${correctionsURL}" title="View all corrections" class="corrections icon">View all corrections</a></li> 
    61             </#if> 
     64            <#assign class="annotation"/> 
    6265          </#if> 
    63         </#if> 
    64           <li><a href="${startDiscussionUrl}" title="Click to make a new comment on this article" class="discuss icon">Make a new comment on this article</a></li> 
    65         </ul> 
    66         <table class="directory" cellpadding="0" cellspacing="0"> 
    67           <#list commentary as comment> 
    68             <@s.url namespace="/annotation" includeParams="none" id="listThreadURL" action="listThread" root="${comment.annotation.id}" inReplyTo="${comment.annotation.id}"/> 
    69             <@s.url namespace="/user" includeParams="none" id="showUserURL" action="showUser" userId="${comment.annotation.creator}"/> 
     66          <#assign numReplies = comment.numReplies> 
     67          <#if numReplies != 1> 
     68            <#assign label = "responses"> 
     69          <#else> 
     70            <#assign label = "response"> 
     71          </#if> 
    7072 
    71             <#if ((comment.annotation.context)!"")?length == 0> 
    72               <#assign class="discuss"/> 
    73             <#else> 
    74               <#assign class="annotation"/> 
    75             </#if> 
    76             <#assign numReplies = comment.numReplies> 
    77             <#if numReplies != 1> 
    78               <#assign label = "responses"> 
    79             <#else> 
    80               <#assign label = "response"> 
    81             </#if> 
    82  
    83             <tr> 
    84               <td class="replies">${comment.numReplies} ${label}<br /></td> 
    85               <td class="title"><a href="${listThreadURL}" title="View Full Discussion Thread" class="${class} icon">${comment.annotation.commentTitle}</a></td> 
    86               <td class="info">Posted by <a href="${showUserURL}" title="Discussion Author" class="user icon">${comment.annotation.creatorName}</a> on <strong>${comment.annotation.createdAsDate?string("dd MMM yyyy '</strong>at<strong>' HH:mm zzz")}</strong></td> 
    87             </tr> 
    88             <tr> 
    89               <td colspan="3" class="last">Most recent response on <strong>${comment.lastModifiedAsDate?string("dd MMM yyyy '</strong>at<strong>' HH:mm zzz")}</strong></td> 
    90             </tr> 
    91           </#list> 
    92         </table> 
     73          <tr> 
     74            <td class="replies">${comment.numReplies} ${label}<br /></td> 
     75            <td class="title"><a href="${listThreadURL}" title="View Full Discussion Thread" class="${class} icon">${comment.annotation.commentTitle}</a></td> 
     76            <td class="info">Posted by <a href="${showUserURL}" title="Discussion Author" class="user icon">${comment.annotation.creatorName}</a> on <strong>${comment.annotation.createdAsDate?string("dd MMM yyyy '</strong>at<strong>' HH:mm zzz")}</strong></td> 
     77          </tr> 
     78          <tr> 
     79            <td colspan="3" class="last">Most recent response on <strong>${comment.lastModifiedAsDate?string("dd MMM yyyy '</strong>at<strong>' HH:mm zzz")}</strong></td> 
     80          </tr> 
     81        </#list> 
     82      </table> 
    9383      </#if> 
    9484    </div>