- // UNUSED ? // this.update_plugin = function(e, rows) {
- // UNUSED ? // // e.data is what we passed in second argument to subscribe
- // UNUSED ? // // so here it is the jquery object attached to the plugin <div>
- // UNUSED ? // var $plugindiv=e.data;
- // UNUSED ? // if (debug)
- // UNUSED ? // messages.debug("entering hazelnut.update_plugin on id '" + $plugindiv.attr('id') + "'");
- // UNUSED ? // // clear the spinning wheel: look up an ancestor that has the need-spin class
- // UNUSED ? // // do this before we might return
- // UNUSED ? // $plugindiv.closest('.need-spin').spin(false);
- // UNUSED ? //
- // UNUSED ? // var options = this.options;
- // UNUSED ? // var hazelnut = this;
- // UNUSED ? //
- // UNUSED ? // /* if we get no result, or an error, try to make that clear, and exit */
- // UNUSED ? // if (rows.length==0) {
- // UNUSED ? // if (debug)
- // UNUSED ? // messages.debug("Empty result on hazelnut " + this.options.domid);
- // UNUSED ? // var placeholder=$(this.table).find("td.dataTables_empty");
- // UNUSED ? // console.log("placeholder "+placeholder);
- // UNUSED ? // if (placeholder.length==1)
- // UNUSED ? // placeholder.html(unfold.warning("Empty result"));
- // UNUSED ? // else
- // UNUSED ? // this.table.html(unfold.warning("Empty result"));
- // UNUSED ? // return;
- // UNUSED ? // } else if (typeof(rows[0].error) != 'undefined') {
- // UNUSED ? // // we now should have another means to report errors that this inline/embedded hack
- // UNUSED ? // if (debug)
- // UNUSED ? // messages.error ("undefined result on " + this.options.domid + " - should not happen anymore");
- // UNUSED ? // this.table.html(unfold.error(rows[0].error));
- // UNUSED ? // return;
- // UNUSED ? // }
- // UNUSED ? //
- // UNUSED ? // /*
- // UNUSED ? // * fill the dataTables object
- // UNUSED ? // * we cannot set html content directly here, need to use fnAddData
- // UNUSED ? // */
- // UNUSED ? // var lines = new Array();
- // UNUSED ? //
- // UNUSED ? // this.current_resources = Array();
- // UNUSED ? //
- // UNUSED ? // $.each(rows, function(index, row) {
- // UNUSED ? // // this models a line in dataTables, each element in the line describes a cell
- // UNUSED ? // line = new Array();
- // UNUSED ? //
- // UNUSED ? // // go through table headers to get column names we want
- // UNUSED ? // // in order (we have temporarily hack some adjustments in names)
- // UNUSED ? // var cols = object.table.fnSettings().aoColumns;
- // UNUSED ? // var colnames = cols.map(function(x) {return x.sTitle})
- // UNUSED ? // var nb_col = cols.length;
- // UNUSED ? // /* if we've requested checkboxes, then forget about the checkbox column for now */
- // UNUSED ? // if (options.checkboxes) nb_col -= 1;
- // UNUSED ? //
- // UNUSED ? // /* fill in stuff depending on the column name */
- // UNUSED ? // for (var j = 0; j < nb_col; j++) {
- // UNUSED ? // if (typeof colnames[j] == 'undefined') {
- // UNUSED ? // line.push('...');
- // UNUSED ? // } else if (colnames[j] == 'hostname') {
- // UNUSED ? // if (row['type'] == 'resource,link')
- // UNUSED ? // //TODO: we need to add source/destination for links
- // UNUSED ? // line.push('');
- // UNUSED ? // else
- // UNUSED ? // line.push(row['hostname']);
- // UNUSED ? // } else {
- // UNUSED ? // if (row[colnames[j]])
- // UNUSED ? // line.push(row[colnames[j]]);
- // UNUSED ? // else
- // UNUSED ? // line.push('');
- // UNUSED ? // }
- // UNUSED ? // }
- // UNUSED ? //
- // UNUSED ? // /* catch up with the last column if checkboxes were requested */
- // UNUSED ? // if (options.checkboxes) {
- // UNUSED ? // var checked = '';
- // UNUSED ? // // xxx problem is, we don't get this 'sliver' thing set apparently
- // UNUSED ? // if (typeof(row['sliver']) != 'undefined') { /* It is equal to null when <sliver/> is present */
- // UNUSED ? // checked = 'checked ';
- // UNUSED ? // hazelnut.current_resources.push(row[ELEMENT_KEY]);
- // UNUSED ? // }
- // UNUSED ? // // Use a key instead of hostname (hard coded...)
- // UNUSED ? // line.push(hazelnut.checkbox(options.plugin_uuid, row[ELEMENT_KEY], row['type'], checked, false));
- // UNUSED ? // }
- // UNUSED ? //
- // UNUSED ? // lines.push(line);
- // UNUSED ? //
- // UNUSED ? // });
- // UNUSED ? //
- // UNUSED ? // this.table.fnClearTable();
- // UNUSED ? // if (debug)
- // UNUSED ? // messages.debug("hazelnut.update_plugin: total of " + lines.length + " rows");
- // UNUSED ? // this.table.fnAddData(lines);
- // UNUSED ? //
- // UNUSED ? // }, // update_plugin
-
- checkbox: function (key, value)