redirects
[plewww.git] / planetlab / slices / delete_slice.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 // Common functions
11 require_once 'plc_functions.php';
12 require_once 'plc_sorts.php';
13   
14 // find person roles
15 $_person= $plc->person;
16 $_roles= $_person['role_ids'];
17
18 //print_r( $_person );
19
20 // if no id then go back to slice index
21 if( !$_GET['id'] )
22   header( "index.php" );
23
24 // get slice id from get
25 $slice_id= $_GET['id'];
26
27 // delete it!
28 if( $_POST['delete'] ) {
29   $api->DeleteSlice( intval( $slice_id ) );
30   plc_redirect(l_slices());
31 }
32
33 // Print header
34 require_once 'plc_drupal.php';
35 drupal_set_title('Slices');
36 include 'plc_header.php';
37
38
39 // get slice info from API call
40 $slice_info= $api->GetSlices( array( intval( $slice_id ) ), array( "name", "expires", "description" ) );
41
42 // start form
43 echo "<form action='delete_slice.php?id=$slice_id' method=post>\n";
44
45 // show delete confirmation
46 echo "<h2>Delete slice ". $slice_info[0]['name'] ."</h2>\n";
47 echo "<p>Are you sure you want to delete this slice?\n";
48
49 echo "<table><tbody>\n";
50 echo "<tr><th>Name: </th><td> ". $slice_info[0]['name'] ."</td></tr>\n";
51 echo "<tr><th>Description: </th><td> ". $slice_info[0]['description'] ."</td></tr>\n";
52 echo "<tr><th>Expiration: </th><td> ". gmstrftime( "%A %b-%d-%y %T %Z", $slice_info[0]['expires'] ) ."</td></tr>\n";
53 echo "</tbody></table>\n";
54 echo "<input type=submit value='Delete Slice' name='delete'>\n";
55 echo "</form\n";
56
57 // Print footer
58 include 'plc_footer.php';
59
60 ?>