-if( $_GET['slice'] && $_GET['node'] ) {
- $slice_id= $_GET['slice'];
- $node_id= $_GET['node'];
-
- // slice info
- $slice_info= $api->GetSlices( array( intval( $slice_id ) ), array( "name" ) );
-
- // node info
- $node_info= $api->GetNodes( array( intval( $node_id ) ), array( "hostname" ) );
-
- // get the slivers for this node
- $sliver_info= $api->GetSliceTags( array( "node_id"=>intval( $node_id ), "slice_id"=>intval( $slice_id ) ), array( "slice_tag_id", "name", "value", "min_role_id", "description" ) );
-
- // get the attrbibutes for this slice
- $tag_info= $api->GetSliceTags( array( intval( $slice_id ) ), array( "slice_tag_id", "name", "value", "min_role_id", "description" ) );
-
-
- // start form
- echo "<form action='slivers.php' method=post>\n<h2>Sliver Details for slice ". $slice_info[0]['name'] ." on node ". $node_info[0]['hostname'] ."</h2>\n";
-
- // sliver tags of slice
- if( empty( $sliver_info ) )
- // if no sliver exists tell user
- echo "No sliver tag for this node/slice sliver combination.\n";
- else {
- echo "<p><table class='list_set' border=0 cellpadding=2>\n<caption class='list_set'>Slivers</caption>\n<thead><tr class='list_set'><th class='list_set'>Name</th><th class='list_set'>Value</th><th class='list_set'>Min Roll</th><th class='list_set'>Description</th>";
- if ( in_array( 10, $_roles ) || ( in_array( 20, $_roles ) && in_array( $node_info, $_person['site_ids'] ) ) ) echo "<th></th><th></th>";
- echo "</tr></thead><tbody>\n";
-
- foreach( $sliver_info AS $sliver ) {
- echo "<tr><td>". $sliver['name'] ."</td><td>". $sliver['value'] ."</td><td>". $sliver['min_role_id'] ."</td><td>". $sliver['description'] ."</td>";
- if ( in_array( 10, $_roles ) || ( in_array( 20, $_roles ) && in_array( $node_info, $_person['site_ids'] ) ) ) echo "<td><a href='/db/slices/tags.php?type=slice&id=". $sliver['slice_tag_id'] ."'>Edit</a></td><td><a href='sliver_action.php?rem_id=". $sliver['slice_tag_id'] ."' onclick=\"javascript:return confirm('Are you sure you want to remove ". $sliver['name'] ." from node ". $node_info[0]['hostname'] ."?')\">Remove</a></td>";
- echo "</tr>\n";
-
-
+if( $_GET['slice_id'] && $_GET['node_id'] ) {
+ $slice_id = $_GET['slice_id'];
+ $node_id = $_GET['node_id'];
+
+
+ // slice info
+ $slice = $api->GetSlices( array( intval( $slice_id ) ), array( "name" ) );
+ $slice = $slice[0];
+
+ // node info
+ $node = $api->GetNodes( array( intval( $node_id ) ), array( "hostname" ) );
+ $node = $node[0];
+
+ drupal_set_title("Sliver tags on node " . $node['hostname'] . " and slice " . $slice['name']);
+
+ $peer_id= $slice['peer_id'];
+ $local_peer = ! $peer_id;
+ $privileges = ( $local_peer && (plc_is_admin() || plc_is_pi() || $am_in_slice));
+
+ // get the slivers for this node
+ $tags = $api->GetSliceTags( array( "node_id"=>intval( $node_id ), "slice_id"=>intval( $slice_id ) ),
+ array( "slice_tag_id", "tagname", "value", "min_role_id", "description" ) );
+
+ $toggle = new PlekitToggle ('sliver-tags',count_english_warning($tags,'tag'),
+ array('bubble'=>'Inspect and set tags on the sliver',
+ 'visible'=>true));
+ $toggle->start();
+
+ $headers=array(
+ "Name"=>"string",
+ "Value"=>"string",
+ "Description"=>"string");
+ if ($privileges) $headers[plc_delete_icon()]="none";
+
+ $table_options = array("notes_area"=>false,"pagesize_area"=>false,"search_width"=>10);
+ $table = new PlekitTable("sliver_tags",$headers,'0',$table_options);
+ $form = new PlekitForm(l_actions(),array('slice_id'=>$slice_id, 'node_id'=>$node_id, 'sliver_action'=>true));
+ $form->start();
+ $table->start();
+
+ foreach ($tags as $tag) {
+ $table->row_start();
+ $table->cell($tag['tagname']);
+ $table->cell($tag['value']);
+ $table->cell($tag['description']);
+ $table->row_end();