X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fpersons%2Fperson.php;h=663608c8cdbdb70942f617f6c351641b04d5f345;hb=c91463378279057df545701298bbe3e9604efd67;hp=bd499adcb04861027351c6a98525a6cca7544efc;hpb=fd9b5dccd591a5bfe48daf1da6bbb52164fa93c9;p=plewww.git diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index bd499ad..663608c 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -30,7 +30,10 @@ if ( ! $person_id ) { //////////////////// // Get all columns as we focus on only one entry -$persons= $api->GetPersons( array($person_id)); +// we need to mention them explicitly because we want hrn that is a tag.. +$columns=array('enabled','first_name','last_name','email','url','phone','title','bio','peer_id', + 'role_ids','roles','site_ids','slice_ids','key_ids','hrn'); +$persons= $api->GetPersons( array($person_id), $columns); if (empty($persons)) { drupal_set_message ("Person " . $person_id . " not found"); @@ -55,11 +58,20 @@ $roles= $person['roles']; $site_ids= $person['site_ids']; $slice_ids= $person['slice_ids']; $key_ids= $person['key_ids']; +$hrn=$person['hrn']; // gets more data from API calls $site_columns=array( "site_id", "name", "login_base" ); -$sites= $api->GetSites( $site_ids, $site_columns); -$slices= $api->GetSlices( $slice_ids, array( "slice_id", "name" ) ); +if ($site_ids) { + $sites= $api->GetSites( $site_ids, $site_columns); +} else { + $sites = array(); +} +if ($slice_ids) { + $slices= $api->GetSlices( $slice_ids, array( "slice_id", "name" ) ); +} else { + $slices = array(); +} $keys= $api->GetKeys( $key_ids ); drupal_set_title("Details for account " . $first_name . " " . $last_name); @@ -143,6 +155,8 @@ $details->th_td("Title",$title,"title",array('width'=>10)); $details->th_td("First Name",$first_name,"first_name"); $details->th_td("Last Name",$last_name,"last_name"); $details->th_td(href("mailto:$email","Email"),$email,"email",array("width"=>30)); +if ($hrn) $details->th_td("SFA hrn",$hrn); +else $details->tr("SFA hrn not set","center"); $details->th_td("Phone",$phone,"phone"); $details->th_td("URL",$url,"url",array('width'=>40)); $details->th_td("Bio",$bio,"bio",array('input_type'=>'textarea','height'=>4)); @@ -299,8 +313,12 @@ if ($local_peer) { // 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, '-SORT'=>'name'), $site_columns); - // xxx cannot use onchange=submit() - would need to somehow pass action name + if ($person_site_ids) { + $relevant_sites= $api->GetSites( array("peer_id"=>NULL,"~site_id"=>$person_site_ids, '-SORT'=>'name'), $site_columns); + } else { + $relevant_sites= $api->GetSites( array("peer_id"=>NULL, '-SORT'=>'name'), $site_columns); + } + // xxx cannot use onchange=submit() - would need to somehow pass action name function site_selector($site) { return array('display'=>$site['name'],"value"=>$site['site_id']); } $selectors = array_map ("site_selector",$relevant_sites); $table->cell ($form->select_html("site_id",$selectors,array('label'=>"Choose a site to add")).