Ignore:
Timestamp:
2019-07-09T21:42:14+12:00 (5 years ago)
Author:
ak19
Message:

Incorporated request for GPS.mapOverlay for children of a section, following Kathy's explanation from last Thursday. map-scripts then adds the overlays for each child to its parent section's doc.mapoverlay. That seems to work for the solr-haminfo GPS map data demo collection. But Solr faceted searching still doesn't work the way I understand it should. And of course, we don't just want children of a section but all descendants and the section itself.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js

    r33303 r33317  
    357357function toggleMapSection(options)
    358358{
    359    
    360359    var sectionID = options["nodeID"];
    361360   
    362361    var titleClassifierEl = document.getElementById("title"+sectionID);
    363362    var jsonNodesStr = titleClassifierEl.getAttribute("data-gps-map-json");
     363    //alert("@@@@ got jsonNodesStr |" + jsonNodesStr + "|");
    364364    var jsonNodes = JSON.parse(jsonNodesStr);
    365365   
     
    703703
    704704function createOverlayItems(doc, options) {
    705     if(doc.mapoverlay) {
    706         //console.log("Have shapes: " + doc.mapoverlay.toString());
     705    var loopCounter = 0;
     706    if(doc.mapoverlay || doc.childrenMapoverlays) {
     707        if(doc.mapoverlay) {
     708            // append any child section's mapoverlays onto doc.mapoverlay
     709            if(doc.childrenMapoverlays) {               
     710                for(loopCounter = 0; loopCounter < doc.childrenMapoverlays.length; loopCounter++) {
     711                    //console.log("Pushing next child mapoverlay onto doc.mapoverlay: ", doc.childrenMapoverlays[loopCounter]);
     712                    Array.prototype.push.apply(doc.mapoverlay, doc.childrenMapoverlays[loopCounter]);                   
     713                }
     714                delete doc.childrenMapoverlays; // served its purpose
     715            }
     716        } else if (doc.childrenMapoverlays) { // no doc.mapoverlay
     717            // construct doc.mapoverlay to contain each child section's mapoverlay
     718            doc.mapoverlay = [];
     719            for(loopCounter = 0; loopCounter < doc.childrenMapoverlays.length; loopCounter++) {
     720                //console.log("Pushing next child mapoverlay onto originally empty doc.mapoverlay: ", doc.childrenMapoverlays[loopCounter]);
     721                Array.prototype.push.apply(doc.mapoverlay, doc.childrenMapoverlays[loopCounter]);
     722            }           
     723            delete doc.childrenMapoverlays;  // no more use for this
     724        }
     725        //console.log("@@@@ Have shapes: ", doc.mapoverlay);       
    707726        createShapes(doc, options);
    708727    } else { // backwards compatible to deal with Lat and Lng meta stored for doc
Note: See TracChangeset for help on using the changeset viewer.