summaryrefslogtreecommitdiff
path: root/swat/scripting
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-31 02:24:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:20 -0500
commitb8b680f3aaa84d61d3ac008cf7a121c29f9edddb (patch)
tree4c2e93d449a1a17a462e644f94f78548676ff842 /swat/scripting
parenta8efb670df4f76cbfeab976d3b2a898a065da8f6 (diff)
downloadsamba-b8b680f3aaa84d61d3ac008cf7a121c29f9edddb.tar.gz
samba-b8b680f3aaa84d61d3ac008cf7a121c29f9edddb.tar.bz2
samba-b8b680f3aaa84d61d3ac008cf7a121c29f9edddb.zip
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)
Diffstat (limited to 'swat/scripting')
-rw-r--r--swat/scripting/common.js27
1 files changed, 23 insertions, 4 deletions
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("<tr><td>" + i + "</td><td>");
+ if (typeof(o[i]) == "object") {
+ var first;
+ first = true;
+ for (j in o[i]) {
+ if (first == false) {
+ write("<br />");
+ }
+ write(o[i][j]);
+ first = false;
+ }
+ } else {
+ write(o[i]);
+ }
+ write("</td></tr>\n");
+}
+/*
+ display a ejs object as a table. The header is optional
*/
function simple_table(v) {
write("<table class=\"data\">\n");
for (r in v) {
- write("<tr><td>" + r + "</td><td>" + v[r] + "</td></tr>\n");
+ table_element(r, v);
}
write("</table>\n");
}
@@ -103,8 +123,7 @@ function multi_table(array, header) {
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");
+ table_element(r, v);
}
}
}