Changeset 27258


Ignore:
Timestamp:
04/25/13 14:54:29 (8 years ago)
Author:
ak19
Message:
  1. The Add User Comment form is no longer displayed when Browsing, only on document pages. 2. When a user is in a subsection and tries to add a comment, it should get added to the top section, which is at the docid level, and not get added at the subsection level. This also means that import's metadata will be set correctly in metadata.xml, since import doesn't store subsection level meta.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/macros/document.dm

    r27257 r27258  
    125125#######################################################################
    126126
    127 # For
     127# Display the add-user-comment form on actual document pages and not when browsing/searching
     128# This means the form should only be displayed on pages where the _cgiargd_ (the docid) is set
     129
     130# For getting the submitbutton to make Ajax calls, see
    128131# http://stackoverflow.com/questions/4264091/input-type-submit-instead-of-input-type-button-with-ajax
    129132# http://stackoverflow.com/questions/8869341/ajax-form-submit-with-submit-button
    130133
    131134_usercomment_ {
     135
     136_If_(_cgiargd_,
    132137
    133138<form name="AddUserCommentForm">
     
    141146<input type="submit" value="_textaddcomment_" onclick="addUserComment(document.AddUserCommentForm.username.value, document.AddUserCommentForm.comment.value, document.AddUserCommentForm.d.value); return false;">
    142147</form>
    143 
     148)
    144149<script type="text/javascript"> 
    145150    function addUserComment(_username, _comment, _docid) \{
     151        // Need to the add user comment meta of username, timestamp and comment to the
     152        // topmost section of the document. So only get the docId up to any period mark:
     153        var period = _docid.indexOf(".");
     154        if(period != -1) \{
     155            _docid = _docid.substring(0, period);
     156        \}
    146157
    147158        // Want to store username, timestamp and comment in import/metadata.xml, archives/doc.xml
     
    183194
    184195        var comment_rec = \{
    185             metaname: "comment",
     196            metaname: "usercomment",
    186197            metavals: [_comment]
    187198        \};
     
    203214</script>
    204215}
     216
    205217
    206218#######################################################################
Note: See TracChangeset for help on using the changeset viewer.