js helper function 'get_value' not defined globally anymore, use unfold.get_velue...
[myslice.git] / plugins / googlemap / static / js / googlemap.js
index 3f3c995..8cb652f 100644 (file)
@@ -59,7 +59,7 @@ googlemap_debug_detailed=false;
         /* PLUGIN EVENTS */
 
         on_show: function(e) {
-           if (googlemap_debug) 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
@@ -101,7 +101,12 @@ googlemap_debug_detailed=false;
                 throw "Not implemented";
                 break;
             }
-           return unfold.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
+           // resources_selected was getting all mixed up
+           // hazelnut does publish hrn's with backslashes and that seems like the thing to do
+           return key_value;
        },          
 
        // return { marker: gmap_marker, ul : <ul DOM> }
@@ -131,6 +136,7 @@ googlemap_debug_detailed=false;
            // the callback for when a user clicks
            // NOTE: this will *not* be called for changes done by program
            checkbox.change( function (e) {
+               if (googlemap_debug) messages.debug("googlemap click handler checked= " + this.checked + " hrn=" + hrn);
                manifold.raise_event (googlemap.options.query_uuid, 
                                      this.checked ? SET_ADD : SET_REMOVED, hrn);
            });
@@ -140,9 +146,9 @@ googlemap_debug_detailed=false;
        // retrieve DOM checkbox and make sure it is checked/unchecked
         set_checkbox: function(record, checked) {
            var hrn=this.record_hrn (record);
-           if (! hrn) { messages.warning ("set_checkbox: record has no hrn"); return; }
+           if (! hrn) { messages.warning ("googlemap.set_checkbox: record has no hrn"); return; }
            var checkbox_s = this.by_hrn [ hrn ];
-           if (! checkbox_s ) { messages.warning ("set_checkbox: could not spot checkbox for hrn "+hrn); return; }
+           if (! checkbox_s ) { messages.warning ("googlemap.set_checkbox: could not spot checkbox for hrn "+hrn); return; }
            checkbox_s.checkbox.prop('checked',checked);
         }, // set_checkbox
 
@@ -152,8 +158,8 @@ googlemap_debug_detailed=false;
             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
@@ -173,7 +179,9 @@ googlemap_debug_detailed=false;
            var checkbox = this.create_record_checkbox (record, ul, false);
            if ( ! this.key in record ) return;
             var key_value = record[this.key];
-           var hrn = unfold.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