From: Thierry Parmentelat Date: Fri, 30 Jan 2009 08:59:57 +0000 (+0000) Subject: tables layout X-Git-Tag: PLEWWW-4.3-1~73 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=388ae6f6d06c4ef578194547ef33e934b3fc5fba;p=plewww.git tables layout --- diff --git a/planetlab/css/plc_details.css b/planetlab/css/plc_details.css new file mode 100644 index 0000000..416cdfa --- /dev/null +++ b/planetlab/css/plc_details.css @@ -0,0 +1,7 @@ +/* $Id: plc_tables.css 11750 2009-01-29 10:11:53Z thierry $ */ +table.plc_details { + width:auto; + padding: 0; + margin: 0 auto 1.5em auto; + border-collapse:collapse; +} diff --git a/planetlab/css/plc_style.css b/planetlab/css/plc_style.css index 310c0dc..2d2a0e0 100644 --- a/planetlab/css/plc_style.css +++ b/planetlab/css/plc_style.css @@ -283,19 +283,23 @@ html>body #clearmenu{ /* non IE browsers * $Id$ */ -/* Thierry : class used for showing foreign items */ +h2.plc { + text-align: center; +} + + .plc-foreign { background: #d0d0d0; } -/* Thierry : class used for showing various warnings */ .plc-warning { background: orange; } +.plc-error { + background: red; +} + *.plc-warning a:link { text-decoration: none; color:white } *.plc-warning a:visited { text-decoration: none; color:white } *.plc-warning a:hover { text-decoration: none; color:black } -.plc-error { - background: red; -} diff --git a/planetlab/css/plc_tables.css b/planetlab/css/plc_tables.css index 1fce227..6d425b6 100644 --- a/planetlab/css/plc_tables.css +++ b/planetlab/css/plc_tables.css @@ -8,6 +8,10 @@ table.plc_table { table.plc_table thead tr, table.plc_table tbody tr { border-left: 1px solid #C1DAD7; } +/* remove border for search/pagesize area */ +table.plc_table thead tr.pagesize_area, table.plc_table thead tr.search_area { + border-left: 0px; +} th.plc_table { font: bold 10px/22px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; @@ -85,18 +89,23 @@ table.plc_table>tbody>tr>td:first-child { font-weight:bold; } -td.table_flushleft { +/*td.table_flushleft { text-align:left; padding-left: 30px; } -td.table_flushright { - text-align:right; - padding-right: 30px; -} table.table_dialogs { width:100%; border:1px; } +*/ +td.search_area { + text-align:right; + padding-right: 30px; +} +td.pagesize_area { + text-align:right; + padding-right: 30px; +} .pagesize_label, .pagesize_input { font-style: oblique; font-size: .5em; diff --git a/planetlab/includes/plc_details.php b/planetlab/includes/plc_details.php index d28d1c7..10af0af 100644 --- a/planetlab/includes/plc_details.php +++ b/planetlab/includes/plc_details.php @@ -4,11 +4,15 @@ require_once 'plc_functions.php'; +drupal_set_html_head(' + +'); + // rough implem, no class for now // start the details area, with an optional caption function plc_details_start ($title="") { - print ""; + print "
"; if ($caption) { printf ("\n",$caption); } diff --git a/planetlab/includes/plc_forms.php b/planetlab/includes/plc_forms.php index 92de1e1..19052e9 100644 --- a/planetlab/includes/plc_forms.php +++ b/planetlab/includes/plc_forms.php @@ -18,7 +18,7 @@ function plc_form_start ($full_url, $values, $options=array()) { if ( $url_values ) $values=array_merge($values,$url_values); $method = array_key_exists('method',$options) ? $options['method'] : 'POST'; print ""; - plc_debug('values',$values); + // plc_debug('values',$values); if ($values) foreach ($values as $key=>$value) { print plc_form_hidden_text($key,$value); } diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index ddfd68e..c703b14 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -343,6 +343,11 @@ function plc_vertical_table ($messages, $class="") { function get_site_id ($site) { return $site['site_id'];} //////////////////////////////////////////////////////////// +function plc_section ($text,$line=true) { + if ($line) { print "
";} + print "

$text

