From 232e3e3ce1e8f07de912ba0d5302b03bfe71f283 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 23 Mar 2009 17:51:41 +0000 Subject: [PATCH] checkpoint --- planetlab/common/adminsearch.php | 10 +- planetlab/css/plc_peers.css | 30 +++ planetlab/css/plc_style.css | 11 +- planetlab/includes/plc_functions.php | 33 +++ planetlab/includes/plc_peers.php | 40 ++-- planetlab/nodes/interface.php | 6 +- planetlab/nodes/node.php | 95 ++++---- planetlab/nodes/nodes.php | 18 +- planetlab/persons/person.php | 321 ++++++++++++++------------- planetlab/persons/persons.php | 6 +- planetlab/sites/site.php | 129 +++++++---- planetlab/sites/sites.php | 4 + planetlab/slices/slice.php | 52 +++-- planetlab/slices/slices.php | 7 +- planetlab/tags/tags.php | 2 +- plekit/details/details.css | 5 + plekit/niftycorner/nifty_init.js | 8 +- plekit/php/nifty.php | 31 +++ plekit/php/table.php | 23 +- plekit/php/toggle.php | 22 +- plekit/table/table.css | 11 +- 21 files changed, 531 insertions(+), 333 deletions(-) create mode 100644 planetlab/css/plc_peers.css diff --git a/planetlab/common/adminsearch.php b/planetlab/common/adminsearch.php index dca6509..c72fbbd 100644 --- a/planetlab/common/adminsearch.php +++ b/planetlab/common/adminsearch.php @@ -47,7 +47,7 @@ function display_form ($pattern) { $title="Search for what"; $visible=true; } - $toggle=new PlekitToggle("admin-search",$title,array('start-visible'=>$visible)); + $toggle=new PlekitToggle("admin-search",$title,array('visible'=>$visible)); $toggle->start(); print <<< EOF

