summaryrefslogtreecommitdiff
path: root/swat/esptest
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-08 03:23:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:31 -0500
commitc8dfaec28a470c09430454a52bf3f4206ebf7037 (patch)
tree9a5cbb7ae4567b89c747075a440488d0d98254d6 /swat/esptest
parent2dcd55f31fa0d4db4dbe3454a0b452f370f6d0c5 (diff)
downloadsamba-c8dfaec28a470c09430454a52bf3f4206ebf7037.tar.gz
samba-c8dfaec28a470c09430454a52bf3f4206ebf7037.tar.bz2
samba-c8dfaec28a470c09430454a52bf3f4206ebf7037.zip
r9212: the beginnings of a registry editor in SWAT, using client side javascript and AJAJ
This doesn't work at all well yet, mostly because of my inexperience with client side javascript and what events are available (This used to be commit 8073e84c7a5fd8d483685d769661c790a803ff49)
Diffstat (limited to 'swat/esptest')
-rw-r--r--swat/esptest/registry.esp120
-rw-r--r--swat/esptest/registry_calls.esp37
2 files changed, 157 insertions, 0 deletions
diff --git a/swat/esptest/registry.esp b/swat/esptest/registry.esp
new file mode 100644
index 0000000000..85843c41d9
--- /dev/null
+++ b/swat/esptest/registry.esp
@@ -0,0 +1,120 @@
+<%
+ page_header("columns", "ESP registry edit", "esptest");
+%>
+
+<script type="text/javascript" src="/scripting/client/encoder.js"></script>
+<script type="text/javascript" src="/scripting/client/call.js"></script>
+
+<h1>Registry Editor</h1>
+
+ <script type="text/javascript">
+
+function folder_list(t, list) {
+ var i;
+ t.populated = true;
+ t.reg_list = new Object();
+ for (i=0;i<list.length;i++) {
+ var te;
+ if (t.reg_list.working != undefined) {
+ te = t.reg_list.working;
+ t.reg_list = new Object();
+ te.label = list[i];
+ } else {
+ te = new QxTreeFolder(list[i]);
+ t.add(te);
+ }
+ te.binding = t.binding;
+ if (t.reg_path == '\\\\') {
+ te.reg_path = list[i];
+ } else {
+ te.reg_path = t.reg_path + '\\\\' + list[i];
+ }
+ te.reg_list = new Object();
+ te.reg_list.working = new QxTreeFolder('Working ...');
+ te.add(te.reg_list.working);
+ t.reg_list[list[i]] = te;
+ te.addEventListener("click", function() {
+ var el = this; folder_click(el);
+ });
+ te.setOverflow("auto");
+ t.setOpen(1);
+ }
+}
+
+function folder_click(t) {
+ if (!t.populated) {
+ server_call("registry_calls.esp", 'enum_path',
+ function(list) { folder_list(t, list); },
+ t.binding, t.reg_path);
+ }
+}
+
+/* return a registry tree for the given server */
+function registry_tree(binding) {
+ var t = new QxTree("registry: " + binding);
+ t.binding = binding;
+ t.reg_path = "\\\\";
+ t.reg_list = new Object();
+ t.populated = false;
+ with(t)
+ {
+ setBackgroundColor(255);
+ setBorder(QxBorder.presets.inset);
+ setOverflow("auto");
+ setStyleProperty("padding", "2px");
+ setWidth(200);
+ setHeight("100%");
+ setTop(20);
+ addEventListener("click", function() { folder_click(t); });
+ }
+ return t;
+}
+
+ window.application.main = function()
+ {
+ var inlineWidget = new QxInline;
+ var fieldSet = new QxFieldSet("Registry");
+ var binding = "ncacn_np:win2003";
+
+ with(fieldSet)
+ {
+ setWidth("40%");
+ setMinHeight(500);
+ setBottom(48);
+ setMinWidth(500);
+ };
+
+ var gl = new QxGridLayout("auto,auto,auto,auto,auto", "100%");
+ gl.setEdge(0);
+ gl.setCellPaddingTop(3);
+ gl.setCellPaddingBottom(3);
+
+ inlineWidget.add(fieldSet);
+
+ var t = registry_tree(binding);
+
+ function change_binding(e) {
+ binding = e.getNewValue();
+ srv_printf("changed binding to %s\\n", binding);
+ gl.remove(t);
+ t = registry_tree(binding);
+ gl.add(t, { row : 2, col : 1 });
+ }
+
+ var b = new QxTextField(binding);
+ b.addEventListener("changeText", change_binding);
+
+ gl.add(b, { row : 1, col : 1 });
+ gl.add(t, { row : 2, col : 1 });
+
+ fieldSet.add(gl);
+ inlineWidget.add(fieldSet);
+ this.getClientWindow().getDocument().add(inlineWidget, "canvas");
+ };
+
+ </script>
+
+
+ <div id="canvas" style="overflow:hidden;position:static;margin-top:38px;margin-left:10px;margin-right:700px;width:700px"></div>
+
+<% page_footer(); %>
diff --git a/swat/esptest/registry_calls.esp b/swat/esptest/registry_calls.esp
new file mode 100644
index 0000000000..a5c1ae7a12
--- /dev/null
+++ b/swat/esptest/registry_calls.esp
@@ -0,0 +1,37 @@
+<%
+libinclude("base.js");
+libinclude("winreg.js");
+libinclude("server_call.js");
+
+/*
+ server side call to return a listing of elements in a winreg path
+*/
+function enum_path(binding, path) {
+ printf("enum_path(%s, %s)\n", binding, path);
+ if (path == "\\") {
+ printf("IN ROOT\n");
+ var list = new Array("HKLM", "HKCR", "HKPD");
+ return list;
+ }
+ printf("binding=%s path=%s\n", binding, path);
+ var reg = winreg_init();
+ security_init(reg);
+
+ reg.credentials = session.authinfo.credentials;
+
+ var status = reg.connect(binding);
+ if (status.is_ok != true) {
+ printVars(status);
+ return undefined;
+ }
+ var list = winreg_enum_path(reg, path);
+ return list;
+}
+
+/* register a call for clients to make */
+var call = servCallObj();
+call.add('enum_path', enum_path);
+
+/* run the function that was asked for */
+call.run();
+%>