From fba8af4a92198ceba4bcd8640a6286bb703de7d0 Mon Sep 17 00:00:00 2001 From: "Leigh B. Stoller" <stoller@flux.utah.edu> Date: Mon, 15 Oct 2007 17:13:28 +0000 Subject: [PATCH] Minor change to make usinf sorted tables (sorttable.js) easier; rather then putting in javascript below each sorted table, instead call AddSortedTable($table_id), which will cause a block of javascript to get spit out in the page footer. --- www/menu.php3 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/www/menu.php3 b/www/menu.php3 index ca3f069867..90b10f3ce1 100644 --- a/www/menu.php3 +++ b/www/menu.php3 @@ -13,6 +13,7 @@ $autorefresh = 0; $javascript_debug = 0; $currentusage = 1; $currently_busy = 0; +$sortedtables = array(); $bodyclosestring = ""; # @@ -42,6 +43,13 @@ else { $nextsidebarcl = ""; $nextsubmenucl = ""; +# Add a table id to the list of sorted tables to initialize on current page. +function AddSortedTable($id) { + global $sortedtables; + + $sortedtables[] = $id; +} + # # TOPBARCELL - Make a cell for the topbar. Actually, the name lies, it can be # used for cells in a bottombar too. @@ -967,6 +975,15 @@ function PAGEFOOTER($view = NULL) { # Plug the home site from all others. echo "\n<p><a href=\"www.emulab.net/netemu.php3\"></a>\n"; + # Prime all the sortable tables. + if (count($sortedtables)) { + echo "<script type='text/javascript' language='javascript'>\n"; + foreach ($sortedtables as $i => $id) { + echo "sorttable.makeSortable(getObjbyName('$id'));\n"; + } + echo "</script>\n"; + } + # This has to be after all the tooltip definitions. echo "<script type='text/javascript' src='${TBBASE}/js/wz_tooltip.js'>". "</script>"; -- GitLab