-print "<hr/>\n";
-plc_table_title ("Slices");
-if ( ! $slices ) {
- echo "<p><span class='plc-warning'>This node is not associated to any slice.</span></p>\n";
- } else {
- $headers=array();
- $headers['Peer']="string";
- $headers['Name']="string";
- $headers['Slivers']="string";
- $table_options = array('notes_area'=>false);
- plc_table_start ("slivers",$headers,1,$table_options);
-
- foreach ($slices as $slice) {
- plc_table_row_start($slice['name']);
- plc_table_cell (plc_peer_shortname($peer_hash,$slice['peer_id']));
- plc_table_cell (l_slice_t ($slice['slice_id'],$slice['name']));
- plc_table_cell (l_sliver_t ($node_id,$slice['slice_id'],'view'));
- plc_table_row_end();
+//////////////////////////////////////////////////////////// Tags
+// tags section
+if ( $local_peer ) {
+
+ $tags=$api->GetNodeTags (array('node_id'=>$node_id));
+ function get_tagname ($tag) { return $tag['tagname'];}
+ // xxx looks like tech-only see an error here,
+ // might be that GetNodeTags is not accessible or something
+ $tagnames = array_map ("get_tagname",$tags);
+ $nodegroups_hash=plc_nodegroup_global_hash($api,$tagnames);
+
+ $toggle = new PlekitToggle ('tags',count_english($tags,'tag'),
+ array('bubble'=>'Inspect and set tags on that node',
+ 'visible'=>get_arg('show_tags',false)));
+ $toggle->start();
+
+ $headers=array("Name"=>"string",
+ "Value"=>"string",
+ "Nodegroup"=>"string",
+ );
+ if (plc_is_admin()) $headers[plc_delete_icon()]="none";
+
+ $table_options=array("notes_area"=>false,"pagesize_area"=>false,"search_width"=>10);
+ $table=new PlekitTable("node_tags",$headers,0,$table_options);
+ $table->start();
+ if ($tags) foreach ($tags as $tag) {
+ // does this match a nodegroup ?
+ $nodegroup_name="n/a";
+ $nodegroup_key=$tag['tagname'] . "=" . $tag['value'];
+ $nodegroup=$nodegroups_hash[$nodegroup_key];
+ if ($nodegroup) $nodegroup_name=l_nodegroup_t($nodegroup['nodegroup_id'],$nodegroup['groupname']);
+ $table->row_start();
+ $table->cell(l_tag_obj($tag));
+ $table->cell($tag['value']);
+ $table->cell($nodegroup_name);
+ // the remove checkbox
+ if (plc_is_admin()) $table->cell ($form->checkbox_html('node_tag_ids[]',$tag['node_tag_id']));
+ $table->row_end();
+ }
+
+ if ($privileges) {
+ $table->tfoot_start();
+
+ // remove tag
+ $table->row_start();
+ $table->cell($form->submit_html("delete-node-tags","Remove Tags"),
+ // use the whole columns and right adjust
+ array('hfill'=>true,'align'=>'right'));
+ $table->row_end();
+
+ // set tag area
+ $table->row_start();
+ // get list of tag names in the node/* category
+ $all_tags= $api->GetTagTypes( array ("category"=>"node*"), array("tagname","tag_type_id"));
+ // xxx cannot use onchange=submit() - would need to somehow pass action name
+ function tag_selector ($tag) { return array("display"=>$tag['tagname'],"value"=>$tag['tag_type_id']); }
+ $selector=array_map("tag_selector",$all_tags);
+ $table->cell($form->select_html("tag_type_id",$selector,array('label'=>"Choose")));
+ $table->cell($form->text_html("value","",array('width'=>8)));
+ $table->cell($form->submit_html("set-tag-on-node","Set Tag"),array('columns'=>2,'align'=>'left'));
+ $table->row_end();