From d3cae1ccc13fcf31dbe778169f92b2445fb99156 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 12 Jan 2009 18:06:50 +0000 Subject: [PATCH] towards client-side filtering and sorting --- planetlab/css/demo.css | 22 ---- planetlab/css/plc_paginate.css | 16 ++- planetlab/css/plc_table.css | 30 +++++ planetlab/icons/tablesort_bullet1.gif | Bin 0 -> 55 bytes planetlab/icons/tablesort_bullet2.gif | Bin 0 -> 262 bytes planetlab/icons/tablesort_col_alt.jpg | Bin 0 -> 659 bytes planetlab/icons/tablesort_td_alt.jpg | Bin 0 -> 564 bytes planetlab/js/plc_filter.js | 30 +++-- planetlab/js/plc_paginate.js | 43 +++++-- planetlab/nodes/newindex.php | 164 +++++++++++++++++--------- 10 files changed, 205 insertions(+), 100 deletions(-) create mode 100644 planetlab/icons/tablesort_bullet1.gif create mode 100644 planetlab/icons/tablesort_bullet2.gif create mode 100644 planetlab/icons/tablesort_col_alt.jpg create mode 100644 planetlab/icons/tablesort_td_alt.jpg diff --git a/planetlab/css/demo.css b/planetlab/css/demo.css index 8ef0d3d..c6907ea 100644 --- a/planetlab/css/demo.css +++ b/planetlab/css/demo.css @@ -153,28 +153,6 @@ td.lft { text-align:left; } -/* 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 - { - background: #F5FAFA url(../media/td_alt.jpg) no-repeat; - } -td[class~="alt"] - { - background: #edf3f3 url(../media/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 */ -tbody tr.alt td:first-child - { - background: #F5FAFA url(../media/bullet2.gif) no-repeat; - font-weight:bold; - } -tbody tr td:first-child - { - background: #fff url(../media/bullet1.gif) no-repeat; - font-weight:bold; - } /* Image free rules for Internet Explorer < 7 */ * html tr.alt td { diff --git a/planetlab/css/plc_paginate.css b/planetlab/css/plc_paginate.css index 8d524f3..407de16 100644 --- a/planetlab/css/plc_paginate.css +++ b/planetlab/css/plc_paginate.css @@ -8,9 +8,9 @@ ul.fdtablePaginater padding:0; margin:0 auto; text-align:center; - height:2em; + height:1.5em; width:auto; - margin-bottom:2em; + margin-bottom:1em; } ul.fdtablePaginater li { @@ -99,13 +99,15 @@ td.sized3 width:7em; text-align:left; } -tfoot td +/* + tfoot td { text-align:right; font-weight:bold; text-transform:uppercase; letter-spacing:1px; } + */ #visibleTotal { text-align:center; @@ -125,6 +127,14 @@ p.paginationText { font-style:oblique; } +p.plc_filter_note + { + font-style:oblique; + font-size:0.6em; + font-family: georgia; + text-align: center + } + GetNodes($node_filter,$node_columns); -// build site_ids and interface_ids +// build site_ids - interface_ids $site_ids=array(); $interface_ids=array(); foreach ($nodes as $node) { @@ -149,26 +107,54 @@ foreach ($sites as $site) { $site_hash[$site['site_id']]=$site; } +// fetch peers +$peer_columns=array('peer_id','shortname'); +$peer_filter=array(); +$peers = $api->GetPeers($peer_filter,$peer_columns); + +$peer_hash=array(); +foreach ($peers as $peer) { + $peer_hash[$peer['peer_id']]=$peer; +} + ?> -
-
- - - + +
+ + + + + +
+ +
+
+ + +
+

+ +class="plc_table sortable-onload-1 rowstyle-alt colstyle-alt no-arrow paginationcallback-nodesTextInfo max-pages-15 paginate-"> + + + - - @@ -178,7 +164,7 @@ class="plc_table sortable-onload-3r rowstyle-alt colstyle-alt no-arrow paginatio ',$hostname); + printf ('',$shortname); + printf ('',topdomain($hostname)); + printf ('',$site_id,$login_base); printf ('',$node['boot_state']); printf ('',$node_id,$hostname); - printf ('',$site_id,$login_base); - printf ('',topdomain($hostname)); printf ('', $interface_id,$ip); printf ('', $fake1); printf ('', $fake2); printf ( ''); - $fake1 += 3; - $fake2 += 2; + + if ($fake_i % 5 == 0) $fake1 += 3; + if ($fake_i % 3 == 0) $fake2 +=5; else $fake2 -= $fake_i; + $fake_i += 1; } ?> @@ -208,4 +202,56 @@ foreach ($nodes as $node) {
PeerRegionSite State HostnameSiteRegion IP Load Avg Load %s %s %s %s %s %s %s %s %s %s

+

Notes: Several words in pattern are combined with OR + +
Hold down the shift key to select multiple columns to sort +

+ + +
+
+

This section is for trying out server-side filtering

+
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + +
+
+
-- 2.43.0