Changeset 27297 for main/trunk


Ignore:
Timestamp:
2013-05-03T21:28:37+12:00 (11 years ago)
Author:
ak19
Message:

Username field should not be cleared as it's no longer hidden and stores the logged in user. Also added a logout for the add comments feature, but there's probably a better way to do this, though the admin pages don't provide a logout and require you to log in repeatedly.

Location:
main/trunk/greenstone2
Files:
4 edited

Legend:

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

    r27294 r27297  
    164164<input type="submit" value="_textaddcomment_" onclick="addUserComment(document.AddUserCommentForm.username.value, document.AddUserCommentForm.comment.value, document.AddUserCommentForm.d.value, document); return false;">
    165165<label id="usercommentfeedback"></label>
     166
     167<!--<div id="usercommentlogoutlink"><a href="_doc-url_&amp;un=">_text-usercomment-logout_</a></div>-->
     168<div id="usercommentlogoutlink"><a href="#" onclick="javascript:logout(); return false;">_text-usercomment-logout_</a></div>
    166169</form>
    167170
     
    260263
    261264        // GSAPI already knows the collection
    262         gsapi.setMetadataArray(docArray, "accumulate", "import|archives|index");       
    263         doc.AddUserCommentForm.comment.value = "";
    264         doc.AddUserCommentForm.username.value = "";
     265        gsapi.setMetadataArray(docArray, "accumulate", "import|archives|index");
     266
     267        // clear the comment field as it has now been submitted, but not the username field
     268        // as the user is logged in, so they should be able to commit again under their username.
     269        doc.AddUserCommentForm.comment.value = "";
    265270        doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_";
    266271
  • main/trunk/greenstone2/macros/english.dm

    r27294 r27297  
    338338_textcommentusername_ {User name}
    339339_textaddusercomment_ {Add Comment}
     340_text-usercomment-logout_ {Logout}
    340341_textaddcomment_ {submit comment}
    341342_textcommentsubmitted_ {Comment Submitted}
  • main/trunk/greenstone2/macros/style.dm

    r27296 r27297  
    250250   \}
    251251
     252   // Logout is the following operation
     253   // _gwcgi_?e=_compressedoptions_&amp;a=_cgiarga_&amp;c=_cgiargc_&amp;cl=_cgiargcl_&amp;d=_cgiargd_&un=
     254   // Maybe this is better done as a post?
     255   // http://mentaljetsam.wordpress.com/2008/06/02/using-javascript-to-post-data-between-pages/
     256   function logout() \{
     257     var logoutForm = document.createElement("form");
     258     logoutForm.method="post" ;
     259     logoutForm.action = "_gwcgi_";
     260
     261     var params = \{
     262         e: "_compressedoptions_",
     263         a: "_cgiarga_",
     264         c: "_cgiargc_",
     265         cl: "_cgiargcl_",
     266         d: "_cgiargd_",
     267         un: null
     268     \};
     269
     270     for (var param in params) \{
     271         var myInput = document.createElement("input") ;
     272             myInput.setAttribute("name", param) ;
     273         myInput.setAttribute("value", params[param]);
     274         logoutForm.appendChild(myInput) ;
     275      \}
     276      document.body.appendChild(logoutForm) ;
     277      logoutForm.submit() ;
     278      document.body.removeChild(logoutForm) ;
     279   \}
    252280
    253281    function loadUserComments() \{
  • main/trunk/greenstone2/web/style/style.css

    r27294 r27297  
    349349}
    350350
    351 #usercommentlink {
     351#usercommentlink, #usercommentlogoutlink {
    352352    margin: 10px 0 20px 0;
    353353}
    354354
    355 #usercommentlink a {
     355#usercommentlink a, #usercommentlogoutlink a {
    356356 text-decoration: none;
    357357 font-weight: bold;
    358358}
     359#usercommentlink a:visited, #usercommentlogoutlink a:visited {
     360    color: #006666;
     361}
Note: See TracChangeset for help on using the changeset viewer.