Changeset 27277 for main/trunk/greenstone2/macros/document.dm
- Timestamp:
- 2013-04-29T20:25:28+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/macros/document.dm
r27260 r27277 151 151 <script type="text/javascript"> 152 152 153 // http://stackoverflow.com/questions/3830244/get-current-date-time-in-seconds 153 // Unused. Replaced in favour of call to escape() in setMetaArray function that calls urlPostSync 154 // http://stackoverflow.com/questions/6020714/escape-html-using-jquery 154 155 function safeHTML(str) \{ 155 156 return str.replace("&", "&").replace("<", "<").replace(">", ">").replace('"',""").replace("'","'").replace("/", "/"); //"\\"" 156 157 \} 158 157 159 158 160 function addUserComment(_username, _comment, _docid, doc) \{ … … 163 165 _docid = _docid.substring(0, period); 164 166 \} 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); 167 170 168 171 169 // Want to store username, timestamp and comment in import/metadata.xml, archives/doc.xml … … 183 181 184 182 185 // To make individual api calls to set username meta, then timestamp then comment meta: 183 // Entity encode the values before storing (at least <, >, /. And single and double quote, ampersand) 184 // http://stackoverflow.com/questions/6020714/escape-html-using-jquery 185 // setMetadataArray escapes the entire JSON, is that better than escaping individually here? 186 //_docid = escape(_docid); 187 //_timestamp = escape(_timestamp); 188 //_username = escape(_username); //safeHTML(_username); 189 //_comment = escape(_comment); //safeHTML(_comment); 190 191 // Use this if making individual api calls to set username meta, then timestamp then comment meta 186 192 // GSAPI already knows the collection 187 193 //gsapi.setMetadata(_docid, "username", null, _username, "accumulate", "import|archives|index"); … … 222 228 223 229 // GSAPI already knows the collection 224 gsapi.setMetadataArray(docArray, "accumulate","import|archives|index"); 225 //doc.AddUserCommentForm.comment.value = "submitted"; 226 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_"; //"submitted"; // <p id="feedback"></p> 230 gsapi.setMetadataArray(docArray, "accumulate", "import|archives|index"); 231 doc.AddUserCommentForm.comment.value = ""; 232 doc.AddUserCommentForm.username.value = ""; 233 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_"; 227 234 \} 228 235 </script>
Note:
See TracChangeset
for help on using the changeset viewer.