break;
}
-//
+//debug
+//$action='debug';
+
$person_id = $_POST['person_id']; // usually needed
if ( ! $action ) {
}
// update site to not allow slice creation or renewal
$api->UpdateSite( $site_id, array( "max_slices" => 0 )) ;
- header ("location: " l_site($site_id));
+ header ("location: " . l_site($site_id));
exit(0);
}
require_once 'plc_functions.php';
require_once 'plc_sorts.php';
-// find person roles
-$_person= $plc->person;
-$_roles= $_person['role_ids'];
-
-//print_r( $_person );
-
-
print "<p class='plc-warning'> This page is under construction </p>";
-if( !$_GET['id'] ) {
-
-
-}
-else {
-
-
-}
-
// Print footer
include 'plc_footer.php';
function l_site_register() { return "/db/sites/register.php"; }
function l_sites_pending() { return "/db/sites/join_request.php"; }
+function tabs_events() { return array('image'=>'/planetlab/icons/event.png','height'=>18);}
+function tabs_comon() { return array('image'=>'/planetlab/icons/comon.png','height'=>18);}
+
// returns array ['url' => path, 'values' => hash (key=>value)* ]
function split_url ($full_url) {
list($url,$args) = explode("?",$full_url);
print( "</ul></div>\n" );
}
-function plc_warning_text ($text) { return "<div class='plc-warning'>" . $text . "</div>";}
+function plc_warning_text ($text) { return "<span class='plc-warning'>" . $text . "</span>";}
function plc_warning ($text) { print plc_warning_text("Warning " . $text); }
-function plc_foreign_text($text) { return "<div class=plc-foreign>$text</div>"; }
+function plc_foreign_text($text) { return "<span class=plc-foreign>$text</span>"; }
// shows a php variable verbatim with a heading message
function plc_debug ($message,$object) {
// fetches peers and initialize hash peer_id->peer
$peer_hash = plc_peer_global_hash ($api);
// show gray background on foreign objects : start a <div> with proper class
-plc_peer_block_start ($peer_hash,$peer_id);
+$local_peer = plc_peer_block_start ($peer_hash,$peer_id);
drupal_set_title("Details for node " . $hostname);
$tabs=array();
// available actions
-if ( ! $peer_id && $privileges ) {
+if ( $local_peer && $privileges ) {
$tabs['Update'] = array ('url'=>"/db/nodes/node_actions.php",
'method'=>'POST',
$tabs['Delete'] = array ('url'=>"/db/nodes/node_actions.php",
'method'=>'POST',
'values'=>array('action'=>'delete','node_id'=>$node_id),
- 'bubble'=>"Delete $hostname",
+ 'bubble'=>"Delete node $hostname",
'confirm'=>'Are you sure to delete ' . $hostname. ' ?');
// xxx subject to roles
- $tabs["Add Interface"]=l_interface_add($node_id);
- $tabs["Comon"]=array('url'=>l_comon("node_id",$node_id),
- 'buble'=>"Comon page for $hostname");
- $tabs["Events"]=array('url'=>l_event("Node","node",$node_id),
- 'bubble'=>"Events for node $hostname");
+ $tabs["Add Interface"]=array('url'=>l_interface_add($node_id),
+ 'bubble'=>"Declare new network interface on $hostname");
+ $tabs["Events"]=array_merge(tabs_events(),
+ array('url'=>l_event("Node","node",$node_id),
+ 'bubble'=>"Events for node $hostname"));
+ $tabs["Comon"]=array_merge(tabs_comon(),
+ array('url'=>l_comon("node_id",$node_id),
+ 'bubble'=>"Comon page about node $hostname"));
}
$tabs["All nodes"]=l_nodes();
plc_tabs($tabs);
plc_details_start ();
-plc_details_line("Peer",plc_peer_label($peer));
plc_details_line("Hostname",$hostname);
plc_details_line("Type",$node_type);
plc_details_line("Model",$model);
plc_details_line("Version",$version);
+plc_details_line("Peer",plc_peer_label($peer));
// no tool to implement this multiple-choice setting yet
// xxx would need at least to use the proper class, like plc_details_class() or something
echo "<tr><th>Boot State: </th><td>";
-if ($peer_id) {
+if ( ! $local_peer) {
echo $boot_state;
} else {
echo "<form name='bootstate' action='/db/nodes/node_actions.php' method=post>\n";
echo "</td></tr>\n";
// same here for the download area
-if ( ! $peer_id && $privileges) {
+if ( $local_peer && $privileges) {
echo "<tr><th>Download </th><td>";
echo "<form name='download' action='/db/nodes/node_actions.php' method='post'>\n";
plc_section ("Slices");
if ( ! $slices ) {
- echo "<p><span class='plc-warning'>This node is not associated to any slice.</span></p>\n";
+ plc_warning ("This node is not associated to any slice");
} else {
$headers=array();
$headers['Peer']="string";
$headers['Name']="string";
$headers['Slivers']="string";
- $table_options = array('notes_area'=>false,"search_width"=>10);
+ $reasonable_page=10;
+ $table_options = array('notes_area'=>false,"search_width"=>10,'pagesize'=>$reasonable_page);
+ if (count ($slices) <= $reasonable_page) {
+ $table_options['search_area']=false;
+ $table_options['pagesize_area']=false;
+ }
plc_table_start ("node_slices",$headers,1,$table_options);
foreach ($slices as $slice) {
}
//////////////////////////////////////////////////////////// interfaces
-if ( ! $peer_id ) {
+if ( $local_peer ) {
// display interfaces
if( ! $interfaces ) {
drupal_set_title("Details for account " . $first_name . " " . $last_name);
$plc_hash=plc_peer_global_hash($api);
+if ($peer_id) {
+ $peers=$api->GetPeers(array($peer_id));
+ $peer=$peers[0];
+}
$local_peer = plc_peer_block_start ($peer_hash,$peer_id);
$is_my_account = plc_my_person_id() == $person_id;
$tabs['Events'] = array('url'=>l_events(),
'values'=>array('type'=>'Person','person'=>$person_id),
'bubble'=>"Events about $first_name $last_name",
- 'image'=>'/planetlab/icons/event.png',
- 'height'=>18);
+ 'image'=>'/planetlab/icons/event.png','height'=>18);
// Back button
$tabs['All Users'] = array ('url'=>l_persons(),
plc_details_line("Phone",$phone);
plc_details_line("Title",$title);
plc_details_line("Bio",wordwrap($bio,50,"<br/>"));
+plc_details_line("Peer",plc_peer_label($peer));
plc_details_end();
//////////////////// slices
plc_warning ("User has no slice");
} else {
$headers=array('Slice name'=>'string');
- $table_options=array('notes_area'=>false, 'pagesize_area'=>false, 'pagesize'=>999, 'search_width'=>10);
+ $reasonable_page=5;
+ $table_options = array('notes_area'=>false,"search_width"=>10,'pagesize'=>$reasonable_page);
+ if (count ($slices) <= $reasonable_page) {
+ $table_options['search_area']=false;
+ $table_options['pagesize_area']=false;
+ }
plc_table_start("person_slices",$headers,1,$table_options);
foreach( $slices as $slice ) {
// available actions
if ( ! $peer_id && $privileges ) {
- $tabs['Update']=array('url'=>l_site_update($site_id));
+ $tabs['Update']=array('url'=>l_site_update($site_id),
+ 'bubble'=>"Update details of $sitename");
// not avail to PI
$tabs['Expire slices'] = array('url'=>l_actions(),
'values'=>array('site_id'=>$site_id,
$tabs['Delete']=array('url'=>l_actions(),
'values'=>array('site_id'=>$site_id,
'action'=>'delete-site'),
- 'bubble'=>"Delete site $login_base",
+ 'bubble'=>"Delete site $sitename",
'confirm'=>"Are you sure you want to delete site $login_base");
- $tabs["Events"]=array('url'=>l_event("Site","site",$site_id),
- 'bubble'=>"Events for site $hostname");
- $tabs["Comon"]=array('url'=>l_comon("site_id",$site_id),
- 'buble'=>"Comon page for $hostname");
+ $tabs["Events"]=array_merge (tabs_events(),
+ array('url'=>l_event("Site","site",$site_id),
+ 'bubble'=>"Events for site $sitename"));
+ $tabs["Comon"]=array_merge(tabs_comon(),
+ array('url'=>l_comon("site_id",$site_id),
+ 'bubble'=>"Comon page for $sitename"));
if (plc_is_admin())
$tabs['Pending'] = array ('url'=>l_sites_pending(),
" to review pending applications.");
plc_details_start();
-plc_details_line("Peer",plc_peer_label($peer));
plc_details_line("Full name",$sitename);
plc_details_line("Login base",$login_base);
plc_details_line("Abbreviated name",$abbrev_name);
plc_details_line("URL",$site_url);
plc_details_line("Latitude",$site_lat);
plc_details_line("Longitude",$site_long);
+plc_details_line("Peer",plc_peer_label($peer));
if ( ! $peer_id ) {
+ // Addresses
+ if ($addresses) {
+ plc_details_space_line();
+ plc_details_line("Addresses","");
+ foreach ($addresses as $address) {
+ plc_details_line(plc_vertical_table($address['address_types']),
+ plc_vertical_table($address['line1'],
+ $address['line2'],
+ $address['line3'],
+ $address['city'],
+ $address['state'],
+ $address['postalcode'],
+ $address['country']));
+ }
+ }
+
// Nodes
plc_details_space_line();
$nb_boot = 0;