262530dbd6cac5588babf8a771450cbe626a18a1
[plewww.git] / planetlab / nodes / sliver_action.php
1 <?php
2
3 // Require login
4 require_once 'plc_login.php';
5
6 // Get session and API handles
7 require_once 'plc_session.php';
8 global $plc, $api;
9
10 /*
11 // Print header
12 require_once 'plc_drupal.php';
13 drupal_set_title('Slices');
14 include 'plc_header.php';
15 */
16
17 // Common functions
18 require_once 'plc_functions.php';
19 require_once 'plc_sorts.php';
20
21 // find person roles
22 $_person= $plc->person;
23 $_roles= $_person['role_ids'];
24
25
26 if( !empty( $_POST['add_sub'] ) ) {
27   $attrib_type= $_POST['sliver'];
28   $value= $_POST['value'];
29   $node_id= $_POST['node_id'];
30   $slice_id= $_POST['slice_id'];
31
32   $api->AddSliceTag( intval( $slice_id ), intval( $attrib_type ), $value, intval( $node_id ) );
33
34   header( "location: slivers.php?slice=$slice_id&node=$node_id" );
35   exit();
36   
37 }
38
39
40 // 
41 if( $_GET['rem_id'] ) {
42   $attrib_id= $_GET['rem_id'];
43   
44   // get the slivers for this node
45   $sliver_info= $api->GetSliceTags( array( "slice_tag_id"=>intval( $attrib_id ) ), array( "slice_id", "node_id" ) );
46   
47   $api->DeleteSliceTag( intval( $attrib_id ) );
48
49   header( "location: slivers.php?slice=". $sliver_info[0]['slice_id'] ."&node=". $sliver_info[0]['node_id'] );
50   exit();
51   
52 }
53
54   
55 /*
56 // Print footer
57 include 'plc_footer.php';
58 */
59
60 ?>