Changeset 33348

Show
Ignore:
Timestamp:
23.07.2019 16:33:07 (4 weeks ago)
Author:
ak19
Message:

2 major changes. 1. Forgot to commit Dr Bainbridge's bugfix for why performProximitySearch() wasn't working for solr collections: the + concatenation signs in the constructed request URL should be spaces which ajax will then convert to + signs. This seems not to have been a problem in lucene, but in solr the + signs end up double encoded or something and the query failed until spaces were used. Unfortunately, with performProximitySearch() now working, searching by facets (unticking and ticking facets) doesn't show up many differences in the map and no longer just displays the search result documents' GPS map information marked up on the map, but that of all nearby documents. 2. With Kathy having now implemented the descendants option, requests for a node's children's mapoverlays has been replaced with requests for descendants' mapoverlays. Tested to work with existing subsection (child) information. 3 Turning off _DEBUGGING_ flag again in map_scripts with performProximitySearch working again. 4. Fixed a minor bug in the debugging function for printing the map bounds, allowing the bounds to be undefined, since that was apparently a possibility. 5. Workaround for when scrool through markers is on, and loopThroughMarkers goes through the doc.shapes array the first time, when it has 3 elements yet they're undefined.

Location:
main/trunk/greenstone3/web/interfaces/default
Files:
3 modified

