summaryrefslogtreecommitdiff
path: root/swat.obsolete/desktop/index.esp
blob: 1dee4d3bb4c8547d6536d197c8bf13bff7c5b39c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<% 
libinclude("base.js");
	page_header("desktop", "Virtual Desktop Design Test", "desktop");
%>

<script type="text/javascript" src="/scripting/client/encoder.js"></script>
<script type="text/javascript" src="/scripting/client/call.js"></script>
<script type="text/javascript" src="/scripting/client/js_scripts.js"></script>
<script type="text/javascript" src="/scripting/client/desktop.js"></script>
<script type="text/javascript" src="/scripting/client/status.js"></script>
<script type="text/javascript" src="/scripting/client/regedit.js"></script>

<script type="text/javascript">

function showMessage(m)
{
	var message = new QxWindow();
	with(message) {
		setWidth(300);
		setTop("35%");
		setLeft("35%");
		setShowMaximize(false);
		setShowMinimize(false);
	}

	var note = new QxAtom(m);
	with(note) {
		setTop(10);
		setLeft(10);
	}

	var ok = new QxButton("OK");
	with(ok) {
		setLeft("42%");
		setBottom(2);
	}
	ok.addEventListener("click", function() {
		doc.remove(message);
	});

	message.add(note);
	message.add(ok);
	doc.add(message);
	message.setVisible(true);
}

function blankW()
{
	var blank = new Window.standard('SWAT');
	doc.add(blank);
	blank.setVisible(true);
}

function showReg()
{
	document.js.add('/scripting/client/regedit.js');

	var regWin = new QxWindow("Registry Editor");
	regWin._onclosebuttonclick = function(e)
	{
		this.close();
		e.stopPropagation();
		document.js.remove('/scripting/client/regedit.js');
	};
	with(regWin) {
		setTop(100);
		setLeft(100);
		setMinWidth(450);
		setMinHeight(450);
	}
	
	var regedit = regedit_widget("ncalrpc:");
	regWin.add(regedit);
	doc.add(regWin);
	regWin.setVisible('true');
}

function clientContextMenu(e)
{
	var aboutCmd = new QxCommand();
	aboutCmd.addEventListener("execute", function() {
		showMessage("SWAT, the Samba Web Administration Tool.<br/>This tool is currently under development.");
	});

	var newWin = new QxCommand();
	newWin.addEventListener("execute", blankW);

	var cmenu = new QxMenu;

	var sub1 = new QxMenuButton("About SWAT", null, aboutCmd);
	var sep = new QxMenuSeparator();
	var sub2 = new QxMenuButton("New Window", null, newWin);

	cmenu.add(sub1, sep, sub2);

	cmenu.setLeft(e.getClientX());
	cmenu.setTop(e.getClientY());
	doc.add(cmenu);
	cmenu.setVisible(true);
}

function windowContextMenu(t, e)
{
	var WinWin = new QxCommand();
	WinWin.addEventListener("execute", function() {
		var blank = new QxWindow();
		t.add(blank);
		blank.setVisible(true);
	}); 

	var inset = new QxMenu;
	var sub1 = new QxMenuButton("Open window in a window", null, WinWin);

	inset.add(sub1);
	t.add(inset)

	inset.setVisible(true);
}