\n"; +} + function plc_error ($text) { // should use the same channel as the php errors.. print "
Error " . $text . "
"; diff --git a/planetlab/includes/plc_tables.php b/planetlab/includes/plc_tables.php index ee3a5d2..ef31cd5 100644 --- a/planetlab/includes/plc_tables.php +++ b/planetlab/includes/plc_tables.php @@ -25,6 +25,7 @@ function plc_table_cell($cell) { // column_sort: the column to sort on at load-time // options : an associative array to override options (should be passed to both _stsart and _end) // - search_area : boolean (default true) +// - pagesize_area : boolean (default true) // - notes_area : boolean (default true) // - notes : an array of additional notes // - pagesize: the initial pagination size @@ -36,69 +37,11 @@ function plc_table_start ($table_id, $headers, $column_sort, $options=NULL) { global $plc_table_hash; $plc_table_hash[$table_id]=array($headers,$options); $search_area = array_key_exists('search_area',$options) ? $options['search_area'] : true; + $pagesize_area = array_key_exists('pagesize_area',$options) ? $options['pagesize_area'] : true; $max_pages = array_key_exists('max_pages',$options) ? $options['max_pages'] : 10; $pagesize = array_key_exists('pagesize',$options) ? $options['pagesize'] : 25; $pagesize_def = array_key_exists('pagesize_def',$options) ? $options['pagesize_def'] : 999; - if ($search_area) - plc_table_search_area($table_id,$pagesize,$pagesize_def); - plc_table_head($table_id,$headers,$column_sort,$max_pages,$pagesize); -} - -// for convenience, the options that apply to the footer only can be passed in plc_table_end() -// they add up to the ones provided to the begin clause -// makes code more readable, as preparing the footer before the table is displayed is confusing -function plc_table_end ($table_id,$options_end=NULL) { - global $plc_table_hash; - list($headers,$options) = $plc_table_hash[$table_id]; - if ($options_end) - $options=array_merge($options,$options_end); - - plc_table_foot($options); - $notes_area = array_key_exists('notes_area',$options) ? $options['notes_area'] : true; - if ($notes_area) - plc_table_notes($options); -} - -//////////////////// -function plc_table_search_area ($table_id,$pagesize,$pagesize_def) { - $pagesize_text_id = $table_id . "_pagesize"; - $search_text_id = $table_id . "_search"; - $search_reset_id = $table_id . "_search_reset"; - $search_and_id = $table_id . "_search_and"; - print <<< EOF -
%s
- - - -
- - - - - - - -
-EOF; -} - -//////////////////////////////////////// -function plc_table_head ($table_id,$headers,$column_sort,$max_pages,$pagesize) { $paginator=$table_id."_paginator"; $classname="paginationcallback-".$paginator; $classname.=" max-pages-" . $max_pages; @@ -112,9 +55,12 @@ function $paginator (opts) { plc_table_paginator (opts,"$table_id"); } - EOF; + if ($pagesize_area) plc_table_pagesize_area ($table_id,$headers,$pagesize, $pagesize_def); + if ($search_area) plc_table_search_area ($table_id, $headers); + + print ""; foreach ($headers as $label => $type) { if ($type == "none" ) { $class=""; @@ -135,6 +81,60 @@ EOF; EOF; } +//////////////////// +function plc_table_pagesize_area ($table_id,$headers,$pagesize,$pagesize_def) { + $width=count($headers); + $pagesize_text_id = $table_id . "_pagesize"; + print <<< EOF + +EOF; +} + +//////////////////// +function plc_table_search_area ($table_id,$headers) { + $width=count($headers); + $search_text_id = $table_id . "_search"; + $search_reset_id = $table_id . "_search_reset"; + $search_and_id = $table_id . "_search_and"; + print <<< EOF + +EOF; +} + +//////////////////////////////////////// +// for convenience, the options that apply to the footer only can be passed in plc_table_end() +// they add up to the ones provided to the begin clause +// makes code more readable, as preparing the footer before the table is displayed is confusing +function plc_table_end ($table_id,$options_end=NULL) { + global $plc_table_hash; + list($headers,$options) = $plc_table_hash[$table_id]; + if ($options_end) + $options=array_merge($options,$options_end); + + plc_table_foot($options); + $notes_area = array_key_exists('notes_area',$options) ? $options['notes_area'] : true; + if ($notes_area) + plc_table_notes($options); +} + //////////////////////////////////////// function plc_table_foot ($options) { print ""; @@ -161,10 +161,6 @@ EOF; } //////////////////////////////////////// -function plc_table_title ($text) { - print "

