From 10342455b167946d770d53036571299ed3605a83 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 27 Jan 2009 13:59:33 +0000 Subject: [PATCH] checkpoint --- planetlab/css/plc_tables.css | 6 +++--- planetlab/includes/plc_minitabs.php | 4 +++- planetlab/persons/person.php | 18 +++++++++--------- planetlab/persons/person_actions.php | 22 +++++++++++++--------- planetlab/persons/persons.php | 6 ++++-- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/planetlab/css/plc_tables.css b/planetlab/css/plc_tables.css index 1a03646..b5cc03b 100644 --- a/planetlab/css/plc_tables.css +++ b/planetlab/css/plc_tables.css @@ -66,18 +66,18 @@ tr.alt { /* Poor old Internet Explorer 6 has a bug that means we can't use background images for the table rows as it trys to download the image each and every time that it is used (which means a 1000 row table will produce 1000 http requests for the image in question) */ -tr[class="alt"] td { +tr[class="alt"]>td { background: #F5FAFA url(/planetlab/icons/tablesort_td_alt.jpg) no-repeat; } td.plc_table [class~="alt"] { background: #edf3f3 url(/planetlab/icons/tablesort_col_alt.jpg) no-repeat !important; } /* Poor old Internet Explorer won't see the next two rules either as it doesn't get :first-child */ -table.plc_table tbody tr.alt td:first-child { +table.plc_table>tbody>tr.alt>td:first-child { background: #F5FAFA url(/planetlab/icons/tablesort_bullet2.gif) no-repeat; font-weight:bold; } -table.plc_table tbody tr td:first-child { +table.plc_table>tbody>tr>td:first-child { background: #fff url(/planetlab/icons/tablesort_bullet1.gif) no-repeat; font-weight:bold; } diff --git a/planetlab/includes/plc_minitabs.php b/planetlab/includes/plc_minitabs.php index 0574f6b..ae7c323 100644 --- a/planetlab/includes/plc_minitabs.php +++ b/planetlab/includes/plc_minitabs.php @@ -57,7 +57,9 @@ function plc_tabs($array) { $type='type=button value="' . $label . '"'; } printf('',$todo['bubble']); - printf('',$tracer,$type,$todo['confirm']); + $message=""; + if ($todo['confirm']) $message=$todo['confirm'] . " ?"; + printf('',$tracer,$type,$message); printf('',$todo['bubble']); printf("\n"); } diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index 2bde056..25ef6cd 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -11,9 +11,7 @@ global $plc, $api; // Print header require_once 'plc_drupal.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; - +include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; @@ -69,16 +67,18 @@ if (empty($persons)) { if ($local_peer && $privileges) { if (plc_is_admin()) - $tabs['Events'] = array('url'=>l_event("Person","person",$person_id), - 'bubble'=>'Related events', - 'image'=>'/planetlab/icons/event.png', - 'height'=>18); + $tabs['Events'] = array('url'=>l_events(), + 'values'=>array('type'=>'Person','person'=>$person_id), + 'bubble'=>'Related events', + 'image'=>'/planetlab/icons/event.png', + 'height'=>18); if ($enabled) $tabs['Disable'] = array ('method'=>'POST', 'url'=>'/db/persons/person_actions.php', 'values'=> array ('person_id'=>$person_id, 'action'=>'disable'), - 'bubble'=>"Disable $first_name"); + 'bubble'=>"Disable $first_name", + 'confirm'=>"Are you sure you want to disable $first_name $last_name"); else $tabs['Enable'] = array ('method'=>'POST', 'url'=>'/db/persons/person_actions.php', @@ -98,7 +98,7 @@ if (empty($persons)) { 'values'=>array('id'=>$person_id), 'bubble'=>"Update $first_name"); - $tabs['Persons'] = array ('url'=>l_persons()); + $tabs['All Users'] = array ('url'=>l_persons()); plc_tabs($tabs); diff --git a/planetlab/persons/person_actions.php b/planetlab/persons/person_actions.php index 155c1bd..9dbcd34 100644 --- a/planetlab/persons/person_actions.php +++ b/planetlab/persons/person_actions.php @@ -21,13 +21,13 @@ require_once 'plc_sorts.php'; $_person= $plc->person; $_roles= $_person['role_ids']; - +////////////////////////////// // get person id if( $_POST['person_id'] ) $person_id= $_POST['person_id']; -// if site_id submitted add the person to that site_id +//////////////////// add in site if( $_POST['site_add'] ) { $site_id= $_POST['site_add']; @@ -37,6 +37,7 @@ if( $_POST['site_add'] ) { } +//////////////////// remove from sites if ( $_POST['Remove_Sites']){ if( $_POST['rem_site'] ) { foreach( $_POST['rem_site'] as $site_id ) { @@ -47,9 +48,11 @@ if ( $_POST['Remove_Sites']){ }else{ echo "

Please select one or more Sites to remove.

\n"; echo "

Back to person page"; + return; } } +//////////////////// remove roles // remove role if ( $_POST['Remove_Roles']){ if($_POST['rem_role']) { @@ -65,7 +68,7 @@ if ( $_POST['Remove_Roles']){ } } -// add roles +//////////////////// add roles if( $_POST['add_role'] ) { $role_id= $_POST['add_role']; @@ -75,8 +78,9 @@ if( $_POST['add_role'] ) { exit(); } +//////////////////// enable // enable person -if( $_GET['enab_id'] ) { +if ( $_GET['enab_id'] ) { $per_id= $_GET['enab_id']; $fields= array( "enabled"=>true ); @@ -88,7 +92,7 @@ if( $_GET['enab_id'] ) { } -// disable person +//////////////////// disable person if( $_GET['dis_id'] ) { $per_id= $_GET['dis_id']; @@ -96,7 +100,7 @@ if( $_GET['dis_id'] ) { $api->UpdatePerson( intval( $per_id ), $fields ); - header( "location: index.php?id=$person_id" ); + header( "location: index.php?id=$per_id" ); exit(); } @@ -127,11 +131,11 @@ if( $_POST['action'] ) { } -// delete person +//////////////////// delete person if( $_GET['per_id'] ) { - $person_id= $_GET['per_id']; + $per_id= $_GET['per_id']; - $api->DeletePerson( intval( $person_id ) ); + $api->DeletePerson( intval( $per_id ) ); header( "location: index.php" ); exit(); diff --git a/planetlab/persons/persons.php b/planetlab/persons/persons.php index f7eb758..dc8fbb5 100644 --- a/planetlab/persons/persons.php +++ b/planetlab/persons/persons.php @@ -64,7 +64,7 @@ function person_status ($person) { // fetch persons -$person_columns=array('first_name','last_name','email','roles','peer_id','key_ids','site_ids'); +$person_columns=array('person_id','first_name','last_name','email','roles','peer_id','key_ids','site_ids'); // PIs and admins can see users not yet enabled $privileges=plc_is_admin() || plc_is_pi(); if ( ! $privileges ) @@ -89,6 +89,8 @@ if ($site_id) { $title .= t_site($site); $tabs = array_merge($tabs,tabs_site($site)); $person_filter['person_id']=$site['person_ids']; + if ($site_id == plc_my_site_id()) + unset($tabs['My accounts']); } if ($slice_id) { @@ -140,7 +142,7 @@ $columns = array ("Peer"=>"string", // initial sort on email $table_options=array(); -plc_table_start("persons",$columns,5,$table_options); +plc_table_start("persons",$columns,4,$table_options); $peer_hash = plc_peer_get_hash ($api); // write rows -- 2.47.0