X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fgooglemap%2Fstatic%2Fjs%2Fgooglemap.js;h=39e80cc0834b759d1ac09dcf5a80554813d29d63;hb=c5795ba59e99c3a9b7481f4965814eca3e9a950d;hp=3f3c995034e2992fca7f750ce05e2f31b6eacbfa;hpb=3c762e77b024e3bdd261002e415bc2e931b3d52f;p=unfold.git
diff --git a/plugins/googlemap/static/js/googlemap.js b/plugins/googlemap/static/js/googlemap.js
index 3f3c9950..39e80cc0 100644
--- a/plugins/googlemap/static/js/googlemap.js
+++ b/plugins/googlemap/static/js/googlemap.js
@@ -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,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
+ // 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 :
}
@@ -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,47 +146,49 @@ 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
// 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 = 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
- // 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,
}