<?php
-// $Id: index.php 12104 2009-02-19 18:41:19Z thierry $
+// $Id$
// pattern-matching selection not implemented
// due to GetSlices bug, see test.php for details
// in addition that would not make much sense
require_once 'plc_peers.php';
require_once 'linetabs.php';
require_once 'table.php';
+require_once 'nifty.php';
// --------------------
// recognized URL arguments
// --- decoration
$title="Slices";
$tabs=array();
+
+if (plc_is_admin()) {
+ $tabs []= tab_slices();
+}
+if (plc_is_user()) {
+ $tabs []= tab_slices_person();
+}
$tabs []= tab_slices_mysite();
if (plc_is_admin()) $tabs []= tab_slices_local();
}
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'];
- }
+ // fetch the person's slice_ids
+ $persons = $api->GetPersons(array('person_id'=>$person_id),array('person_id','email','slice_ids'));
+ $person=$persons[0];
+ $slice_ids['slice_id']=$person['slice_ids'];
+ $title .= t_person($person);
+ $slice_filter['slice_id']=$person['slice_ids'];
+}
// go
$slices=$api->GetSlices($slice_filter,$slice_columns);
return;
}
-$headers = array ("Peer"=>"string",
- "Name"=>"string",
- "Users"=>"string",
- "N"=>"int",
- "Exp. d/m/y"=>"date-dmy");
+$nifty=new PlekitNifty ('','objects-list','big');
+$nifty->start();
+if (plc_is_admin()) $headers["I"]="int";
+$headers["Peer"]="string";
+$headers["Name"]="string";
+$headers["Users"]="string";
+$headers["U"]="int";
+$headers["N"]="int";
+$headers["Exp. d/m/y"]="date-dmy";
# initial sort on hostnames
-$table=new PlekitTable ("slices",$headers,2,
+if (plc_is_admin()) $slices_sort_column = 3;
+else $slices_sort_column = 2;
+
+$table=new PlekitTable ("slices",$headers,$slices_sort_column,
array('search_width'=>20));
$table->start();
$peers = new Peers ($api);
// write rows
foreach ($slices as $slice) {
+ $slice_id=$slice['slice_id'];
$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));
+ if (plc_is_admin()) $table->cell (l_slice_t($slice_id,$slice_id));
+ $peers->cell($table,$peer_id);
+ $table->cell (href(l_slice_nodes($slice_id),$slice['name']));
$table->cell ($users);
- $table->cell (href(l_nodes_slice($slice['slice_id']),count($slice['node_ids'])));
+ $table->cell(href(l_persons_slice($slice_id),count($slice['person_ids'])));
+ $table->cell (href(l_nodes_slice($slice_id),count($slice['node_ids'])));
$table->cell ($expires);
$table->row_end();
}
-$table->end();
+$notes=array();
+$notes []= "U = number of users";
+$notes []= "N = number of nodes";
+$table->end(array('notes'=>$notes));
+$nifty->end();
//plekit_linetabs ($tabs,"bottom");