- Timestamp:
- 2013-05-16T19:45:16+12:00 (11 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/macros/document.dm
r27363 r27365 183 183 184 184 // http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript 185 var trimmed_username=_username.replace(/^\s+|\s+$/g, '');185 //var trimmed_username=_username.replace(/^\s+|\s+$/g, ''); 186 186 var trimmed_comment = _comment.replace(/^\s+|\s+$/g, ''); 187 187 188 if(!trimmed_ username || !trimmed_comment) \{189 doc.AddUserCommentForm.comment.value = ""; 190 doc.AddUserCommentForm.username.value = "";188 if(!trimmed_comment) \{ // || !trimmed_username 189 doc.AddUserCommentForm.comment.value = ""; 190 //doc.AddUserCommentForm.username.value = ""; 191 191 doc.getElementById("usercommentfeedback").innerHTML = "_text-is-empty_"; 192 192 return; … … 262 262 263 263 // GSAPI already knows the collection 264 gsapi.setMetadataArray(docArray, "accumulate", "import|archives|index");264 var result = gsapi.setMetadataArray(docArray, "accumulate", "import|archives|index"); 265 265 266 266 // clear the comment field as it has now been submitted, but not the username field 267 267 // as the user is logged in, so they should be able to commit again under their username. 268 268 doc.AddUserCommentForm.comment.value = ""; 269 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_"; 270 271 // update display of existing user comments to show the newly added comment 272 var usercommentdiv = document.getElementById("usercomments"); 273 if(usercommentdiv != undefined) \{ 269 270 // check for locked collection error 271 var errorIndex = result.indexOf("ERROR"); 272 if(errorIndex != -1) \{ 273 var endIndex = result.indexOf("\\n"); 274 var error = result.substring(errorIndex,endIndex); 275 errormessage="Unable to add comment. " + error; 276 doc.getElementById("usercommentfeedback").innerHTML = errormessage; 277 //alert("Result: " + result); 278 \} else \{ 279 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_"; 280 281 // update display of existing user comments to show the newly added comment 282 var usercommentdiv = document.getElementById("usercomments"); 283 if(usercommentdiv != undefined) \{ 274 284 displayInUserCommentList(usercommentdiv, _username, _timestamp, _comment); 275 \} 285 \} 286 \} 276 287 \} 277 288 </script> -
main/trunk/greenstone2/web/script/gsajaxapi.js
r27322 r27365 344 344 345 345 //this.urlGetSync(mdserver + "?" + params); 346 this.urlPostSync(mdserver,params);346 return this.urlPostSync(mdserver,params); 347 347 } 348 348
Note:
See TracChangeset
for help on using the changeset viewer.