Changeset 31540

Show
Ignore:
Timestamp:
27.03.2017 18:01:36 (2 years ago)
Author:
ak19
Message:

Some commits ahead of further changes: 1. Kathy came up with better name for GS2Construct.java method (to be refactored) that's more descriptive of the multiple tasks it performs. Removed unused paramter. 2. Javascript user_comments.js displays the heading for the comments section only when appropriate, which is when there is a comment history or when the form to add a comment is shown. Otherwise only the Add Comment link will be shown. 3. Changed core.css colours of links and headings in comments section to better match GS3. 4. document.xsl needs to display usercomments section not just for simple docs but also for wrapped docs.

Location:
main/trunk/greenstone3
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r31537 r31540  
    331331        // If a user is only adding comments, they don't need to have editing powers over a collection 
    332332        // but they need to be logged in 
    333         String[] docids = isAddingUserComments(request, params); 
     333        String[] docids = getDocIDsifAddingUserComments(params); //isAddingUserComments(request, params); 
    334334        boolean isAddingUserComments = (docids == null) ? false : true; 
    335335 
     
    10211021    } 
    10221022 
    1023  
    1024     protected String[] isAddingUserComments(Element request, HashMap<String, Serializable> params) { 
     1023    // getDocIdsWithOptFilter(JSONArray json, Pattern filterFields, boolean strictOrPermissible) 
     1024    protected String[] getDocIDsifAddingUserComments(HashMap<String, Serializable> params) { 
    10251025 
    10261026    String metaserver_command = (String) params.get("a"); // e.g. set-archives-metadata or set-metadata-array 
  • main/trunk/greenstone3/web/interfaces/default/js/user_comments.js

    r31537 r31540  
    7676    var i = 0; 
    7777    var looping = true; 
    78     var print_heading = false; // UNUSED SECTION if(print_heading) below 
    79      
     78 
     79     
     80    // if there's at least one existing comment OR if the form is currently being displayed 
     81    // (regardless of whether previous comments exist), display a heading for the comments section 
     82    if(metatable[0].metavals[0] != undefined || document.getElementById("usercommentform") != undefined) { 
     83    var heading=document.createElement("div"); 
     84    var attr=document.createAttribute("class"); 
     85    attr.nodeValue="usercommentheading"; 
     86    heading.setAttributeNode(attr); 
     87    var txt=document.createTextNode(gs.variables["textusercommentssection"]); ///"_textusercommentssection_"); 
     88    heading.appendChild(txt); 
     89    usercommentdiv.appendChild(heading); 
     90    } 
     91     
     92    
    8093    // metatable[0] = list of usernames, metatable[1] = list of timestamps, metatable[2] = list of comments  
    8194    // the 3 lists/arrays should be of even length. Assuming this, loop as long as there's another username 
     
    8699        }  
    87100    else { 
    88          
    89 // BEGIN UNUSED 
    90         if(print_heading) { 
    91         var heading=document.createElement("div"); 
    92         var attr=document.createAttribute("class"); 
    93         attr.nodeValue="usercommentheading"; 
    94         heading.setAttributeNode(attr); 
    95         var txt=document.createTextNode(gs.variables["textusercommentssection"]); ///"_textusercommentssection_"); 
    96         heading.appendChild(txt); 
    97         usercommentdiv.appendChild(heading); 
    98          
    99         print_heading = false; 
    100         } 
    101 // END UNUSED 
    102101         
    103102            var username = metaval_rec.metavalue; 
  • main/trunk/greenstone3/web/interfaces/default/style/core.css

    r31537 r31540  
    12531253.usercommentheading { 
    12541254    font-weight: bold; 
    1255     color: #006666; 
     1255    color: #3c8700; 
    12561256    border-top: solid 1px black; 
    12571257} 
     
    12681268 text-decoration: none; 
    12691269 font-weight: bold; 
    1270  color: #006666; 
     1270 color: #3c8700; 
    12711271} 
    12721272#usercommentlink a:visited, #usercommentlogoutlink a:visited { 
    1273     color: #006666; 
     1273    color: #3c8700; 
    12741274} 
    12751275 
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/usercomments.xsl

    r31537 r31540  
    2727  <div id="commentssection" class="centrediv">     
    2828    <div id="usercomments"> 
    29       <!-- The div that loads the user comments that were already submitted --> 
    30       <div class="usercommentheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'usercomments.heading')"/></div> 
     29      <!-- A heading for the comment section will be added here dynamically either if 
     30       previously submitted comments exist, or if the form#usercommentform to add 
     31       a new comment is displayed. Otherwise only the "Add Comments" link is shown. --> 
     32      <xsl:comment>Existing comments will be loaded dynamically loaded into this div#usercomments</xsl:comment> 
    3133    </div> 
    3234 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl

    r31537 r31540  
    374374            <xsl:otherwise> <!-- display the standard greenstone document --> 
    375375                <xsl:call-template name="wrappedDocument"/> 
     376                <br /><xsl:call-template name="userCommentsSection"/> 
    376377            </xsl:otherwise> 
    377378        </xsl:choose>