Legend:

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

    r33323 r33348  
    264264            query += ")"; 
    265265 
    266             if(i != iMax || j != jMax){ query += "+OR+"; } //if(i != (Math.floor(latDistance / latDelta) + 1) || j != (Math.floor(lngDistance / lngDelta) + 1)){ query += "+OR+"; } 
     266            if(i != iMax || j != jMax){ query += " OR "; } //if(i != (Math.floor(latDistance / latDelta) + 1) || j != (Math.floor(lngDistance / lngDelta) + 1)){ query += " OR "; } 
    267267        } 
    268268    } 
     
    699699        for(var x = 0; x < doc.shapes.length; x++) { 
    700700            var shape = doc.shapes[i]; 
     701            if(typeof shape === 'undefined') { // happens just after map page has loaded when scrolling through markers. Why does this happen 
     702                console.log("shape at " + x + " not defined"); 
     703                continue; 
     704            } 
    701705            if(shape.type === google.maps.drawing.OverlayType.MARKER) { 
    702706                shape.markerInfo.open(_map, shape); 
     
    769773function createOverlayItems(doc, options) { 
    770774    var loopCounter = 0; 
    771     if(doc.mapoverlay || doc.childrenMapoverlays) { 
     775    if(doc.mapoverlay || doc.descendantsMapoverlays) { 
    772776        if(doc.mapoverlay) { 
    773             // append any child section's mapoverlays onto doc.mapoverlay 
    774             if(doc.childrenMapoverlays) {                
    775                 for(loopCounter = 0; loopCounter < doc.childrenMapoverlays.length; loopCounter++) { 
    776                     //console.log("Pushing next child mapoverlay onto doc.mapoverlay: ", doc.childrenMapoverlays[loopCounter]); 
    777                     Array.prototype.push.apply(doc.mapoverlay, doc.childrenMapoverlays[loopCounter]);                    
     777            // append any descendant section's mapoverlays onto doc.mapoverlay 
     778            if(doc.descendantsMapoverlays) { 
     779                for(loopCounter = 0; loopCounter < doc.descendantsMapoverlays.length; loopCounter++) { 
     780                    //console.log("Pushing next descendant mapoverlay onto doc.mapoverlay: ", doc.descendantsMapoverlays[loopCounter]); 
     781                    Array.prototype.push.apply(doc.mapoverlay, doc.descendantsMapoverlays[loopCounter]);                     
    778782                } 
    779                 delete doc.childrenMapoverlays; // served its purpose 
    780             } 
    781         } else if (doc.childrenMapoverlays) { // no doc.mapoverlay 
    782             // construct doc.mapoverlay to contain each child section's mapoverlay 
     783                delete doc.descendantsMapoverlays; // served its purpose 
     784            } 
     785        } else if (doc.descendantsMapoverlays) { // no doc.mapoverlay 
     786            // construct doc.mapoverlay to contain each descendant section's mapoverlay 
    783787            doc.mapoverlay = []; 
    784             for(loopCounter = 0; loopCounter < doc.childrenMapoverlays.length; loopCounter++) { 
    785                 //console.log("Pushing next child mapoverlay onto originally empty doc.mapoverlay: ", doc.childrenMapoverlays[loopCounter]); 
    786                 Array.prototype.push.apply(doc.mapoverlay, doc.childrenMapoverlays[loopCounter]); 
     788            for(loopCounter = 0; loopCounter < doc.descendantsMapoverlays.length; loopCounter++) { 
     789                //console.log("Pushing next descendant mapoverlay onto originally empty doc.mapoverlay: ", doc.descendantsMapoverlays[loopCounter]); 
     790                Array.prototype.push.apply(doc.mapoverlay, doc.descendantsMapoverlays[loopCounter]); 
    787791            }            
    788             delete doc.childrenMapoverlays;  // no more use for this 
     792            delete doc.descendantsMapoverlays;  // no more use for this 
    789793        } 
    790794        //console.log("@@@@ Have shapes: ", doc.mapoverlay);         
     
    10651069            query += "(" + getDistanceQueryStringTerm(lat, lng, latDelta, lngDelta, 2, "CS") + ")"; 
    10661070             
    1067             if(i != ((degrees * 2) - 1) || j != ((degrees * 2) - 1)){ query += "+OR+"; } 
     1071            if(i != ((degrees * 2) - 1) || j != ((degrees * 2) - 1)){ query += " OR "; } 
    10681072        } 
    10691073    } 
     
    12941298function _debugPrintBounds(bounds, message) { 
    12951299    if(!_DEBUGGING_) return; 
     1300    if(typeof bounds === 'undefined') { 
     1301        console.log("Bounds undefined"); 
     1302        return; 
     1303    } 
    12961304    var ne = bounds.getNorthEast(); 
    12971305    var sw = bounds.getSouthWest();                
  • main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl

    r33317 r33348  
    2121      <xsl:text>[</xsl:text> 
    2222      <xsl:for-each select="//documentNode"> 
    23     <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
     23    <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
    2424      <xsl:text>{</xsl:text> 
    2525      <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text> 
     
    5757      </xsl:if> 
    5858       
    59       <xsl:if test="metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
    60         <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'children_GPS.mapOverlay'])"/></xsl:variable> 
     59      <xsl:if test="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
     60        <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'descendants_GPS.mapOverlay'])"/></xsl:variable> 
    6161        <xsl:text disable-output-escaping="yes">,</xsl:text> 
    62         <xsl:text disable-output-escaping="yes">"childrenMapoverlays":[</xsl:text> 
    63         <xsl:for-each select="metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
     62        <xsl:text disable-output-escaping="yes">"descendantsMapoverlays":[</xsl:text> 
     63        <xsl:for-each select="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
    6464            <xsl:value-of disable-output-escaping="yes" select="current()"/> 
    6565            <xsl:if test="not(position() = $count)"> 
     
    8484    <gsf:metadata name="Coordinate" hidden="true"/> 
    8585    <gsf:metadata name="GPS.mapOverlay" hidden="true"/> 
    86     <gsf:metadata name="GPS.mapOverlay" select="children" hidden="true"/> 
     86    <gsf:metadata name="GPS.mapOverlay" select="descendants" hidden="true"/> 
    8787<!--  these were included in version in query. don't think we need them... 
    8888    <gsf:metadata name="Image" hidden="true"/> 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl

    r33321 r33348  
    844844                <xsl:when test="count(//documentNode) > 0"> 
    845845                    <xsl:for-each select="//documentNode"> 
    846                         <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
     846                        <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate'] or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
    847847                            <xsl:text>{</xsl:text> 
    848848                            <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text> 
     
    874874                            </xsl:if> 
    875875                             
    876                             <xsl:if test="metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
    877                                 <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'children_GPS.mapOverlay'])"/></xsl:variable> 
     876                            <xsl:if test="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
     877                                <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'descendants_GPS.mapOverlay'])"/></xsl:variable> 
    878878                                <xsl:text disable-output-escaping="yes">,</xsl:text> 
    879                                 <xsl:text disable-output-escaping="yes">"childrenMapoverlays":[</xsl:text> 
    880                                 <xsl:for-each select="metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
     879                                <xsl:text disable-output-escaping="yes">"descendantsMapoverlays":[</xsl:text> 
     880                                <xsl:for-each select="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
    881881                                    <xsl:value-of disable-output-escaping="yes" select="current()"/> 
    882882                                    <xsl:if test="not(position() = $count)"> 
     
    899899                <xsl:otherwise> 
    900900                    <xsl:for-each select="/page/pageResponse/document"> 
    901                         <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate']  or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
     901                        <xsl:if test="(metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']) or metadataList/metadata[@name = 'Coordinate']  or metadataList/metadata[@name = 'GPS.mapOverlay'] or metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
    902902                            <xsl:text>{</xsl:text> 
    903903                            <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text> 
     
    929929                            </xsl:if> 
    930930                             
    931                             <xsl:if test="metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
    932                                 <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'children_GPS.mapOverlay'])"/></xsl:variable> 
     931                            <xsl:if test="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
     932                                <xsl:variable name="count"><xsl:value-of select="count(metadataList/metadata[@name = 'descendants_GPS.mapOverlay'])"/></xsl:variable> 
    933933                                <xsl:text disable-output-escaping="yes">,</xsl:text> 
    934                                 <xsl:text disable-output-escaping="yes">"childrenMapoverlays":[</xsl:text> 
    935                                 <xsl:for-each select="metadataList/metadata[@name = 'children_GPS.mapOverlay']"> 
     934                                <xsl:text disable-output-escaping="yes">"descendantsMapoverlays":[</xsl:text> 
     935                                <xsl:for-each select="metadataList/metadata[@name = 'descendants_GPS.mapOverlay']"> 
    936936                                    <xsl:value-of disable-output-escaping="yes" select="current()"/>                                     
    937937                                    <xsl:if test="not(position() = $count)"> 
     
    955955        <gsf:metadata name="Coordinate" hidden="true"/> 
    956956        <gsf:metadata name="GPS.mapOverlay" hidden="true"/> 
    957         <gsf:metadata name="GPS.mapOverlay" select="children" hidden="true"/> 
     957        <gsf:metadata name="GPS.mapOverlay" select="descendants" hidden="true"/> 
    958958    </xsl:template> 
    959959