bugfix: the slice page was broken when nobody is in slice
[plewww.git] / planetlab / events / events_choser.php
1 <?php
2 // $Id$
3
4 // Require login
5 require_once 'plc_login.php';
6
7 // Get session and API handles
8 require_once 'plc_session.php';
9 global $plc, $api;
10
11 //// Print header
12 require_once 'plc_drupal.php';
13 include 'plc_header.php';
14
15 // Common functions
16 require_once 'plc_functions.php';
17 require_once 'linetabs.php';
18 require_once 'details.php';
19 require_once 'datepicker.php';
20   
21 //set default title
22 drupal_set_title('Events choser');
23
24 // this needs to be fine-tuned anyway
25 if ( ! plc_is_admin()) {
26   drupal_set_error("You need admin role to see this page.");
27   return;
28  }
29
30 //////////////////////////////////////////////////////////// form
31
32 $tabs=array();
33 $tabs['Clear']=l_events();
34 $tabs['Sites']=l_sites();
35 $tabs['Users']=l_persons();
36 $tabs['Nodes']=l_nodes();
37 $tabs['Slices']=l_slices();
38 plekit_linetabs ($tabs);
39
40 // fill out dates from now if not specified
41 $from_picker = new PlekitDatepicker ('from_date','From (inclusive)',array('inline'=>true));
42 $from_picker->today();
43 $until_picker = new PlekitDatepicker ('until_date','Until (inclusive)',array('inline'=>true));
44 $until_picker->today();
45
46 $form=new PlekitForm(l_events(),array(),array('method'=>'get'));
47 $form->start();
48
49 $details = new PlekitDetails (true);
50 $details->start();
51
52 $details->tr ($form->submit_html('submit','Show Events'),'center');
53 $details->space();
54
55 $details->th_td ( $form->radio_html ('type','Event',array('id'=>'events','checked'=>true)) . "Events",
56                  $form->text_html('event','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'events.checked=true')));
57 $details->th_td ( $form->radio_html ('type','Site',array('id'=>'sites')) . "Sites",
58                  $form->text_html('site','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'sites.checked=true')));
59 $details->th_td ( $form->radio_html ('type','Person',array('id'=>'persons')) . "Persons",
60                  $form->text_html('person','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'persons.checked=true')));
61 $details->th_td ( $form->radio_html ('type','Node',array('id'=>'nodes')) . "Nodes",
62                  $form->text_html('node','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'nodes.checked=true')));
63 $details->th_td ( $form->radio_html ('type','Slice',array('id'=>'slices')) . "Slices",
64                  $form->text_html('slice','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'slices.checked=true')));
65
66 $details->space();
67 $details->tr ($form->submit_html('submit','Show Events'),'center');
68
69 $details->space();
70 $details->th_th(html_div($from_picker->html()) , html_div($until_picker->html()));
71
72 $details->end();
73 $form->end();
74
75 //plekit_linetabs ($tabs,"bottom");
76
77   // Print footer
78 include 'plc_footer.php';
79
80 ?>
81