Changeset 27293 for main/trunk/greenstone2/macros/document.dm
- Timestamp:
- 2013-05-02T17:43:31+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/macros/document.dm
r27281 r27293 166 166 167 167 function addUserComment(_username, _comment, _docid, doc) \{ 168 169 // don't add empty strings for name/comment 170 171 // http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript 172 var trimmed_username=_username.replace(/^\s+|\s+$/g, ''); 173 var trimmed_comment = _comment.replace(/^\s+|\s+$/g, ''); 174 175 if(!trimmed_username || !trimmed_comment) \{ 176 doc.AddUserCommentForm.comment.value = ""; 177 doc.AddUserCommentForm.username.value = ""; 178 doc.getElementById("usercommentfeedback").innerHTML = "_text-is-empty_"; 179 return; 180 \} 181 168 182 // Need to the add user comment meta of username, timestamp and comment to the 169 183 // topmost section of the document. So only get the docId up to any period mark: … … 241 255 242 256 // update display of existing user comments to show the newly added comment 243 loadUserComments(); 257 var usercommentdiv = document.getElementById("usercomments"); 258 if(usercommentdiv != undefined) \{ 259 displayInUserCommentList(usercommentdiv, _username, _timestamp, _comment); 260 \} 244 261 \} 245 262 </script>
Note:
See TracChangeset
for help on using the changeset viewer.