diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-30 06:55:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:15 -0500 |
commit | 3f4f393c98e7bc3b2853c699a67a9f5fc2e7d20a (patch) | |
tree | 060a166c7faec043afc65db1c137de20e4e6a75a /swat/scripting | |
parent | 11009ee2d7ac9d2c04ada55e1be21563c40e8e8d (diff) | |
download | samba-3f4f393c98e7bc3b2853c699a67a9f5fc2e7d20a.tar.gz samba-3f4f393c98e7bc3b2853c699a67a9f5fc2e7d20a.tar.bz2 samba-3f4f393c98e7bc3b2853c699a67a9f5fc2e7d20a.zip |
r7092: added some js for formatting table results in a nicer fashion
(This used to be commit 5f91db4d60a5b5b03b1b14d1348f9db6807ab18b)
Diffstat (limited to 'swat/scripting')
-rw-r--r-- | swat/scripting/common.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/swat/scripting/common.js b/swat/scripting/common.js index 34f5a958da..cc3ca55468 100644 --- a/swat/scripting/common.js +++ b/swat/scripting/common.js @@ -61,3 +61,34 @@ function simple_menu() { } write("</ul>\n"); } + + +/* + display a ejs object as a table +*/ +function simple_table(v) { + write("<table class=\"data\">\n"); + for (r in v) { + write("<tr><td>" + r + "</td><td>" + v[r] + "</td></tr>\n"); + } + write("</table>\n"); +} + +/* + display an array of objects, with the header for each element from the given + attribute +*/ +function multi_table(array, header) { + write("<table class=\"data\">\n"); + for (i in array) { + var v = array[i]; + write("<tr><th colspan=2>" + v[header] + "</th></tr>\n"); + for (r in v) { + if (r != header) { + write("<tr><td align=left>" + r + + "</td><td align=left>" + v[r] + "</td></tr>\n"); + } + } + } + write("</table>\n"); +} |