// Common functions
require_once 'plc_functions.php';
+require_once 'plc_peers.php';
require_once 'plc_minitabs.php';
require_once 'plc_tables.php';
require_once 'plc_details.php';
$keys= $api->GetKeys( $key_ids );
drupal_set_title("Details for account " . $first_name . " " . $last_name);
+$local_peer = ! $peer_id;
-$plc_hash=plc_peer_global_hash($api);
+$peers = new Peers ($api);
-$local_peer = plc_peer_block_start ($peer_hash,$peer_id);
$is_my_account = plc_my_person_id() == $person_id;
$privileges = plc_is_admin () || ( plc_in_site($site_id) && plc_is_pi());
$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_tabs($tabs);
+$peers->block_start ($peer_id);
+
if ($local_peer && $privileges && ! $enabled )
drupal_set_message ("$first_name $last_name is not enabled yet, you can enable her/him with the 'Enable' button below");
$enabled_text="Enabled";
-if ( ! $enabled ) $enabled_text = plc_warning_div("Disabled");
+if ( ! $enabled ) $enabled_text = plc_warning_text("Disabled");
plc_details_start();
plc_details_line("Enabled",$enabled_text);
plc_details_line("Phone",$phone);
plc_details_line("Title",$title);
plc_details_line("Bio",wordwrap($bio,50,"<br/>"));
+plc_details_line("Peer",$peers->peer_link($peer_id));
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 ) {
}
// we don't set 'action', but use the submit button name instead
-plc_form_start(l_actions(),
- array("person_id"=>$person_id,
- // uncomment this to run the 'debug' action
- //"action"=>"debug",
- ));
+plc_form_start(l_actions(), array("person_id"=>$person_id,));
//////////////////// keys
plc_section ("Keys");
if ($keys) foreach ($keys as $key) {
$key_id=$key['key_id'];
- plc_table_row_start($key_id);
+ plc_table_row_start();
plc_table_cell ($key['key_type']);
plc_table_cell(wordwrap( $key['key'], 60, "<br />\n", 1 ));
if ($can_manage_keys)
// add a site : the button
$add_site_right_area=plc_form_submit_text("add-person-to-site","Add in site");
// get list of local sites that the person is not in
+ function get_site_id ($site) { return $site['site_id'];}
$person_site_ids=array_map("get_site_id",$sites);
$relevant_sites= $api->GetSites( array("peer_id"=>NULL,"~site_id"=>$person_site_ids), $site_columns);
$add_site_left_area=plc_form_select_text("site_id",$selector,"Choose a site to add");
$add_site_area = $add_site_left_area . $add_site_right_area;
if ($sites)
- $footers[]="<td colspan=3 style='text-align:right'> $remove_sites_area </td>";
+ $footers[]=plc_table_td_text ($remove_sites_area,3,"right");
// add a new site
- $footers []="<td colspan=3 style='text-align:right'> $add_site_area </td>";
+ $footers []= plc_table_td_text ($add_site_right_area,3,"right");
}
plc_table_end("person_sites",array("footers"=>$footers));
//////////////////////////////
plc_form_end();
-plc_peer_block_end();
+$peers->block_end($peer_id);
// Print footer
include 'plc_footer.php';