85843c41d9caddbaa1ca9bdda88b6daa9011b8e9
[jra/samba/.git] / swat / esptest / registry.esp
1 <% 
2   page_header("columns", "ESP registry edit", "esptest"); 
3 %>
4
5 <script type="text/javascript" src="/scripting/client/encoder.js"></script>
6 <script type="text/javascript" src="/scripting/client/call.js"></script>
7
8 <h1>Registry Editor</h1>
9
10   <script type="text/javascript">
11
12 function folder_list(t, list) {
13         var i;
14         t.populated = true;
15         t.reg_list = new Object();
16         for (i=0;i<list.length;i++) {
17                 var te;
18                 if (t.reg_list.working != undefined) {
19                         te = t.reg_list.working;
20                         t.reg_list = new Object();
21                         te.label = list[i];
22                 } else {
23                         te = new QxTreeFolder(list[i]);
24                         t.add(te);
25                 }
26                 te.binding = t.binding;
27                 if (t.reg_path == '\\\\') {
28                         te.reg_path = list[i];
29                 } else {
30                         te.reg_path = t.reg_path + '\\\\' + list[i];
31                 }
32                 te.reg_list = new Object();
33                 te.reg_list.working = new QxTreeFolder('Working ...');
34                 te.add(te.reg_list.working);
35                 t.reg_list[list[i]] = te;
36                 te.addEventListener("click", function() { 
37                         var el = this; folder_click(el); 
38                 });
39                 te.setOverflow("auto");
40                 t.setOpen(1);
41         }
42 }
43
44 function folder_click(t) {
45         if (!t.populated) {
46                 server_call("registry_calls.esp", 'enum_path', 
47                             function(list) { folder_list(t, list); }, 
48                             t.binding, t.reg_path);
49         }
50 }
51
52 /* return a registry tree for the given server */
53 function registry_tree(binding) {
54       var t = new QxTree("registry: " + binding);
55       t.binding = binding;
56       t.reg_path = "\\\\";
57       t.reg_list = new Object();
58       t.populated = false;
59       with(t)
60       {
61         setBackgroundColor(255);
62         setBorder(QxBorder.presets.inset);
63         setOverflow("auto");
64         setStyleProperty("padding", "2px");
65         setWidth(200);
66         setHeight("100%");
67         setTop(20);
68         addEventListener("click", function() { folder_click(t); });
69       }
70       return t;
71 }
72
73   window.application.main = function()
74   {
75     var inlineWidget = new QxInline;
76     var fieldSet = new QxFieldSet("Registry");
77     var binding = "ncacn_np:win2003";
78
79     with(fieldSet)
80     {
81             setWidth("40%");
82             setMinHeight(500);
83             setBottom(48);
84             setMinWidth(500);
85     };
86
87     var gl = new QxGridLayout("auto,auto,auto,auto,auto", "100%");
88     gl.setEdge(0);
89     gl.setCellPaddingTop(3);
90     gl.setCellPaddingBottom(3);
91
92     inlineWidget.add(fieldSet);
93
94     var t = registry_tree(binding);
95
96     function change_binding(e) {
97             binding = e.getNewValue();
98             srv_printf("changed binding to %s\\n", binding);
99             gl.remove(t);
100             t = registry_tree(binding);
101             gl.add(t, { row : 2, col : 1 });
102     }
103
104     var b = new QxTextField(binding);
105     b.addEventListener("changeText", change_binding);
106
107     gl.add(b, { row : 1, col : 1 });
108     gl.add(t, { row : 2, col : 1 });
109
110     fieldSet.add(gl);
111     inlineWidget.add(fieldSet);
112     this.getClientWindow().getDocument().add(inlineWidget, "canvas");
113   };
114
115   </script>
116
117
118  <div id="canvas" style="overflow:hidden;position:static;margin-top:38px;margin-left:10px;margin-right:700px;width:700px"></div>
119
120 <% page_footer(); %>