ckp
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 11 Mar 2009 07:32:57 +0000 (07:32 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 11 Mar 2009 07:32:57 +0000 (07:32 +0000)
17 files changed:
planetlab/common/actions.php
planetlab/css/plc_style.css
planetlab/includes/plc_functions.php
planetlab/nodes/node.php
planetlab/nodes/nodes.php
planetlab/persons/person.php
planetlab/sites/site.php
planetlab/slices/index.php
planetlab/slices/renew_slice.php [deleted file]
planetlab/slices/slice.php [new file with mode: 0644]
planetlab/slices/slices.php [new file with mode: 0644]
planetlab/tags/nodegroup.php
plekit/details/details.css
plekit/php/table.php
plekit/php/toggle.php
plekit/table/table.css
plekit/toggle/toggle.css

index 0a0bec4..b7b2bc8 100644 (file)
@@ -66,6 +66,10 @@ $known_actions []= "expire-all-slices-in-site";
 $known_actions []= "update-site";
 //     expects:        site_id & name abbreviated_name url latitude longitude [login_base max_slices]
 
+//////////////////////////////////////// slices
+$known_actions []= "renew-slice";
+//     expects:        slice_id & expires
+
 //////////////////////////////////////// tag types
 $known_actions []= "update-tag-type";
 //     expects:        tag_type_id & name & description & category & min_role_id  
@@ -425,6 +429,28 @@ switch ($action) {
    break;
  }
 
+//////////////////////////////////////////////////////////// slices
+ case 'renew_slice': {
+   $slice_id = intval ($_POST['slice_id']);    
+   $expires = intval ($_POST['expires']);
+   // 8 weeks from now
+   // xxx
+   $now=date();
+   $WEEKS=8;
+   $MAX_FUTURE=$WEEKS*7*24*3600;
+   if ( ($expires-$now) > $MAX_FUTURE) {
+     drupal_set_error("Cannot renew slice that far in the future, max is $WEEKS from now");
+     plc_redirect(l_slice($slice_id));
+   }
+   if ($api->UpdateSlice ($slice_id, array('expires'=>$expires)) == 1)
+     drupal_set_message("Slice renewed");
+   else
+     drupal_set_error("Could not update slice $slice_id");
+   plc_redirect(l_slice($slice_id));
+   break;
+ }
+
+
 //////////////////////////////////////////////////////////// tag types
 
  case 'update-tag-type': {
index 1740333..32869ea 100644 (file)
@@ -28,7 +28,7 @@ body {
     background:  #e0e0e0;
 }
 .plc-warning {
-    background:  orange;
+    background:  #ffa223; 
 }
 .plc-error {
     background: red;
index 5e8fcc2..d5de8a5 100644 (file)
@@ -58,6 +58,7 @@ function l_node_t ($node_id,$text)    { return href (l_node($node_id),$text); }
 function l_node_obj($node)             { return href(l_node($node['node_id']),$node['hostname']); }
 function l_node_add ()                 { return "/db/nodes/node_add.php"; }
 function l_nodes_site ($site_id)       { return "/db/nodes/index.php?site_id=$site_id"; }
+function l_nodes_slice ($slice_id)     { return "/db/nodes/index.php?slice_id=$slice_id"; }
 
 function l_interface ($interface_id)   { return "/db/nodes/interface.php?id=$interface_id"; }
 function l_interface_t ($interface_id,$text) { 
@@ -68,6 +69,7 @@ function l_sites ()                   { return "/db/sites/index.php"; }
 function l_sites_peer ($peer_id)       { return "/db/sites/index.php?peerscope=$peer_id"; }
 function l_site ($site_id)             { return "/db/sites/index.php?id=$site_id"; }
 function l_site_t ($site_id,$text)     { return href (l_site($site_id),$text); }
+function l_site_obj($site)             { return href (l_site($site['site_id']),$site['name']); }
 
 function l_slices ()                   { return "/db/slices/index.php"; }
 function l_slices_peer ($peer_id)      { return "/db/slices/index.php?peerscope=$peer_id"; }
@@ -75,6 +77,7 @@ function l_slice ($slice_id)          { return "/db/slices/index.php?id=$slice_id"; }
 function l_slice_t ($slice_id,$text)   { return href (l_slice($slice_id),$text); }
 function l_slice_add ()                        { return "/db/slices/slice_add.php"; }
 function l_slices_site($site_id)       { return "/db/slices/index.php?site_id=$site_id"; }
+function l_slices_local()              { return "/db/slices/index.php?peerscope=local"; }
 // from an object
 function l_slice_obj ($slice)          { return l_slice_t ($slice['slice_id'],$slice['name']); }
 
@@ -128,21 +131,30 @@ function tab_nodes_local ()       { return array ('label'=>'Local nodes', 'url'=>l_nod
                                                'bubble'=>'Display local nodes only'); }
 function tab_nodes_site($site_id){ return array ('label'=>'Site nodes', 'url'=>l_nodes_site($site_id), 
                                                 'bubble'=>'Display nodes on that site'); }
+function tab_nodes_slice($slice_id){ return array ('label'=>'Slice nodes', 'url'=>l_nodes_slice($slice_id), 
+                                                'bubble'=>'Display nodes for that slice'); }
 function tab_nodes_mysite ()   { return array ('label'=>'My nodes', 'url'=>l_nodes_site(plc_my_site_id()), 
-                                               'bubble'=>'Display nodes on that site'); }
-function tab_node($node)       { return array ('label'=>'Node '.$node['hostname'], 'url'=>l_node($node_id),
+                                               'bubble'=>'Display nodes on my site'); }
+function tab_node($node)       { return array ('label'=>'Node '.$node['hostname'], 'url'=>l_node($node['node_id']),
                                                'bubble'=>'Details for ' . $node['hostname']); }
 //////////
-function tab_site($site)       { return array ('label'=>'Site '.$site['login_base'], 'url'=>l_site($site_id),
+function tab_site($site)       { return array ('label'=>'Site '.$site['login_base'], 'url'=>l_site($site['site_id']),
                                                'bubble'=>'Details for ' . $site['name']); }
 function tab_mysite()          { return array ('label'=>'My site', 'url'=>l_site(plc_my_site_id()),
                                                'bubble'=>'Details for site ' . plc_my_site_id()); }
 function tab_sites ()          { return array ('label'=>'All sites' , 'url'=>l_sites(), 'bubble'=> 'Display all sites'); }
-function tab_sites_local ()    { return array ('label'=>'Local sites' , 'url'=>l_sites_peer('local'), 'bubble'=> 'Display local sites'); }
+function tab_sites_local ()    { return array ('label'=>'Local sites' , 'url'=>l_sites_peer('local'), 
+                                               'bubble'=> 'Display local sites'); }
 //////////
 function tab_slices()          { return array ('label'=>'All slices', 'url'=>l_slices(),
                                                'bubble' => 'Display all slices'); }
-function tab_slice($slice)     { return array ('label'=>'Slice '.$slice['name'], 'url'=>l_slice($slice_id),
+function tab_slices_mysite ()  { return array ('label'=>'My site slices', 'url'=>l_slices_site(plc_my_site_id()), 
+                                               'bubble'=>'Display all slices on my site'); }
+function tab_slices_mine ()    { return array ('label'=>'My site slices', 'url'=>l_slices_site(plc_my_site_id()), 
+                                               'bubble'=>'Display all slices on my site'); }
+function tab_slices_local ()   { return array ('label'=>'Local slices', 'url'=>l_slices_local(), 
+                                               'bubble'=>'Display all slices on my site'); }
+function tab_slice($slice)     { return array ('label'=>'Slice '.$slice['name'], 'url'=>l_slice($slice['slice_id']),
                                                'bubble' => 'Details for ' . $slice['name']); }
 //////////
 function tab_persons()         { return array ('label'=>'All accounts', 'url'=>l_persons(),
@@ -151,6 +163,8 @@ function tab_persons_local()        { return array ('label'=>'Local accounts', 'url'=>l
                                                'bubble'=>'Display local users'); }
 function tab_persons_mysite()  { return array ('label'=>'My accounts' , 'url'=>l_persons_site(plc_my_site_id()),
                                                'bubble'=>'Display accounts on site ' . plc_my_site_id()); }
+function tab_person($person)   { return array ('label'=>'Account '.$person['email'], 'url'=>l_person($person['person_id']),
+                                               'bubble'=>'Details for ' . $person['email']); }
 //////////
 function tab_tags()            { return array ('label'=>'Tag Types', 'url'=>l_tags(),
                                                'bubble' => 'Display and create tag types'); }
@@ -273,6 +287,7 @@ function plc_nodegroup_global_hash ($api,$tagnames=NULL) {
 //////////////////////////////////////////////////////////// titles
 function t_site($site) { return " on site " . $site['name'] . " (" . $site['login_base'] .")"; }
 function t_slice ($slice) { return " running slice " . $slice['name'] . " (" . $slice['slice_id'] . ")"; }
+function t_person ($person) { return " belonging to " . $person['email'] . " (" . $person['person_id'] . ")"; }
 
 //////////////////////////////////////////////////////////// html fragments
 function plc_vertical_table ($messages, $class="") {
index 2ebc3f4..06d0792 100644 (file)
@@ -111,18 +111,17 @@ $tabs=array();
 // available actions
 $tabs [] = tab_nodes_site($site_id);
 $tabs [] = tab_site($site_id);
-$tabs [] = tab_nodes();
+//$tabs [] = tab_nodes();
 
 if ( $local_peer  && $privileges ) {
     
+  $tabs["Add Interface"]=array('url'=>l_interface_add($node_id),
+                              'bubble'=>"Define new network interface on $hostname");
   $tabs['Delete'] = array ('url'=>l_actions(),
                           'method'=>'POST',
                           'values'=>array('action'=>'delete-node','node_id'=>$node_id),
                           'bubble'=>"Delete node $hostname",
-                          'confirm'=>'Are you sure to delete ' . $hostname. ' ?');
-  // xxx subject to roles
-  $tabs["Add Interface"]=array('url'=>l_interface_add($node_id),
-                              'bubble'=>"Define new network interface on $hostname");
+                          'confirm'=>'Are you sure to delete ' . $hostname);
   $tabs["Events"]=array_merge(tablook_event(),
                              array('url'=>l_event("Node","node",$node_id),
                                    'bubble'=>"Events for node $hostname"));
@@ -136,6 +135,10 @@ plekit_linetabs($tabs);
 // show gray background on foreign objects : start a <div> with proper class
 $peers->block_start ($peer_id);
   
+$toggle = new PlekitToggle ('node',"Details",
+                           array('trigger-bubble'=>'Display and modify details for that node'));
+$toggle->start();
+
 $details=new PlekitDetails($privileges);
 $details->start();
 if ( ! $local_peer) {
@@ -213,6 +216,7 @@ foreach ($site_node_hash as $hash_node_id => $hash_hostname) {
 $details->th_tds ("All site nodes",$nodes_area);
 
 $details->end ();
+$toggle->end();
 
 $form=new PlekitForm (l_actions(), array('node_id'=>$node_id));
 $form->start();
index 6c57cf5..5aea940 100644 (file)
@@ -29,7 +29,6 @@ $slice_id=intval($_GET['slice_id']);
 // --- decoration
 $title="Nodes";
 $tabs=array();
-$mysite_id=plc_my_site_id();
 $tabs []= tab_nodes_mysite();
 $tabs []= tab_nodes_local();
 
@@ -141,30 +140,30 @@ $table->start();
 $peers = new Peers ($api);
 // write rows
 foreach ($nodes as $node) {
-    $hostname=$node['hostname'];
-    $node_id=$node['node_id'];
-    $site_id=$node['site_id'];
-    $site=$site_hash[$site_id];
-    $login_base = $site['login_base'];
-    $node_id=$node['node_id'];
-    $ip=$interface_hash[$node['node_id']]['ip'];
-    $interface_id=$interface_hash[$node['node_id']]['interface_id'];
-    $peer_id=$node['peer_id'];
-    $shortname = $peers->shortname($peer_id);
-    $node_type = $node['node_type'];
-
-    $table->row_start();
-    $table->cell ($peers->link($peer_id,$shortname));
-    $table->cell (topdomain($hostname));
-    $table->cell (l_site_t($site_id,$login_base));
-    $table->cell ($node['boot_state']);
-    $table->cell (l_node_t($node_id,$hostname));
-    $table->cell (l_interface_t($interface_id,$ip));
-    $table->cell ($node_type);
-    $table->cell ($node['arch']);
-    $table->cell (node_status($node));
-    $table->row_end();
-                                
+  $hostname=$node['hostname'];
+  $node_id=$node['node_id'];
+  $site_id=$node['site_id'];
+  $site=$site_hash[$site_id];
+  $login_base = $site['login_base'];
+  $node_id=$node['node_id'];
+  $ip=$interface_hash[$node['node_id']]['ip'];
+  $interface_id=$interface_hash[$node['node_id']]['interface_id'];
+  $peer_id=$node['peer_id'];
+  $shortname = $peers->shortname($peer_id);
+  $node_type = $node['node_type'];
+  
+  $table->row_start();
+  $table->cell ($peers->link($peer_id,$shortname));
+  $table->cell (topdomain($hostname));
+  $table->cell (l_site_t($site_id,$login_base));
+  $table->cell ($node['boot_state']);
+  $table->cell (l_node_t($node_id,$hostname));
+  $table->cell (l_interface_t($interface_id,$ip));
+  $table->cell ($node_type);
+  $table->cell ($node['arch']);
+  $table->cell (node_status($node));
+  $table->row_end();
+  
 }
 
 $table->end();
index ff630e8..3154035 100644 (file)
@@ -127,6 +127,12 @@ $enabled_label="Yes";
 if ( ! $enabled ) $enabled_label = plc_warning_html("Disabled");
 
 $can_update = (plc_is_admin() && $local_peer) || $is_my_account;
+
+$toggle = new PlekitToggle ('person',"Details",
+                           array('trigger-bubble'=>'Display and modify details for that account',
+                                 'start-visible'=>false));
+$toggle->start();
+
 $details = new PlekitDetails($can_update);
 
 $details->form_start(l_actions(),array("action"=>"update-person",
@@ -158,9 +164,10 @@ if ( ! $local_peer ) {
 
 $details->end();
 $details->form_end();
+$toggle->end();
 
 //////////////////// slices
-$toggle=new PlekitToggle ('slices','Slices');
+$toggle=new PlekitToggle ('slices','Slices',array('start-visible'=>false));
 $toggle->start();
 
 if( ! $slices) {
@@ -192,7 +199,7 @@ $form=new PlekitForm(l_actions(), array("person_id"=>$person_id));
 $form->start();
 
 //////////////////// keys
-$toggle=new PlekitToggle ('keys',"Keys");
+$toggle=new PlekitToggle ('keys',"Keys",array('start-visible'=>false));
 $toggle->start();
                
 $can_manage_keys = ( $local_peer && ( plc_is_admin() || $is_my_account) );
@@ -240,7 +247,7 @@ $table->end();
 $toggle->end();
 
 //////////////////// sites
-$toggle=new PlekitToggle('sites','Sites');
+$toggle=new PlekitToggle('sites','Sites',array('start-visible'=>false));
 $toggle->start();
   
 if (empty( $sites ) ) {
@@ -293,7 +300,7 @@ $table->end();
 $toggle->end();
 
 //////////////////// roles
-$toggle=new PlekitToggle ('roles','Roles');
+$toggle=new PlekitToggle ('roles','Roles',array('start-visible'=>false));
 $toggle->start();
 
 if (! $roles) plc_warning ("This user has no role !");
index 81cb990..aa2c660 100644 (file)
@@ -144,6 +144,12 @@ if ( ! $enabled )
               " to review pending applications.");
 
 $can_update=(plc_is_admin ()  && $local_peer) || ( plc_in_site($site_id) && plc_is_pi());
+
+
+$toggle = new PlekitToggle ('site',"Details",
+                           array('trigger-bubble'=>'Display and modify details for that site'));
+$toggle->start();
+
 $details = new PlekitDetails($can_update);
 
 if ( ! $site['is_public']) 
@@ -176,6 +182,7 @@ if ( ! $local_peer) {
  }
 $details->end();
 $details->form_end();
+$toggle->end();
 
 //////////////////// mode details - for local object
 if ( $local_peer ) {
@@ -185,7 +192,7 @@ if ( $local_peer ) {
   $nb_boot = 0;
   if ($nodes) foreach ($nodes as $node) if ($node['boot_state'] == 'boot') $nb_boot ++;
 
-  $nodes_title = "Nodes : ";
+  $nodes_title = "Nodes : ";
   $nodes_title .= count($nodes) . " total";
   $nodes_title .= " / " . $nb_boot . " boot";
   if ($nb_boot < 2 ) 
@@ -218,12 +225,12 @@ if ( $local_peer ) {
   $toggle->end();
     
   //////////////////// Users
-  $persons_title = "Users : ";
+  $persons_title = "Users : ";
   $persons_title .= count($person_ids) . " total";
   $persons_title .= " / " . count ($pis) . " PIs";
   $persons_title .= " / " . count ($techs) . " Techs";
   if ($has_disabled_persons) 
-    $persons_title .= " / " . ($disabled_persons) . " Disabled";
+    $persons_title .= " / " . count($disabled_persons) . " Disabled";
   if ( (count ($pis) == 0) || (count ($techs) == 0) || (count($person_ids) >= 30) || count($disabled_persons) != 0 ) 
     $persons_title = plc_warning_html ($persons_title);
   $persons_title .= href(l_persons_site($site_id)," (See as users)");
index 67b7b62..4aebbbf 100644 (file)
 <?php
 
 // $Id$
-// pattern-matching selection not implemented
-// due to GetSlices bug, see test.php for details
-// in addition that would not make much sense
 
 // 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';
-// set default
-drupal_set_title('Slices');
-include 'plc_header.php';
-
-// Common functions
-require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
-
-// find person roles
-$_person= $plc->person;
-$_roles= $_person['role_ids'];
-
-//print_r( $_person );
-
-
-// if node_host is set then set id to that node's id.
-if( $_POST['slicename'] ) {
-  $slicename= $_POST['slicename'];
-
-  $slices= $api->GetSlices( array( $slicename ), array( "slice_id" ) );
-  $slice=$slices[0];
-  $slice_id=$slice['slice_id'];
-
-  plc_redirect(l_slice($slice_id));
-
-}
-
-
-// if no slice id, display list of slices
-if( !$_GET['id'] ) {
-  // diplay site select list for admins
-  if( in_array( 10, $_roles ) ) {
-    // auto complete box for finding a slice
-                
-    // xxx dismantle this
-    drupal_set_html_head('<script type="text/javascript" src="/planetlab/bsn/bsn.Ajax.js"></script>
-    <script type="text/javascript" src="/planetlab/bsn/bsn.DOM.js"></script>
-    <script type="text/javascript" src="/planetlab/bsn/bsn.AutoSuggest.js"></script>');
-
-    echo "<div>\n
-          <form method=post action='index.php'>\n";
-    if( $slicename ) echo "<font color=red>'$slicename' is not a valid slice name.</font>\n";
-    echo "<p><label for='testinput'>Enter Slice Name: </label>\n
-          <input type='text' id='testinput' name='slicename' size=40 value='' />\n
-          <input type=submit value='Select Slice' />\n
-          </div>\n
-          <br />\n";
-     
-    // get site info
-    $site_info= $api->GetSites( NULL, array( "site_id", "name", "peer_id" ) );
-    sort_sites( $site_info );
-
-    // Thierry -- try to select only one entry
-    // xxx still not right if _person in several sites, but that is good enough
-    //if( $site['site_id'] == $_POST['site_id'] || in_array( $site['site_id'], $_person['site_ids'] ) )
-    if ($_POST['site_id'])
-      $selected_site_id = $_POST['site_id'];
-    else if ($_GET['site_id']) 
-      $selected_site_id = $_GET['site_id'];
-    else
-      $selected_site_id = $_person['site_ids'][0];
-
-    echo "Select a site to view slices from: &nbsp;";
-    echo "<select name='site_id' onChange='submit()'>\n";
-
-    foreach( $site_info as $site ) {
-      echo "<option value=". $site['site_id'];
-      if ( $site['site_id'] == $selected_site_id)
-         echo " selected";
-      if ( $site['peer_id'] ) 
-       echo " class='plc-foreign'";
-      echo ">". $site['name'] ."</option>\n";
-      
-    }
-
-    echo "</select>\n";
-  
-  }
-
-  if( $_POST['site_id'] ) {
-    $selection="Site";
-    $site= array( intval( $_POST['site_id'] ) );
-  } elseif( $_GET['site_id'] ) {
-    $selection="Site";
-    $site= array( intval( $_GET['site_id'] ) );
-  } else {
-    $selection="Person";
-    $site= $_person['site_ids'];
-  }
-  
-  // get site's slices
-  $site_info= $api->GetSites( $site, array( "slice_ids","name" ) );
-
-  if ( $selection == "Site" ) 
-    drupal_set_title ("Slices for site " . $site_info[0]['name']);
-  else
-    drupal_set_title ("Slices for " . $_person['email'] . "'s sites");
-
-  // make an array of all slices
-  foreach( $site_info as $site ) {
-    foreach( $site['slice_ids'] as $slice_id ) {
-      $slice_ids[]= $slice_id;
-    }
-    
-  }
-  
-  if (empty ($slice_ids)) {
-    echo "<p><strong>No slice found, or all are expired.</strong>";
-  } else {
-  
-    $slices= $api->GetSlices( $slice_ids, array( "slice_id", "name", "site_id", "person_ids", "expires", "peer_id" ) );
-    $slice=$slices[0];
-    //print '<pre>'; print_r( $api->trace() ) ; print '</pre>';
-
-    if ( ! $slices) {
-      echo "<p><strong>No Slices on site, or all are expired.</strong>\n";
-    } else  {
-      echo "<table class='list_set' border=0 cellpadding=2>\n";
-      echo "<caption class='list_set'>Slice list</caption>\n";
-      echo "<thead><tr class='list_set'><th class='list_set'>Slice Name</th>";
-      echo "<th class='list_set'>Users</th>";
-      echo "<th class='list_set'>Expiration</th></tr>";
-      echo "</thead><tbody>\n";
-      
-      // create a list of person_ids
-      $person_ids = array();
-      foreach( $slices as $slice ) {
-         if ( !empty($slice['person_ids']) )
-           $person_ids = array_merge($person_ids, $slice['person_ids']);
-       }
-
-      // create an associative array of persons with person_id as the key
-      $person_list = $api->GetPersons( $person_ids, array("person_id", "email") ); 
-      $persons = array();
-      foreach( $person_list as $person)
-       {
-         $persons[$person['person_id']] = $person;
-       }
-      
-      foreach( $slices as $slice ) {
-       $slice_id= $slice['slice_id'];
-       $slice_name= $slice['name'];
-       $slice_expires= date( "M j, Y", $slice['expires'] );
-       $peer_id = $slice['peer_id'];
-      
-       $extraclass="";
-       if ( $peer_id ) 
-         $extraclass="plc-foreign";
-      
-       echo "<tr class='list_set $extraclass'><td><a href='/db/slices/index.php?id=$slice_id'>$slice_name</a></td><td class='list_set'>";
-      
-       if( !empty( $slice['person_ids'] ) ) {
-         foreach( $slice['person_ids'] as $person_id ) {
-           $person = $persons[$person_id];
-           $id= $person['person_id'];
-           $email= $person['email'];
-           echo "<a href='../persons/index.php?id=$id'>$email</a><br />\n";
-         }
-       } else {
-         echo "None";
-       }
-      
-       echo "</td><td class='list_set'>$slice_expires</td></tr>\n";
-    
-      }
-    
-      echo "</tbody></table>\n";
-
-    }
-  }
-  
-
-  echo "</form>\n";
-
-  echo "<script type=\"text/javascript\">
-var options = {
-       script:\"/planetlab/slices/test.php?\",
-       varname:\"input\",
-       minchars:1
-};
-var as = new AutoSuggest('testinput', options);
-</script>\n";
-
-}
-// if nothing else then show slice info
-else {
-  $slice_id= intval( $_GET['id'] );
-
-  // GetSlices API call
-  $slices= $api->GetSlices( array( $slice_id ) );
-
-  if( empty( $slices ) ) 
-    plc_redirect(l_slices());
-
-  // pull all slice info to vars
-  $instantiation= $slice['instantiation'];
-  $name= $slice['name'];
-  $url= $slice['url'];
-  $expires= date( "M j, Y", $slice['expires'] );
-  $site_id= $slice['site_id'];
-  $description= $slice['description'];
-  $max_nodes= $slice['max_nodes'];
-  $node_ids=$slice['node_ids'];
-  $person_ids=$slice['node_ids'];
-
-  // get peer id
-  $peer_id= $slice['peer_id'];
-
-  $person_ids= $slice['person_ids'];
-  $node_ids= $slice['node_ids'];
-  $slice_tag_ids= $slice['slice_tag_ids'];
-
-
-  // node info
-// looks unused
-//  if( !empty( $node_ids ) )
-//    $nodes= $api->GetNodes( $node_ids, array( "node_id", "hostname" ) );
-
-  // site info
-  $site_info= $api->GetSites( array( $site_id ), array( "site_id", "name", "person_ids" ) );
-
-  // gets all persons from site_id
-    // person info
-  if( !empty( $person_ids ) ) 
-    $persons= $api->GetPersons( $site_info[0]['person_ids'] , array( "person_id", "role_ids", "first_name", "last_name", "email" ) );
-
-  if( $persons ) {
-    // gets site contacts pis stores in dict
-    foreach( $persons as $person )
-      if( in_array( "20", $person['role_ids'] ) ) {
-       $pis[]= array( "email" => $person['email'], "first_name" => $person['first_name'], "last_name" => $person['last_name'], "person_id" => $person['person_id'] );
-       
-      }
-    if ($pis) {
-      sort_persons( $pis );
-    }
-  }
-
-  // slice tag info
-  if( !empty( $slice_tag_ids ) )
-    $slice_attibs= $api->GetSliceTags( $slice_tag_ids, 
-                                      array( "slice_tag_id", "tag_type_id", "value", "description", "min_role_id", "node_id" ) );
-
-  // gets tag type info and combines it to form all tag info array
-  if( $slice_attibs ) {
-    foreach( $slice_attibs as $slice_attib ) {
-      $tag_type= $api->GetTagTypes( array( $slice_attib['tag_type_id'] ), 
-                                                 array( "tag_type_id", "tagname", "description" ) );
-      
-      $tags[]= array( "slice_tag_id" => $slice_attib['slice_tag_id'], 
-                     "tag_type_id" => $slice_attib['tag_type_id'], 
-                     "tagname" => $tag_type[0]['tagname'], 
-                     "value" => $slice_attib['value'], 
-                     "description" => $slice_attib['description'], 
-                     "min_role_id" => $slice_attib['min_role_id'], 
-                     "node_id" => $slice_attib['node_id'] );
-    }
-
-  }
-
-  drupal_set_title("Slice details for " . $name);
-  // start form
-
-  if( $peer_id ) {
-    echo "<div class='plc-foreign'>\n";
-  }
-
-  // basic slice menu
-  if( ! $peer_id ) {
-
-    $actions= array( ''=>'Choose Action' );
-    
-    if( in_array( 10, $_roles ) 
-       || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) 
-       || in_array( $slice_id, $_person['slice_ids'] ) ) {
-      $actions['renew']= "Renew $name";
-      $actions['nodes']= "Manage Nodes";
-    }
-    if ( in_array( 10, $_roles )
-        || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) ) {
-      $actions['users']= "Manage Users";
-      $actions['delete']= "Delete $name";
-    }
-    
-    echo "<table><tr><td>\n";
-    if (in_array( 10, $_roles )) {
-      echo plc_event_button("slices","slice",$slice_id);
-      echo "</td><td>";
-    }
-    echo plc_comon_button("slice_id",$slice_id);
-    echo "</td><td>\n";
-
-    echo "<form action='/db/slices/slice_action.php' method='post'>\n";
-    echo "<input type=hidden name=slice_id value=$slice_id>\n";
-
-    echo "<select name='actions' onChange=\"submit();\">\n";
-    foreach( $actions as $key => $val ) {
-      echo "<option value='$key'";
-      
-      if( $key == $_POST['actions'] )
-       echo " selected";
-      
-      echo ">$val\n";
-    }
-    
-    echo "</select><br />\n";
-    echo "</form>\n";
-
-    echo "</td></tr></table>\n";
-  }
-
-  echo "<table cellpadding=3><tbody>\n
-       <tr><th>Slice Name: </th><td> $name </td></tr>\n
-       <tr><th>Description: </th><td> $description </td></tr>\n
-        <tr><th>URL: </th><td> <a href='$url'>$url</a> </td></tr>\n";
-       
-  if( gmmktime() > $slice['expires'] ) { 
-    $class1= ' style="color:red;"'; 
-    $msg1= '(slice is expired)'; 
-  }
-  echo "<tr><th$class1>Expiration: </th><td$class1> $expires &nbsp; $msg1</td></tr>\n";
-  echo "<tr><th>Instantiation: </th><td><select name='instantiation' onChange=\"submit();\"\n";
-  echo "<option value='delegated'"; 
-  if( $instantiation == 'delegated' ) echo " selected"; 
-  echo ">delegated</option>";
-  echo "<option value='plc-instantiated'"; 
-  if( $instantiation == 'plc-instantiated' ) echo " selected"; 
-  echo ">plc-instantiated</option>";
-  echo "<option value='not-instantiated'"; 
-  if( $instantiation == 'not-instantiated' ) echo " selected"; 
-  echo ">not-instantiated</option>";
-  echo "</select>"; 
-
-  echo "</td></tr>\n";
-  echo "<tr><th>Site: </th><td> <a href='/db/sites/index.php?id=$site_id'>". $site_info[0]['name'] ."</a></td></tr>\n";
-  $href="'/db/nodes/index.php?slice_id=" . $slice_id . "'";
-  printf ("<tr><th> <a href=%s># Nodes</a></th><td><a href=%s>Total %d nodes</a></td>\n",$href,$href,count($node_ids));
-  $href="'/db/persons/index.php?slice_id=" . $slice_id . "'";
-  printf ("<tr><th> <a href=%s># Users</a></th><td><a href=%s>Total %d users</a></td>\n",$href,$href,count($person_ids));
-  echo "</tbody></table>\n";
-
-  if ( (!$class1) && in_array( $slice_id, $_person['slice_ids'] ) && (! $peer_id) ) 
-    echo "<p><a href='update_slice.php?id=$slice_id'>Update Information</a>\n";
-
-  echo "<br /><hr />\n";
-
-
-  // slice tags
-  if( $tags ) {
-
-    // builds 2 arrays, one for tags, one for slivers
-    foreach( $tags as $tag ) {
-      if( empty( $tag['node_id'] ) ) {
-        $slice_tag[]= $tag;
-      }
-      else {
-        $sliver_tag[]= $tag;
-        $sliver_nodes[]= $tag['node_id'];
-      }
-    }
-  }
-
-  // Get node info for those slivers
-  $sliver_node_info= $api->GetNodes( $sliver_nodes, array( "node_id", "hostname" ) );
-
-  if( $sliver_node_info ) {
-    foreach( $sliver_node_info as $sliv_node ) {
-      $new_sliver_node_info[$sliv_node['node_id']]= $sliv_node;
-    }
-  }
-
- if( $peer_id ) {
-   echo "<br /></div>\n";
-  }
-  // slice tags
-  $is_admin=in_array( 10, $_roles );
-  $is_in_slice=in_array( $slice_id, $_person['slice_ids'] );
-  $is_pi=in_array( 20, $_roles );
-  if( $slice_tag ) {
-    echo "<table cellpadding=3><caption class='list_set'>Slice Tags</caption>";
-    echo "<thead><tr>";
-    if( $is_admin )
-      echo "<th></th>";
-    echo "<th>Tag</th><th>Value</th><th>Description</th>";
-    echo "</tr></thead><tbody>\n";
-
-    foreach( $tags as $tag ) {
-      // ignore sliver tags at this stage
-      if( empty( $tag['node_id'] ) ) {
-        echo("<tr>");
-        if( $is_admin ) {
-         printf("<td>");
-         sprintf($label,"\\n [ %s = %s] \\n from %s",$tag['tagname'],$tag['value'],$name);
-         // xxx this is deprecated
-         echo plc_delete_link_button ('tag_action.php?rem_id=' . $tag['slice_tag_id'],
-                                      $label);
-         echo "</td>";
-       }
-       if( $is_admin || ($is_pi && $is_in_slice) ) {
-          printf ("<td><a href='tags.php?type=slice?id=%s'>%s</a></td>",
-                 $tag['slice_tag_id'],$tag['tagname']);
-       } else {
-         printf("<td>%s</td>",$tag['tagname']);
-       }
-       printf("<td align=center>%s</td><td>%s</td>",
-              $tag['value'],$tag['description']);
-        echo "</tr>";
-      }
-    }
-
-    
-    echo "</tbody></table>\n";
-
-  }
-  if( $is_admin || ($is_pi && $is_in_slice) )
-    echo "<a href='tags.php?type=slice&add=$slice_id'>Add a Slice Tag</a>\n";    
-
-
-
-  // sliver tags
-  if( $sliver_tag ) {
-    echo "<table cellpadding=3><caption class='list_set'>Sliver Tags</caption>";
-    echo "<thead><tr>";
-    if( $is_admin )
-      echo "<th></th>";
-    echo "<th>Tag</th><th>Value</th><th>Description</th><th>Node</th>";
-    echo "</tr></thead><tbody>\n";
-
-    foreach( $tags as $tag ) {
-      $nodename=$new_sliver_node_info[$tag['node_id']]['hostname'];
-      // consider only sliver tags at this stage
-      if( !empty( $tag['node_id'] ) ) {
-        echo("<tr>");
-        if( $is_admin ) {
-         echo("<td>");
-         $label=sprintf("\\n [ %s = %s ] \\n from %s \\n on node %s",
-                        $tag['tagname'],$tag['value'],$name,$nodename);
-         echo plc_delete_link_label('/db/nodes/sliver_action.php?rem_id=' . $tag['slice_tag_id'], 
-                                    $label);
-         echo "</td>";
-       }
-        if( $is_admin ) {
-          printf("<td><a href='tags.php?type=slice&id=%s'>%s</a></td>",$tag['slice_tag_id'],$tag['tagname']);
-       } else {
-         printf("<td>%s</td>",$tag['tagname']);
-       }
-       printf("<td align=center>%s</td><td>%s</td><td><a href='/db/nodes/index.php?id=%s'>%s</a></td>",
-              $tag['value'],$tag['description'],$tag['node_id'],$nodename);
-       
-        echo "</tr>";
-      }
-    }
-
-    echo "</tbody></table>\n";
-    
-  }
-  
-  echo "<br /><hr />\n";
-  
-  if( $pis && !$peer_id ) {
-    // site contacts
-    echo "<h5>Contacts</h5>\n";
-               
-    $pi_rows= count( $pis );
-    $tech_rows= count( $techs );
-    $table_row= 0;
-       
-    echo "<table cellpadding=2><tbody>";
-    if( $pis ) {
-      echo "<tr><td rowspan=$pi_rows><strong>PI's:</strong> &nbsp; </td>\n";
-      
-      foreach( $pis as $pi ) {
-       if( $table_row != 0 )
-         echo "<tr>";
-       printf("<td><a href='/db/persons/index.php?id=%s'>%s %s</td><td><a href='mailto:%s'>%s</a></td></tr>\n",
-              $pi['person_id'],$pi['first_name'],$pi['last_name'],$pi['email'],$pi['email']);
-       $table_row++;
-      }
-      
-    }
-    
-    echo "</table>\n<br /><hr />\n";
-    
-  }
-  
-  
-  echo "<p><a href='index.php'>Back to slice list</a></div>\n";
- }
-
-// Print footer
-include 'plc_footer.php';
+if ($_GET['id']) require ('slice.php') ;
+else             require ('slices.php');
 
 ?>
diff --git a/planetlab/slices/renew_slice.php b/planetlab/slices/renew_slice.php
deleted file mode 100644 (file)
index a106b17..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-
-// Require login
-require_once 'plc_login.php';
-
-// Get session and API handles
-require_once 'plc_session.php';
-global $plc, $api;
-
-// Common functions
-require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
-  
-// find person roles
-$_person= $plc->person;
-$_roles= $_person['role_ids'];
-
-
-// Constants
-$week= 7 * 24 * 60 * 60; // seconds
-$max_renewal_length= 8; // weeks from today
-$max_expiration= mktime() + ($max_renewal_length * $week); // seconds since epoch
-$max_expiration_date= gmstrftime("%A %b-%d-%y %T %Z", $max_expiration);
-
-// if submitted validate input
-if( $_POST['submitted'] ) {
-  // get post vars
-  $expire_len= $_POST['expire_len'];
-  $expires= $_POST['expires'];
-  $slice_id= intval( $_POST['id'] );
-  
-  // create empty error array
-  $error= array(  );
-  
-  // check input
-  
-  $url= $_POST['url'];
-  if( $url == '' || empty( $url ) )
-    $error['url']= "Provide a link to a project website.";
-    
-  $description= htmlspecialchars( $_POST['description'] );
-  if ( $description == '' || empty( $description ) )
-    $error['description']= "Provide a short description of the slice.";
-    
-  // if no errors update slice info 
-  if( empty( $error ) ) {
-    // set new expiration
-    
-    $expires+= ( $expire_len * $week );
-    
-    // make slice field array
-    $slice_fields= array( "url" => $url, "description" => $description, "expires" => $expires );
-    
-    // Update it!
-    $api->UpdateSlice( $slice_id, $slice_fields );
-    
-    plc_redirect( l_slice($slice_id));
-    
-  }
-  
-}
-
-// if no id is set redirect back to slice index
-if( !$_POST['id'] && !$_GET['id'] ) {
-  plc_redirect( l_slices());
- }
-
-// Print header
-require_once 'plc_drupal.php';
-drupal_set_title('Slice Renewal');
-include 'plc_header.php';
-
-
-
-
-// get id
-if( $_GET['id'] )
-  $slice_id= intval( $_GET['id'] );
-if( $_POST['id'] )
-  $slice_id= intval( $_POST['id'] );
-
-// get slice info
-$slice_info= $api->GetSlices( array( $slice_id ), array( "expires", "name", "site_id", "description", "url" ) );
-
-echo "<h2>Slice ". $slice_info[0]['name'] ." Renewal</h2>\n";
-
-// get site info
-if( !empty( $slice_info[0]['site_id'] ) ) {
-  // get sliver/slice site info
-  $site_info= $api->GetSites( array( $slice_info[0]['site_id'] ), array( "max_slivers", "max_slices" ) );
-  
-  // do not allow renew if max_slices are 0
-  if( $site_info[0]['max_slices'] <= 0 ) {
-    $support= '';
-    $site_id= $slice_info[0]['site_id'];
-    
-    echo "<p>Slice creation and renewal have been temporarily disabled for your site. This may have occurred because your site's nodes have been down or unreachable for several weeks, and multiple attempts to contact your site's PI(s) and Technical Contact(s) have all failed. If so, contact your site's PI(s) and Technical Contact(s) and ask them to bring up your site's nodes. If you believe that your site's nodes are up and reachable. Visit your site's <a href='/db/sites/index.php?id=$site_id'>Site Details</a> page to find out more about your site's nodes, and how to contact your site's PI(s) and Technical Contact(s).</p>";
-
-  }
-  // else start renewal form
-  else {
-    // Calculate possible extension lengths
-    $renewal_lengths = array();
-    foreach ( array( 1 => "One more week", 2 => "Two more weeks", 4 => "One more month" ) as $weeks => $text ) {
-      if ( ( $slice_info[0]['expires'] + ( $weeks * $week ) ) < $max_expiration ) {
-        $renewal_lengths[$weeks]= "$text (". gmstrftime( "%A %b-%d-%y %T %Z", $slice_info[0]['expires'] + ( $weeks * $week ) ) .")";
-      }
-    }
-    
-        
-    if ( empty( $renewal_lengths ) ) {
-      echo "<font color='red'>Slice cannot be renewed any further into the future, try again closer to expiration date.</font> Go <a href='index.php?id=$slice_id'>back</a> to ". $slice_info[0]['name'] .".\n";
-    }
-    else {
-      // clean vars
-      $expiration_date = gmstrftime( "%A %b-%d-%y %T %Z", $slice_info[0]['expires'] );
-      
-      // display form
-      echo "<form action='/db/slices/renew_slice.php' method='post'>\n";
-      echo "<input type=hidden name='id' value='$slice_id'><input type=hidden name='expires' value='". $slice_info[0]['expires'] ."'>\n";
-    
-      echo "<p>You must provide a short description as well as a link to a project website before renewing it. Do <b>not</b> provide bogus information; if a complaint is lodged against your slice and PlanetLab Operations is unable to determine what the normal behavior of your slice is, your slice may be deleted to resolve the complaint.</p>\n";
-      
-      echo "<p><b>NOTE:</b> Slices cannot be renewed beyond $max_renewal_length weeks of today ($max_expiration_date).</p>\n";
-      
-      echo "<table cellpadding=2><tbody>\n";
-      
-      echo "<tr><th>Name:</th><td colspan=2>". $slice_info[0]['name'] ."</td></tr>\n";
-      
-      if( $error['url'] ) 
-        $url_style= " style='border: 1px solid red;'";
-      echo "<tr><th$url_style>URL: </th><td$url_style><input size=50 name='url' value='". $slice_info[0]['url'] ."' /></td><td$url_style><font color=red>". $error['url'] ."</font></td></tr>\n";
-      
-      if( $error['description'] ) 
-        $desc_style= " style='border: 1px solid red;'";
-      echo "<tr><th$desc_style>Description: </th><td$desc_style><textarea name='description' rows=5 cols=40>". $slice_info[0]['description'] ."</textarea></td><td$desc_style><font color=red>". $error['description'] ."</font></td></tr>\n";
-      
-      echo "<tr><th>Expiration Date: </th><td colspan=2>$expiration_date</td></tr>\n";
-      
-      echo "<tr><th>Renewal Length: </th><td colspan=2><select name='expire_len'>";
-      
-      // create drop down of lengths to choose
-      foreach ($renewal_lengths as $weeks => $text) {
-        echo "<option value='$weeks'";
-        if( $weeks == $expire_len )
-          echo " selected";
-        echo ">$text</option>\n";
-      }
-      
-      echo "</select></td></tr>\n<tr><td colspan=3 align=center><input type=submit value='Renew Slice' name='submitted'></td></tr>\n</tbody></table>\n";
-    
-    }
-    
-  }
-
-}
-else 
-  echo "No data for this slice ID.  Go <a href='index.php'>back</a> to slices.\n";
-  
-
-
-
-
-
-
-
-
-// Print footer
-include 'plc_footer.php';
-
-?>
diff --git a/planetlab/slices/slice.php b/planetlab/slices/slice.php
new file mode 100644 (file)
index 0000000..4e23205
--- /dev/null
@@ -0,0 +1,522 @@
+<?php
+
+// $Id: index.php 12104 2009-02-19 18:41:19Z 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_peers.php';
+require_once 'linetabs.php';
+require_once 'table.php';
+require_once 'details.php';
+require_once 'toggle.php';
+
+// -------------------- 
+// recognized URL arguments
+$slice_id=intval($_GET['id']);
+if ( ! $slice_id ) { plc_error('Malformed URL - id not set'); return; }
+
+function renew_area ($slice,$site) {
+  // Constants
+  $week= 7 * 24 * 60 * 60; // seconds
+  $max_renewal_length= 8; // weeks from today
+  $max_expiration= mktime() + ($max_renewal_length * $week); // seconds since epoch
+  $max_expiration_date= gmstrftime("%A %b-%d-%y %T %Z", $max_expiration);
+  
+  // the renew area
+  // xxx some extra code needed to enable this area only if the slice description is OK:
+  // description and url must be non void
+  $toggle=new PlekitToggle('renew',"Renew this slice",
+                          array("trigger-bubble"=>"Enter this zone if you wish to renew your slice",
+                                'start-visible'=>true));
+  $toggle->start();
+
+  // xxx message could take roles into account
+  if ($site['max_slices']<=0) {
+     $message= <<< EOF
+<p>Slice creation and renewal have been temporarily disabled for your
+site. This may have occurred because your site's nodes have been down
+or unreachable for several weeks, and multiple attempts to contact
+your site's PI(s) and Technical Contact(s) have all failed. If so,
+contact your site's PI(s) and Technical Contact(s) and ask them to
+bring up your site's nodes. Please visit your <a
+href='/db/sites/index.php?id=$site_id'>site details</a> page to find
+out more about your site's nodes, and how to contact your site's PI(s)
+and Technical Contact(s).</p>
+EOF;
+     echo $message;
+  } else {
+    // xxx this is a rough cut and paste from the former UI
+    // Showing a datepicker view could be considered as well with some extra work
+    // Calculate possible extension lengths
+    $renewal_lengths = array();
+    foreach ( array ( 1 => "One more week", 
+                     2 => "Two more weeks", 
+                     4 => "One more month" ) as $weeks => $text ) {
+       if (($slice [ 'expires' ] + ($weeks * $week)) < $max_expiration) {
+        $renewal_lengths [ $weeks ] = "$text (" . 
+          gmstrftime( "%A %b-%d-%y %T %Z", $slice [ 'expires' ] + ( $weeks * $week ) ) 
+          . ")";
+       }
+    }
+
+    if ( empty( $renewal_lengths ) ) {
+      plc_warning("Slice cannot be renewed any further into the future, try again closer to expiration date.");
+     } else {
+      // clean vars
+       $expiration_date = gmstrftime( "%A %b-%d-%y %T %Z", $slice [ 'expires' ] );
+       echo '<p> area under construction </a>';
+       
+       //       // display form
+       //       echo "<form action='/db/slices/renew_slice.php' method='post'>\n";
+       //       echo "<input type=hidden name='id' value='$slice_id'><input type=hidden name='expires' value='". $slice['expires'] ."'>\n";
+     
+// $message = <<< EOF
+// <p>You must provide a short description as well as a link to a project website before renewing it.
+// Do <span class='bold'>not</span> provide bogus information; if a complaint is lodged against your slice 
+// and PlanetLab Operations is unable to determine what the normal behavior of your slice is, 
+// your slice may be deleted to resolve the complaint.</p>
+// EOF;
+// echo $message;
+//       
+//       echo "<p><span class='bold'>NOTE:</span> 
+// Slices cannot be renewed beyond $max_renewal_length weeks of today ($max_expiration_date).</p>\n";
+//       
+//       echo "<table cellpadding=2><tbody>\n";
+//       
+//       echo "<tr><th>Name:</th><td colspan=2>". $slice['name'] ."</td></tr>\n";
+//       
+//       if( $error['url'] ) 
+//         $url_style= " style='border: 1px solid red;'";
+//       echo "<tr><th$url_style>URL: </th><td$url_style><input size=50 name='url' value='". $slice['url'] ."' /></td><td$url_style><font color=red>". $error['url'] ."</font></td></tr>\n";
+//       
+//       if( $error['description'] ) 
+//         $desc_style= " style='border: 1px solid red;'";
+//       echo "<tr><th$desc_style>Description: </th><td$desc_style><textarea name='description' rows=5 cols=40>". $slice['description'] ."</textarea></td><td$desc_style><font color=red>". $error['description'] ."</font></td></tr>\n";
+//       
+//       echo "<tr><th>Expiration Date: </th><td colspan=2>$expiration_date</td></tr>\n";
+//       
+//       echo "<tr><th>Renewal Length: </th><td colspan=2><select name='expire_len'>";
+//       
+//       // create drop down of lengths to choose
+//       foreach ($renewal_lengths as $weeks => $text) {
+//         echo "<option value='$weeks'";
+//         if( $weeks == $expire_len )
+//           echo " selected";
+//         echo ">$text</option>\n";
+       }
+//       
+//       echo "</select></td></tr>\n<tr><td colspan=3 align=center><input type=submit value='Renew Slice' name='submitted'></td></tr>\n</tbody></table>\n";
+//     
+//     }
+//     
+  }
+  $toggle->end();
+}
+
+////////////////////
+// Get all columns as we focus on only one entry
+$slices= $api->GetSlices( array($slice_id));
+
+if (empty($slices)) {
+  drupal_set_message ("Slice " . $slice_id . " not found");
+  return;
+ }
+
+$slice=$slices[0];
+
+// pull all node info to vars
+$name= $slice['name'];
+$expires = date( "d/m/Y", $slice['expires'] );
+$site_id= $slice['site_id'];
+
+//$node_ids=$slice['node_ids'];
+$person_ids=$slice['person_ids'];
+//$slice_tag_ids= $slice['slice_tag_ids'];
+
+// get peers
+$peer_id= $slice['peer_id'];
+$peers=new Peers ($api);
+
+// gets site info
+$sites= $api->GetSites( array( $site_id ) );
+$site=$sites[0];
+$site_name= $site['name'];
+$max_slices = $site['max_slices'];
+
+// get all persons info
+if (!empty($person_ids))
+  $persons=$api->GetPersons($person_ids,array('email','enabled'));
+
+////////// 
+drupal_set_title("Details for slice " . $name);
+$local_peer= ! $peer_id;
+
+$am_in_slice = in_array(plc_my_person_id(),$person_ids);
+
+$privileges = (plc_is_admin()  || $am_in_slice);
+
+$tabs=array();
+$tabs [] = tab_nodes_slice($slice_id);
+$tabs [] = tab_site($site_id);
+
+// are these the right privileges for deletion ?
+if ($privileges) {
+  $tabs ['Delete']= array('url'=>l_actions(),
+                         'method'=>'post',
+                         'values'=>array('action'=>'delete-slice','slice_id'=>$slice_id),
+                         'bubble'=>"Delete slice $name",
+                         'confirm'=>'Are you sure to delete $name');
+
+  $tabs["Events"]=array_merge(tablook_event(),
+                             array('url'=>l_event("Slice","slice",$slice_id),
+                                   'bubble'=>"Events for slice $name"));
+  $tabs["Comon"]=array_merge(tablook_comon(),
+                            array('url'=>l_comon("slice_id",$slice_id),
+                                  'bubble'=>"Comon page about slice $name"));
+}
+
+plekit_linetabs($tabs);
+
+////////////////////////////////////////
+$peers->block_start($peer_id);
+
+$toggle = new PlekitToggle ('slice',"Details",
+                           array('trigger-bubble'=>'Display and modify details for that slice'));
+$toggle->start();
+
+$details=new PlekitDetails($privileges);
+$details->form_start(l_actions(),array('action'=>'update-slice','slice_id'=>$slice_id));
+
+$details->start();
+if (! $local_peer) {
+  $details->th_td("Peer",$peers->peer_link($peer_id));
+  $details->space();
+ }
+
+
+$details->th_td('Name',$slice['name']);
+$details->th_td('Description',$slice['description'],'description',
+               array('input_type'=>'textarea',
+                     'width'=>50,'height'=>5));
+$details->th_td('URL',$slice['url'],'url',array('width'=>50));
+$details->th_td('Expires',$expires);
+$details->th_td('Instantiation',$slice['instantiation']);
+$details->th_td('Site',l_site_obj($site));
+$details->end();
+
+$details->form_end();
+$toggle->end();
+
+renew_area ($slice,$site);
+
+$peers->block_end($peer_id);
+
+//////////////////// users
+
+//////////////////// nodes
+
+//////////////////// tags
+
+// Print footer
+include 'plc_footer.php';
+
+return;
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  // gets all persons from site_id
+    // person info
+  if( !empty( $person_ids ) ) 
+    $persons= $api->GetPersons( $site_info[0]['person_ids'] , array( "person_id", "role_ids", "first_name", "last_name", "email" ) );
+
+  if( $persons ) {
+    // gets site contacts pis stores in dict
+    foreach( $persons as $person )
+      if( in_array( "20", $person['role_ids'] ) ) {
+       $pis[]= array( "email" => $person['email'], "first_name" => $person['first_name'], "last_name" => $person['last_name'], "person_id" => $person['person_id'] );
+       
+      }
+    if ($pis) {
+      sort_persons( $pis );
+    }
+  }
+
+  // slice tag info
+  if( !empty( $slice_tag_ids ) )
+    $slice_attibs= $api->GetSliceTags( $slice_tag_ids, 
+                                      array( "slice_tag_id", "tag_type_id", "value", "description", "min_role_id", "node_id" ) );
+
+  // gets tag type info and combines it to form all tag info array
+  if( $slice_attibs ) {
+    foreach( $slice_attibs as $slice_attib ) {
+      $tag_type= $api->GetTagTypes( array( $slice_attib['tag_type_id'] ), 
+                                   array( "tag_type_id", "tagname", "description" ) );
+      
+      $tags[]= array( "slice_tag_id" => $slice_attib['slice_tag_id'], 
+                     "tag_type_id" => $slice_attib['tag_type_id'], 
+                     "tagname" => $tag_type[0]['tagname'], 
+                     "value" => $slice_attib['value'], 
+                     "description" => $slice_attib['description'], 
+                     "min_role_id" => $slice_attib['min_role_id'], 
+                     "node_id" => $slice_attib['node_id'] );
+    }
+
+  }
+
+  drupal_set_title("Slice details for " . $name);
+  // start form
+
+  if( $peer_id ) {
+    echo "<div class='plc-foreign'>\n";
+  }
+
+  // basic slice menu
+  if( ! $peer_id ) {
+
+    $actions= array( ''=>'Choose Action' );
+    
+    if( in_array( 10, $_roles ) 
+       || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) 
+       || in_array( $slice_id, $_person['slice_ids'] ) ) {
+      $actions['renew']= "Renew $name";
+      $actions['nodes']= "Manage Nodes";
+    }
+    if ( in_array( 10, $_roles )
+        || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) ) {
+      $actions['users']= "Manage Users";
+      $actions['delete']= "Delete $name";
+    }
+    
+    echo "<table><tr><td>\n";
+    if (in_array( 10, $_roles )) {
+      echo plc_event_button("slices","slice",$slice_id);
+      echo "</td><td>";
+    }
+    echo plc_comon_button("slice_id",$slice_id);
+    echo "</td><td>\n";
+
+    echo "<form action='/db/slices/slice_action.php' method='post'>\n";
+    echo "<input type=hidden name=slice_id value=$slice_id>\n";
+
+    echo "<select name='actions' onChange=\"submit();\">\n";
+    foreach( $actions as $key => $val ) {
+      echo "<option value='$key'";
+      
+      if( $key == $_POST['actions'] )
+       echo " selected";
+      
+      echo ">$val\n";
+    }
+    
+    echo "</select><br />\n";
+    echo "</form>\n";
+
+    echo "</td></tr></table>\n";
+  }
+
+  echo "<table cellpadding=3><tbody>\n
+       <tr><th>Slice Name: </th><td> $name </td></tr>\n
+       <tr><th>Description: </th><td> $description </td></tr>\n
+        <tr><th>URL: </th><td> <a href='$url'>$url</a> </td></tr>\n";
+       
+  if( gmmktime() > $slice['expires'] ) { 
+    $class1= ' style="color:red;"'; 
+    $msg1= '(slice is expired)'; 
+  }
+  echo "<tr><th$class1>Expiration: </th><td$class1> $expires &nbsp; $msg1</td></tr>\n";
+  echo "<tr><th>Instantiation: </th><td><select name='instantiation' onChange=\"submit();\"\n";
+  echo "<option value='delegated'"; 
+  if( $instantiation == 'delegated' ) echo " selected"; 
+  echo ">delegated</option>";
+  echo "<option value='plc-instantiated'"; 
+  if( $instantiation == 'plc-instantiated' ) echo " selected"; 
+  echo ">plc-instantiated</option>";
+  echo "<option value='not-instantiated'"; 
+  if( $instantiation == 'not-instantiated' ) echo " selected"; 
+  echo ">not-instantiated</option>";
+  echo "</select>"; 
+
+  echo "</td></tr>\n";
+  echo "<tr><th>Site: </th><td> <a href='/db/sites/index.php?id=$site_id'>". $site_info[0]['name'] ."</a></td></tr>\n";
+  $href="'/db/nodes/index.php?slice_id=" . $slice_id . "'";
+  printf ("<tr><th> <a href=%s># Nodes</a></th><td><a href=%s>Total %d nodes</a></td>\n",$href,$href,count($node_ids));
+  $href="'/db/persons/index.php?slice_id=" . $slice_id . "'";
+  printf ("<tr><th> <a href=%s># Users</a></th><td><a href=%s>Total %d users</a></td>\n",$href,$href,count($person_ids));
+  echo "</tbody></table>\n";
+
+  if ( (!$class1) && in_array( $slice_id, $_person['slice_ids'] ) && (! $peer_id) ) 
+    echo "<p><a href='update_slice.php?id=$slice_id'>Update Information</a>\n";
+
+  echo "<br /><hr />\n";
+
+
+  // slice tags
+  if( $tags ) {
+
+    // builds 2 arrays, one for tags, one for slivers
+    foreach( $tags as $tag ) {
+      if( empty( $tag['node_id'] ) ) {
+        $slice_tag[]= $tag;
+      }
+      else {
+        $sliver_tag[]= $tag;
+        $sliver_nodes[]= $tag['node_id'];
+      }
+    }
+  }
+
+  // Get node info for those slivers
+  $sliver_node_info= $api->GetNodes( $sliver_nodes, array( "node_id", "hostname" ) );
+
+  if( $sliver_node_info ) {
+    foreach( $sliver_node_info as $sliv_node ) {
+      $new_sliver_node_info[$sliv_node['node_id']]= $sliv_node;
+    }
+  }
+
+ if( $peer_id ) {
+   echo "<br /></div>\n";
+  }
+  // slice tags
+  $is_admin=in_array( 10, $_roles );
+  $is_in_slice=in_array( $slice_id, $_person['slice_ids'] );
+  $is_pi=in_array( 20, $_roles );
+  if( $slice_tag ) {
+    echo "<table cellpadding=3><caption class='list_set'>Slice Tags</caption>";
+    echo "<thead><tr>";
+    if( $is_admin )
+      echo "<th></th>";
+    echo "<th>Tag</th><th>Value</th><th>Description</th>";
+    echo "</tr></thead><tbody>\n";
+
+    foreach( $tags as $tag ) {
+      // ignore sliver tags at this stage
+      if( empty( $tag['node_id'] ) ) {
+        echo("<tr>");
+        if( $is_admin ) {
+         printf("<td>");
+         sprintf($label,"\\n [ %s = %s] \\n from %s",$tag['tagname'],$tag['value'],$name);
+         // xxx this is deprecated
+         echo plc_delete_link_button ('tag_action.php?rem_id=' . $tag['slice_tag_id'],
+                                      $label);
+         echo "</td>";
+       }
+       if( $is_admin || ($is_pi && $is_in_slice) ) {
+          printf ("<td><a href='tags.php?type=slice?id=%s'>%s</a></td>",
+                 $tag['slice_tag_id'],$tag['tagname']);
+       } else {
+         printf("<td>%s</td>",$tag['tagname']);
+       }
+       printf("<td align=center>%s</td><td>%s</td>",
+              $tag['value'],$tag['description']);
+        echo "</tr>";
+      }
+    }
+
+    
+    echo "</tbody></table>\n";
+
+  }
+  if( $is_admin || ($is_pi && $is_in_slice) )
+    echo "<a href='tags.php?type=slice&add=$slice_id'>Add a Slice Tag</a>\n";    
+
+
+
+  // sliver tags
+  if( $sliver_tag ) {
+    echo "<table cellpadding=3><caption class='list_set'>Sliver Tags</caption>";
+    echo "<thead><tr>";
+    if( $is_admin )
+      echo "<th></th>";
+    echo "<th>Tag</th><th>Value</th><th>Description</th><th>Node</th>";
+    echo "</tr></thead><tbody>\n";
+
+    foreach( $tags as $tag ) {
+      $nodename=$new_sliver_node_info[$tag['node_id']]['hostname'];
+      // consider only sliver tags at this stage
+      if( !empty( $tag['node_id'] ) ) {
+        echo("<tr>");
+        if( $is_admin ) {
+         echo("<td>");
+         $label=sprintf("\\n [ %s = %s ] \\n from %s \\n on node %s",
+                        $tag['tagname'],$tag['value'],$name,$nodename);
+         echo plc_delete_link_label('/db/nodes/sliver_action.php?rem_id=' . $tag['slice_tag_id'], 
+                                    $label);
+         echo "</td>";
+       }
+        if( $is_admin ) {
+          printf("<td><a href='tags.php?type=slice&id=%s'>%s</a></td>",$tag['slice_tag_id'],$tag['tagname']);
+       } else {
+         printf("<td>%s</td>",$tag['tagname']);
+       }
+       printf("<td align=center>%s</td><td>%s</td><td><a href='/db/nodes/index.php?id=%s'>%s</a></td>",
+              $tag['value'],$tag['description'],$tag['node_id'],$nodename);
+       
+        echo "</tr>";
+      }
+    }
+
+    echo "</tbody></table>\n";
+    
+  }
+  
+  echo "<br /><hr />\n";
+  
+  if( $pis && !$peer_id ) {
+    // site contacts
+    echo "<h5>Contacts</h5>\n";
+               
+    $pi_rows= count( $pis );
+    $tech_rows= count( $techs );
+    $table_row= 0;
+       
+    echo "<table cellpadding=2><tbody>";
+    if( $pis ) {
+      echo "<tr><td rowspan=$pi_rows><strong>PI's:</strong> &nbsp; </td>\n";
+      
+      foreach( $pis as $pi ) {
+       if( $table_row != 0 )
+         echo "<tr>";
+       printf("<td><a href='/db/persons/index.php?id=%s'>%s %s</td><td><a href='mailto:%s'>%s</a></td></tr>\n",
+              $pi['person_id'],$pi['first_name'],$pi['last_name'],$pi['email'],$pi['email']);
+       $table_row++;
+      }
+      
+    }
+    
+    echo "</table>\n<br /><hr />\n";
+    
+  }
+  
+  
+  echo "<p><a href='index.php'>Back to slice list</a></div>\n";
+ }
+
diff --git a/planetlab/slices/slices.php b/planetlab/slices/slices.php
new file mode 100644 (file)
index 0000000..28cba3b
--- /dev/null
@@ -0,0 +1,139 @@
+<?php
+
+// $Id: index.php 12104 2009-02-19 18:41:19Z thierry $
+// pattern-matching selection not implemented
+// due to GetSlices bug, see test.php for details
+// in addition that would not make much sense
+
+// 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_peers.php';
+require_once 'linetabs.php';
+require_once 'table.php';
+
+// -------------------- 
+// recognized URL arguments
+$peerscope=$_GET['peerscope'];
+$pattern=$_GET['pattern'];
+$site_id=intval($_GET['site_id']);
+$person_id=intval($_GET['person_id']);
+
+// --- decoration
+$title="Slices";
+$tabs=array();
+$tabs []= tab_slices_mysite();
+if (plc_is_admin()) $tabs []= tab_slices_local();
+
+// ----------
+$slice_filter=array();
+
+
+// fetch slices
+$slice_columns=array('slice_id','name','expires','person_ids','peer_id','node_ids');
+// server-side filtering - set pattern in $_GET for filtering on hostname
+if ($pattern) {
+  $slice_filter['name']=$pattern;
+  $title .= " matching " . $pattern;
+ } else {
+  $slice_filter['name']="*";
+ }
+
+// server-side selection on peerscope
+$peerscope=new PeerScope($api,$_GET['peerscope']);
+$slice_filter=array_merge($slice_filter,$peerscope->filter());
+$title .= ' - ' . $peerscope->label();
+
+
+if ($site_id) {
+  $sites=$api->GetSites(array($site_id));
+  $site=$sites[0];
+  $name=$site['name'];
+  $login_base=$site['login_base'];
+  $title .= t_site($site);
+  $tabs []= tab_site($site);
+  $slice_filter['site_id']=array($site_id);
+}
+
+if ($person_id) {
+  $persons=$api->GetPersons(array('person_id'=>$person_id,array('email','person_id','slice_ids')));
+  $person=$persons[0];
+  $title .= t_person($person);
+  $tabs .= tab_person($person);
+  $slice_filter['slice_id']=$person['slice_ids'];
+ }
+
+// go
+$slices=$api->GetSlices($slice_filter,$slice_columns);
+
+// build person_hash
+$person_ids=array();
+if ($slices) foreach ($slices as $slice) {
+  $person_ids = array_merge ($person_ids,$slice['person_ids']);
+}
+$persons=$api->GetPersons($person_ids,array('person_id','email'));
+global $person_hash;
+$person_hash=array();
+if ($persons) foreach ($persons as $person) $person_hash[$person['person_id']]=$person;
+
+function email_link_from_hash($person_id) { 
+  global $person_hash; 
+  return l_person_obj($person_hash[$person_id]);
+}
+
+// --------------------
+drupal_set_title($title);
+
+plekit_linetabs($tabs);
+
+if ( ! $slices ) {
+  drupal_set_message ('No slice found');
+  return;
+ }
+  
+$headers = array ("Peer"=>"string",
+                 "Name"=>"string",
+                 "Users"=>"string",
+                 "N"=>"int",
+                 "Exp. d/m/y"=>"date-dmy");
+
+# initial sort on hostnames
+$table=new PlekitTable ("slices",$headers,2,
+                       array('search_width'=>20));
+$table->start();
+
+$peers = new Peers ($api);
+// write rows
+foreach ($slices as $slice) {
+  $peer_id=$slice['peer_id'];
+  $shortname = $peers->shortname($peer_id);
+  $users=plc_vertical_table (array_map ("email_link_from_hash",$slice['person_ids']));
+  $expires= date( "d/m/Y", $slice['expires'] );
+
+  $table->row_start();
+  $table->cell ($peers->link($peer_id,$shortname));
+  $table->cell (l_slice_obj($slice));
+  $table->cell ($users);
+  $table->cell (href(l_nodes_slice($slice['slice_id']),count($slice['node_ids'])));
+  $table->cell ($expires);
+  $table->row_end();
+}
+
+$table->end();
+
+//plekit_linetabs ($tabs,"bottom");
+
+// Print footer
+include 'plc_footer.php';
+
+?>
index 86b7e6d..cb97270 100644 (file)
@@ -62,7 +62,7 @@ $details->end();
 
 // xxx : add & delete buttons would make sense here too
 $toggle=new PlekitToggle('nodes',"Nodes");
-$toggle=>start();
+$toggle->start();
 
 $headers["Hostname"]="string";
 
index d7808a2..bbedc8f 100644 (file)
@@ -8,5 +8,5 @@ table.plc_details {
 
 table.plc_details>tbody>tr>th {
     text-align: right;
-    font: bold 14px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+    font: 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
 }
index 7adcb5f..a475bee 100644 (file)
@@ -103,14 +103,15 @@ EOF;
 
   print "<tr>";
   foreach ($this->headers as $label => $type) {
-    if ($type == "none" ) {
-      $class="";
-    } else {
-      if ($type == "string") $type="";
-      if ($type == "int") $type="";
-      if ($type == "float") $type="";
-      $class="sortable";
-      if ( ! empty($type)) $class .= "-sort" . $type;
+    switch ($type) {
+    case "none" : 
+      $class=""; break;
+    case "string": case "int": case "float":
+      $class="sortable"; break;
+    case ( strpos($type,"date-") == 0):
+      $class="sortable-" . $type; break;
+    default:
+      $class="sortable-sort" . $type; break;
     }
     printf ('<th class="%s plekit_table">%s</th>',$class,$label);
   }
@@ -144,7 +145,7 @@ EOF;
       onkeyup='plekit_pagesize_set("$this->table_id","$pagesize_text_id", $this->pagesize);' 
       size='3' maxlength='3' /> 
   <label class='pagesize_label'> items/page </label>   
-  <img class='table_reset' src="/planetlab/icons/clear.png" alt="reset visible size"
+  <img class='reset' src="/planetlab/icons/clear.png" alt="reset visible size"
       onmousedown='plekit_pagesize_reset("$this->table_id","$pagesize_text_id",$this->pagesize_def);' />
 </fieldset></form></td></tr>
 EOF;
@@ -159,16 +160,16 @@ EOF;
     $search_and_id = $this->table_id . "_search_and";
     $result = <<< EOF
 <tr class='search_area'><td class='search_area' colspan='$width'>
-<form class='table_search' action='satisfy_xhtml_validator'><fieldset>
-   <label class='table_search_label'> Search </label> 
-   <input class='table_search_input' type='text' id='$search_text_id'
+<form class='search' action='satisfy_xhtml_validator'><fieldset>
+   <label class='search_label'> Search </label> 
+   <input class='search_input' type='text' id='$search_text_id'
       onkeyup='plekit_table_filter("$this->table_id","$search_text_id","$search_and_id");'
       size='$this->search_width' maxlength='256' />
    <label>and</label>
-   <input id='$search_and_id' class='table_search_and' 
+   <input id='$search_and_id' class='search_and' 
       type='checkbox' checked='checked' 
       onchange='plekit_table_filter("$this->table_id","$search_text_id","$search_and_id");' />
-   <img class='table_reset' src="/planetlab/icons/clear.png" alt="reset search"
+   <img class='reset' src="/planetlab/icons/clear.png" alt="reset search"
       onmousedown='plekit_table_filter_reset("$this->table_id","$search_text_id","$search_and_id");' />
 </fieldset></form></td></tr>
 EOF;
@@ -207,7 +208,7 @@ EOF;
     if (! $notes)
       return "";
     $result = "";
-    $result .= "<p class='plekit_table_note'> <span class='plekit_table_note_title'>Notes</span>\n";
+    $result .= "<p class='table_note'> <span class='table_note_title'>Notes</span>\n";
     foreach ($notes as $note) 
       $result .= "<br/>$note\n";
     $result .= "</p>";
index aac3c9d..6d35af8 100644 (file)
@@ -122,7 +122,7 @@ class PlekitToggle {
     $id=$this->id_name('container');
 
     // side-effects on the header
-    $nifty_init = "<script> Event.observe(window,'load', function () { Nifty ('div#$id','big'); } ); </script>";
+    $nifty_init = "<script> Event.observe(window,'load', function () { Nifty ('div#$id','medium'); } ); </script>";
     drupal_set_html_head($nifty_init);
 
     $html="<div class='plc-toggle-container'";
index c6bf723..b3a509b 100644 (file)
@@ -35,9 +35,14 @@ table.plekit_table>tbody>tr>td, table.plekit_table textarea, table.plekit_table
     border-bottom: 1px solid #C1DAD7;
 }
 table.plekit_table>tbody>tr>td {
-    padding: 6px 12px 6px 12px;
+/*    padding: 6px 12px 6px 12px; */
+    padding: 4px 8px 4px 8px;
     color: #4f6b72;
 }
+table.plekit_table>tbody>tr>td a {
+    font-weight:normal;
+}
+
 th.sortable,
 th.sortable-text,
 th.sortable-date,
@@ -98,19 +103,21 @@ table.plekit_table>tbody>tr>td:first-child {
 td.search_area {
     text-align:right;
     padding-right: 30px;
+    padding-bottom: 5px;
 }
 td.pagesize_area {
     text-align:right;
     padding-right: 30px;
+    padding-bottom: 5px;
 }
 .pagesize_label, .pagesize_input {
     font-style: oblique;
     font-size: .5em;
 }
-.table_search_label{
+.search_label{
     font-weight:bold;
 }
-.table_reset {
+.reset {
     border:1px;
 }
 
@@ -223,13 +230,13 @@ tr.invisibleRow {
 p.paginationText {
     font-style:oblique;
 }
-p.plekit_table_note {
+p.table_note {
     font-style:oblique;
     font-size:0.6em;
     font-family: georgia;
     text-align: center;
 }
-span.plekit_table_note_title {
+span.table_note_title {
     font-weight:bold;
     font-size:1.5em;
     font-family: georgia;
@@ -247,6 +254,7 @@ ul.fdtablePaginater li {float:left;}
 ul.fdtablePaginater {text-align:center;}
 /*table.plekit_table { border-bottom:1px solid #C1DAD7; }*/
 
-.table_search_input:focus {
-    background-color: #888;
+.search_input:focus ,.pagesize_input:focus {
+    background-color: #aaa;
+    outline-color: #696;
 }
index 4560ba8..38f8860 100644 (file)
@@ -4,16 +4,17 @@
 
 /* containers - work with nifty corners*/
 div.plc-toggle-container {
-    background-color: #E6E6E6;
-    padding: 20px;
+/*    background-color: #E6E6E6; */
+    background-color: #d0f0d0;
+    padding: 5px;
     margin: 10px;
 }
 
 .plc-toggle-trigger {
     padding: 0;
     margin: 20px;
-    font-weight: bold;
     cursor: crosshair;
+    font: italic 16px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
 }
 
 /* the buttons */