- $actions= array( ''=>'Choose Action' );
-
- if( in_array( 10, $_roles )
- || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) )
- || in_array( $slice_id, $_person['slice_ids'] ) ) {
- $actions['renew']= "Renew $name";
- $actions['nodes']= "Manage Nodes";
- }
- if ( in_array( 10, $_roles )
- || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) ) {
- $actions['users']= "Manage Users";
- $actions['delete']= "Delete $name";
- }
-
- echo "<table><tr><td>\n";
- if (in_array( 10, $_roles )) {
- echo plc_event_button("slices","slice",$slice_id);
- echo "</td><td>";
- }
- echo plc_comon_button("slice_id",$slice_id);
- echo "</td><td>\n";
-
- echo "<form action='/db/slices/slice_action.php' method='post'>\n";
- echo "<input type=hidden name=slice_id value=$slice_id>\n";
-
- echo "<select name='actions' onChange=\"submit();\">\n";
- foreach( $actions as $key => $val ) {
- echo "<option value='$key'";
-
- if( $key == $_POST['actions'] )
- echo " selected";
-
- echo ">$val\n";
- }
-
- echo "</select><br />\n";
- echo "</form>\n";
+$layout_info='
+This tab allows you to customize the columns in the node tables,
+below. Information on the nodes comes from a variety of monitoring
+sources. If you, as either a user or a provider of monitoring data,
+would like to see additional columns made available, please send us
+your request in mail to <a
+href="mailto:support@myslice.info">support@myslice.info</a>. You can
+find more information about the MySlice project at <a
+href="http://trac.myslice.info">http://trac.myslice.info</a>.
+';
+$toggle_nodes=new PlekitToggle('my-slice-nodes-configuration',
+ "Node table layout",
+ array('visible'=>$column_conf_visible,
+ 'info-text'=>$layout_info,
+ 'info-visible'=>$show_layout_info));
+$toggle_nodes->start();
+
+//usort ($table_headers, create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);'));
+//print("<p>TABLE HEADERS<p>");
+//print_r($table_headers);
+
+print("<div id='debug'></div>");
+print("<input type='hidden' id='slice_id' value='".$slice['slice_id']."' />");
+print("<input type='hidden' id='person_id' value='".$plc->person['person_id']."' />");
+print("<input type='hidden' id='conf_tag_id' value='".$conf_tag_id."' />");
+print("<input type='hidden' id='show_tag_id' value='".$show_tag_id."' />");
+print("<input type='hidden' id='show_configuration' value='".$show_configuration."' />");
+print("<input type='hidden' id='column_configuration' value='".$slice_column_configuration."' />");
+print("<br><input type='hidden' size=80 id='full_column_configuration' value='".$column_configuration."' />");
+print("<input type='hidden' id='previousConf' value='".$slice_column_configuration."' />");
+print("<input type='hidden' id='defaultConf' value='".$default_configuration."' />");
+
+$ConfigureColumns->configuration_panel_html(true);
+
+$ConfigureColumns->javascript_init();
+
+$toggle_nodes->end();
+
+
+$all_sites=$api->GetSites(NULL, array('site_id','login_base'));
+$site_hash=array();
+foreach ($all_sites as $tmp_site) $site_hash[$tmp_site['site_id']]=$tmp_site['login_base'];
+
+$interface_columns=array('ip','node_id','interface_id');
+$interface_filter=array('is_primary'=>TRUE);
+$interfaces=$api->GetInterfaces($interface_filter,$interface_columns);
+
+$interface_hash=array();
+foreach ($interfaces as $interface) $interface_hash[$interface['node_id']]=$interface;
+
+
+
+
+
+//////////////////// nodes currently in
+$toggle_nodes=new PlekitToggle('my-slice-nodes-current',
+ count_english($slice_nodes,"node") . " currently in $name",
+ array('visible'=>get_arg('show_nodes_current',!$privileges)));
+$toggle_nodes->start();
+
+$headers=array();
+$notes=array();
+//$notes=array_merge($notes,$visibletags->notes());
+$notes [] = "For information about the different columns please see the <b>node table layout</b> tab above or <b>mouse over</b> the column headers";
+
+/*
+$headers['peer']='string';
+$headers['hostname']='string';
+$short="-S-"; $long=Node::status_footnote(); $type='string';
+ $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
+$short=reservable_mark(); $long=reservable_legend(); $type='string';
+ $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
+// the extra tags, configured for the UI
+$headers=array_merge($headers,$visibletags->headers());
+
+if ($privileges) $headers[plc_delete_icon()]="none";
+*/
+
+$edit_header = array();
+if ($privileges) $edit_header[plc_delete_icon()]="none";
+$headers = array_merge($ConfigureColumns->get_headers(),$edit_header);
+
+//print("<p>HEADERS<p>");
+//print_r($headers);
+
+$table_options = array('notes'=>$notes,
+ 'search_width'=>15,
+ 'pagesize'=>20,
+ 'configurable'=>true);
+
+$table=new PlekitTable('nodes',$headers,NULL,$table_options);
+
+$form=new PlekitForm(l_actions(),array('slice_id'=>$slice['slice_id']));
+$form->start();
+$table->start();
+if ($slice_nodes) foreach ($slice_nodes as $node) {
+ $table->row_start();
+
+$table->cell($node['node_id'], array('display'=>'none'));
+
+ $table->cell(l_node_obj($node));
+ $peers->cell($table,$node['peer_id']);
+ $run_level=$node['run_level'];
+ list($label,$class) = Node::status_label_class_($node);
+ $table->cell ($label,array('class'=>$class));
+ $table->cell( ($node['node_type']=='reservable')?reservable_mark():"" );
+
+ $hostname=$node['hostname'];
+ $ip=$interface_hash[$node['node_id']]['ip'];
+ $interface_id=$interface_hash[$node['node_id']]['interface_id'];