- });
- 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;
- }
- var checkbox_s = this.by_hrn [ hrn ];
- 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
+ });
+ //extend the bounds to include each marker's position
+ this.bounds.extend(marker.position);
+ return {marker:marker, ul:ul};
+ },
+
+ // given an input <ul> element, this method inserts a <li> with embedded checkbox
+ // for displaying/selecting the resource corresponding to the input record
+ // returns the created <input> element for further checkbox manipulation
+ create_record_checkbox: function (record,ul,checked) {
+ var checkbox = $("<input>", {type:'checkbox', checked:checked, class:'geo'});
+ var id=record[this.canonical_key];
+ var init_id=record[this.init_key];
+ // xxx use init_key to find out label - or should we explicitly accept an incoming label_key ?
+ var label=init_id;
+ ul.append($("<li>").addClass("geo").append(checkbox).
+ append($("<span>").addClass("geo").append(label)));
+ // hash by id and by init_id
+ this.by_id[id]=checkbox;
+ this.by_init_id[init_id] = checkbox;
+ //
+ // the callback for when a user clicks
+ // NOTE: this will *not* be called for changes done by program
+ var self=this;
+ checkbox.change( function (e) {
+ manifold.raise_event (self.options.query_uuid, this.checked ? SET_ADD : SET_REMOVED, id);
+ });
+ return checkbox;
+ },
+
+ warning: function (record,message) {
+ try {messages.warning (message+" -- "+this.key+"="+record[this.key]); }
+ catch (err) {messages.warning (message); }
+ },
+
+ // retrieve DOM checkbox and make sure it is checked/unchecked
+ set_checkbox_from_record: function(record, checked) {
+ var init_id=record[this.init_key];
+ var checkbox = this.by_init_id [ init_id ];
+ if (checkbox) checkbox.prop('checked',checked);
+ else this.warning(record, "googlemap.set_checkbox_from_record - not found "+init_id);
+ },
+
+ set_checkbox_from_data: function(id, checked) {
+ var checkbox = this.by_id [ id ];
+ if (checkbox) checkbox.prop('checked',checked);
+ else messages.warning("googlemap.set_checkbox_from_data - id not found "+id);
+ },
+
+ // this record is *in* the slice