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';
19 require_once 'plc_sorts.php';
22 $_person= $plc->person;
23 $_roles= $_person['role_ids'];
26 drupal_set_message ("xxx tag_action.php is deprecated - use planetlab/actions.php instead");
30 // TAGS -------------------------------------------------
33 if( $_GET['rem_id'] ) {
34 // get the id of the tag to remove from GET
35 $tag_id= intval( $_GET['rem_id'] );
38 $tag_info= $api->GetSliceTags( array( $tag_id ), array( "slice_id" ) );
39 $slice_id= $tag_info[0]['slice_id'];
42 $api->DeleteSliceTag( $tag_id );
44 plc_redirect( "index.php?id=$slice_id" );
49 if( $_POST['edit_tag'] ) {
50 // get the id of the tag to update and the value from POST
51 $tag_id= intval( $_POST['tag_id'] );
52 $value= $_POST['value'];
53 $slice_id= $_POST['slice_id'];
56 $api->UpdateSliceTag( $tag_id, $value );
58 plc_redirect( "index.php?id=$slice_id" );
63 if( $_POST['add_tag'] ) {
64 // get the slice_id, tag_type_id, and value from POST
65 $slice_id= intval( $_POST['slice_id'] );
66 $tag_type_id= intval( $_POST['tag_type_id'] );
67 $value= $_POST['value'];
70 $api->AddSliceTag( $slice_id, $tag_type_id, $value );
72 plc_redirect( "index.php?id=$slice_id" );
75 // TAG TYPES ---------------------------------------------------
78 if( $_POST['add_type'] ) {
80 $name= $_POST['name'];
81 $min_role_id= intval( $_POST['min_role_id'] );
82 $description= $_POST['description'];
84 // make the tag_type_fields dict
85 // xxx misses category
86 $tag_type_fields= array( "min_role_id" => $min_role_id,
88 "description" => $description );
91 $api->AddTagType( $tag_type_fields );
93 plc_redirect( "tags.php?type=slice" );
98 if( $_POST['edit_type'] ) {
100 $name= $_POST['name'];
101 $min_role_id= intval( $_POST['min_role_id'] );
102 $description= $_POST['description'];
103 $tag_type_id= intval( $_POST['tag_type_id'] );
105 // make tag_type_fields dict
106 $tag_type_fields= array( "min_role_id" => $min_role_id, "tagname" => $name, "description" => $description );
109 $api->UpdateTagType( $tag_type_id, $tag_type_fields );
111 plc_redirect( "tags.php?type=slice" );
117 include 'plc_footer.php';