4 require_once 'plc_login.php';
6 // Get session and API handles
7 require_once 'plc_session.php';
12 require_once 'plc_drupal.php';
13 drupal_set_title('Slices');
14 include 'plc_header.php';
18 require_once 'plc_functions.php';
21 $_person= $plc->person;
22 $_roles= $_person['role_ids'];
25 drupal_set_message ("xxx tag_action.php is deprecated - use planetlab/actions.php instead");
29 // TAGS -------------------------------------------------
32 if( $_GET['rem_id'] ) {
33 // get the id of the tag to remove from GET
34 $tag_id= intval( $_GET['rem_id'] );
37 $tag_info= $api->GetSliceTags( array( $tag_id ), array( "slice_id" ) );
38 $slice_id= $tag_info[0]['slice_id'];
41 $api->DeleteSliceTag( $tag_id );
43 plc_redirect( "index.php?id=$slice_id" );
48 if( $_POST['edit_tag'] ) {
49 // get the id of the tag to update and the value from POST
50 $tag_id= intval( $_POST['tag_id'] );
51 $value= $_POST['value'];
52 $slice_id= $_POST['slice_id'];
55 $api->UpdateSliceTag( $tag_id, $value );
57 plc_redirect( "index.php?id=$slice_id" );
62 if( $_POST['add_tag'] ) {
63 // get the slice_id, tag_type_id, and value from POST
64 $slice_id= intval( $_POST['slice_id'] );
65 $tag_type_id= intval( $_POST['tag_type_id'] );
66 $value= $_POST['value'];
69 $api->AddSliceTag( $slice_id, $tag_type_id, $value );
71 plc_redirect( "index.php?id=$slice_id" );
74 // TAG TYPES ---------------------------------------------------
77 if( $_POST['add_type'] ) {
79 $name= $_POST['name'];
80 $min_role_id= intval( $_POST['min_role_id'] );
81 $description= $_POST['description'];
83 // make the tag_type_fields dict
84 // xxx misses category
85 $tag_type_fields= array( "min_role_id" => $min_role_id,
87 "description" => $description );
90 $api->AddTagType( $tag_type_fields );
92 plc_redirect( "tags.php?type=slice" );
97 if( $_POST['edit_type'] ) {
99 $name= $_POST['name'];
100 $min_role_id= intval( $_POST['min_role_id'] );
101 $description= $_POST['description'];
102 $tag_type_id= intval( $_POST['tag_type_id'] );
104 // make tag_type_fields dict
105 $tag_type_fields= array( "min_role_id" => $min_role_id, "tagname" => $name, "description" => $description );
108 $api->UpdateTagType( $tag_type_id, $tag_type_fields );
110 plc_redirect( "tags.php?type=slice" );
116 include 'plc_footer.php';