@@ -126,7 +126,7 @@ $table_options = array('notes_area'=>false); function display_persons ($persons,$visible) { if ( ! $persons) return; - $toggle=new PlekitToggle('persons-area',"Persons",array('start-visible'=>$visible)); + $toggle=new PlekitToggle('persons-area',"Persons",array('visible'=>$visible)); $toggle->start(); $headers=array('id'=>'int', @@ -153,7 +153,7 @@ function display_persons ($persons,$visible) { function display_slices ($slices,$visible) { if ( ! $slices) return; - $toggle=new PlekitToggle('slices-area',"Slices",array('start-visible'=>$visible)); + $toggle=new PlekitToggle('slices-area',"Slices",array('visible'=>$visible)); $toggle->start(); $headers=array('id'=>'int', @@ -184,7 +184,7 @@ function display_slices ($slices,$visible) { function display_sites ($sites,$visible) { if ( ! $sites) return; - $toggle=new PlekitToggle('sites-area',"Sites",array('start-visible'=>$visible)); + $toggle=new PlekitToggle('sites-area',"Sites",array('visible'=>$visible)); $toggle->start(); $headers=array('id'=>'int', @@ -213,7 +213,7 @@ function display_sites ($sites,$visible) { function display_nodes ($nodes,$visible) { if ( ! $nodes) return; - $toggle=new PlekitToggle('nodes-area',"Nodes",array('start-visible'=>$visible)); + $toggle=new PlekitToggle('nodes-area',"Nodes",array('visible'=>$visible)); $toggle->start(); $headers=array('id'=>'int', diff --git a/planetlab/css/plc_peers.css b/planetlab/css/plc_peers.css new file mode 100644 index 0000000..8ab2268 --- /dev/null +++ b/planetlab/css/plc_peers.css @@ -0,0 +1,30 @@ +/* $Id$ */ + +/* rounded corner around lists (all nodes, all sites, ..) */ +div.objects-list { + background-color: #f0f0f0 ; +} + +/* -------------------- foreign objects */ +/* default for foreign objects */ +.peer-foreign { + background: #808080; +} + +/* -------------------- PLC is bluish */ +div.peer-plc { + background-color: #0e5e95; +} +table.plekit_table>tbody>tr>td.peer-plc a { + font-weight: bold; + color: #0e5e95; +} + +/* -------------------- PLE is redish */ +div.peer-ple { + background-color: #6e1c19; +} +table.plekit_table>tbody>tr>td.peer-ple a { + font-weight: bold; + color: #6e1c19; +} diff --git a/planetlab/css/plc_style.css b/planetlab/css/plc_style.css index 9cf5e42..1e4cdbd 100644 --- a/planetlab/css/plc_style.css +++ b/planetlab/css/plc_style.css @@ -25,10 +25,8 @@ body { position: relative; } -.plc-foreign { - background: #e0e0e0; -} .plc-warning { + padding: 4px; background: #ffa223; } .plc-error { @@ -74,3 +72,10 @@ p.node_add { text-align: center; font-size: larger; } + +/* some air around the list tables */ +table#sites, table#persons, table#nodes, table#slices { + margin-left: 10px; + margin-right: 10px; +} + diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index 182f3aa..8309f34 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -418,4 +418,37 @@ function interface_method_selectors ($api, $method, $primary) { } return $selectors; } + +//////////////////// +function instantiation_label ($slice) { + $instantiation_labels = array ('not-instantiated'=>'NOT', + 'plc-instantiated'=>'PLC', + 'delegated' => 'DEL', + 'nm-controller' => 'NM'); + $result=$instantiation_labels[$slice['instantiation']]; + if (!$result) $result = $slice['instantiation']; + if (!$result) $result = '??'; + return $result; +} + +//////////////////// toggle areas +// get_arg ('show_persons',false) returns $_GET['show_persons'] if set and false otherwise +function get_arg ($name,$default,$method='get') { + if ($method == 'get') $var=$_GET; else $var=$_POST; + if (isset ($var[$name])) return $var[$name]; + else return $default; +} + +//////////////////// number of ... +function count_english ($objs,$name) { + $count=count($objs); + if ($count == 0) return 'No ' . $name; + else if ($count == 1) return 'One ' . $name; + else return $count . ' ' . $name . 's'; +} +function count_english_warning ($objs, $name) { + $x=count_english ($objs,$name); + if (count ($objs) == 0) $x=plc_warning_html($x . ' !!'); + return $x; +} ?> diff --git a/planetlab/includes/plc_peers.php b/planetlab/includes/plc_peers.php index e0e3736..468fda7 100644 --- a/planetlab/includes/plc_peers.php +++ b/planetlab/includes/plc_peers.php @@ -4,6 +4,8 @@ require_once 'plc_functions.php'; +drupal_set_html_head(''); + // all known peers hashed on peer_id class Peers { var $hash; @@ -69,28 +71,38 @@ class Peers { } function classname ($peer_id) { - if ( ! $peer_id) - return ""; - $peer = $this->peer ($peer_id); - $shortname=$peer['shortname']; - return "plc-$shortname"; + $shortname=strtolower($this->shortname($peer_id)); + return "peer-$shortname"; } function block_start ($peer_id) { - // to set the background to grey on foreign objects - // return true if the peer is local - if ( ! $peer_id ) { - print "

"; - } else { - $classname=strtolower($this->classname($peer_id)); - // set two classes, one generic to all foreign, and one based on the peer's shortname for finer grain tuning - printf ("
",$classname); - } + // start a
element with 2 classes: + // (1) generic: is either peer-local or peer-foreign + // (2) specific: is peer- based on the plc's shortname + // e.g. at PLE we'd get
+ // or
+ // see plc_styles.css for how to have the more specific ones override the generic one + if ( ! $peer_id ) + $generic='peer-local'; + else + $generic='peer-foreign'; + $specific=$this->classname($peer_id); + // add nifty-big for the rounded corner + printf ("
"); } function block_end ($peer_id) { print "
\n"; } + + // writes a cell in the table with the peer's shortname, link to the peer page, + // and classname set for proper background + function cell ($table, $peer_id) { + $shortname = $this->shortname($peer_id); + $table->cell ($this->link($peer_id,$shortname),array('class'=>'peer-'.strtolower($shortname))); + } + + } //////////////////////////////////////////////////////////// diff --git a/planetlab/nodes/interface.php b/planetlab/nodes/interface.php index 471d8d3..248ca4f 100644 --- a/planetlab/nodes/interface.php +++ b/planetlab/nodes/interface.php @@ -131,7 +131,8 @@ if ($mode == 'add') return; //////////////////////////////////////// tags -$toggle=new PlekitToggle ('tags','Tags'); +$toggle=new PlekitToggle ('tags','Tags', + array('visible'=>get_arg('show_tags',false))); $toggle->start(); $form = new PlekitForm (l_actions(),array('interface_id'=>$interface_id)); @@ -166,7 +167,7 @@ if ($can_update) { $table->row_start(); $table->cell($form->submit_html("delete-interface-tags","Remove Tags"), // use the whole columns and right adjust - $table->columns(), "right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); // set tag area @@ -178,6 +179,7 @@ if ($can_update) { $selector=array_map("tag_selector",$all_tags); $table->cell($form->select_html("tag_type_id",$selector,array('label'=>"Choose"))); $table->cell($form->text_html("value","",array('width'=>8))); + //cell-xxx $table->cell($form->submit_html("set-tag-on-interface","Set Tag"),2,"left"); $table->row_end(); } diff --git a/planetlab/nodes/node.php b/planetlab/nodes/node.php index fcb9d28..25edde1 100644 --- a/planetlab/nodes/node.php +++ b/planetlab/nodes/node.php @@ -136,7 +136,8 @@ plekit_linetabs($tabs); $peers->block_start ($peer_id); $toggle = new PlekitToggle ('node',"Details", - array('trigger-bubble'=>'Display and modify details for that node')); + array('bubble'=>'Display and modify details for that node', + 'visible'=>get_arg('show_details',true))); $toggle->start(); $details=new PlekitDetails($privileges); @@ -223,9 +224,42 @@ $toggle->end(); $form=new PlekitForm (l_actions(), array('node_id'=>$node_id)); $form->start(); +//////////////////////////////////////////////////////////// slivers +{ + $toggle=new PlekitToggle ('slices',count_english_warning($slices,'sliver'), + array('bubble'=>'Review slices running on that node', + 'visible'=>get_arg('show_slices',false))); + $toggle->start(); + if ( ! $slices ) { + plc_warning ("This node is not associated to any slice"); + } else { + $headers=array(); + $headers['Peer']="string"; + $headers['Name']="string"; + $headers['Sliver']="string"; + $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; + } + $table=new PlekitTable("node_slices",$headers,1,$table_options); + $table->start(); + + foreach ($slices as $slice) { + $table->row_start(); + $table->cell ($peers->shortname($peer_id)); + $table->cell (l_slice_t ($slice['slice_id'],$slice['name'])); + $table->cell (l_sliver_t ($node_id,$slice['slice_id'],'view')); + $table->row_end(); + } + $table->end(); + } + $toggle->end(); +} + //////////////////////////////////////////////////////////// Tags // tags section -$show_tags = (plc_is_admin()); if ( $local_peer ) { $tags=$api->GetNodeTags (array('node_id'=>$node_id)); @@ -235,9 +269,9 @@ if ( $local_peer ) { $tagnames = array_map ("get_tagname",$tags); $nodegroups_hash=plc_nodegroup_global_hash($api,$tagnames); - $toggle = new PlekitToggle ('tags',"Tags", - array('trigger-bubble'=>'Inspect and set tags on that node', - 'start-visible'=>$show_tags)); + $toggle = new PlekitToggle ('tags',count_english_warning($tags,'tag'), + array('bubble'=>'Inspect and set tags on that node', + 'visible'=>get_arg('show_tags',false))); $toggle->start(); $headers=array("Name"=>"string", @@ -271,7 +305,7 @@ if ( $local_peer ) { $table->row_start(); $table->cell($form->submit_html("delete-node-tags","Remove Tags"), // use the whole columns and right adjust - $table->columns(), "right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); // set tag area @@ -283,7 +317,7 @@ if ( $local_peer ) { $selector=array_map("tag_selector",$all_tags); $table->cell($form->select_html("tag_type_id",$selector,array('label'=>"Choose"))); $table->cell($form->text_html("value","",array('width'=>8))); - $table->cell($form->submit_html("set-tag-on-node","Set Tag"),2,"left"); + $table->cell($form->submit_html("set-tag-on-node","Set Tag"),array('columns'=>2,'align'=>'left')); $table->row_end(); } @@ -293,9 +327,9 @@ if ( $local_peer ) { //////////////////////////////////////////////////////////// interfaces if ( $local_peer ) { - $toggle=new PlekitToggle ('interfaces',"Interfaces", - array('trigger-bubble'=>'Inspect and tune interfaces on that node', - 'start-hidden'=>true)); + $toggle=new PlekitToggle ('interfaces',count_english_warning($interfaces,'interfaces'), + array('bubble'=>'Inspect and tune interfaces on that node', + 'visible'=>get_arg('show_interfaces',false))); $toggle->start(); // display interfaces if( ! $interfaces ) { @@ -353,8 +387,9 @@ if ( $local_peer ) { $table->row_start(); $add_button=new PlekitFormButton (l_interface_add($node_id),"add","Add Interface","GET"); // we should have 6 cols, use 3 for the left (new) and the rest for the right (remove) - $table->cell($add_button->html(), 3,"left"); - $table->cell($form->submit_html("delete-interfaces","Remove Interfaces"), $table->columns()-3,"right"); + $table->cell($add_button->html(),array('columns'=> 3,'align'=>'left')); + $table->cell($form->submit_html("delete-interfaces","Remove Interfaces"), + array('columns'=>$table->columns()-3,'align'=>'right')); $table->row_end(); } $table->end(); @@ -362,42 +397,6 @@ if ( $local_peer ) { $toggle->end(); } -//////////////////////////////////////////////////////////// slices -// display slices - -{ - $toggle=new PlekitToggle ('slices',"Slices", - array('trigger-bubble'=>'Review slices running on that node', - 'start-hidden'=>true)); - $toggle->start(); - if ( ! $slices ) { - plc_warning ("This node is not associated to any slice"); - } else { - $headers=array(); - $headers['Peer']="string"; - $headers['Name']="string"; - $headers['Slivers']="string"; - $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; - } - $table=new PlekitTable("node_slices",$headers,1,$table_options); - $table->start(); - - foreach ($slices as $slice) { - $table->row_start(); - $table->cell ($peers->shortname($peer_id)); - $table->cell (l_slice_t ($slice['slice_id'],$slice['name'])); - $table->cell (l_sliver_t ($node_id,$slice['slice_id'],'view')); - $table->row_end(); - } - $table->end(); - } - $toggle->end(); -} - $form->end(); //////////////////////////////////////////////////////////// diff --git a/planetlab/nodes/nodes.php b/planetlab/nodes/nodes.php index 5aea940..43b994f 100644 --- a/planetlab/nodes/nodes.php +++ b/planetlab/nodes/nodes.php @@ -18,6 +18,9 @@ require_once 'plc_functions.php'; require_once 'plc_peers.php'; require_once 'linetabs.php'; require_once 'table.php'; +require_once 'nifty.php'; + +ini_set("memory_limit","48M"); // -------------------- // recognized URL arguments @@ -53,7 +56,7 @@ function node_status ($node) { // fetch nodes -$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id', "arch"); +$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id', 'arch','slice_ids'); // server-side filtering - set pattern in $_GET for filtering on hostname if ($pattern) { $node_filter['hostname']=$pattern; @@ -122,7 +125,9 @@ if ( ! $nodes ) { return; } -$headers = array ("Peer"=>"string", +$nifty=new PlekitNifty ('','objects-list','big'); +$nifty->start(); +$headers = array ("P"=>"string", "Region"=>"string", "Site"=>"string", "State"=>"string", @@ -130,6 +135,7 @@ $headers = array ("Peer"=>"string", "IP"=>"IPAddress", "Type"=>"string", "Arch"=>"string", + "S"=>'int', "?"=>"string", ); @@ -149,11 +155,10 @@ foreach ($nodes as $node) { $ip=$interface_hash[$node['node_id']]['ip']; $interface_id=$interface_hash[$node['node_id']]['interface_id']; $peer_id=$node['peer_id']; - $shortname = $peers->shortname($peer_id); $node_type = $node['node_type']; $table->row_start(); - $table->cell ($peers->link($peer_id,$shortname)); + $peers->cell ($table,$peer_id); $table->cell (topdomain($hostname)); $table->cell (l_site_t($site_id,$login_base)); $table->cell ($node['boot_state']); @@ -161,12 +166,15 @@ foreach ($nodes as $node) { $table->cell (l_interface_t($interface_id,$ip)); $table->cell ($node_type); $table->cell ($node['arch']); + $table->cell (count($node['slice_ids'])); $table->cell (node_status($node)); $table->row_end(); } -$table->end(); +$notes=array("S = number of slivers"); +$table->end(array('notes'=>$notes)); +$nifty->end(); //plekit_linetabs ($tabs,"bottom"); diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index 5521a40..ab6351b 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -93,7 +93,7 @@ if ($local_peer && $privileges) 'confirm'=>"Are you sure you want to enable $first_name $last_name"); // become -if (plc_is_admin() && ! $is_my_account) +if (plc_is_admin() && ! $is_my_account && $local_peer) $tabs['Become'] = array('method'=>'POST', 'url'=>l_actions(), 'values'=>array('action'=>'become-person', @@ -102,7 +102,7 @@ if (plc_is_admin() && ! $is_my_account) 'confirm'=>"Are you sure you want to su $first_name $last_name"); // delete -if ($local_peer && $privileges) +if ($local_peer && $privileges && $local_peer) $tabs['Delete'] = array ('method'=>'POST', 'url'=>l_actions(), 'values'=> array ('person_id'=>$person_id, @@ -129,8 +129,8 @@ if ( ! $enabled ) $enabled_label = plc_warning_html("Disabled"); $can_update = (plc_is_admin() && $local_peer) || $is_my_account; $toggle = new PlekitToggle ('person',"Details", - array('trigger-bubble'=>'Display and modify details for that account', - 'start-visible'=>false)); + array('bubble'=>'Display and modify details for that account', + 'visible'=>get_arg('show_details',true))); $toggle->start(); $details = new PlekitDetails($can_update); @@ -167,188 +167,201 @@ $details->form_end(); $toggle->end(); //////////////////// slices -$toggle=new PlekitToggle ('slices','Slices',array('start-visible'=>false)); -$toggle->start(); - -if( ! $slices) { - plc_warning ("User has no slice"); - } else { - $headers=array('Slice name'=>'string'); - $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; - } - $table=new PlekitTable ("person_slices",$headers,1,$table_options); - $table->start(); - - foreach( $slices as $slice ) { - $slice_name= $slice['name']; - $slice_id= $slice['slice_id']; - $table->row_start(); - $table->cell(l_slice_t($slice_id,$slice_name)); - $table->row_end(); +if ($local_peer) { + $slices_title=count_english_warning($slices,'slice'); + $toggle=new PlekitToggle ('slices',$slices_title, + array('visible'=>get_arg('show_slices',false))); + $toggle->start(); + + if( ! $slices) { + plc_warning ("User has no slice"); + } else { + $headers=array('Slice name'=>'string'); + $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; + } + $table=new PlekitTable ("person_slices",$headers,1,$table_options); + $table->start(); + + foreach( $slices as $slice ) { + $slice_name= $slice['name']; + $slice_id= $slice['slice_id']; + $table->row_start(); + $table->cell(l_slice_t($slice_id,$slice_name)); + $table->row_end(); + } + $table->end(); } - $table->end(); + $toggle->end(); } -$toggle->end(); +//////////////////////////////////////// // we don't set 'action', but use the submit button name instead $form=new PlekitForm(l_actions(), array("person_id"=>$person_id)); $form->start(); //////////////////// keys -$toggle=new PlekitToggle ('keys',"Keys",array('start-visible'=>false)); -$toggle->start(); +if ($local_peer) { + $keys_title = count_english_warning($keys,'key'); + $toggle=new PlekitToggle ('keys',$keys_title,array('visible'=>get_arg('show_keys',false))); + $toggle->start(); -$can_manage_keys = ( $local_peer && ( plc_is_admin() || $is_my_account) ); -if ( empty( $key_ids ) ) { - plc_warning("This user has no known key"); - } - -$headers=array("Type"=>"string", - "Key"=>"string"); -if ($can_manage_keys) $headers[plc_delete_icon()]="none"; -// table overall options -$table_options=array('search_area'=>false,'pagesize_area'=>false,'notes_area'=>false); -$table=new PlekitTable("person_keys",$headers,"1",$table_options); -$table->start(); + $can_manage_keys = ( $local_peer && ( plc_is_admin() || $is_my_account) ); + if ( empty( $key_ids ) ) { + plc_warning("This user has no known key"); + } + + $headers=array("Type"=>"string", + "Key"=>"string"); + if ($can_manage_keys) $headers[plc_delete_icon()]="none"; + // table overall options + $table_options=array('search_area'=>false,'pagesize_area'=>false,'notes_area'=>false); + $table=new PlekitTable("person_keys",$headers,"1",$table_options); + $table->start(); -if ($keys) foreach ($keys as $key) { - $key_id=$key['key_id']; - $table->row_start(); - $table->cell ($key['key_type']); - $table->cell(wordwrap( $key['key'], 60, "
\n", 1 )); - if ($can_manage_keys) - $table->cell ($form->checkbox_html('key_ids[]',$key_id)); - $table->row_end(); -} -// the footer area is used for displaying key-management buttons -// add the 'remove keys' button and key upload areas as the table footer -if ($can_manage_keys) { - $table->tfoot_start(); - // no need to remove if there's no key - if ($keys) { + if ($keys) foreach ($keys as $key) { + $key_id=$key['key_id']; + $table->row_start(); + $table->cell ($key['key_type']); + $table->cell(wordwrap( $key['key'], 60, "
\n", 1 )); + if ($can_manage_keys) + $table->cell ($form->checkbox_html('key_ids[]',$key_id)); + $table->row_end(); + } + // the footer area is used for displaying key-management buttons + // add the 'remove keys' button and key upload areas as the table footer + if ($can_manage_keys) { + $table->tfoot_start(); + // no need to remove if there's no key + if ($keys) { + $table->row_start(); + $table->cell($form->submit_html ("delete-keys","Remove keys"), + array('hfill'=>true,'align'=>'right')); + $table->row_end(); + } $table->row_start(); - $table->cell($form->submit_html ("delete-keys","Remove keys"), - $table->columns(),"right"); + $table->cell($form->label_html("key","Upload new key") + . $form->file_html("key","upload",array('size'=>60)) + . $form->submit_html("upload-key","Upload key"), + array('hfill'=>true,'align'=>'right')); $table->row_end(); } - $table->row_start(); - $table->cell($form->label_html("key","Upload new key") - . $form->file_html("key","upload",array('size'=>60)) - . $form->submit_html("upload-key","Upload key"), - $table->columns(),"right"); - $table->row_end(); -} - -$table->end(); -$toggle->end(); + + $table->end(); + $toggle->end(); + } //////////////////// sites -$toggle=new PlekitToggle('sites','Sites',array('start-visible'=>false)); -$toggle->start(); +if ($local_peer) { + $sites_title = count_english_warning($sites,'site'); + $toggle=new PlekitToggle('sites',$sites_title, + array('visible'=>get_arg('show_sites',false))); + $toggle->start(); -if (empty( $sites ) ) { - plc_warning('This user is not affiliated with a site !!'); - } -$can_manage_sites = $local_peer && plc_is_admin() || $is_my_account; -$headers=array(); -$headers['Login_base']="string"; -$headers['Name']="string"; -if ($can_manage_sites) $headers[plc_delete_icon()]="none"; -$table_options = array('notes_area'=>false,'search_area'=>false, 'pagesize_area'=>false); -$table=new PlekitTable ("person_sites",$headers,0,$table_options); -$table->start(); -foreach( $sites as $site ) { - $site_name= $site['name']; - $site_id= $site['site_id']; - $login_base=$site['login_base']; - $table->row_start(); - $table->cell ($login_base); - $table->cell (l_site_t($site_id,$site_name)); - if ($can_manage_sites) - $table->cell ($form->checkbox_html('site_ids[]',$site_id)); - $table->row_end (); -} -if ($can_manage_sites) { - $table->tfoot_start(); - - if ($sites) { + if (empty( $sites ) ) { + plc_warning('This user is not affiliated with a site !!'); + } + $can_manage_sites = $local_peer && plc_is_admin() || $is_my_account; + $headers=array(); + $headers['Login_base']="string"; + $headers['Name']="string"; + if ($can_manage_sites) $headers[plc_delete_icon()]="none"; + $table_options = array('notes_area'=>false,'search_area'=>false, 'pagesize_area'=>false); + $table=new PlekitTable ("person_sites",$headers,0,$table_options); + $table->start(); + foreach( $sites as $site ) { + $site_name= $site['name']; + $site_id= $site['site_id']; + $login_base=$site['login_base']; $table->row_start(); - $table->cell($form->submit_html("remove-person-from-sites","Remove Sites"), - $table->columns(),"right"); - $table->row_end(); + $table->cell ($login_base); + $table->cell (l_site_t($site_id,$site_name)); + if ($can_manage_sites) + $table->cell ($form->checkbox_html('site_ids[]',$site_id)); + $table->row_end (); } + if ($can_manage_sites) { + $table->tfoot_start(); - $table->row_start(); - - // 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); - // 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")). - $form->submit_html("add-person-to-site","Add in site"), - $table->columns(),"right"); - $table->row_end(); - } -$table->end(); -$toggle->end(); + if ($sites) { + $table->row_start(); + $table->cell($form->submit_html("remove-person-from-sites","Remove Sites"), + array('hfill'=>true,'align'=>'right')); + $table->row_end(); + } + $table->row_start(); + + // 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); + // 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")). + $form->submit_html("add-person-to-site","Add in site"), + array('hfill'=>true,'align'=>'right')); + $table->row_end(); + } + $table->end(); + $toggle->end(); + } //////////////////// roles -$toggle=new PlekitToggle ('roles','Roles',array('start-visible'=>false)); -$toggle->start(); +if ($local_peer) { + $toggle=new PlekitToggle ('roles','Roles',array('visible'=>get_arg('show_roles',false))); + $toggle->start(); -if (! $roles) plc_warning ("This user has no role !"); + if (! $roles) plc_warning ("This user has no role !"); -$can_manage_roles= ($local_peer && plc_is_admin()); -$table_options=array("search_area"=>false,"notes_area"=>false); + $can_manage_roles= ($local_peer && plc_is_admin()); + $table_options=array("search_area"=>false,"notes_area"=>false); -$headers=array("Role"=>"string"); -if ($can_manage_roles) $headers [plc_delete_icon()]="none"; + $headers=array("Role"=>"string"); + if ($can_manage_roles) $headers [plc_delete_icon()]="none"; -$table_options=array('search_area'=>false,'pagesize_area'=>false,'notes_area'=>false); -$table=new PlekitTable("person_roles",$headers,0,$table_options); -$table->start(); + $table_options=array('search_area'=>false,'pagesize_area'=>false,'notes_area'=>false); + $table=new PlekitTable("person_roles",$headers,0,$table_options); + $table->start(); -// construct array of role objs -$role_objs=array(); -for ($n=0; $n$role_ids[$n], 'name'=>$roles[$n]); - } + // construct array of role objs + $role_objs=array(); + for ($n=0; $n$role_ids[$n], 'name'=>$roles[$n]); + } -if ($role_objs) foreach ($role_objs as $role_obj) { - $table->row_start(); - $table->cell($role_obj['name']); - if ($can_manage_roles) $table->cell ($form->checkbox_html('role_ids[]',$role_obj['role_id'])); - $table->row_end(); - } + if ($role_objs) foreach ($role_objs as $role_obj) { + $table->row_start(); + $table->cell($role_obj['name']); + if ($can_manage_roles) $table->cell ($form->checkbox_html('role_ids[]',$role_obj['role_id'])); + $table->row_end(); + } + + // footers : the remove and add buttons + if ($can_manage_roles) { + $table->tfoot_start(); + if ($roles) { + $table->row_start(); + $table->cell($form->submit_html("remove-roles-from-person","Remove Roles"), + array('hfill'=>true,'align'=>'right')); + $table->row_end(); + } -// footers : the remove and add buttons -if ($can_manage_roles) { - $table->tfoot_start(); - if ($roles) { $table->row_start(); - $table->cell($form->submit_html("remove-roles-from-person","Remove Roles"), - $table->columns(),"right"); + $selectors=$form->role_selectors_excluding($api,$role_ids); + $add_role_left_area=$form->select_html("role_id",$selectors,array('label'=>"Choose role")); + // add a role : the button + $add_role_right_area=$form->submit_html("add-role-to-person","Add role"); + $table->cell ($add_role_left_area . $add_role_right_area, + array('hfill'=>true,'align'=>'right')); $table->row_end(); } - - $table->row_start(); - $selectors=$form->role_selectors_excluding($api,$role_ids); - $add_role_left_area=$form->select_html("role_id",$selectors,array('label'=>"Choose role")); - // add a role : the button - $add_role_right_area=$form->submit_html("add-role-to-person","Add role"); - $table->cell ($add_role_left_area . $add_role_right_area, - $table->columns(),"right"); - $table->row_end(); + $table->end(); + $toggle->end(); } -$table->end(); -$toggle->end(); ////////////////////////////// $form->end(); diff --git a/planetlab/persons/persons.php b/planetlab/persons/persons.php index 86203bd..5282d7a 100644 --- a/planetlab/persons/persons.php +++ b/planetlab/persons/persons.php @@ -18,6 +18,7 @@ require_once 'plc_functions.php'; require_once 'plc_peers.php'; require_once 'linetabs.php'; require_once 'table.php'; +require_once 'nifty.php'; //fix the memory limit for this page ini_set("memory_limit","48M"); @@ -134,6 +135,8 @@ if ( ! $persons ) { return; } +$nifty=new PlekitNifty ('','objects-list','big'); +$nifty->start(); $headers = array ("Peer"=>"string", "First"=>"string", "Last"=>"string", @@ -174,8 +177,9 @@ foreach ($persons as $person) { $table->row_end(); } -$notes=array("The S column shows the number of slices for the given user"); +$notes=array("S = number of slices"); $table->end(array('notes'=>$notes)); +$nifty->end(); //plekit_linetabs ($tabs,"bottom"); diff --git a/planetlab/sites/site.php b/planetlab/sites/site.php index 12e8849..ba3273c 100644 --- a/planetlab/sites/site.php +++ b/planetlab/sites/site.php @@ -49,13 +49,16 @@ $max_slices= $site['max_slices']; $enabled = $site['enabled']; -// extra privileges to admins, and (pi||tech) on this site -$privileges = plc_is_admin () || ( plc_in_site($site_id) && ( plc_is_pi() || plc_is_tech())); - // get peer $peer_id= $site['peer_id']; $peers = new Peers ($api); +$local_peer = ! $peer_id; +// extra privileges to admins, and (pi||tech) on this site +$is_site_pi = ( $local_peer && plc_is_pi() && plc_in_site($site_id) ); +$is_site_tech = ( $local_peer && plc_is_pi() && plc_in_site($site_id) ); +$is_site_admin = ($local_peer && plc_is_admin()); + $address_ids= $site['address_ids']; $pcu_ids= $site['pcu_ids']; $node_ids= $site['node_ids']; @@ -76,7 +79,7 @@ $api->GetNodes( $node_ids, array( "node_id", "hostname", "boot_state" ) ); // gets person info $api->GetPersons( $person_ids, array( "role_ids", "person_id", "first_name", "last_name", "email", "enabled" ) ); -$api->GetSlices ( $slice_ids, array ("slice_id", "name", "instantiation" ) ); +$api->GetSlices ( $slice_ids, array ("slice_id", "name", "instantiation", "node_ids", "person_ids" ) ); //list( $addresses, $pcus, $nodes, $persons, $slices )= $api->commit(); list( $addresses, $nodes, $persons, $slices )= $api->commit(); @@ -95,50 +98,54 @@ foreach( $persons as $person ) { $has_disabled_persons = count ($disabled_persons) !=0; +// get number of slivers +$slivers_count=0; +if ($slices) foreach ($slices as $slice) $slivers_count += count ($slice['node_ids']); + +//////////////////////////////////////// drupal_set_title("Details for site " . $sitename); -$local_peer = ! $peer_id; - -// extra privileges to admins, and pi on this site -$privileges = plc_is_admin () || ( plc_in_site($site_id) && plc_is_pi()); $tabs=array(); $tabs []= tab_sites_local(); // available actions -if ( $local_peer && $privileges ) { - +if ( $is_site_admin) $tabs['Expire slices'] = array('url'=>l_actions(), 'method'=>'POST', 'values'=>array('site_id'=>$site_id, 'action'=>'expire-all-slices-in-site'), 'bubble'=>"Expire all slices and prevent creation of new slices", 'confirm'=>"Suspend all slices in $login_base"); - if (plc_is_admin()) - $tabs['Delete']=array('url'=>l_actions(), - 'method'=>'POST', - 'values'=>array('site_id'=>$site_id, - 'action'=>'delete-site'), - 'bubble'=>"Delete site $sitename", - 'confirm'=>"Are you sure you want to delete site $login_base"); +if ( $is_site_admin) + $tabs['Delete']=array('url'=>l_actions(), + 'method'=>'POST', + 'values'=>array('site_id'=>$site_id, + 'action'=>'delete-site'), + 'bubble'=>"Delete site $sitename", + 'confirm'=>"Are you sure you want to delete site $login_base"); + +if ( $is_site_pi ) + $tabs ['Add site'] = array ('url'=>l_slice_add(), + 'method'=>'post', + 'bubble'=>'Create new slice in site'); + +if (plc_in_site($site_id)) $tabs["Events"]=array_merge (tablook_event(), array('url'=>l_event("Site","site",$site_id), 'bubble'=>"Events for site $sitename")); +if (plc_in_site($site_id)) $tabs["Comon"]=array_merge(tablook_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(), - 'bubble'=>'Review pending join requests'); - } plekit_linetabs($tabs); // show gray background on foreign objects : start a
with proper class $peers->block_start ($peer_id); -if ( ! $enabled ) +if ( $local_peer && ( ! $enabled ) ) plc_warning ("This site is not enabled - Please visit " . href (l_sites_pending(),"this page") . " to review pending applications."); @@ -147,7 +154,8 @@ $can_update=(plc_is_admin () && $local_peer) || ( plc_in_site($site_id) && plc_ $toggle = new PlekitToggle ('site',"Details", - array('trigger-bubble'=>'Display and modify details for that site')); + array('visible'=>get_arg('show_details',true), + 'bubble'=>'Display and modify details for that site')); $toggle->start(); $details = new PlekitDetails($can_update); @@ -199,7 +207,8 @@ if ( $local_peer ) { $nodes_title = plc_warning_html ($nodes_title); $nodes_title .= href(l_nodes_site($site_id)," (See as nodes)"); - $toggle=new PlekitToggle ('nodes',$nodes_title); + $toggle=new PlekitToggle ('nodes',$nodes_title, + array('visible'=>get_arg('show_nodes',false))); $toggle->start(); $headers=array(); @@ -219,7 +228,7 @@ if ( $local_peer ) { $table->tfoot_start(); $table->row_start(); $button=new PlekitFormButton (l_node_add(),"node_add","Add node","POST"); - $table->cell($button->html(),$table->columns(),"right"); + $table->cell($button->html(),array('hfill'=>true,'align'=>'right')); $table->row_end(); $table->end(); $toggle->end(); @@ -235,7 +244,8 @@ if ( $local_peer ) { $persons_title = plc_warning_html ($persons_title); $persons_title .= href(l_persons_site($site_id)," (See as users)"); - $toggle=new PlekitToggle ('persons',$persons_title); + $toggle=new PlekitToggle ('persons',$persons_title, + array('visible'=>get_arg('show_persons',false))); $toggle->start(); $headers = array (); @@ -245,41 +255,68 @@ if ( $local_peer ) { $headers["Tech"]='string'; if ($has_disabled_persons) $headers["Disabled"]='string'; $table=new PlekitTable('persons',$headers,'1r-3r-0',array('search_area'=>false, - 'notes_area'=>false, - 'pagesize_area'=>false)); + 'notes_area'=>false, + 'pagesize_area'=>false)); $table->start(); - foreach ($persons as $person) { + if ($persons) foreach ($persons as $person) { $table->row_start(); $table->cell(l_person_obj($person)); $table->cell( in_array ('20',$person['role_ids']) ? "yes" : "no"); $table->cell( in_array ('30',$person['role_ids']) ? "yes" : "no"); $table->cell( in_array ('40',$person['role_ids']) ? "yes" : "no"); - if ($has_disabled_persons) $table->cell( $person['enabled'] ? "no" : "yes"); + if ($has_disabled_persons) $table->cell( $person['enabled'] ? "no" : plc_warning_html("yes")); $table->row_end(); } $table->end(); $toggle->end(); //////////////////// Slices - // xxx to review after slices gets reworked - $toggle=new PlekitToggle ('slices',"Slices"); - $toggle->start(); - $details=new PlekitDetails (false); - $details->start(); - // summary on slices - $slice_label = count($slice_ids) . " running / " . $max_slices . " max"; + $slices_title="Slices : "; + $slices_title .= $max_slices . " max"; + $slices_title .= " / " . count($slice_ids) . " running"; + $slices_title .= " / $slivers_count slivers"; if (count($slice_ids) >= $max_slices) - $slice_label = plc_warning_html ($slice_label); - $details->th_td("# Slices", href(l_slices_site($site_id),$slice_label)); - if ($slices) foreach ($slices as $slice) - $details->th_td($slice['instantiation'],l_slice_obj($slice)); - $button=new PlekitFormButton (l_slice_add(),"slice_add","Add slice","POST"); - $details->tr($button->html(),"right"); - $details->end(); + $slices_title = plc_warning_html($slices_title); + $slices_title .= href(l_slices_site($site_id)," (See as slices)"); + + $toggle=new PlekitToggle ('slices',$slices_title, + array('visible'=>get_arg('show_slices',false))); + $toggle->start(); + + $headers = array (); + $headers ['name']='string'; + $headers ['I'] = 'string'; + $headers ['N']='int'; + $headers ['U']='int'; + $notes=array('I column shows instantiation type', + 'N column shows number of nodes', + 'U column shows number of users'); + $table=new PlekitTable ('slices',$headers,0,array('search_area'=>false, + 'pagesize_area'=>false, + 'notes'=>$notes)); + + $table->start(); + if ($slices) foreach ($slices as $slice) { + $table->row_start(); + $table->cell(l_slice_obj($slice)); + $table->cell(instantiation_label($slice)); + $table->cell (href(l_nodes_slice($slice['slice_id']),count($slice['node_ids']))); + $table->cell (count($slice['person_ids'])); + $table->row_end(); + } + if ($is_site_pi) { + $button=new PlekitFormButton (l_slice_add(),"slice_add","Add slice","post"); + $table->tfoot_start(); + $table->row_start(); + $table->cell($button->html(),array('hfill'=>true,'align'=>'right')); + } + + $table->end(); $toggle->end(); - // Addresses - $toggle=new PlekitToggle ('addresses',"Addresses",array('start-visible'=>false)); + //////////////////// Addresses + $toggle=new PlekitToggle ('addresses',"Addresses", + array('visible'=>get_arg('show_addresses',false))); $toggle->start(); if ( ! $addresses) { print "

No known address for this site

"; diff --git a/planetlab/sites/sites.php b/planetlab/sites/sites.php index 439adb0..752c248 100644 --- a/planetlab/sites/sites.php +++ b/planetlab/sites/sites.php @@ -18,6 +18,7 @@ require_once 'plc_functions.php'; require_once 'plc_peers.php'; require_once 'linetabs.php'; require_once 'table.php'; +require_once 'nifty.php'; // -------------------- // recognized URL arguments @@ -109,6 +110,8 @@ $sites= $api->GetSites( $site_filter , $site_columns); $peers=new Peers($api); +$nifty=new PlekitNifty ('','objects-list','big'); +$nifty->start(); $headers['Peer']="string"; $headers['Full Name']="string"; $headers['Login']="string"; @@ -141,6 +144,7 @@ if ($sites) foreach ($sites as $site) { $notes=array("N = number of sites / U = number of users / S = number of slices"); $table->end(array('notes'=>$notes)); +$nifty->end(); //plekit_linetabs ($tabs,"bottom"); diff --git a/planetlab/slices/slice.php b/planetlab/slices/slice.php index 4c641f7..82e48c6 100644 --- a/planetlab/slices/slice.php +++ b/planetlab/slices/slice.php @@ -102,9 +102,9 @@ function renew_area ($slice,$site,$visible) { // description and url must be non void $toggle= new PlekitToggle('renew',"Renew this slice", - array("trigger-bubble"=> + array("bubble"=> "Enter this zone if you wish to renew your slice", - 'start-visible'=>$visible)); + 'visible'=>$visible)); $toggle->start(); // xxx message could take roles into account @@ -174,10 +174,15 @@ EOF; } ////////// -drupal_set_title("My slice " . $name); $am_in_slice = in_array(plc_my_person_id(),$person_ids); +if ($am_in_slice) { + drupal_set_title("My slice " . $name); + } else { + drupal_set_title("Slice " . $name); +} + $privileges = ( $local_peer && (plc_is_admin() || $am_in_slice)); $tabs=array(); @@ -215,13 +220,18 @@ if ($local_peer ) { //////////////////// details -$show_details=false; -if (isset ($_GET['show_details'])) $show_details=$_GET['show_details']; +// default for opening the details section or not ? +if ($local_peer) { + $default_show_details = true; + } else { + $default_show_details = ! $renew_visible; + } + $toggle = new PlekitToggle ('my-slice-details',"Details", - array('trigger-bubble'=> + array('bubble'=> 'Display and modify details for that slice', - 'start-visible'=>$show_details)); + 'visible'=>get_arg('show_details',$default_show_details))); $toggle->start(); $details=new PlekitDetails($privileges); @@ -262,15 +272,13 @@ else $potential_persons= $api->GetPersons(array('~person_id'=>$slice['person_ids'],'peer_id'=>NULL), array('email','person_id','first_name','last_name','roles')); -$show_persons=false; $count=count($persons); -if (isset ($_GET['show_persons'])) $show_persons=$_GET['show_persons']; $toggle= new PlekitToggle ('my-slice-persons',"$count Users", - array('trigger-bubble'=> + array('bubble'=> 'Manage accounts attached to this slice', - 'start-visible'=>$show_persons)); + 'visible'=>get_arg('show_persons',false))); $toggle->start(); ////////// people currently in @@ -280,7 +288,7 @@ $toggle->start(); // show otherwise $toggle_persons = new PlekitToggle ('my-slice-persons-current', "$count people currently in $name", - array('start-visible'=>!$privileges)); + array('visible'=>get_arg('show_persons_current',!$privileges))); $toggle_persons->start(); $headers=array(); @@ -311,7 +319,7 @@ if ($privileges) { $table->row_start(); $table->cell($form->submit_html ("remove-persons-from-slice","Remove selected"), - $table->columns(),"right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); } $table->end(); @@ -322,7 +330,7 @@ if ($privileges) { $count=count($potential_persons); $toggle_persons = new PlekitToggle ('my-slice-persons-add', "$count people may be added to $name", - array('start-visible'=>false)); + array('visible'=>get_arg('show_persons_add',false))); $toggle_persons->start(); if ( ! $potential_persons ) { // xxx improve style @@ -357,7 +365,7 @@ if ($privileges) { $table->tfoot_start(); $table->row_start(); $table->cell($form->submit_html ("add-persons-in-slice","Add selected"), - $table->columns(),"right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); $table->end(); $form->end(); @@ -376,19 +384,17 @@ else $potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),$node_columns); $count=count($nodes); -$show_nodes=true; -if (isset ($_GET['show_nodes'])) $show_nodes=$_GET['show_nodes']; $toggle=new PlekitToggle ('my-slice-nodes',"$count Nodes", - array('trigger-bubble'=> + array('bubble'=> 'Manage nodes attached to this slice', - 'start-visible'=>$show_nodes)); + 'visible'=>get_arg('show_nodes',false))); $toggle->start(); ////////// nodes currently in $count=count($nodes); $toggle_nodes=new PlekitToggle('my-slice-nodes-current', "$count nodes currently in $name", - array('start-visible'=>!$privileges)); + array('visible'=>get_arg('show_nodes_current',!$privileges))); $toggle_nodes->start(); $headers=array(); @@ -415,7 +421,7 @@ if ($privileges) { $table->row_start(); $table->cell($form->submit_html ("remove-nodes-from-slice","Remove selected"), - $table->columns(),"right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); } $table->end(); @@ -426,7 +432,7 @@ if ($privileges) { $count=count($potential_nodes); $toggle_nodes=new PlekitToggle('my-slice-nodes-add', "$count more nodes available", - array('start-visible'=>false)); + array('visible'=>get_arg('show_persons_add',false))); $toggle_nodes->start(); if ( ! $potential_nodes ) { @@ -457,7 +463,7 @@ if ($privileges) { $table->tfoot_start(); $table->row_start(); $table->cell($form->submit_html ("add-nodes-in-slice","Add selected"), - $table->columns(),"right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); $table->end(); $form->end(); diff --git a/planetlab/slices/slices.php b/planetlab/slices/slices.php index 4889323..974b95b 100644 --- a/planetlab/slices/slices.php +++ b/planetlab/slices/slices.php @@ -21,6 +21,7 @@ require_once 'plc_functions.php'; require_once 'plc_peers.php'; require_once 'linetabs.php'; require_once 'table.php'; +require_once 'nifty.php'; // -------------------- // recognized URL arguments @@ -101,6 +102,8 @@ if ( ! $slices ) { return; } +$nifty=new PlekitNifty ('','objects-list','big'); +$nifty->start(); $headers = array ("Peer"=>"string", "Name"=>"string", "Users"=>"string", @@ -131,7 +134,9 @@ foreach ($slices as $slice) { $table->row_end(); } -$table->end(); +$notes=array("U = number of users / N = number of nodes"); +$table->end(array('notes'=>$notes)); +$nifty->end(); //plekit_linetabs ($tabs,"bottom"); diff --git a/planetlab/tags/tags.php b/planetlab/tags/tags.php index e78582a..a8b218a 100644 --- a/planetlab/tags/tags.php +++ b/planetlab/tags/tags.php @@ -86,7 +86,7 @@ if (plc_is_admin()) { $table->row_start(); $table->cell($form->submit_html ("delete-tag-types","Remove tags"), - $table->columns(),"right"); + array('hfill'=>true,'align'=>'right')); $table->row_end(); // an inline area to add a tag type diff --git a/plekit/details/details.css b/plekit/details/details.css index bbedc8f..f5a3246 100644 --- a/plekit/details/details.css +++ b/plekit/details/details.css @@ -8,5 +8,10 @@ table.plc_details { table.plc_details>tbody>tr>th { text-align: right; + font: italic 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; +} + +table.plc_details>tbody>tr>td { font: 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + padding: 3px 8px 3px 8px; } diff --git a/plekit/niftycorner/nifty_init.js b/plekit/niftycorner/nifty_init.js index cdca3f6..ce24db1 100644 --- a/plekit/niftycorner/nifty_init.js +++ b/plekit/niftycorner/nifty_init.js @@ -12,10 +12,8 @@ var nifty_inited = false; function nifty_init () { if ( nifty_inited ) return; - var sizes=new Array(); - sizes[0]='small'; sizes[1]='medium'; sizes[2]='large'; - for (x in sizes) { - size=sizes[x]; + var sizes= { 0: 'small', 1: 'medium', 2: 'big', length: 3}; + $A(sizes).each (function (size) { var elements=document.getElementsByClassName('nifty-'+size); for (var i=0; i Event.observe(window,"load", nifty_init); '); +class PlekitNifty { + var $id; + var $class; + var $size; + + function PlekitNifty ($id,$class,$size='medium') { + $this->id = $id; + $this->class=$class; + $this->size=$size; + } + + function start () { print $this->start_html(); } + function start_html () { + $html=""; + $html .= "id) $html .= " id='$this->id'"; + $html .= " class='"; + if ($this->class) $html .= $this->class . " "; + $html .= "nifty-$this->size"; + // close the class quote + $html .= "'>"; + return $html; + } + + function end () { print $this->end_html();} + function end_html () { + return "
"; + } + +} + ?> diff --git a/plekit/php/table.php b/plekit/php/table.php index 481cbc6..c913127 100644 --- a/plekit/php/table.php +++ b/plekit/php/table.php @@ -232,14 +232,21 @@ EOF; } //////////////////// - public function cell ($text,$colspan=0,$align=NULL) { print $this->cell_html ($text,$colspan,$align); } - public function cell_html ($text,$colspan=0,$align=NULL) { - $result=""; - $result .= "cell_html ($text,$options); } + public function cell_html ($text,$options=NULL) { + $html=""; + $html .= "columns() . "'"; + $option=$options['align']; if ($option) $html .= " style='text-align:$option'"; + $html .= ">$text"; + return $html; } } diff --git a/plekit/php/toggle.php b/plekit/php/toggle.php index 1796766..acc9fe5 100644 --- a/plekit/php/toggle.php +++ b/plekit/php/toggle.php @@ -21,27 +21,28 @@ drupal_set_html_head(' // (*) trigger: the html text for the trigger // (*) options: a hash that can define // - trigger-tagname : to be used instead of for wrapping the trigger -// - trigger-bubble : might not work if trigger-tagname is redefined +// - bubble : might not work if trigger-tagname is redefined // - init-hidden : start hidden rather than visible // // methods are as follows // (*) trigger_html (): return the html code for the trigger // (*) image_html (): returns the html code for the image -// (*) area_start (): because we have too many places where php 'prints' code instead +// (*) area_start (): because we have too many places where php 'prints' code: instead // (*) area_end(): of returning it, we do not expect the code for the area to be passed // so these methods can be used to delimit the area in question class PlekitToggle { // mandatory var $id; + var $nifty; function PlekitToggle ($id,$trigger,$options=NULL) { $this->id = $id; $this->trigger=$trigger; if ( ! $options ) $options = array(); - if (array_key_exists ('start-visible',$options)) { - $options['start-hidden'] = ! $options['start-visible']; - unset ($options['start-visible']); + if (array_key_exists ('visible',$options)) { + $options['start-hidden'] = ! $options['visible']; + unset ($options['visible']); } if (!isset ($options['start-hidden'])) $options['start-hidden']=false; $this->options = $options; @@ -87,7 +88,7 @@ class PlekitToggle { if (array_key_exists ('trigger-tagname',$this->options)) $tagname=$this->options['trigger-tagname']; if (empty($tagname)) $tagname="span"; $bubble=""; - if (array_key_exists ('trigger-bubble',$this->options)) $bubble=$this->options['trigger-bubble']; + if (array_key_exists ('bubble',$this->options)) $bubble=$this->options['bubble']; $html="<$tagname"; $html .= " id='$trigger_id'"; @@ -122,15 +123,12 @@ class PlekitToggle { function container_start () { print $this->container_start_html(); } function container_start_html () { $id=$this->id_name('container'); - - $html="
nifty=new PlekitNifty ($id,'plc-toggle-container','medium'); + return $this->nifty->start_html(); } function container_end () { print $this->container_end_html(); } - function container_end_html () { return "
"; } + function container_end_html () { return $this->nifty->end_html(); } // build id names function id_name ($zonename) { return "toggle-$zonename-$this->id"; } diff --git a/plekit/table/table.css b/plekit/table/table.css index b3a509b..89a509e 100644 --- a/plekit/table/table.css +++ b/plekit/table/table.css @@ -91,12 +91,13 @@ table.plekit_table>tbody>tr>td [class~="alt"] { } /* Poor old Internet Explorer won't see the next two rules either as it doesn't get :first-child */ table.plekit_table>tbody>tr.alt>td:first-child { - background: #F5FAFA url(/plekit/icons/tablesort-bullet2.gif) no-repeat; - font-weight:bold; + background-color: #F5FAFA; + background-image: url(/plekit/icons/tablesort-bullet2.gif); + background-repeat: no-repeat; } table.plekit_table>tbody>tr>td:first-child { - background: #fff url(/plekit/icons/tablesort-bullet1.gif) no-repeat; - font-weight:bold; + background-image: url(/plekit/icons/tablesort-bullet1.gif); + background-repeat: no-repeat; } /* table decorations */ @@ -255,6 +256,6 @@ ul.fdtablePaginater {text-align:center;} /*table.plekit_table { border-bottom:1px solid #C1DAD7; }*/ .search_input:focus ,.pagesize_input:focus { - background-color: #aaa; + background-color: #8cd; outline-color: #696; } -- 2.43.0