- Timestamp:
- 2019-03-02T19:41:08+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts.js
r32837 r32838 117 117 118 118 var gsmap_store = {}; 119 var gps_metadata_name = "GPS.mapOverlay"; 119 120 120 121 // Called by documentedit_scripts_util.js when saving and rebuilding. 121 122 // This function should return all the doc sections' map overlay data so that 122 123 // setArchivesMetadata can be called for each and the entire collection rebuilt with the changes 123 function getDocMapsEditDataForSaving( ) {124 function getDocMapsEditDataForSaving(collName) { 124 125 var map_editors_array = Object.values(gsmap_store); 125 126 var modifiedMaps = []; // the array that is the return value: an array of only all the modified maps 126 127 127 // get collection name128 var coll = gs.cgiParams.c;129 130 128 131 129 for(var i = 0; i < map_editors_array.length; i++) { 132 130 var map_editor = map_editors_array[i]; 133 var oldMapData = map_editor.savedOverlays; 134 var newMapData = JSON.stringify(ShapesUtil.overlayToJSON(map_editor.overlays)); 131 var oldMapData = map_editor.savedOverlays; // stringified JSON shape 132 var newMapData = JSON.stringify(ShapesUtil.overlayToJSON(map_editor.overlays)); // stringified JSON shape too 135 133 136 if(oldMapData !== newMapData) { 134 // We only consider a map editor's map data to have been modified in the following cases: 135 // - if oldMapData is null, new mapData should not be empty array 136 // - OR oldMapData had some value and it's not the same as newMapData 137 if(!oldMapData && newMapData !== "[]" /*|| oldMapData && oldMapData !== newMapData*/) { 138 var nodeID = map_editors_array[i].id; 139 console.log("old vs new mapdata for nodeID " + nodeID); 140 console.log(oldMapData); 141 console.log(newMapData); 137 142 138 var nodeID = map_editors_array[i].id;139 var val = map_editors_array[i].overlays;140 143 modifiedMaps.push({ 141 collection: coll ,144 collection: collName, 142 145 docID: nodeID, 143 name: "GSP.mapOverlay",144 pos: 0,146 name:gps_metadata_name, 147 metapos: 0, 145 148 value:newMapData 146 149 });
Note:
See TracChangeset
for help on using the changeset viewer.