function startMenu() 
{
	var sMenu = new QxMenu;
	with(sMenu) {
		setWidth(150);
		setHeight(150);
	}

	var srvMenu = new QxMenu;
	var srv1 = new QxMenuButton("LDAP Server", null);
	var srv2 = new QxMenuButton("CDAP Server", null);
	var srv3 = new QxMenuButton("RPC Server", null);
	var srv4 = new QxMenuButton("NBT Server", null);
	var srv5 = new QxMenuButton("WINS Server", null);
	var srv6 = new QxMenuButton("Kerberos Server", null);
	srvMenu.add(srv1, srv2, srv3, srv4, srv5, srv6);
	doc.add(srvMenu);
	srvMenu.setVisible(false);

	var editReg = new QxCommand;
	editReg.addEventListener("execute", function() {
		showReg();
	});

	var espMenu = new QxMenu;
	var esp1 = new QxMenuButton("Registry Editor", null, editReg);
	espMenu.add(esp1);
	doc.add(espMenu);
	espMenu.setVisible(false);

	var opt1 = new QxMenuButton("Servers", null)
	opt1.addEventListener("mouseover", function() {
		srvMenu.setVisible(true);
		srvMenu.setLeft(this.getComputedPageBoxRight() + 4);
		srvMenu.setTop(this.getComputedPageBoxTop() - 3);
		if (espMenu.getVisible()) {
			espMenu.setVisible(false);
		} else if (newMenu.getVisible()) {
			newMenu.setVisible(false);
		}
	}); 

	var openWin = new QxCommand;
	openWin.addEventListener("execute", function() {
		blankW();
	});

	var newMenu = new QxMenu;
	var new1 = new QxMenuButton("Window", null, openWin);
	newMenu.add(new1);
	doc.add(newMenu);
	newMenu.setVisible(false);

	var opt2 = new QxMenuButton("Installation", null);
	var opt3 = new QxMenuButton("Configuration", null);
	var opt4 = new QxMenuButton("ESP Tests", null);
	opt4.addEventListener("mouseover", function() {
		espMenu.setVisible(true);
		espMenu.setLeft(this.getComputedPageBoxRight() + 4);
		espMenu.setTop(this.getComputedPageBoxTop() - 3);
		if (srvMenu.getVisible()) {
			srvMenu.setVisible(false);
		} else if (newMenu.getVisible()) {
			newMenu.setVisible(false);
		}
	}); 
	var opt5 = new QxMenuButton("Documentation", null);
	var opt6 = new QxMenuButton("New", null);
	opt6.addEventListener("mouseover", function() {
		newMenu.setVisible(true);
		newMenu.setLeft(this.getComputedPageBoxRight() + 4);
		newMenu.setTop(this.getComputedPageBoxTop() - 3);
		if (srvMenu.getVisible()) {
			srvMenu.setVisible(false);
		} else if (espMenu.getVisible()) {
			espMenu.setVisible(false);
		}
	}); 
	var sep1 = new QxMenuSeparator();
	var sep2 = new QxMenuSeparator();

	sMenu.add(opt1, opt2, opt3, sep1, opt4, sep2, opt5, opt6);
	sMenu.setLeft(0);
	sMenu.setTop(docY() - 150);
	doc.add(sMenu);
	sMenu.setVisible(true);
}

function contextMenu(e)
{	
	var t = e.getTarget()
	var tObj = t.getHtmlAttribute("class")

	if (tObj == 'QxClientDocument QxThemeWin9x') {
		clientContextMenu(e);
	} else if (tObj == 'QxWindowPane') {
		windowContextMenu(t, e);
	}
}

window.application.main = function()
{
	doc = this.getClientWindow().getClientDocument();
	doc.addEventListener("contextmenu", contextMenu);

	var bar = new QxMenuBar;
	with (bar) {
		setBottom(0);
		setLeft(0);
		setWidth("100%");
		setHeight(25);
		setBackgroundColor("ThreeDFace");
	}

	var start = new QxMenuButton("START");
	start.addEventListener("click", function() {
		startMenu();
	});
	bar.add(start);

	doc.add(bar);

	// Always open with stats
	var win = new QxWindow();
	document.js.add('/scripting/client/status.js');
	win._onclosebuttonclick = function(e)
	{
		this.close();
		e.stopPropagation();
		document.js.remove('/scripting/client/status.js');
	};
	with(win) {
		setTop(50);
		setRight(50);
		setHeight(175);
	}
	doc.add(win);
	getServerStatus(win);
}
</script>

<% page_footer(); %>