ckp
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 10 Feb 2009 11:20:22 +0000 (11:20 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 10 Feb 2009 11:20:22 +0000 (11:20 +0000)
planetlab/events/events.php [new file with mode: 0644]
planetlab/events/events_choser.php [new file with mode: 0644]
planetlab/events/index.php

diff --git a/planetlab/events/events.php b/planetlab/events/events.php
new file mode 100644 (file)
index 0000000..5ef4ec4
--- /dev/null
@@ -0,0 +1,290 @@
+<?php
+// $Id: index.php 11949 2009-02-09 17:57:16Z thierry $
+
+// Require login
+require_once 'plc_login.php';
+
+// Get session and API handles
+require_once 'plc_session.php';
+global $plc, $api;
+
+//// Print header
+require_once 'plc_drupal.php';
+include 'plc_header.php';
+
+// Common functions
+require_once 'plc_functions.php';
+require_once 'plc_tables.php';
+require_once 'plc_minitabs.php';
+require_once 'plc_datepicker.php';
+  
+// needs much memory
+ini_set("memory_limit","256M");
+
+//set default title
+drupal_set_title('Events');
+
+// as per index.php, we get here if _GET['type'] is set
+$type=$_GET['type'];
+$from_date=$_GET['from_date'];
+$until_date=$_GET['until_date'];
+
+$messages=array();
+
+//////////////////////////////////////////////////////////// dates
+// our format is yyyy/MMM/dd
+
+// given the user-typed string, return (*) a visible string, (*) an int time
+// the flag should be false for the 'from' field, and true for the until field
+
+$EPOCH="1 January 2008";
+$DAY=24*60*60-1;
+
+function parse_date ($user_date,$until_if_true=false,$DAY,$EPOCH) {
+
+  // empty string
+  if (empty ($user_date)) {
+    if ( ! $until_if_true) {
+    // an empty string means the epoch in from-mode
+      $date=$EPOCH; $time=strtotime($date);
+    } else {
+      $date="now"; $time=strtotime($date);
+    }
+  
+  } else {
+    // user-provided string
+    list ($year,$month,$day) = split ('[/.-]',$user_date);
+    $date=sprintf("%s %s %s",$day,$month,$year);
+    $time=strtotime($date);
+    //if the flag is set, we add 23h59'59'', so the 'until' date is inclusive
+    if ($until_if_true) {
+      $time += $DAY;
+    }
+    $date=strftime("%Y/%b/%d @ %H:%M",$time);
+  }
+  return array($date,$time);
+}
+
+//////////////////////////////////////////////////////////// layout
+// outline node ids and person ids with a link
+function e_node ($node_id) {
+  if (! $node_id) return "";
+  return l_node_t($node_id,$node_id);
+}
+function e_person ($person_id) {
+  if (! $person_id) return "";
+  return l_person_t($person_id,$person_id);
+}
+// xxx broken
+function e_event ($event_id) {
+  if (! $event_id) return "";
+  return href(l_event("Event","event",$event_id),$event_id);
+}
+
+function e_subject ($type,$id) {
+  $mess=$type . " " . $id;
+  switch ($type) {
+  case 'Node': return l_node_t ($id,$mess);
+  case 'Site': return l_site_t ($id,$mess);
+  case 'Person': return l_person_t ($id,$mess);
+  case 'Slice': return l_slice_t ($id,$mess);
+  case 'Role': case 'Key': case 'PCU': case 'Interface': case 'NodeGroup': case "Address":
+    return "$mess";
+  default: return "Unknown $type" . "-" . $id;
+  }
+}
+
+// synthesize links to the subject objects from types and ids
+function e_subjects ($param) {
+  $types=$param['object_types'];
+  $ids=$param['object_ids'];
+  if ( ! $types) return "";
+  return plc_vertical_table(array_map ("e_subject",$types,$ids));
+}
+
+function e_issuer ($param) {
+  if ($param['node_id'])       return e_subject('Node',$param['node_id']);
+  if ($param['person_id'])     return e_subject('Person',$param['person_id']);
+  return '???';
+}
+
+function e_auth ($event) {
+  if (array_key_exists('auth_type',$event)) 
+    return $event['auth_type'];
+    else
+      return "";
+}
+
+function e_fault ($event) {
+  $f=$event['fault_code'];
+  if ($f==0) return "OK";
+  else return $f;
+}
+
+////////////////////////////////////////////////////////////
+// for convenience, add 1 day to the 'until' date as otherwise this corresponds to 0:00
+
+$tabs=array();
+$tabs['Clear events']=l_events();
+plc_tabs($tabs);
+
+list($from_string,$from_time) = parse_date ($from_date,false,$DAY,$EPOCH);
+list($until_string,$until_time) = parse_date ($until_date,true,$DAY,$EPOCH);
+
+if ($from_time > $until_time) {
+  drupal_set_error("Warning - <from> is after <until>");
+  return;
+ }
+
+$filter=array();
+// sort events by time is not good enough, let's use event_id
+$filter['-SORT']='-event_id';
+$filter[']time']=$from_time;
+$filter['[time']=$until_time;
+
+//////////////////////////////////////// Events
+if ($type == 'Event') {
+  
+  // and the filter applied for fetching events using GetEvent
+  $user_desc=$_GET['event'];
+  if ( ! empty($user_desc)) {
+    // should parse stuff like 45-90,230-3000 - some other day
+    $filter['event_id']=intval($user_desc);
+  }
+  
+  $events = $api->GetEvents($filter); 
+  $title="Events [ $from_string - $until_string] matching " . ($user_desc ? $user_desc : "everything");
+  
+  // see actual display of $title and $events below
+  
+ } else {
+  
+  switch ($type) {
+  case 'Person': 
+    $primary_key='person_id';
+    $string_key='email';
+    $user_input=$_GET['person'];
+    $method="GetPersons";
+    $object_type='Person';
+    break;
+
+  case 'Node': 
+    $primary_key='node_id';
+    $string_key='hostname';
+    $user_input=$_GET['node'];
+    $method="GetNodes";
+    $object_type='Node';
+    break;
+      
+  case 'Site': 
+    $primary_key='site_id';
+    $string_key='login_base';
+    $user_input=$_GET['site'];
+    $method="GetSites";
+    $object_type='Site';
+    break;
+
+  case 'Slice': 
+    $primary_key='slice_id';
+    $string_key='name';
+    $user_input=$_GET['slice'];
+    $method="GetSlices";
+    $object_type='Slice';
+    break;
+  }
+
+  $object_ids=array();
+  $title="Events [ $from_string - $until_string]";
+  $title .= " type=$object_type";
+  $title .= " id(s)=";
+  foreach ( split(",",$user_input) as $user_desc) {
+# numeric 
+    if (my_is_int($user_desc)) {
+      $obj_check = call_user_func(array($api,$method),array(intval($user_desc)),array($primary_key));
+      if (empty ($obj_check)) {
+       $messages[] = "No such " . $primary_key . ": " . $user_desc;
+      } else {
+       $object_ids[] = $obj_check[0][$primary_key];
+       $title .= " $user_desc, " ;
+      }
+    } else {
+# string
+      $new_object_ids=call_user_func (array($api,$method), array($string_key=>$user_desc),array($primary_key,$string_key));
+      if (empty($new_object_ids)) {
+       $messages[] = "No " . $string_key . " matching " . $user_desc;
+      } else {
+       foreach ($new_object_ids as $new_obj_id) {
+         $object_ids[] = $new_obj_id[$primary_key];
+         $title .= $new_obj_id[$primary_key] . ", ";
+       }
+      }
+    }
+  }
+
+  $event_objs = $api->GetEventObjects(array('object_id'=>$object_ids,'object_type'=>$object_type),array('event_id'));
+  // get set of event_ids
+  $event_ids = array_map ( create_function ('$eo','return $eo["event_id"];') , $event_objs);
+    
+  $events = $api->GetEvents (array('event_id'=>$event_ids));
+
+  // see actual display of $title and $events below
+
+ }
+
+  drupal_set_title ($title);
+// Show messages
+if (!empty($messages)) 
+  foreach ($messages as $line) 
+    drupal_set_message($line);
+
+$headers=array("Id"=>"int",
+              "Time"=>"EnglishDateTime",
+              "Method"=>"string",
+              "Message"=>"string",
+              "Subjects"=>"string",
+              "Issuer"=>"string",
+              "Auth"=>"string",
+              "R"=>"string",
+              "D"=>"none",
+              );
+
+$table = new PlcTable ("events",$headers,"0r");
+$table->set_options (array ('max_pages'=>20));
+$table->start ();
+foreach ($events as $event) {
+  
+  // the call button
+  $message = htmlentities($event['message'], ENT_QUOTES);
+  $call = htmlentities($event['call'], ENT_QUOTES);
+  $text = sprintf("message=<<%s>>\\n\\ncall=<<%s>>\\n\\nruntime=<<%f>>\\n",$message,$call,$event['runtime']);
+  $method = "<input type=button name='call' value='" . $event['call_name'] ."' onclick='alert(\"" . $text . "\")'";
+  //    $method = sprintf('<span title="%s">%s</span>',$call,$method);
+  
+  // the message button
+  $trunc_mess=htmlentities(truncate($event['message'],40),ENT_QUOTES);
+  $message="<input type=button name='message' value='" . $trunc_mess ."' onclick='alert(\"" . $text . "\")'";
+  $details="<input type=button name='message' value='X' onclick='alert(\"" . $text . "\")'";
+  //    $message=sprintf('<span title="%s">%s</span>',$message,$message);
+  
+  $message=truncate($event['message'],40);
+  $table->row_start();
+  $table->cell(e_event($event['event_id']));
+  $table->cell(date('M/d/Y H:i', $event['time']));
+  $table->cell($event['call_name']);
+  $table->cell($message);
+  $table->cell(e_subjects($event));
+  $table->cell(e_issuer($event));
+  $table->cell(e_auth($event));
+  $table->cell(e_fault($event));
+  $table->cell($details);
+  $table->row_end();
+}
+$table->set_options(array('notes'=>array("The R column shows the call result value, a.k.a. fault_code",
+                                        "Click the button in the D(etails) column to get more details")));
+$table->end();
+  
+// Print footer
+include 'plc_footer.php';
+
+?>
+
diff --git a/planetlab/events/events_choser.php b/planetlab/events/events_choser.php
new file mode 100644 (file)
index 0000000..45316f7
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+// $Id: index.php 11949 2009-02-09 17:57:16Z thierry $
+
+// Require login
+require_once 'plc_login.php';
+
+// Get session and API handles
+require_once 'plc_session.php';
+global $plc, $api;
+
+//// Print header
+require_once 'plc_drupal.php';
+include 'plc_header.php';
+
+// Common functions
+require_once 'plc_functions.php';
+require_once 'plc_minitabs.php';
+require_once 'plc_details.php';
+require_once 'plc_datepicker.php';
+  
+//set default title
+drupal_set_title('Events choser');
+
+// this needs to be fine-tuned anyway
+if ( ! plc_is_admin()) {
+  drupal_set_error("You need admin role to see this page.");
+  return;
+ }
+
+//////////////////////////////////////////////////////////// form
+
+$tabs=array();
+$tabs['Clear']=l_events();
+$tabs['Sites']=l_sites();
+$tabs['Users']=l_persons();
+$tabs['Nodes']=l_nodes();
+$tabs['Slices']=l_slices();
+plc_tabs ($tabs);
+
+// fill out dates from now if not specified
+$from_picker = new PlcDatepicker ('from_date','From (inclusive)',array('inline'=>true));
+$from_picker->today();
+$until_picker = new PlcDatepicker ('until_date','Until (inclusive)',array('inline'=>true));
+$until_picker->today();
+
+$form=new PlcForm(l_events(),array(),'GET');
+$form->start();
+
+$details = new PlcDetails (true);
+$details->start();
+
+$details->single ($form->submit_html('submit','Show Events'),'center');
+$details->space();
+
+$details->line ( $form->radio_html ('events','type','Event',true) . "Events",
+                $form->text_html('event','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'events.checked=true')));
+$details->line ( $form->radio_html ('sites','type','Site',false) . "Sites",
+                $form->text_html('site','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'sites.checked=true')));
+$details->line ( $form->radio_html ('persons','type','Person',false) . "Persons",
+                $form->text_html('person','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'persons.checked=true')));
+$details->line ( $form->radio_html ('nodes','type','Node',false) . "Nodes",
+                $form->text_html('node','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'nodes.checked=true')));
+$details->line ( $form->radio_html ('slices','type','Slice',false) . "Slices",
+                $form->text_html('slice','',array('width'=>30,'onSelect'=>'submit()', 'onFocus'=>'slices.checked=true')));
+
+$details->space();
+$details->single ($form->submit_html('submit','Show Events'),'center');
+
+$details->space();
+$details->line_th(html_div($from_picker->html()) , html_div($until_picker->html()));
+
+$details->end();
+$form->end();
+
+  // Print footer
+include 'plc_footer.php';
+
+?>
+
index a132504..6eae410 100644 (file)
 <?php
+
 // $Id$
 
 // Require login
 require_once 'plc_login.php';
 
-// Get session and API handles
-require_once 'plc_session.php';
-global $plc, $api;
-
-//// Print header
-require_once 'plc_drupal.php';
-include 'plc_header.php';
-
-// Common functions
-require_once 'plc_functions.php';
-require_once 'plc_tables.php';
-require_once 'plc_minitabs.php';
-require_once 'plc_datepicker.php';
-  
-// needs much memory
-ini_set("memory_limit","256M");
-
-//set default title
-drupal_set_title('Events');
-
-// page size
-$page_size=30;
-
-$messages = array ();
-
-//////////////////////////////////////////////////////////// form
-
-// defaults for day ('j'), 3-letter month ('M') or year ('Y')
-function the_date ($key,$dateformat) { 
-  if ($_GET[$key]) return $_GET[$key];
-  else return date($dateformat);
-}
-
-// fill out dates from now if not specified
-$from_picker = new PlcDatepicker ('from_date','From (inclusive)');
-$from_picker->today();
-$from_html=$from_picker->html();
-$until_picker = new PlcDatepicker ('until_date','Until (inclusive)');
-$until_picker->today();
-$until_html=$until_picker->html();
-
-$action=l_events();
-
-$event_form = <<< EOF
-<form method=get name='events' action='$action' >
-
-<table class='plc_details'>
-<tr><td colspan=2>
-<table> <TR><TD>
-<input type='radio' name='type' id='events' value='Event' checked='checked'>&nbsp;Events: 
-</TD><TD>
-<input type='text' onSelect="submit();" onFocus='events.checked=true' name='event' size=20>
-</TD></TR><TR><TD>
-<input type='radio' name='type' id='persons' value='Person'>&nbsp;Persons:
-</TD><TD>
-<input type='text' onSelect="submit();" onFocus='persons.checked=true' name='person' size=20>
-</TD></TR><TR><TD>  
-<input type='radio' name='type' id='nodes' value='Node'>&nbsp;Nodes:
-</TD><TD>
-<input type='text' onSelect="submit();" onFocus='nodes.checked=true' name='node' size=20>
-</TD></TR><TR><TD>
-<input type='radio' name='type' id='sites' value='Site'>&nbsp;Sites:
-</TD><TD>
-<input type='text' onSelect="submit();" onFocus='sites.checked=true' name='site' size=20>
-</TD></TR><TR><TD>
-<input type='radio' name='type' id='slices' value='Slice'>&nbsp;Slices:
-</TD><TD>
-<input type='text' onSelect="submit();" onFocus='slices.checked=true' name='slice' size=20>
-</TD></TR></table>
-</td></tr>
-
-<tr><td> $from_html </td><td>$until_html</td></tr>
-<tr><td colspan=2>&nbsp </td></tr>
-<TR><TD colspan=2 style='text-align:center'>
-<input type='submit' align='middle' value='Show Events'>
-</TD></TR>
-</table>
-</form>
-
-EOF;
-
-//////////////////////////////////////////////////////////// dates
-// our format is yyyy/MMM/dd
-function parse_date ($datestring) {
-  if (empty ($datestring)) {
-    $year="2008"; $month="Jan"; $day="01";
-  } else {
-    list ($year,$month,$day) = split ('[/.-]',$datestring);
-  }
-  $date=sprintf("%s %s %s",$day,$month,$year);
-  $time=strtotime($date);
-  return array($date,$time);
-}
-
-function parse_dates () {
-  list($from_date,$from_time) = parse_date($_GET['from_date']);
-  list($until_date,$until_time) = parse_date($_GET['until_date']);
-  return array($from_date,$from_time,$until_date,$until_time);
-}
-
-//////////////////////////////////////////////////////////// layout
-// outline node ids and person ids with a link
-function e_node ($node_id) {
-  if (! $node_id) return "";
-  return l_node_t($node_id,$node_id);
-}
-function e_person ($person_id) {
-  if (! $person_id) return "";
-  return l_person_t($person_id,$person_id);
-}
-// xxx broken
-function e_event ($event_id) {
-  if (! $event_id) return "";
-  return href(l_event("Event","event",$event_id),$event_id);
-}
-
-function e_subject ($type,$id) {
-  $mess=$type . " " . $id;
-  switch ($type) {
-  case 'Node': return l_node_t ($id,$mess);
-  case 'Site': return l_site_t ($id,$mess);
-  case 'Person': return l_person_t ($id,$mess);
-  case 'Slice': return l_slice_t ($id,$mess);
-  case 'Role': case 'Key': case 'PCU': case 'Interface': case 'NodeGroup': case "Address":
-    return "$mess";
-  default: return "Unknown $type" . "-" . $id;
-  }
-}
-
-// synthesize links to the subject objects from types and ids
-function e_subjects ($param) {
-  $types=$param['object_types'];
-  $ids=$param['object_ids'];
-  if ( ! $types) return "";
-  return plc_vertical_table(array_map ("e_subject",$types,$ids));
-}
-
-function e_issuer ($param) {
-  if ($param['node_id'])       return e_subject('Node',$param['node_id']);
-  if ($param['person_id'])     return e_subject('Person',$param['person_id']);
-  return '???';
-}
-
-function e_auth ($event) {
-  if (array_key_exists('auth_type',$event)) 
-    return $event['auth_type'];
-    else
-      return "";
-}
-
-function e_fault ($event) {
-  $f=$event['fault_code'];
-  if ($f==0) return "OK";
-  else return $f;
-}
-
-////////////////////////////////////////////////////////////
-// for convenience, add 1 day to the 'until' date as otherwise this corresponds to 0:00
-$STEP=24*60*60;
-
-if ( ! plc_is_admin()) {
-  plc_warning("You need admin role to see this page.");
-
- } else if (! $_GET['type']) {
-  echo "<h2>Select the events to focus on :</h2>";
-  // print the selection frame
-  echo $event_form;
-  
- } else {
-
-  $tabs=array();
-  $tabs['Back to events form']=l_events();
-  plc_tabs($tabs);
-
-  // handle dates
-  list($from_date,$from_time,$until_date,$until_time) = parse_dates ();
-  // add one day to until_time - otherwise this corresponds to 0:0
-  $until_time += $STEP;
-  if ( ($from_time != 0) && ($until_time != $STEP) && ($from_time > $until_time) ) {
-    $messages[] = "Warning - <from> is after <until>";
-  }
-  
-  $filter=array();
-  // sort events by time is not good enough, let's use event_id
-  $filter['-SORT']='-event_id';
-  if ($from_time != 0) {
-    $filter[']time']=$from_time;
-  }
-  if ($until_time != $STEP) {
-    $filter['[time']=$until_time;
-  }
-
-  //////////////////////////////////////// Events
-  $type=$_GET['type'];
-  if ($type == 'Event') {
-
-   // and the filter applied for fetching events using GetEvent
-    $user_desc=$_GET['event'];
-    if ( ! empty($user_desc)) {
-      // should parse stuff like 45-90,230-3000 - some other day
-      $filter['event_id']=intval($user_desc);
-    }
-    // the filter might be void here - in python we need an empty dict but that's not what we get so
-    if (empty($filter)) {
-      $filter[']time']=0;
-    }
-    $events = $api->GetEvents($filter); 
-    $title="Events matching " . ($user_desc ? $user_desc : "everything");
-    if ($from_time != 0) 
-      $title .= " From " . $from_date;
-    if ($until_time != $STEP) 
-      $title .= " Until " . $until_date;
-
-    // see actual display of $title and $events below
-    
-  } else {
-
-    switch ($type) {
-    case 'Person': 
-      $primary_key='person_id';
-      $string_key='email';
-      $user_input=$_GET['person'];
-      $method="GetPersons";
-      $object_type='Person';
-      break;
-
-    case 'Node': 
-      $primary_key='node_id';
-      $string_key='hostname';
-      $user_input=$_GET['node'];
-      $method="GetNodes";
-      $object_type='Node';
-      break;
-      
-    case 'Site': 
-      $primary_key='site_id';
-      $string_key='login_base';
-      $user_input=$_GET['site'];
-      $method="GetSites";
-      $object_type='Site';
-      break;
-
-    case 'Slice': 
-      $primary_key='slice_id';
-      $string_key='name';
-      $user_input=$_GET['slice'];
-      $method="GetSlices";
-      $object_type='Slice';
-      break;
-    }
-
-    $object_ids=array();
-    $title=sprintf('Events for type %s:',$object_type);
-    foreach ( split(",",$user_input) as $user_desc) {
-      # numeric 
-      if (my_is_int($user_desc)) {
-       $obj_check = call_user_func(array($api,$method),array(intval($user_desc)),array($primary_key));
-       if (empty ($obj_check)) {
-         $messages[] = "No such " . $primary_key . ": " . $user_desc;
-       } else {
-         $object_ids[] = $obj_check[0][$primary_key];
-         $title .= $user_desc . ", " ;
-       }
-      } else {
-       # string
-       $new_object_ids=call_user_func (array($api,$method), array($string_key=>$user_desc),array($primary_key,$string_key));
-       if (empty($new_object_ids)) {
-         $messages[] = "No " . $string_key . " matching " . $user_desc;
-       } else {
-         foreach ($new_object_ids as $new_obj_id) {
-           $object_ids[] = $new_obj_id[$primary_key];
-           $title .= $new_obj_id[$primary_key] . ", ";
-         }
-       }
-      }
-    }
-
-    $event_objs = $api->GetEventObjects(array('object_id'=>$object_ids,'object_type'=>$object_type),array('event_id'));
-    // get set of event_ids
-    $event_ids = array_map ( create_function ('$eo','return $eo["event_id"];') , $event_objs);
-    
-    $events = $api->GetEvents (array('event_id'=>$event_ids));
-
-    // see actual display of $title and $events below
-
-  }
-
-  drupal_set_title ($title);
-  // Show messages
-  if (!empty($messages)) 
-    foreach ($messages as $line) 
-      drupal_set_message($line);
-
-  $headers=array("Id"=>"int",
-                "Time"=>"EnglishDateTime",
-                "Method"=>"string",
-                "Message"=>"string",
-                "Subjects"=>"string",
-                "Issuer"=>"string",
-                "Auth"=>"string",
-                "R"=>"string",
-                "D"=>"none",
-                );
-
-  $table = new PlcTable ("events",$headers,"0r");
-  $table->set_options (array ('max_pages'=>20));
-  $table->start ();
-  foreach ($events as $event) {
-
-    // the call button
-    $message = htmlentities($event['message'], ENT_QUOTES);
-    $call = htmlentities($event['call'], ENT_QUOTES);
-    $text = sprintf("message=<<%s>>\\n\\ncall=<<%s>>\\n\\nruntime=<<%f>>\\n",$message,$call,$event['runtime']);
-    $method = "<input type=button name='call' value='" . $event['call_name'] ."' onclick='alert(\"" . $text . "\")'";
-    //    $method = sprintf('<span title="%s">%s</span>',$call,$method);
-
-  // the message button
-    $trunc_mess=htmlentities(truncate($event['message'],40),ENT_QUOTES);
-    $message="<input type=button name='message' value='" . $trunc_mess ."' onclick='alert(\"" . $text . "\")'";
-    $details="<input type=button name='message' value='X' onclick='alert(\"" . $text . "\")'";
-    //    $message=sprintf('<span title="%s">%s</span>',$message,$message);
-
-    $message=truncate($event['message'],40);
-    $table->row_start();
-    $table->cell(e_event($event['event_id']));
-    $table->cell(date('M/d/Y H:i', $event['time']));
-    $table->cell($event['call_name']);
-    $table->cell($message);
-    $table->cell(e_subjects($event));
-    $table->cell(e_issuer($event));
-    $table->cell(e_auth($event));
-    $table->cell(e_fault($event));
-    $table->cell($details);
-    $table->row_end();
-  }
-  $table->set_options(array('notes'=>array("The R column shows the call result value, a.k.a. fault_code",
-                                          "Click the button in the D(etails) column to get more details")));
-  $table->end();
-  
- }
-
-
-  // Print footer
-include 'plc_footer.php';
+// the choser form is expected to set _GET['type'] among other stuff
+if ($_GET['type']) require ('events.php') ;
+else             require ('events_choser.php');
 
 ?>
-