+// actions area
+if ($privileges) {
+
+ // remove persons
+ $table->tfoot_start();
+
+ $table->row_start();
+ $table->cell($form->submit_html("remove-persons-from-slice", "Remove selected"),
+ array('hfill' => true, 'align' => 'right'));
+ $table->row_end();
+}
+$table->end();
+$toggle_persons->end();
+
+////////// people to add
+if ($privileges) {
+ $count = count($potential_persons);
+ $toggle_persons = new PlekitToggle('my-slice-persons-add',
+ "$count people may be added to $name",
+ array('visible' => get_arg('show_persons_add')));
+ $toggle_persons->start();
+ if (!$potential_persons) {
+ // xxx improve style
+ echo "<p class='not-relevant'>No person to add</p>";
+ } else {
+ $headers = array();
+ $headers['email'] = 'string';
+ $headers['first'] = 'string';
+ $headers['last'] = 'string';
+ $headers['R'] = 'string';
+ $headers['+'] = "none";
+ $options = array('notes_area' => false,
+ 'search_width' => 15,
+ 'pagesize' => 8);
+ // show search for admins only as other people won't get that many names to add
+ if (!plc_is_admin()) {
+ $options['search_area'] = false;
+ }
+
+ $table = new PlekitTable('add_persons', $headers, '0', $options);
+ $form = new PlekitForm(l_actions(), array('slice_id' => $slice['slice_id']));
+ $form->start();
+ $table->start();
+ if ($potential_persons) {
+ foreach ($potential_persons as $person) {
+ $table->row_start();
+ $table->cell(l_person_obj($person));
+ $table->cell($person['first_name']);
+ $table->cell($person['last_name']);
+ $table->cell(plc_vertical_table($person['roles']));
+ $table->cell($form->checkbox_html('person_ids[]', $person['person_id']));
+ $table->row_end();
+ }
+ }
+
+ // add users
+ $table->tfoot_start();
+ $table->row_start();
+ $table->cell($form->submit_html("add-persons-in-slice", "Add selected"),
+ array('hfill' => true, 'align' => 'right'));
+ $table->row_end();
+ $table->end();
+ $form->end();
+ }
+ $toggle_persons->end();
+}
+$toggle->end();
+
+//////////////////////////////////////////////////////////// tab:nodes
+// the nodes details to display here
+// (1) we search for the tag types for which 'category' matches 'node*/ui*'
+// all these tags will then be tentatively displayed in this area
+// (2) further information can also be optionally specified in the category:
+// (.) we split the category with '/' and search for assignments of the form var=value
+// (.) header can be set to supersede the column header (default is tagname)
+// (.) rank can be used for ordering the columns (default is tagname)
+// (.) type is passed to the javascript table, for sorting (default is 'string')
+
+// minimal list as a start
+$node_fixed_columns = array('hostname', 'node_id', 'peer_id', 'slice_ids_whitelist', 'site_id',
+ 'run_level', 'boot_state', 'last_contact', 'node_type');
+// create a VisibleTags object : basically the list of tag columns to show
+//$visibletags = new VisibleTags ($api, 'node');
+//$visiblecolumns = $visibletags->column_names();
+
+// optimizing calls to GetNodes
+//$all_nodes=$api->GetNodes(NULL,$node_columns);
+//$slice_nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),$node_columns);
+//$potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),$node_columns);
+
+//NEW CODE FOR ENABLING COLUMN CONFIGURATION
+
+//prepare fix and configurable columns
+
+$fix_columns = array();
+$fix_columns[] = array('tagname' => 'hostname', 'header' => 'hostname', 'type' => 'string', 'title' => 'The name of the node');
+$fix_columns[] = array('tagname' => 'peer_id', 'header' => 'AU', 'type' => 'string', 'title' => 'Authority');
+$fix_columns[] = array('tagname' => 'run_level', 'header' => 'ST', 'type' => 'string', 'title' => 'Status');
+$fix_columns[] = array('tagname' => 'node_type', 'header' => 'RES', 'type' => 'string', 'title' => 'Reservable');
+
+// columns that correspond to the visible tags for nodes (*node/ui*)
+$visibletags = new VisibleTags($api, 'node');
+$visibletags->columns();
+$tag_columns = $visibletags->headers();
+
+//columns that are not defined as extra myslice tags
+$extra_columns = array();
+//MyPLC columns
+$extra_columns[] = array('tagname' => 'sitename', 'header' => 'SN', 'type' => 'string', 'title' => 'Site name', 'fetched' => true, 'source' => 'myplc');
+$extra_columns[] = array('tagname' => 'domain', 'header' => 'DN', 'type' => 'string', 'title' => 'Toplevel domain name', 'fetched' => true, 'source' => 'myplc');
+$extra_columns[] = array('tagname' => 'ipaddress', 'header' => 'IP', 'type' => 'string', 'title' => 'IP Address', 'fetched' => true, 'source' => 'myplc');
+$extra_columns[] = array('tagname' => 'fcdistro', 'header' => 'OS', 'type' => 'string', 'title' => 'Operating system', 'fetched' => false, 'source' => 'myplc');
+$extra_columns[] = array('tagname' => 'date_created', 'header' => 'DA', 'source' => 'myplc', 'type' => 'date', 'title' => 'Date added', 'fetched' => false);
+$extra_columns[] = array('tagname' => 'arch', 'header' => 'A', 'source' => 'myplc', 'type' => 'string', 'title' => 'Architecture', 'fetched' => false);
+if (plc_is_admin()) {
+ $extra_columns[] = array('tagname' => 'deployment', 'header' => 'DL', 'source' => 'myplc', 'type' => 'string', 'title' => 'Deployment', 'fetched' => false);
+}
+
+//CoMon Live data
+
+if (MYSLICE_COMON_AVAILABLE) {
+ $extra_columns[] = array('tagname' => 'bwlimit', 'header' => 'BW', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Bandwidth limit', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'numcores', 'header' => 'CC', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Number of CPU Cores', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'cpuspeed', 'header' => 'CR', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'CPU clock rate', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'disksize', 'header' => 'DS', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Disk size', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'gbfree', 'header' => 'DF', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Currently available disk space', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'memsize', 'header' => 'MS', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Memory size', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'numslices', 'header' => 'SM', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Number of slices in memory', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'uptime', 'header' => 'UT', 'source' => 'comon', 'type' => 'sortAlphaNumericTop', 'title' => 'Continuous uptime until now', 'fetched' => false);
+}
+
+//TopHat Live data
+
+if (MYSLICE_TOPHAT_AVAILABLE) {
+ $extra_columns[] = array('tagname' => 'asn', 'header' => 'AS', 'source' => 'tophat', 'type' => 'string', 'title' => 'AS Number', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'city', 'header' => 'LCY', 'source' => 'tophat', 'type' => 'string', 'title' => 'City', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'region', 'header' => 'LRN', 'source' => 'tophat', 'type' => 'string', 'title' => 'Region', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'country', 'header' => 'LCN', 'source' => 'tophat', 'type' => 'string', 'title' => 'Country', 'fetched' => false);
+ $extra_columns[] = array('tagname' => 'continent', 'header' => 'LCT', 'source' => 'tophat', 'type' => 'string', 'title' => 'Continent', 'fetched' => false);
+//$extra_columns[]=array('tagname'=>'hopcount', 'header'=>'HC', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Hop count from reference node', 'fetched'=>false);
+ ////$extra_columns[]=array('tagname'=>'rtt', 'header'=>'RTT', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Round trip time from reference node', 'fetched'=>false);
+ //////$extra_columns[]=array('tagname'=>'agents', 'header'=>'MA', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located measurement agents', 'fetched'=>true);
+ ////$extra_columns[]=array('tagname'=>'agents_sonoma', 'header'=>'MAS', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located SONoMA agents', 'fetched'=>true);
+ ////$extra_columns[]=array('tagname'=>'agents_etomic', 'header'=>'MAE', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located ETOMIC agents', 'fetched'=>true);
+ ////$extra_columns[]=array('tagname'=>'agents_tdmi', 'header'=>'MAT', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located TDMI agents', 'fetched'=>true);
+ ////$extra_columns[]=array('tagname'=>'agents_dimes', 'header'=>'MAD', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located DIMES agents', 'fetched'=>true);
+}
+
+//Get user's column configuration
+
+$first_time_configuration = false;
+$default_configuration = "hostname:f|ST:f|AU:f|RES:f";
+//$extra_default = "";
+$column_configuration = "";
+$slice_column_configuration = "";
+
+$show_configuration = "";
+
+$PersonTags = $api->GetPersonTags(array('person_id' => $plc->person['person_id']));
+//plc_debug('ptags',$PersonTags);
+foreach ($PersonTags as $ptag) {
+ if ($ptag['tagname'] == 'columnconf') {
+ $column_configuration = $ptag['value'];
+ $conf_tag_id = $ptag['person_tag_id'];
+ } else if ($ptag['tagname'] == 'showconf') {
+ $show_configuration = $ptag['value'];
+ $show_tag_id = $ptag['person_tag_id'];
+ }
+}
+
+$sliceconf_exists = false;
+if ($column_configuration == "") {
+ $first_time_configuration = true;
+ $column_configuration = $slice_id . ";default";
+ $sliceconf_exists = true;
+} else {
+ $slice_conf = explode(";", $column_configuration);
+ for ($i = 0; $i < count($slice_conf); $i++) {
+ if ($slice_conf[$i] == $slice_id) {
+ $i++;
+ $slice_column_configuration = $slice_conf[$i];
+ $sliceconf_exists = true;
+ break;
+ } else {
+ $i++;
+ $slice_column_configuration = $slice_conf[$i];
+ }
+ }
+}
+
+if ($sliceconf_exists == false) {
+ $column_configuration = $column_configuration . ";" . $slice_id . ";default";
+}
+
+if ($slice_column_configuration == "") {
+ $full_configuration = $default_configuration;
+} else {
+ $full_configuration = $default_configuration . "|" . $slice_column_configuration;
+}
+
+//instantiate the column configuration class, which prepares the headers array
+$ConfigureColumns = new PlekitColumns($full_configuration, $fix_columns, $tag_columns, $extra_columns);
+
+$visiblecolumns = $ConfigureColumns->node_tags();
+
+$node_columns = array_merge($node_fixed_columns, $visiblecolumns);
+$all_nodes = $api->GetNodes(null, $node_columns);
+
+$ConfigureColumns->fetch_live_data($all_nodes);
+
+$show_reservable_info = true;
+$show_layout_info = '1';
+$show_conf = explode(";", $show_configuration);
+foreach ($show_conf as $ss) {
+ if ($ss == "reservable") {
+ $show_reservable_info = false;
+ } else if ($ss == "columns") {
+ $show_layout_info = '0';
+ }
+
+}