c74e5c22460c037e00359d2a279ac187769551db
[raven.git] / apps / gacksadmin / user_image.php
1 <?php
2
3 // this must occur before linetabs.php, or linetabs won't work. I have no idea why.
4 drupal_add_js("misc/popup.js");
5
6 // Require login
7 require_once 'plc_login.php';
8
9 // Get session and API handles
10 require_once 'plc_session.php';
11 global $plc, $api, $adm;
12
13 // Common functions
14 require_once 'plc_functions.php';
15 require_once 'plc_peers.php';
16 require_once 'gacks_functions.php';
17 require_once 'gacksclient.php';
18 require_once 'linetabs.php';
19 require_once 'table.php';
20 require_once 'details.php';
21 require_once 'toggle.php';
22 require_once 'form.php';
23 require_once 'nifty.php';
24
25 // find person roles
26 $_person= $plc->person;
27 $_person_id = $plc->person['person_id'];
28 $_roles= $_person['role_ids'];
29
30 // Print header
31 require_once 'plc_drupal.php';
32 drupal_set_title('Manage Nodes: Select Image');
33 include 'plc_header.php';
34
35 $tabs['Show Nodes'] = array('method'=>'GET',
36                            'url'=>l_gacks_nodelist(),
37                            'bubble'=>"Show nodes in your slice");
38
39 $tabs['Add Nodes'] = array('method'=>'GET',
40                            'url'=>l_gacks_wizard(),
41                            'bubble'=>"Add nodes to your slice");
42
43 $tabs['Select Image'] = array('method'=>'GET',
44                            'url'=>l_gacks_image(),
45                            'bubble'=>"Select image to use in this slice");
46
47 $_GET['active_line_tab'] = "Select Image";
48 plekit_linetabs($tabs);
49
50 $nifty=new PlekitNifty ('sliceimage','objects-list','big');
51 $nifty->start();
52 print '<div style="width: 640px; margin-left: auto; margin-right: auto;">';
53
54 //print "<br>";
55 $account_name = get_account_name($api, $_person_id);
56
57 if ($account_name != NULL) {
58     $gacksapi = new GACKSAPI();
59
60     $image = get_slice_image($api, $account_name);
61     if (!$image) {
62         $image = "";
63     }
64
65     $image_selectors = array();
66     $image_selectors []= array("display"=>"Default PlanetLab image", "value"=>"");
67     $image_selectors []= array("display"=>"Hadoop", "value"=>"hadoop");
68     $image_selectors []= array("display"=>"MPI", "value"=>"mpi");
69     if (!in_array($image, array("", "hadoop", "mpi"))) {
70         $image_selectors []= array("display"=> $image, "value"=> $image);
71     }
72     select_selector($image, $image_selectors);
73
74     $form = new PlekitForm(l_gacks_actions(), array("action"=>"set-image",
75                                                     "account_name"=> $account_name));
76     $form->start();
77
78     print "<br><br>Select a preconfigured image for your slice:<br>";
79     print $form->select_html("image", $image_selectors);
80     print "<br><br>";
81     print $form->submit_html("submit", "submit");
82
83     $form->end();
84 }
85
86 print "</div>";
87 $nifty->end();
88
89 include 'plc_footer.php';
90
91 ?>
92
93