From b8b680f3aaa84d61d3ac008cf7a121c29f9edddb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 31 May 2005 02:24:50 +0000 Subject: r7131: support sub-object arrays when displaying objects. This allows the ldb test to correctly display multi-value attributes like objectClass (This used to be commit 134f42655ed2e5e13dee25921b8cd4e1ca9a1396) --- swat/scripting/common.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'swat/scripting') diff --git a/swat/scripting/common.js b/swat/scripting/common.js index 13ed34346b..8df419bc60 100644 --- a/swat/scripting/common.js +++ b/swat/scripting/common.js @@ -82,12 +82,32 @@ function simple_menu() { /* - display a ejs object as a table + display a table element +*/ +function table_element(i, o) { + write("" + i + ""); + if (typeof(o[i]) == "object") { + var first; + first = true; + for (j in o[i]) { + if (first == false) { + write("
"); + } + write(o[i][j]); + first = false; + } + } else { + write(o[i]); + } + write("\n"); +} +/* + display a ejs object as a table. The header is optional */ function simple_table(v) { write("\n"); for (r in v) { - write("\n"); + table_element(r, v); } write("
" + r + "" + v[r] + "
\n"); } @@ -103,8 +123,7 @@ function multi_table(array, header) { write("" + v[header] + "\n"); for (r in v) { if (r != header) { - write("" + r + - "" + v[r] + "\n"); + table_element(r, v); } } } -- cgit