Changeset 32837


Ignore:
Timestamp:
2019-03-01T22:34:19+13:00 (5 years ago)
Author:
ak19
Message:

Adding a new function that will be called on saveAndRebuild to save mapdata. So far it is only syntax error free, untested.

Location:
main/trunk/greenstone3/web/interfaces/default/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts.js

    r32832 r32837  
    117117
    118118var gsmap_store = {};
     119
     120// Called by documentedit_scripts_util.js when saving and rebuilding.
     121// This function should return all the doc sections' map overlay data so that
     122// setArchivesMetadata can be called for each and the entire collection rebuilt with the changes
     123function getDocMapsEditDataForSaving() {
     124    var map_editors_array = Object.values(gsmap_store);
     125    var modifiedMaps = []; // the array that is the return value: an array of only all the modified maps
     126   
     127    // get collection name
     128    var coll = gs.cgiParams.c;
     129
     130   
     131    for(var i = 0; i < map_editors_array.length; i++) {
     132        var map_editor = map_editors_array[i];
     133        var oldMapData = map_editor.savedOverlays;
     134        var newMapData = JSON.stringify(ShapesUtil.overlayToJSON(map_editor.overlays));
     135       
     136        if(oldMapData !== newMapData) {
     137           
     138            var nodeID = map_editors_array[i].id;
     139            var val = map_editors_array[i].overlays;
     140            modifiedMaps.push({
     141                collection: coll,
     142                docID: nodeID,
     143                name:"GSP.mapOverlay",
     144                pos: 0,
     145                value:newMapData               
     146            });
     147        }
     148       
     149    }
     150   
     151    return modifiedMaps;
     152}
     153
    119154
    120155function addEditMapGPSLink(cell) {
     
    348383
    349384    // get collection name
    350     var collection = gs.cgiParams.c; ;
     385    var collection = gs.cgiParams.c;
    351386
    352387    // get document id
  • main/trunk/greenstone3/web/interfaces/default/js/map-scripts-editor.js

    r32834 r32837  
    654654}
    655655
    656 
     656// event handler for s being pressed *when map editor has the focus*
     657// For saving and rebuilding, see map_scripts
    657658MapEditor.prototype.saveToArchives = function () {
    658659    var that = this;
Note: See TracChangeset for help on using the changeset viewer.