- // If the node is attached to the slice, action will be Remove; else action will be add to slice
- if (typeof(record['sliver']) != 'undefined') {
- data.current_resources.push(record['urn']);
- action="del";
- action_class="ui-icon-circle-minus";
- action_message="Remove from slice";
- }else{
- action="add";
- action_class="ui-icon-circle-plus";
- action_message="Add to slice";
- }
- // XXX not working
- if (!(record['latitude'])) {
- return true;
+ // 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> }
+ create_marker_struct: function (object,lat,lon) {
+ // the DOM fragment
+ var dom = $("<p>").addClass("geo").append(object+"(s)");
+ var ul = $("<ul>").addClass("geo");
+ dom.append(ul);
+ // add a gmap marker to the mix
+ var marker = new google.maps.Marker({
+ position: new google.maps.LatLng(lat, lon),
+ title: object,
+ // gmap can deal with a DOM element but not a jquery object
+ content: dom.get(0),
+ });
+ return {marker:marker, ul:ul};
+ },
+
+ // add an entry in the marker <ul> tag for that record
+ // returns { checkbox : <input DOM> }
+ create_record_checkbox: function (record,ul,checked) {
+ var checkbox = $("<input>", {type:'checkbox', checked:checked, class:'geo'});
+ var hrn=this.record_hrn(record);
+ ul.append($("<li>").addClass("geo").append(checkbox).
+ append($("<span>").addClass("geo").append(hrn)));
+ var googlemap=this;
+ // 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);
+ });
+ return checkbox;
+ },
+
+ // retrieve DOM checkbox and make sure it is checked/unchecked
+ set_checkbox: function(record, checked) {
+ var hrn=this.record_hrn (record);
+ if (! hrn) {
+ try {messages.warning ("googlemap.set_checkbox: record has no hrn -- hostname="+record.hostname); }
+ catch (err) {messages.warning ("googlemap.set_checkbox: record has no hrn"); }
+ return;