From 8dfeb8aa13ccfe89e04ca7e290f0dfbd10e1b5ab Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 13 Feb 2009 13:56:08 +0000 Subject: [PATCH] cleaned up tabs --- planetlab/css/plc_style.css | 4 +-- planetlab/includes/plc_functions.php | 49 ++++++++++++++++++++++++---- planetlab/includes/plc_minitabs.php | 19 +++++++++-- planetlab/minitabs/minitabs.js | 16 +++++++-- planetlab/nodes/interface.php | 4 +-- planetlab/nodes/node.php | 17 ++++++---- planetlab/nodes/nodes.php | 14 ++++---- planetlab/persons/person.php | 5 +-- planetlab/persons/persons.php | 15 ++++----- planetlab/sites/site.php | 10 +++--- planetlab/sites/sites.php | 4 +-- planetlab/tags/nodegroup.php | 11 +++---- planetlab/tags/nodegroups.php | 4 +-- planetlab/tags/tag.php | 2 +- planetlab/tags/tags.php | 9 +++-- 15 files changed, 118 insertions(+), 65 deletions(-) diff --git a/planetlab/css/plc_style.css b/planetlab/css/plc_style.css index 9152078..26c2b67 100644 --- a/planetlab/css/plc_style.css +++ b/planetlab/css/plc_style.css @@ -29,8 +29,8 @@ h2.plc { } /* tmp - for visual checking */ -.plc-local { - border: 1px solid #00f; +/*.plc-local { + border: 1px solid #00f; */ } .plc-foreign { background: #e0e0e0; diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index 9a5eff5..ad41d99 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -118,8 +118,48 @@ function l_person_register() { return "/db/persons/register.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);} + +//////////////////////////////////////////////////////////// nav tabs +function tab_nodes () { return array ('label'=>'All nodes','url'=>l_nodes(), + 'bubble'=>'Display nodes from all peers'); } +function tab_nodes_local () { return array ('label'=>'Local nodes', 'url'=>l_nodes_peer('local'), + 'bubble'=>'Display local nodes only'); } +function tab_nodes_site($site_id){ return array ('label'=>'Site nodes', 'url'=>l_nodes_site($site_id), + 'bubble'=>'Display nodes on that site'); } +function tab_nodes_mysite () { return array ('label'=>'My nodes', 'url'=>l_nodes_site(plc_my_site_id()), + 'bubble'=>'Display nodes on that site'); } +function tab_node($node) { return array ('label'=>'Node '.$node['hostname'], 'url'=>l_node($node_id), + 'bubble'=>'Details for ' . $node['hostname']); } +////////// +function tab_site($site) { return array ('label'=>'Site '.$site['login_base'], 'url'=>l_site($site_id), + 'bubble'=>'Details for ' . $site['name']); } +function tab_mysite() { return array ('label'=>'My site', 'url'=>l_site(plc_my_site_id()), + 'bubble'=>'Details for site ' . plc_my_site_id()); } +function tab_sites () { return array ('label'=>'All sites' , 'url'=>l_sites(), 'bubble'=> 'Display all sites'); } +function tab_sites_local () { return array ('label'=>'Local sites' , 'url'=>l_sites_peer('local'), 'bubble'=> 'Display local sites'); } +////////// +function tab_slices() { return array ('label'=>'All slices', 'url'=>l_slices(), + 'bubble' => 'Display all slices'); } +function tab_slice($slice) { return array ('label'=>'Slice '.$slice['name'], 'url'=>l_slice($slice_id), + 'bubble' => 'Details for ' . $slice['name']); } +////////// +function tab_persons() { return array ('label'=>'All accounts', 'url'=>l_persons(), + 'bubble'=>'Display users from all peers'); } +function tab_persons_local() { return array ('label'=>'Local accounts', 'url'=>l_persons_peer('local'), + 'bubble'=>'Display local users'); } +function tab_persons_mysite() { return array ('label'=>'My accounts' , 'url'=>l_persons_site(plc_my_site_id()), + 'bubble'=>'Display accounts on site ' . plc_my_site_id()); } +////////// +function tab_tags() { return array ('label'=>'Tag Types', 'url'=>l_tags(), + 'bubble' => 'Display and create tag types'); } +function tab_nodegroups() { return array ('label'=>'Nodegroups', 'url'=>l_nodegroups(), + 'bubble' => 'Display and create nodegroups'); } + +// only partial tab +function tablook_event() { return array('image'=>'/planetlab/icons/event.png','height'=>18);} +function tablook_comon() { return array('image'=>'/planetlab/icons/comon.png','height'=>18);} + +//////////////////// // returns array ['url' => path, 'values' => hash (key=>value)* ] function split_url ($full_url) { @@ -247,11 +287,6 @@ function plc_nodegroup_global_hash ($api,$tagnames=NULL) { function t_site($site) { return " on site " . $site['name'] . " (" . $site['login_base'] .")"; } function t_slice ($slice) { return " running slice " . $slice['name'] . " (" . $slice['slice_id'] . ")"; } -//////////////////////////////////////////////////////////// nav tabs -function tabs_node($node) { return array('Node ' . $node['hostname']=>l_node($node_id)); } -function tabs_site($site) { return array('Site ' . $site['name']=>l_site($site_id)); } -function tabs_slice($slice) { return array('Slice ' . $slice['name']=>l_slice($slice_id)); } - //////////////////////////////////////////////////////////// html fragments function plc_vertical_table ($messages, $class="") { // pretty print the cell diff --git a/planetlab/includes/plc_minitabs.php b/planetlab/includes/plc_minitabs.php index cac7aad..5bce03b 100644 --- a/planetlab/includes/plc_minitabs.php +++ b/planetlab/includes/plc_minitabs.php @@ -13,25 +13,37 @@ drupal_set_html_head(' // todo can be either // (*) a string : it is then taken to be a URL to move to // (*) or an associative array with the following keys +// (*) 'label' : if set, this overrides the string key just above +// this is used for functions that return a tab, more convenient to write&use // (*) 'method': 'POST' or 'GET' -- default is 'GET' // (*) 'url': where to go // (*) 'values': an associative array of (key,value) pairs to send to the URL; values are strings // (*) 'confirm': a question to display before actually triggering // (*) 'bubble': a longer message displayed when the mouse stays quite for a while on the label -// (*) 'image' : the url of an image used instead of the full title +// (*) 'image' : the url of an image used instead of the label // (*) 'height' : used for the image +// examples +// function my_tab () { return array('label'=>'The Text','url'=>'http://google.com'); } +// $tabs=array(); +// $tabs[] = my_tab(); +// $tabs['Simple Tab']="http://planet-lab.org"; +// $tabs['Complex Tab']=array('url'=>'http://planet-lab.org/', +// 'bubble'=>'This text gets displayed when the mouse remains over for a while'); +// plc_tabs($tabs); + ////////// Notes: limited support for images // (*) for some reason, confirmation does not work with image tabs // (the form gets submitted whatever the confirmation....) // (*) you need to tune the image size, which is wrong, as the image should rather be bottom-aligned - function plc_tabs ($array) { print '
'; print '