require_once 'table.php';
require_once 'nifty.php';
-// --------------------
+// --------------------
// recognized URL arguments
-$peerscope=$_GET['peerscope'];
-$pattern=$_GET['pattern'];
-$site_id=intval($_GET['site_id']);
-$person_id=intval($_GET['person_id']);
+$peerscope=get_array($_GET, 'peerscope');
+$pattern=get_array($_GET, 'pattern');
+$site_id=intval(get_array($_GET, 'site_id'));
+$person_id=intval(get_array($_GET, 'person_id'));
// --- 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();
}
// server-side selection on peerscope
-$peerscope=new PeerScope($api,$_GET['peerscope']);
+$peerscope=new PeerScope($api,get_array($_GET, 'peerscope'));
$slice_filter=array_merge($slice_filter,$peerscope->filter());
$title .= ' - ' . $peerscope->label();
}
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);
$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;
+function email_link_from_hash($person_id) {
+ global $person_hash;
return l_person_obj($person_hash[$person_id]);
}
drupal_set_message ('No slice found');
return;
}
-
+
$nifty=new PlekitNifty ('','objects-list','big');
$nifty->start();
-$headers = array ("Peer"=>"string",
- "Name"=>"string",
- "Users"=>"string",
- "U"=>"int",
- "N"=>"int",
- "Exp. d/m/y"=>"date-dmy");
+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();
$expires= date( "d/m/Y", $slice['expires'] );
$table->row_start();
+ if (plc_is_admin()) $table->cell (l_slice_t($slice_id,$slice_id));
$peers->cell($table,$peer_id);
- $table->cell (l_slice_obj($slice));
+ $table->cell (href(l_slice_nodes($slice_id),$slice['name']));
$table->cell ($users);
$table->cell(href(l_persons_slice($slice_id),count($slice['person_ids'])));
$table->cell (href(l_nodes_slice($slice_id),count($slice['node_ids'])));