ee4290f234c5c53dc06be697caa06589f81a8fa4
[samba.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 function showContextMenu(e)
55 {
56         var aboutCmd = new QxCommand();
57         aboutCmd.addEventListener("execute", function() {
58                 showMessage("SWAT, the Samba Web Administration Tool.<br/>This tool is currently under development.");
59         });
60
61         var newWin = new QxCommand();
62         newWin.addEventListener("execute", blankW);
63
64         cmenu = new QxMenu;
65
66         var sub1 = new QxMenuButton("About SWAT", null, aboutCmd);
67         var sep = new QxMenuSeparator();
68         var sub2 = new QxMenuButton("New Window", null, newWin);
69
70         cmenu.add(sub1, sep, sub2);
71
72         cmenu.setLeft(e.getClientX());
73         cmenu.setTop(e.getClientY());
74         w.add(cmenu);
75         cmenu.setVisible(true);
76 }
77
78 // Always open with stats
79 var win = new QxWindow();
80 document.js.add('/scripting/client/status.js');
81 win._onclosebuttonclick = function(e)
82 {
83         this.close();
84         e.stopPropagation();
85         document.js.remove('/scripting/client/status.js');
86 };
87 with(win) {
88         setTop(50);
89         setRight(50);
90         setHeight(175);
91 }
92 w.add(win);
93 getServerStatus(win);
94
95 function showReg()
96 {
97         document.js.add('/scripting/client/regedit.js');
98
99         var regWin = new QxWindow("Registry Editor");
100         regWin._onclosebuttonclick = function(e)
101         {
102                 this.close();
103                 e.stopPropagation();
104                 document.js.remove('/scripting/client/regedit.js');
105         };
106         with(regWin) {
107                 setTop(100);
108                 setLeft(100);
109                 setMinWidth(450);
110                 setMinHeight(450);
111         }
112         
113         var regedit = regedit_widget("ncalrpc:");
114         regWin.add(regedit);
115         w.add(regWin);
116         regWin.setVisible('true');
117 }
118
119 function startMenu() 
120 {
121         var sMenu = new QxMenu;
122         with(sMenu) {
123                 setWidth(150);
124                 setHeight(150);
125         }
126
127         var srvMenu = new QxMenu;
128         var srv1 = new QxMenuButton("LDAP Server", null);
129         var srv2 = new QxMenuButton("CDAP Server", null);
130         var srv3 = new QxMenuButton("RPC Server", null);
131         var srv4 = new QxMenuButton("NBT Server", null);
132         var srv5 = new QxMenuButton("WINS Server", null);
133         var srv6 = new QxMenuButton("Kerberos Server", null);
134         srvMenu.add(srv1, srv2, srv3, srv4, srv5, srv6);
135         w.add(srvMenu);
136         srvMenu.setVisible(false);
137
138         var editReg = new QxCommand;
139         editReg.addEventListener("execute", function() {
140                 showReg();
141         });
142
143         var espMenu = new QxMenu;
144         var esp1 = new QxMenuButton("Registry Editor", null, editReg);
145         espMenu.add(esp1);
146         w.add(espMenu);
147         espMenu.setVisible(false);
148
149         var opt1 = new QxMenuButton("Servers", null)
150         opt1.addEventListener("mouseover", function() {
151                 srvMenu.setVisible(true);
152                 srvMenu.setLeft(this.getComputedPageBoxRight() + 4);
153                 srvMenu.setTop(this.getComputedPageBoxTop() - 3);
154                 if (espMenu.getVisible()) {
155                         espMenu.setVisible(false);
156                 } else if (newMenu.getVisible()) {
157                         newMenu.setVisible(false);
158                 }
159         }); 
160
161         var openWin = new QxCommand;
162         openWin.addEventListener("execute", function() {
163                 blankW();
164         });
165
166         var newMenu = new QxMenu;
167         var new1 = new QxMenuButton("Window", null, openWin);
168         newMenu.add(new1);
169         w.add(newMenu);
170         newMenu.setVisible(false);
171
172         var opt2 = new QxMenuButton("Installation", null);
173         var opt3 = new QxMenuButton("Configuration", null);
174         var opt4 = new QxMenuButton("ESP Tests", null);
175         opt4.addEventListener("mouseover", function() {
176                 espMenu.setVisible(true);
177                 espMenu.setLeft(this.getComputedPageBoxRight() + 4);
178                 espMenu.setTop(this.getComputedPageBoxTop() - 3);
179                 if (srvMenu.getVisible()) {
180                         srvMenu.setVisible(false);
181                 } else if (newMenu.getVisible()) {
182                         newMenu.setVisible(false);
183                 }
184         }); 
185         var opt5 = new QxMenuButton("Documentation", null);
186         var opt6 = new QxMenuButton("New", null);
187         opt6.addEventListener("mouseover", function() {
188                 newMenu.setVisible(true);
189                 newMenu.setLeft(this.getComputedPageBoxRight() + 4);
190                 newMenu.setTop(this.getComputedPageBoxTop() - 3);
191                 if (srvMenu.getVisible()) {
192                         srvMenu.setVisible(false);
193                 } else if (espMenu.getVisible()) {
194                         espMenu.setVisible(false);
195                 }
196         }); 
197         var sep1 = new QxMenuSeparator();
198         var sep2 = new QxMenuSeparator();
199
200         sMenu.add(opt1, opt2, opt3, sep1, opt4, sep2, opt5, opt6);
201         sMenu.setLeft(0);
202         sMenu.setTop(docY() - 150);
203         w.add(sMenu);
204         sMenu.setVisible(true);
205 }
206 </script>
207
208 <% page_footer(); %>