$text

\n"; -} - function plc_table_row_start ($id="") { if ( $id) { printf ('',$id); diff --git a/planetlab/nodes/comon.php b/planetlab/nodes/comon.php index 18b2623..3524eb9 100644 --- a/planetlab/nodes/comon.php +++ b/planetlab/nodes/comon.php @@ -93,7 +93,7 @@ foreach ($nns as $nn) { $local_ips[] = $nn['ip']; } -plc_debug('locals',$local_ips); +//plc_debug('locals',$local_ips); // for foreign hosts we're left with dns resolving them $remote_ips=array(); @@ -106,7 +106,7 @@ foreach ($hostnames as $hostname) { } } -plc_debug('remote ips',$remote_ips); +//plc_debug('remote ips',$remote_ips); // add both lists @@ -114,7 +114,7 @@ $all_ips=$local_ips+$remote_ips; // compute comon URL $url = plc_comon_url_from_ips("http://comon.cs.princeton.edu",$all_ips); -plc_debug('url',$url); +//plc_debug('url',$url); // redirect to comon header("Location: " . $url); diff --git a/planetlab/nodes/node.php b/planetlab/nodes/node.php index ef87039..7ecc909 100644 --- a/planetlab/nodes/node.php +++ b/planetlab/nodes/node.php @@ -130,8 +130,6 @@ $tabs["All nodes"]=l_nodes(); plc_tabs($tabs); -echo "
"; - plc_details_start (); plc_details_line("Hostname",$hostname); plc_details_line("Type",$node_type); @@ -200,8 +198,7 @@ plc_details_end (); //////////////////////////////////////////////////////////// slices // display slices -print "
\n"; -plc_table_title ("Slices"); +plc_section ("Slices"); if ( ! $slices ) { echo "

This node is not associated to any slice.

\n"; } else { @@ -241,8 +238,7 @@ if ( ! $peer_id ) { $headers["MAC"]="string"; $headers["bw limit"]="FileSize"; - print "
\n"; - plc_table_title('Interfaces'); + plc_section('Interfaces'); $table_options=array('search_area'=>false); plc_table_start("interfaces",$headers,2,$table_options); @@ -290,8 +286,7 @@ if ( ! $peer_id ) { //////////////////////////////////////////////////////////// nodegroups // display node group info -print "
\n"; -plc_table_title("Nodegroups"); +plc_section("Nodegroups"); if ( ! $nodegroups ) { echo "

This node is not in any nodegroup.

\n"; } diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index 31a18d6..41b39c6 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -144,8 +144,7 @@ plc_details_line("Bio",wordwrap($bio,50,"
")); plc_details_end(); //////////////////// slices -echo "
\n"; -plc_table_title('Slices'); +plc_section('Slices'); if( ! $slices) { plc_warning ("User has no slice"); @@ -173,8 +172,7 @@ plc_form_start(l_actions(), )); //////////////////// keys -echo "
\n"; -plc_table_title ("Keys"); +plc_section ("Keys"); $can_manage_keys = ( $local_peer && ( plc_is_admin() || $is_my_account) ); if ( empty( $key_ids ) ) { @@ -216,8 +214,7 @@ if ($can_manage_keys) { plc_table_end("person_keys",array("footers"=>$footers)); //////////////////// sites -echo "
\n"; -plc_table_title('Sites'); +plc_section('Sites'); // sites if (empty( $sites ) ) { @@ -268,8 +265,7 @@ if ($can_manage_sites) { plc_table_end("person_sites",array("footers"=>$footers)); //////////////////// roles -echo "
\n"; -plc_table_title("Roles"); +plc_section("Roles"); if (! $roles) plc_warning ("This user has no role !"); $can_manage_roles= ($local_peer && plc_is_admin()); diff --git a/planetlab/tags/tag_form.php b/planetlab/tags/tag_form.php index 2851e82..12f1b08 100644 --- a/planetlab/tags/tag_form.php +++ b/planetlab/tags/tag_form.php @@ -50,7 +50,7 @@ if ($update_mode) { } // display form for tag types -plc_table_title($label); +plc_section($label,false); plc_form_start (l_actions(),array()); plc_details_start();
+ + + +