0714a2d038fbb89147a6f77e21cbadeb618de222
[jelmer/samba4-debian.git] / swat / desktop / index.esp
1 <% 
2 libinclude("base.js");
3         page_header("desktop", "Virtual Desktop Design Test", "desktop");
4 %>
5
6 <script type="text/javascript" src="/scripting/client/encoder.js"></script>
7 <script type="text/javascript" src="/scripting/client/call.js"></script>
8 <script type="text/javascript" src="/scripting/client/js_scripts.js"></script>
9 <script type="text/javascript" src="/scripting/client/desktop.js"></script>
10 <script type="text/javascript" src="/scripting/client/status.js"></script>
11 <script type="text/javascript" src="/scripting/client/regedit.js"></script>
12
13 <script type="text/javascript">
14
15 function showMessage(m)
16 {
17         var message = new QxWindow();
18         with(message) {
19                 setWidth(300);
20                 setTop("35%");
21                 setLeft("35%");
22                 setShowMaximize(false);
23                 setShowMinimize(false);
24         }
25
26         var note = new QxAtom(m);
27         with(note) {
28                 setTop(10);
29                 setLeft(10);
30         }
31
32         var ok = new QxButton("OK");
33         with(ok) {
34                 setLeft("42%");
35                 setBottom(2);
36         }
37         ok.addEventListener("click", function() {
38                 w.remove(message);
39         });
40
41         message.add(note);
42         message.add(ok);
43         w.add(message);
44         message.setVisible(true);
45 }
46
47 function blankW()
48 {
49         var blank = new Window.standard('SWAT');
50         w.add(blank);
51         blank.setVisible(true);
52 }
53
54 // Always open with stats
55 var win = new QxWindow();
56 document.js.add('/scripting/client/status.js');
57 win._onclosebuttonclick = function(e)
58 {
59         this.close();
60         e.stopPropagation();
61         document.js.remove('/scripting/client/status.js');
62 };
63 with(win) {
64         setTop(50);
65         setRight(50);
66         setHeight(175);
67 }
68 w.add(win);
69 getServerStatus(win);
70
71 function showReg()
72 {
73         document.js.add('/scripting/client/regedit.js');
74
75         var regWin = new QxWindow("Registry Editor");
76         regWin._onclosebuttonclick = function(e)
77         {
78                 this.close();
79                 e.stopPropagation();
80                 document.js.remove('/scripting/client/regedit.js');
81         };
82         with(regWin) {
83                 setTop(100);
84                 setLeft(100);
85                 setMinWidth(450);
86                 setMinHeight(450);
87         }
88         
89         var regedit = regedit_widget("ncalrpc:");
90         regWin.add(regedit);
91         w.add(regWin);
92         regWin.setVisible('true');
93 }
94
95 function clientContextMenu(e)
96 {
97         var aboutCmd = new QxCommand();
98         aboutCmd.addEventListener("execute", function() {
99                 showMessage("SWAT, the Samba Web Administration Tool.<br/>This tool is currently under development.");
100         });
101
102         var newWin = new QxCommand();
103         newWin.addEventListener("execute", blankW);
104
105         var cmenu = new QxMenu;
106
107         var sub1 = new QxMenuButton("About SWAT", null, aboutCmd);
108         var sep = new QxMenuSeparator();
109         var sub2 = new QxMenuButton("New Window", null, newWin);
110
111         cmenu.add(sub1, sep, sub2);
112
113         cmenu.setLeft(e.getClientX());
114         cmenu.setTop(e.getClientY());
115         w.add(cmenu);
116         cmenu.setVisible(true);
117 }
118
119 function windowContextMenu(t, e)
120 {
121         var WinWin = new QxCommand();
122         WinWin.addEventListener("execute", function() {
123                 var blank = new QxWindow();
124                 t.add(blank);
125                 blank.setVisible(true);
126         }); 
127
128         var inset = new QxMenu;
129         var sub1 = new QxMenuButton("Open window in a window", null, WinWin);
130
131         inset.add(sub1);
132         t.add(inset)
133
134         inset.setVisible(true);
135 }
136
137 function startMenu() 
138 {
139         var sMenu = new QxMenu;
140         with(sMenu) {
141                 setWidth(150);
142                 setHeight(150);
143         }
144
145         var srvMenu = new QxMenu;
146         var srv1 = new QxMenuButton("LDAP Server", null);
147         var srv2 = new QxMenuButton("CDAP Server", null);
148         var srv3 = new QxMenuButton("RPC Server", null);
149         var srv4 = new QxMenuButton("NBT Server", null);
150         var srv5 = new QxMenuButton("WINS Server", null);
151         var srv6 = new QxMenuButton("Kerberos Server", null);
152         srvMenu.add(srv1, srv2, srv3, srv4, srv5, srv6);
153         w.add(srvMenu);
154         srvMenu.setVisible(false);
155
156         var editReg = new QxCommand;
157         editReg.addEventListener("execute", function() {
158                 showReg();
159         });
160
161         var espMenu = new QxMenu;
162         var esp1 = new QxMenuButton("Registry Editor", null, editReg);
163         espMenu.add(esp1);
164         w.add(espMenu);
165         espMenu.setVisible(false);
166
167         var opt1 = new QxMenuButton("Servers", null)
168         opt1.addEventListener("mouseover", function() {
169                 srvMenu.setVisible(true);
170                 srvMenu.setLeft(this.getComputedPageBoxRight() + 4);
171                 srvMenu.setTop(this.getComputedPageBoxTop() - 3);
172                 if (espMenu.getVisible()) {
173                         espMenu.setVisible(false);
174                 } else if (newMenu.getVisible()) {
175                         newMenu.setVisible(false);
176                 }
177         }); 
178
179         var openWin = new QxCommand;
180         openWin.addEventListener("execute", function() {
181                 blankW();
182         });
183
184         var newMenu = new QxMenu;
185         var new1 = new QxMenuButton("Window", null, openWin);
186         newMenu.add(new1);
187         w.add(newMenu);
188         newMenu.setVisible(false);
189
190         var opt2 = new QxMenuButton("Installation", null);
191         var opt3 = new QxMenuButton("Configuration", null);
192         var opt4 = new QxMenuButton("ESP Tests", null);
193         opt4.addEventListener("mouseover", function() {
194                 espMenu.setVisible(true);
195                 espMenu.setLeft(this.getComputedPageBoxRight() + 4);
196                 espMenu.setTop(this.getComputedPageBoxTop() - 3);
197                 if (srvMenu.getVisible()) {
198                         srvMenu.setVisible(false);
199                 } else if (newMenu.getVisible()) {
200                         newMenu.setVisible(false);
201                 }
202         }); 
203         var opt5 = new QxMenuButton("Documentation", null);
204         var opt6 = new QxMenuButton("New", null);
205         opt6.addEventListener("mouseover", function() {
206                 newMenu.setVisible(true);
207                 newMenu.setLeft(this.getComputedPageBoxRight() + 4);
208                 newMenu.setTop(this.getComputedPageBoxTop() - 3);
209                 if (srvMenu.getVisible()) {
210                         srvMenu.setVisible(false);
211                 } else if (espMenu.getVisible()) {
212                         espMenu.setVisible(false);
213                 }
214         }); 
215         var sep1 = new QxMenuSeparator();
216         var sep2 = new QxMenuSeparator();
217
218         sMenu.add(opt1, opt2, opt3, sep1, opt4, sep2, opt5, opt6);
219         sMenu.setLeft(0);
220         sMenu.setTop(docY() - 150);
221         w.add(sMenu);
222         sMenu.setVisible(true);
223 }
224 </script>
225
226 <% page_footer(); %>