r7003: added an example script for fetching smb.conf parameters from esp scripts
authorAndrew Tridgell <tridge@samba.org>
Fri, 27 May 2005 03:59:12 +0000 (03:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:04 +0000 (13:17 -0500)
swat/esptest/index.esp
swat/esptest/loadparm.esp [new file with mode: 0644]

index f229732e3e3e1297f98b0fddd33b28a7d2d9ca79..e85937e4bf735b08f19c7d78f28ae0d669b141be 100644 (file)
@@ -1,5 +1,5 @@
 <%
 <%
-  var tests = new Array("formtest", "showvars", "include", "session");
+  var tests = new Array("formtest", "showvars", "include", "session", "loadparm");
 %>
 
 <HTML>
 %>
 
 <HTML>
diff --git a/swat/esptest/loadparm.esp b/swat/esptest/loadparm.esp
new file mode 100644 (file)
index 0000000..b5f3c86
--- /dev/null
@@ -0,0 +1,74 @@
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+<h1>Samba4 loadparm test</h1>
+
+<form name="LoadparmTest" method="POST" action="@@request['SCRIPT_NAME']"> 
+    Share:      <input name="Share" type="text" value=""><br>
+    Parameter:  <input name="Name"  type="text" value=""><br>
+    <input name="submit" type="submit" value="OK">
+    <input name="submit" type="submit" value="Cancel"><br>
+</form>
+
+<%
+
+function stringVar(v) {
+       var type = typeof(v);
+       var ret = "";
+       if (type == "object") {
+               for (val in v) {
+                       ret = ret + " " + v[val];
+               }
+       } else {
+               ret = ret + v;
+       }
+       return ret;
+}
+
+function showValue(name, v) {
+       write("parameter:" + name + "<br>\n");
+       write("Type  is: " + typeof(v) + "<br>\n");
+       write("Value is: " + stringVar(v) + "<p>\n");
+}
+
+
+if (request['REQUEST_METHOD'] == "POST") {
+       /* if they cancelled then take them back to the list of tests */
+       if (form['submit'] == "Cancel") {
+               redirect("index.esp");
+       }
+       
+       var v;
+
+       share = form['Share'];
+       name  = form['Name'];
+       if (share && name) {
+               v = lpGet(share, name);
+       } else if (name) {
+               v = lpGet(name);
+       }
+
+       showValue(name, v);
+}
+%>
+
+Here are some commonly used parameters:<p>
+
+<%
+function showParameter(name) {
+       showValue(name, lpGet(name));
+}
+
+showParameter("server services");
+showParameter("netbios name");
+showParameter("security");
+showParameter("workgroup");
+showParameter("log level");
+showParameter("server signing");
+showParameter("interfaces");
+%>
+
+</BODY>
+</HTML>