unfinished business on newnames (unsaved pending changes..)
[myslice.git] / plugins / googlemap / static / js / googlemap.js
index 50d921e..39e80cc 100644 (file)
@@ -35,7 +35,7 @@ googlemap_debug_detailed=false;
             /* XXX Events */
             this.elmt().on('show', this, this.on_show);
             // TODO in destructor
-            // $(window).unbind('Hazelnut');
+            // $(window).unbind('QueryTable');
 
             var query = manifold.query_store.find_analyzed_query(this.options.query_uuid);
             this.object = query.object;
@@ -59,8 +59,7 @@ googlemap_debug_detailed=false;
         /* PLUGIN EVENTS */
 
         on_show: function(e) {
-//         if (googlemap_debug) messages.debug("on_show");
-           messages.debug("on_show");
+           if (googlemap_debug) messages.debug("googlemap.on_show");
             var googlemap = e.data;
             google.maps.event.trigger(googlemap.map, 'resize');
         }, // on_show
@@ -102,7 +101,12 @@ googlemap_debug_detailed=false;
                 throw "Not implemented";
                 break;
             }
-           return this.escape_id(key_value).replace(/\\/g, '');
+           // XXX BACKSLASHES original code was reading like this
+           //return this.escape_id(key_value).replace(/\\/g, '');
+           //  however this sequence removes backslashes from hrn's and as a result
+           // queryupdater was getting all mixed up
+           // querytable does publish hrn's with backslashes and that seems like the thing to do
+           return key_value;
        },          
 
        // return { marker: gmap_marker, ul : <ul DOM> }
@@ -150,39 +154,41 @@ googlemap_debug_detailed=false;
 
        // this record is *in* the slice
         new_record: function(record) {
-           if (googlemap_debug_detailed) messages.debug ("new_record");
+               if (googlemap_debug_detailed) messages.debug ("new_record");
             if (!(record['latitude'])) return false;
            
             // get the coordinates
-            var latitude=get_value(record['latitude']);
-            var longitude=get_value(record['longitude']);
+            var latitude=unfold.get_value(record['latitude']);
+            var longitude=unfold.get_value(record['longitude']);
             var lat_lon = latitude + longitude;
 
-           // check if we've seen anything at that place already
-           // xxx might make sense to allow for some fuzziness, 
-           // i.e. consider 2 places equal if not further away than 300m or so...
-           var marker_s = this.by_lat_lon [lat_lon];
-           if ( marker_s == null ) {
-               marker_s = this.create_marker_struct (this.object, latitude, longitude);
-               this.by_lat_lon [ lat_lon ] = marker_s;
-               this.arm_marker(marker_s.marker, this.map);
-           }
+           // check if we've seen anything at that place already
+           // xxx might make sense to allow for some fuzziness, 
+           // i.e. consider 2 places equal if not further away than 300m or so...
+           var marker_s = this.by_lat_lon [lat_lon];
+           if ( marker_s == null ) {
+                       marker_s = this.create_marker_struct (this.object, latitude, longitude);
+                       this.by_lat_lon [ lat_lon ] = marker_s;
+                       this.arm_marker(marker_s.marker, this.map);
+               }
            
-           // now add a line for this resource in the marker
-           // xxx should compute checked here ?
-           // this is where the checkbox will be appended
-           var ul=marker_s.ul;
-           var checkbox = this.create_record_checkbox (record, ul, false);
-           if ( ! this.key in record ) return;
+           // now add a line for this resource in the marker
+           // xxx should compute checked here ?
+           // this is where the checkbox will be appended
+           var ul=marker_s.ul;
+           var checkbox = this.create_record_checkbox (record, ul, false);
+           if ( ! this.key in record ) return;
             var key_value = record[this.key];
-           var hrn = this.escape_id(key_value).replace(/\\/g, '');
+           // see XXX BACKSLASHES 
+           //var hrn = this.escape_id(key_value).replace(/\\/g, '');
+           var hrn = key_value;
             this.by_hrn[hrn] = {
-               checkbox: checkbox,
-               // xxx Thierry sept 2013
-               // xxx actually we might have just used a domid-based scheme instead of the hash
-               // since at this point we only need to retrieve the checkbox from an hrn
-               // but I was not sure enough that extra needs would not show up so I kept this in place
-               // xxx not sure these are actually useful :
+                   checkbox: checkbox,
+                       // xxx Thierry sept 2013
+                       // xxx actually we might have just used a domid-based scheme instead of the hash
+                       // since at this point we only need to retrieve the checkbox from an hrn
+                       // but I was not sure enough that extra needs would not show up so I kept this in place
+                       // xxx not sure these are actually useful :
                 value: key_value,
                 record: record,
             }