6 require_once 'plc_login.php';
8 // Get session and API handles
9 require_once 'plc_session.php';
13 require_once 'plc_drupal.php';
14 include 'plc_header.php';
17 require_once 'plc_functions.php';
18 require_once 'linetabs.php';
19 require_once 'table.php';
21 drupal_set_message ("xxx tag_set.php is deprecated - use planetlab/actions.php instead");
25 // get slice id from GET
26 $slice_id= intval( $_GET['add'] );
29 $tag_types= $api->GetTagTypes( $tag_type_filter , array( "tag_type_id", "tagname" ) );
31 foreach( $tag_types as $tag_type ) {
32 $all_tags[$tag_type['tag_type_id']]= $tag_type['tagname'];
35 // get slice's tag types
36 $slice_info= $api->GetSlices( array( $slice_id ), array( "slice_tag_ids" ) );
37 $tag_info= $api->GetSliceTags( $slice_info[0]['slice_tag_ids'], array( "tag_type_id", "tagname" ) );
39 foreach( $tag_info as $info ) {
40 $slice_tag_types[$info['tag_type_id']]= $info['tagname'];
44 $tag_types= $all_tags;
47 echo "<form action='tag_action.php' method='post'>\n";
48 echo "<h2>Edit ". $slice_info[0]['name'] ." tag: ". $tag_type[0]['tagname'] ."</h2>\n";
50 echo "<select name='tag_type_id'><option value=''>Choose a type to add</option>\n";
52 foreach( $tag_types as $key => $val ) {
53 echo "<option value='". $key ."'>". $val ."</option>\n";
58 echo "<p><strong>Value: </strong><input type=text name='value'>\n";
60 echo "<p><input type=submit name='add_tag' value='Add Tag'>\n";
61 echo "<input type=hidden name='slice_id' value='$slice_id'>\n";
66 $tag_id= intval( $_GET['id'] );
69 $slice_tag= $api->GetSliceTags( array( $tag_id ), array( "slice_id", "slice_tag_id", "tag_type_id", "value", "description", "min_role_id" ) );
72 $tag_type= $api->GetTagTypes( array( $slice_tag[0]['tag_type_id'] ), array( "tag_type_id", "tagname", "description" ) );
75 $slice_info= $api->GetSlices( array( $slice_tag[0]['slice_id'] ), array( "name" ) );
77 // start form and put values in to be edited.
78 echo "<form action='tag_action.php' method='post'>\n";
79 echo "<h2>Edit ". $slice_info[0]['name'] ." tag: ". $tag_type[0]['tagname'] ."</h2>\n";
81 echo $slice_tag[0]['description'] ."<br />\n";
82 echo "<strong>Value:</strong> <input type=text name=value value='". $slice_tag[0]['value'] ."'><br /><br />\n";
84 echo "<input type=submit value='Edit Tag' name='edit_tag'>\n";
85 echo "<input type=hidden name='slice_id' value='". $slice_tag[0]['slice_id'] ."'>\n";
86 echo "<input type=hidden name='tag_id' value='". $tag_id ."'>\n";
92 include 'plc_footer.php';