+//$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';
+ }
+
+}
+
+$slice_nodes = array();
+$potential_nodes = array();
+$reservable_nodes = array();
+foreach ($all_nodes as $node) {
+ if (in_array($node['node_id'], $slice['node_ids'])) {
+ $slice_nodes[] = $node;
+ if ($node['node_type'] == 'reservable') {
+ $reservable_nodes[] = $node;
+ }
+
+ } else {
+ $potential_nodes[] = $node;
+ }
+}
+if ($profiling) {
+ plc_debug_prof('05: nodes', count($slice_nodes));
+}
+
+////////////////////
+// outline the number of reservable nodes
+$nodes_message = count_english($slice_nodes, "node");
+if (count($reservable_nodes)) {
+ $nodes_message .= " (" . count($reservable_nodes) . " reservable)";
+}
+
+$toggle = new PlekitToggle('my-slice-nodes', $nodes_message,
+ array('bubble' =>
+ 'Manage nodes attached to this slice',
+ 'visible' => get_arg('show_nodes')));