summaryrefslogtreecommitdiff
path: root/swat/scripting/common.js
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-09 05:31:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:26 -0500
commita343050b2b91067d70eafd5ade88d6a3637be236 (patch)
tree7c750c8c2d95061f020ede3252ef2751b5b598ed /swat/scripting/common.js
parent7efeb8f451345b54ce125bcbb601ba2475ef9e59 (diff)
downloadsamba-a343050b2b91067d70eafd5ade88d6a3637be236.tar.gz
samba-a343050b2b91067d70eafd5ade88d6a3637be236.tar.bz2
samba-a343050b2b91067d70eafd5ade88d6a3637be236.zip
r8257: add a samr rpc test page in the web server. It lists all level3
information from QueryUserInfo for all users in the domain. If you want to see why I am putting the effort into ejs, then please read swat/scripting/samr.js, and compare it to other methods of rpc access for our web management interface. Using ejs like this will make building a rich interface _much_ easier. (This used to be commit eb354f6da7ed79eb080f2ba47df2ea655e1891db)
Diffstat (limited to 'swat/scripting/common.js')
-rw-r--r--swat/scripting/common.js24
1 files changed, 6 insertions, 18 deletions
diff --git a/swat/scripting/common.js b/swat/scripting/common.js
index 4fc3884db6..3321cfb772 100644
--- a/swat/scripting/common.js
+++ b/swat/scripting/common.js
@@ -115,7 +115,7 @@ function simple_menu() {
function table_element(i, o) {
write("<tr><td>" + i + "</td><td>");
if (typeof(o[i]) == "object") {
- var first;
+ var j, first;
first = true;
for (j in o[i]) {
if (first == false) {
@@ -131,24 +131,14 @@ function table_element(i, o) {
}
/*
- return the number of elements in an object
-*/
-function elcount(o) {
- var count = 0;
- for (i in o) {
- count++;
- }
- return count;
-}
-
-/*
display a ejs object as a table. The header is optional
*/
function simple_table(v) {
- if (elcount(v) == 0) {
+ if (v.length == 0) {
return;
}
write("<table class=\"data\">\n");
+ var r;
for (r in v) {
table_element(r, v);
}
@@ -160,12 +150,10 @@ function simple_table(v) {
attribute
*/
function multi_table(array, header) {
- if (elcount(array) == 0) {
- return;
- }
+ var i, n;
write("<table class=\"data\">\n");
- for (i in array) {
- var v = array[i];
+ for (i=0;i<array.length;i++) {
+ var r, v = array[i];
write('<tr><th colspan="2">' + v[header] + "</th></tr>\n");
for (r in v) {
if (r != header) {