+ // 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),
+ keys: Array(),
+ });
+ //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 key, key_value, data;
+
+ 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;
+
+ key = this.canonical_key;
+ key_value = manifold.record_get_value(record, key);
+
+ ul.append($("<li>").addClass("geo")
+ .append($('<div>') // .addId(this.id_from_key(key, key_value))
+ .append(checkbox)
+ .append($("<span>").addClass("geo")
+ .append(label)
+ )
+ )
+ );
+
+ // XXX STATE / BACKGROUND
+
+ // 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) {
+ data = {
+ state: STATE_SET,
+ key : null,
+ op : this.checked ? STATE_SET_ADD : STATE_SET_REMOVE,
+ value: id
+ }
+ manifold.raise_event(self.options.query_uuid, FIELD_STATE_CHANGED, data);