- Timestamp:
- 2013-04-26T15:51:49+12:00 (11 years ago)
- Location:
- main/trunk/greenstone2/macros
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/macros/document.dm
r27258 r27259 144 144 </p> 145 145 146 <input type="submit" value="_textaddcomment_" onclick="addUserComment(document.AddUserCommentForm.username.value, document.AddUserCommentForm.comment.value, document.AddUserCommentForm.d.value); return false;"> 146 <input type="submit" value="_textaddcomment_" onclick="addUserComment(document.AddUserCommentForm.username.value, document.AddUserCommentForm.comment.value, document.AddUserCommentForm.d.value, document); return false;"> 147 <label id="usercommentfeedback"></label> 147 148 </form> 148 149 ) 150 149 151 <script type="text/javascript"> 150 function addUserComment(_username, _comment, _docid) \{ 152 153 // http://stackoverflow.com/questions/3830244/get-current-date-time-in-seconds 154 function safeHTML(str) \{ 155 return str.replace("&", "&").replace("<", "<").replace(">", ">").replace('"',""").replace("'","'").replace("/", "/"); //"\\"" 156 \} 157 158 function addUserComment(_username, _comment, _docid, doc) \{ 151 159 // Need to the add user comment meta of username, timestamp and comment to the 152 160 // topmost section of the document. So only get the docId up to any period mark: … … 155 163 _docid = _docid.substring(0, period); 156 164 \} 165 166 // Entity encode the values before storing (at least <, >, /. And single and double quote, ampersand) 167 // http://stackoverflow.com/questions/6020714/escape-html-using-jquery 168 _username = safeHTML(_username); 169 _comment = safeHTML(_comment); 157 170 158 171 // Want to store username, timestamp and comment in import/metadata.xml, archives/doc.xml … … 210 223 // GSAPI already knows the collection 211 224 gsapi.setMetadataArray(docArray, "accumulate","import|archives|index"); 212 225 //doc.AddUserCommentForm.comment.value = "submitted"; 226 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_"; //"submitted"; // <p id="feedback"></p> 213 227 \} 214 228 </script> -
main/trunk/greenstone2/macros/english.dm
r27257 r27259 337 337 338 338 _textcommentusername_ {User name:} 339 _textaddusercomment_ { Add user comment:}339 _textaddusercomment_ {Comment:} 340 340 _textaddcomment_ {add comment} 341 _textcommentsubmitted_ {Comment Submitted} 341 342 342 343 _textgoto_ {go to page}
Note:
See TracChangeset
for help on using the changeset viewer.