+ set_checkbox: function(record, checked)
+ {
+ var key_value;
+ /* The function accepts both records and their key */
+ switch (manifold.get_type(record)) {
+ case TYPE_VALUE:
+ key_value = record;
+ break;
+ case TYPE_RECORD:
+ /* XXX Test the key before ? */
+ key_value = record[this.key];
+ break;
+ default:
+ throw "Not implemented";
+ break;
+ }
+
+ // we cannot directly edit html, since nothing but marker is displayed
+ //var checkbox_id = this.id('checkbox', this.id_from_key(this.key, key_value));
+ //checkbox_id = '#' + checkbox_id.replace(/\./g, '\\.');
+ //$(checkbox_id, this.table.fnGetNodes()).attr('checked', checked);
+
+ var dict_info = this.map_markers[unfold.escape_id(key_value).replace(/\\/g, '')];
+
+ /* Default: swap check status */
+ if (typeof checked === 'undefined')
+ dict_info.in_set = !dict_info.in_set;
+ else
+ dict_info.in_set = checked;
+
+ // Update the marker content
+ dict_info.marker.content = this.get_marker_content(dict_info.record, checked);
+
+ // Update opened infowindow
+ // XXX Factor this code
+ this.infowindow.close();
+ this.infowindow.setContent(dict_info.marker.content);
+ this.infowindow.open(this.map, dict_info.marker);
+ this.els('map-button').unbind('click').click(this, this._button_click);
+
+ //var button = this.checkbox(record, checked);
+ //this.el('checkbox', this.id_from_record(method, record)).html(button);
+ },
+
+ checkbox: function(record, checked)
+ {
+ if (typeof checked === 'undefined')
+ checked = false;
+
+ var method = manifold.query_store.find_analyzed_query(this.options.query_uuid).object;
+ var action = checked ? 'checked' : 'del';
+ var ctx = {
+ action_class : checked ? 'ui-icon-circle-minus' : 'ui-icon-circle-plus',
+ action_message: checked ? 'Remove from slice' : 'Add to slice',
+ };
+ var button = this.load_template('template', ctx);
+
+ var id_record = this.id_from_record(method, record);
+ if (!id_record)
+ return 'ERROR';
+ var id = this.id('checkbox', this.id_from_record(method, record));
+ return "<div id='" + id + "'>" + button + "</div>";
+ },
+
+ get_marker_content: function(record, checked)
+ {
+ return '<p><b>' + this.method + '</b>: ' + get_value(record['resource_hrn']) + '<br/><b>network</b>: ' + get_value(record['network'])+'</p>' + this.checkbox(record, checked);
+ },
+