Changeset 38234 for main/trunk/greenstone3
- Timestamp:
- 2023-09-26T21:56:47+13:00 (8 months ago)
- Location:
- main/trunk/greenstone3/web/interfaces/default/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js
r38218 r38234 1029 1029 where, successResponseFunction, forceSync, errorResponseFunction) 1030 1030 { 1031 alert("in gs.functions.removeMetaArray START");1032 1033 1031 if( typeof errorResponseFunction === 'undefined' ) { errorResponseFunction = null; } // force error callback to be defined: either null or has value 1034 1032 … … 1045 1043 var response = gs.functions._callMetadataServer("Removing metadata from "+where, payload, successResponseFunction, errorResponseFunction, {"forceSync": forceSync, "requestMethod": "POST"}); 1046 1044 1047 console.log("in gs.functions.removeMetaArray: " + JSON.stringify(payload));1045 //console.log("in gs.functions.removeMetaArray: " + JSON.stringify(payload)); 1048 1046 1049 1047 return response; -
main/trunk/greenstone3/web/interfaces/default/js/user_comments.js
r38232 r38234 327 327 } 328 328 329 console.log("About to remove usercomments at metapositions: " + metadataPositions); 329 330 330 331 gs.functions.removeMetadataArray( … … 339 340 ); 340 341 341 342 //console.log("username: " + opt_metaname_username + " - " + gs.usercomments.defaults.metaname_username); 343 console.log("metapositions to remove: " + metadataPositions); 344 console.log("docArray:\n" + JSON.stringify(docArray)); 342 //console.log("metapositions to remove: " + metadataPositions); 343 //console.log("docArray:\n" + JSON.stringify(docArray)); 345 344 } 346 345 … … 351 350 352 351 // TODO, force a page reload so that the usercomments' state somewhat better reflects what's in DBs 352 location.reload(); 353 353 } 354 354 … … 461 461 var result = (data.responseText) ? data.responseText : data; 462 462 463 //alert(result); 464 console.log("@@@ Done removing metadata:\n" + result); 463 //console.log("@@@ Done removing metadata:\n" + result); 465 464 466 465 var userCommentsDiv = document.getElementById("usercomments"); … … 495 494 } 496 495 497 498 /*499 gs.usercomments.removeUserComment = function (_usernames, _timestamps, _comments, _docid, doc,500 opt_metaname_username, opt_metaname_usertimestamp, opt_metaname_usercomment)501 {502 // Want to remove usernames, timestamps and comments from import/metadata.xml,503 // archives/doc.xml and index/col.gdb.504 505 // Need to the add user comment meta of username, timestamp and comment to the506 // topmost section of the document. So only get the docId up to any period mark:507 var period = _docid.indexOf(".");508 if(period != -1) {509 _docid = _docid.substring(0, period);510 }511 512 // Use the new JSON metatable format to remove list of usernames, their matching timestamps and comments meta for docid in one go513 // For creating the JSON object that gets turned into a string, see514 // http://msdn.microsoft.com/en-us/library/ie/cc836459%28v=vs.94%29.aspx515 // http://jsfiddle.net/qmacro/W54hy/516 517 var username_rec = {518 metaname: opt_metaname_username || gs.usercomments.defaults.metaname_username, // e.g. "username"519 metavals: _usernames520 };521 522 var timestamp_rec = {523 metaname: opt_metaname_usertimestamp || gs.usercomments.defaults.metaname_usertimestamp, // e.g. "usertimestamp"524 metavals: _timestamps525 };526 527 var comment_rec = {528 metaname: opt_metaname_usercomment || gs.usercomments.defaults.metaname_usercomment, // e.g. "usercomment"529 metavals: _comments530 };531 532 var doc_rec = {533 docid: _docid,534 metatable: [username_rec, timestamp_rec, comment_rec],535 metamode: "accumulate" // TODO536 };537 538 var docArray = [doc_rec];539 540 // Don't allow the user to submit further comments or delete comments541 // until the metadata has been updated542 document.getElementById("usercommentSubmitButton").disabled = true;543 var delCommentsButton = document.getElementById("delCommentsButton");544 if(delCommentsButton != undefined) {// should be defined when in this function545 delCommentsButton.disabled = true;546 }547 548 // There is no remove array version yet!!!549 550 //var result = gs.functions.setMetadataArray(gs.variables["c"], gs.variables["site"], docArray, "accumulate", "import|archives|index");551 gs.functions.removeMetadataArray(gs.variables["c"],552 gs.variables["site"],553 docArray, "accumulate",554 "import|archives|index",555 function(ajaxResult) { return gs.usercomments.doneUpdatingMetatada(ajaxResult, _username, _timestamp, _comment); },556 true); // true for synchronous, meaning is opposite to explanation for addUserComment() function below557 558 }559 */560 496 561 497 gs.usercomments.addUserComment = function(_username, _comment, _docid, doc,
Note:
See TracChangeset
for help on using the changeset viewer.