svn commit: samba r7092 - in branches/SAMBA_4_0/swat: esptest
scripting style
tridge at samba.org
tridge at samba.org
Mon May 30 06:55:26 GMT 2005
Author: tridge
Date: 2005-05-30 06:55:25 +0000 (Mon, 30 May 2005)
New Revision: 7092
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7092
Log:
added some js for formatting table results in a nicer fashion
Modified:
branches/SAMBA_4_0/swat/esptest/ldb.esp
branches/SAMBA_4_0/swat/scripting/common.js
branches/SAMBA_4_0/swat/style/main.css
Changeset:
Modified: branches/SAMBA_4_0/swat/esptest/ldb.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/ldb.esp 2005-05-30 06:54:43 UTC (rev 7091)
+++ branches/SAMBA_4_0/swat/esptest/ldb.esp 2005-05-30 06:55:25 UTC (rev 7092)
@@ -2,60 +2,26 @@
<h1>Samba4 ldb test</h1>
-<form name="LdbTest" method="post" action="@@request['SCRIPT_NAME']">
- <input name="submit" type="submit" value="Cancel" /><br />
-</form>
+<h3>An attribute constrained search</h3>
<%
-if (request['REQUEST_METHOD'] == "POST") {
- /* if they cancelled then take them back to the list of tests */
- if (form['submit'] == "Cancel") {
- redirect("/");
- }
-}
-
-/*
- hmm, this gets fairly involved ...
-*/
-function showLdbRes(res) {
- for (i in res) {
- var r = res[i];
- for (j in r) {
- var a = r[j];
- if (typeof(a) == "object") {
- for (k in a) {
- write(j + "[" + k + "]=" + a[k] + "<br />\n");
- }
- } else {
- write(j + "=" + r[j] + "<br />\n");
- }
- }
- write("<p>");
- }
-}
-
-%>
-
-Trying a attribute constrained search on samdb:<p>
-
-<%
var dbfile = lpGet("sam database");
var attrs = new Array("name", "dnsDomain", "objectSid", "dn");
res = ldbSearch(dbfile, "(objectClass=domain)", attrs);
-showLdbRes(res);
+multi_table(res, "dn");
%>
-and now an unconstrained search:<p>
+<h3>An unconstrained search</h3>
<%
var dbfile = lpGet("sam database");
res = ldbSearch(dbfile, "(objectClass=user)");
-showLdbRes(res);
+multi_table(res, "dn");
%>
-and a bad search<br>
+<h3>A search with bad arguments</h3>
<%
res = ldbSearch("foo");
Modified: branches/SAMBA_4_0/swat/scripting/common.js
===================================================================
--- branches/SAMBA_4_0/swat/scripting/common.js 2005-05-30 06:54:43 UTC (rev 7091)
+++ branches/SAMBA_4_0/swat/scripting/common.js 2005-05-30 06:55:25 UTC (rev 7092)
@@ -61,3 +61,34 @@
}
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");
+}
Modified: branches/SAMBA_4_0/swat/style/main.css
===================================================================
--- branches/SAMBA_4_0/swat/style/main.css 2005-05-30 06:54:43 UTC (rev 7091)
+++ branches/SAMBA_4_0/swat/style/main.css 2005-05-30 06:55:25 UTC (rev 7092)
@@ -105,3 +105,19 @@
text-align:center;
margin:10px 0 25px 0;
}
+
+/*
+ styles for data tables
+*/
+table.data {
+ border: 2px;
+}
+table.data th {
+ margin-top:20px;
+ text-align:left;
+ background-color: #F5C915;
+}
+table.data tr {
+ background-color: #E5C995;
+ text-align:left;
+}
More information about the samba-cvs
mailing list