32
31
* Please visit http://jwchat.sourceforge.net for more information!
35
var jid, pass, register;
34
var jid, pass, register, prio, connect_host, connect_port, connect_secure;
36
35
var jwchats = new Array();
42
function loginCheck(form) { /* check if user want's to register new
44
if (form.jid.value == '') {
45
alert("You need to supply a username");
49
if (form.pass.value == '') {
50
alert("You need to supply a password");
54
if (document.getElementById('tr_server').style.display != 'none') {
55
var val = document.getElementById('server').value;
57
alert("You need to supply a jabber server");
41
/* check if user want's to register new
42
* account and things */
43
function loginCheck(form) {
44
if (form.jid.value == '') {
45
alert("You need to supply a username");
49
if (form.pass.value == '') {
50
alert("You need to supply a password");
54
if (document.getElementById('tr_server').style.display != 'none') {
55
var val = document.getElementById('server').value;
57
alert("You need to supply a jabber server");
64
64
jid = form.jid.value + "@" + JABBERSERVER + "/";
65
if (form.res.value != '')
66
jid += form.res.value;
68
jid += DEFAULTRESOURCE;
65
if (form.res.value != '')
66
jid += form.res.value;
68
jid += DEFAULTRESOURCE;
70
70
if(!isValidJID(jid))
73
if (jwchats[jid] && !jwchats[jid].closed) {
73
if (jwchats[jid] && !jwchats[jid].closed) {
78
78
pass = form.pass.value;
79
register = form.register.checked;
81
jwchats[jid] = window.open('jwchat.html',makeWindowName(jid),'width=180,height=390,resizable=yes');
79
register = form.register.checked;
81
prio = form.prio[form.prio.selectedIndex].value;
83
connect_port = form.connect_port.value;
84
connect_host = form.connect_host.value;
85
connect_secure = form.connect_secure.checked;
87
jwchats[jid] = window.open('jwchat.html',makeWindowName(jid),'width=180,height=390,resizable=yes');
86
92
function toggleMoreOpts(show) {
88
document.getElementById('showMoreOpts').style.display = 'none';
89
document.getElementById('showLessOpts').style.display = '';
91
document.getElementById('showLessOpts').style.display = 'none';
92
document.getElementById('showMoreOpts').style.display = '';
95
var rows = document.getElementById('lTable').getElementsByTagName('TBODY').item(0).getElementsByTagName('TR');
97
for (var i=0; i<rows.length; i++) {
98
if (rows[i].className == 'moreOpts') {
100
rows[i].style.display = '';
102
rows[i].style.display = 'none';
94
document.getElementById('showMoreOpts').style.display = 'none';
95
document.getElementById('showLessOpts').style.display = '';
97
document.getElementById('showLessOpts').style.display = 'none';
98
document.getElementById('showMoreOpts').style.display = '';
101
var rows = document.getElementById('lTable').getElementsByTagName('TBODY').item(0).getElementsByTagName('TR');
103
for (var i=0; i<rows.length; i++) {
104
if (rows[i].className == 'moreOpts') {
106
rows[i].style.display = '';
108
rows[i].style.display = 'none';
114
function serverSelected() {
115
var oSel = document.getElementById('server');
116
var servers_allowed = BACKENDS[bs.selectedIndex].servers_allowed;
120
/* change format of servers_allowed to be able to associate connect
121
* host information to it
108
125
function backendSelected() {
110
var bs = document.getElementById('backend_selector');
111
var servers_allowed, default_server;
113
servers_allowed = BACKENDS[bs.selectedIndex].servers_allowed;
114
default_server = BACKENDS[bs.selectedIndex].default_server;
115
if (BACKENDS[bs.selectedIndex].description)
116
document.getElementById('backend_description').innerHTML = BACKENDS[bs.selectedIndex].description;
117
HTTPBASE = BACKENDS[bs.selectedIndex].httpbase;
118
BACKEND_TYPE = BACKENDS[bs.selectedIndex].type;
120
servers_allowed = BACKENDS[0].servers_allowed;
121
default_server = BACKENDS[0].default_server;
122
HTTPBASE = BACKENDS[0].httpbase;
123
BACKEND_TYPE = BACKENDS[0].type;
127
|| servers_allowed.length == 0)
129
var tr_server = document.getElementById('tr_server');
131
var input = document.createElement('input');
132
input.setAttribute("type","text");
133
input.setAttribute("id","server");
134
input.setAttribute("name","server");
135
input.setAttribute("tabindex","2");
136
input.className = 'input_text';
139
input.setAttribute("value",default_server);
141
var td = tr_server.getElementsByTagName('td').item(0);
142
for (var i=0; i<td.childNodes.length; i++)
143
td.removeChild(td.childNodes.item(i));
145
td.appendChild(input);
147
tr_server.style.display = '';
149
else if (servers_allowed.length == 1) {
150
document.getElementById('tr_server').style.display = 'none'
151
JABBERSERVER = servers_allowed[0];
152
} else { // create selectbox
153
var tr_server = document.getElementById('tr_server');
155
var oSelect = document.createElement('select');
156
oSelect.setAttribute('id','server');
157
oSelect.setAttribute('name','server');
158
oSelect.setAttribute('tabindex',"2");
160
var td = tr_server.getElementsByTagName('td').item(0);
161
for (var i=0; i<td.childNodes.length; i++)
162
td.removeChild(td.childNodes.item(i));
164
td.appendChild(oSelect);
166
for (var i in servers_allowed) {
167
if (typeof(servers_allowed[i]) == 'undefined')
169
oSelect.options.add(new Option(servers_allowed[i],servers_allowed[i]));
172
tr_server.style.display = '';
126
var bs = document.getElementById('backend_selector');
127
var servers_allowed, default_server;
129
servers_allowed = BACKENDS[bs.selectedIndex].servers_allowed;
130
default_server = BACKENDS[bs.selectedIndex].default_server;
131
if (BACKENDS[bs.selectedIndex].description)
132
document.getElementById('backend_description').innerHTML = BACKENDS[bs.selectedIndex].description;
133
HTTPBASE = BACKENDS[bs.selectedIndex].httpbase;
134
BACKEND_TYPE = BACKENDS[bs.selectedIndex].type;
136
servers_allowed = BACKENDS[0].servers_allowed;
137
default_server = BACKENDS[0].default_server;
138
HTTPBASE = BACKENDS[0].httpbase;
139
BACKEND_TYPE = BACKENDS[0].type;
143
|| servers_allowed.length == 0)
145
var tr_server = document.getElementById('tr_server');
147
var input = document.createElement('input');
148
input.setAttribute("type","text");
149
input.setAttribute("id","server");
150
input.setAttribute("name","server");
151
input.setAttribute("tabindex","2");
152
input.className = 'input_text';
155
input.setAttribute("value",default_server);
157
var td = tr_server.getElementsByTagName('td').item(0);
158
for (var i=0; i<td.childNodes.length; i++)
159
td.removeChild(td.childNodes.item(i));
161
td.appendChild(input);
163
tr_server.style.display = '';
165
document.getElementById('connect_port').disabled = false;
166
document.getElementById('connect_host').disabled = false;
167
document.getElementById('connect_secure').disabled = false;
169
else if (servers_allowed.length == 1) {
170
document.getElementById('tr_server').style.display = 'none';
171
JABBERSERVER = servers_allowed[0];
172
document.getElementById('connect_port').disabled = true;
173
document.getElementById('connect_host').disabled = true;
174
document.getElementById('connect_secure').disabled = true;
175
} else { // create selectbox
176
var tr_server = document.getElementById('tr_server');
178
var oSelect = document.createElement('select');
179
oSelect.setAttribute('id','server');
180
oSelect.setAttribute('name','server');
181
oSelect.setAttribute('tabindex',"2");
182
oSelect.onchange = serverSelected;
184
var td = tr_server.getElementsByTagName('td').item(0);
185
for (var i=0; i<td.childNodes.length; i++)
186
td.removeChild(td.childNodes.item(i));
188
td.appendChild(oSelect);
190
for (var i=0; i<servers_allowed.length; i++) {
191
if (typeof(servers_allowed[i]) == 'undefined')
193
oSelect.options.add(new Option(servers_allowed[i],servers_allowed[i]));
196
tr_server.style.display = '';
197
document.getElementById('connect_port').disabled = true;
198
document.getElementById('connect_host').disabled = true;
199
document.getElementById('connect_secure').disabled = true;
178
203
function init() {
179
204
var welcome = "Welcome to JWChat at "+SITENAME;
180
205
document.title = welcome;
181
206
document.getElementById("welcomeh1").innerHTML = welcome;
183
// create backend chooser - if any
184
if (typeof(BACKENDS) == 'undefined' || BACKENDS.length == 0) {
186
} else if (BACKENDS.length == 1) {
190
var oSelect = document.createElement('select');
191
oSelect.setAttribute('id','backend_selector');
192
oSelect.setAttribute('name','backend');
193
oSelect.setAttribute('tabindex',"1");
194
oSelect.onchange = backendSelected;
196
var tr = document.createElement('tr');
197
var td = tr.appendChild(document.createElement('th'));
198
var label = td.appendChild(document.createElement('label'));
199
label.setAttribute('for','backend_selector');
200
label.appendChild(document.createTextNode("Choose Backend"));
202
tr.appendChild(document.createElement('td')).appendChild(oSelect);
204
var tr_server = document.getElementById('tr_server');
205
tr_server.parentNode.insertBefore(tr,tr_server);
207
tr = document.createElement('tr');
208
td = tr.appendChild(document.createElement('td'));
209
td = document.createElement('td');
210
td.setAttribute('id','backend_description');
211
td.className= 'desc';
214
tr_server.parentNode.insertBefore(tr,tr_server);
216
for (var i in BACKENDS) {
217
if (typeof(BACKENDS[i]) == 'undefined')
219
var oOption = new Option(BACKENDS[i].name,BACKENDS[i].httpbase);
220
oOption.setAttribute('description',BACKENDS[i].description);
221
oSelect.options[i] = oOption;
226
document.forms[0].jid.focus();
227
document.getElementById('login_button').disabled = false;
208
// create backend chooser - if any
209
if (typeof(BACKENDS) == 'undefined' || BACKENDS.length == 0) {
211
} else if (BACKENDS.length == 1) {
215
var oSelect = document.createElement('select');
216
oSelect.setAttribute('id','backend_selector');
217
oSelect.setAttribute('name','backend');
218
oSelect.setAttribute('tabindex',"1");
219
oSelect.onchange = backendSelected;
221
var tr = document.createElement('tr');
222
var td = tr.appendChild(document.createElement('th'));
223
var label = td.appendChild(document.createElement('label'));
224
label.setAttribute('for','backend_selector');
225
label.appendChild(document.createTextNode("Choose Backend"));
227
tr.appendChild(document.createElement('td')).appendChild(oSelect);
229
var tr_server = document.getElementById('tr_server');
230
tr_server.parentNode.insertBefore(tr,tr_server);
232
tr = document.createElement('tr');
233
td = tr.appendChild(document.createElement('td'));
234
td = document.createElement('td');
235
td.setAttribute('id','backend_description');
236
td.className= 'desc';
239
tr_server.parentNode.insertBefore(tr,tr_server);
241
for (var i=0; i<BACKENDS.length; i++) {
242
if (typeof(BACKENDS[i]) == 'undefined')
244
var oOption = new Option(BACKENDS[i].name,BACKENDS[i].httpbase);
245
oOption.setAttribute('description',BACKENDS[i].description);
246
oSelect.options[i] = oOption;
251
document.forms[0].jid.focus();
252
document.getElementById('chars_prohibited').innerHTML = prohibited;
253
if (typeof(DEFAULTRESOURCE) != 'undefined' && DEFAULTRESOURCE)
254
document.forms[0].res.value = DEFAULTRESOURCE;
256
document.getElementById('login_button').disabled = false;
234
263
<style type="text/css">
237
background-color: white;
246
a { color: #2a3847; }
254
h2 { padding-top: 0px; margin-top: 0px; }
257
border-bottom: 1px solid #2a3847;
261
font-variant: small-caps;
267
border: 1px solid #2a3847;
270
input:focus, input:hover {
271
background-color: #f9fae1;
267
background-color: white;
276
a { color: #2a3847; }
284
h2 { padding-top: 0px; margin-top: 0px; }
287
border-bottom: 1px solid #2a3847;
291
font-variant: small-caps;
297
border: 1px solid #2a3847;
300
input:focus, input:hover {
301
background-color: #f9fae1;
274
304
.toggleOpts { cursor: pointer; }
293
border-top:1px solid #2a3847;
298
border: 2px solid #2a3847;
299
-moz-border-radius: 8px;
301
background-color: #81addc;
323
border-top:1px solid #2a3847;
328
border: 2px solid #2a3847;
329
-moz-border-radius: 8px;
331
background-color: #81addc;
308
<table width="100%" height="100%">
310
<td align=center id='td_top'>
314
<h1 id="welcomeh1">Welcome to JWChat</h1>
315
<h2>A web-based Jabber<sup><small>®</small></sup> client</h2>
321
<form name="login" onSubmit="return loginCheck(this);">
323
<td height="100%" align=center valign=top id='td_form'>
324
<table border=0 cellspacing=0 cellpadding=2 id="lTable" align=center width=380>
326
<td colspan=2><h3>Login<img src="images/available.gif" width=16 height=16></h3></td>
328
<tr id="tr_server" style="display:none;">
329
<th title="Select Jabber server to connect to"><label for='server'>Server</label></th>
333
<th class='form_spacer'><label for='jid'>Username</label></td>
334
<td class='form_spacer' width="100%"><input type="text" id='jid' name="jid" tabindex=3 class='input_text'></td>
336
<tr><td> </td><td nowrap class="desc">Username must not contain: <script>document.write(prohibited)</script></td></tr>
338
<th><label for='pass'>Password</label></th>
339
<td><input type="password" id='pass' name="pass" tabindex=4 class='input_text'></td>
341
<tr><td> </td><td><input type=checkbox name=register id=register> <label for="register">Register New Account</label></td></tr>
342
<tr id="showMoreOpts" class="toggleOpts">
344
<td onClick="return toggleMoreOpts(1);"><img src="images/group_close.gif" title="Show More Options"> Show More Options</td>
346
<tr id="showLessOpts" class="toggleOpts" style="display:none;">
348
<td onClick="return toggleMoreOpts(0);"><img src="images/group_open.gif" title="Show Less Options"> Show Less Options</td>
350
<tr class="moreOpts" style="display:none;">
351
<th><label for='res'>Resource</label></th>
352
<td><input type="text" id='res' name="res" class='input_text'></td>
354
<tr class="moreOpts" style="display:none;">
355
<th><label for='prio'>Priority</label></th>
356
<td><input type="text" id='prio' name="prio" class='input_text' disabled></td>
359
<tr><td> </td><td><button type="submit" id='login_button' tabindex=5 disabled>Login</button></td></tr>
366
<a href="http://sourceforge.net/donate/index.php?group_id=92011"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" border="0" alt="Support This Project" align=right /></a>
367
For details please visit <a href="http://jwchat.sourceforge.net">JWChat's Homepage</a>.
369
© 2003-2005 <a href="mailto:steve@zeank.in-berlin.de">Stefan Strigler</a> -
370
<!-- Created: Wed Feb 5 15:19:17 CET 2003 -->
372
Last modified: Fri May 20 15:10:14 CEST 2005
338
<table width="100%" height="100%">
340
<td align=center id='td_top'>
344
<h1 id="welcomeh1">Welcome to JWChat</h1>
345
<h2>A web-based Jabber<sup><small>®</small></sup> client</h2>
351
<form name="login" onSubmit="return loginCheck(this);">
353
<td height="100%" align=center valign=top id='td_form'>
354
<table border=0 cellspacing=0 cellpadding=2 id="lTable" align=center width=380>
356
<td colspan=2><h3>Login<img src="images/available.gif" width=16 height=16></h3></td>
358
<tr id="tr_server" style="display:none;">
359
<th title="Select Jabber server to connect to"><label for='server'>Server</label></th>
363
<th class='form_spacer'><label for='jid'>Username</label></th>
364
<td class='form_spacer' width="100%"><input type="text" id='jid' name="jid" tabindex=3 class='input_text'></td>
366
<tr><td> </td><td nowrap class="desc">Username must not contain: <span id='chars_prohibited'></span></td></tr>
368
<th><label for='pass'>Password</label></th>
369
<td><input type="password" id='pass' name="pass" tabindex=4 class='input_text'></td>
371
<tr><td> </td><td><input type=checkbox name=register id=register> <label for="register">Register New Account</label></td></tr>
372
<tr id="showMoreOpts" class="toggleOpts">
374
<td onClick="return toggleMoreOpts(1);"><img src="images/group_close.gif" title="Show More Options"> Show More Options</td>
376
<tr id="showLessOpts" class="toggleOpts" style="display:none;">
378
<td onClick="return toggleMoreOpts(0);"><img src="images/group_open.gif" title="Show Less Options"> Show Less Options</td>
380
<tr class="moreOpts" style="display:none;">
381
<th><label for='res'>Resource</label></th>
382
<td><input type="text" id="res" name="res" class="input_text"></td>
384
<tr class="moreOpts" style="display:none;">
385
<th><label for='prio'>Priority</label></th>
387
<select type="text" id="prio" name="prio" class="input_text" size="1">
388
<option value="0">low</option>
389
<option value="10" selected>medium</option>
390
<option value="100">high</option>
394
<tr class="moreOpts" style="display: none;">
395
<th class="form_spacer"><label for="connect_port">Port</th>
396
<td class="form_spacer"><input type="text" name="connect_port" id="connect_port" class="input_text" disabled></td>
398
<tr class="moreOpts" style="display: none;">
399
<th><label for="connect_host">Connect Host</th>
400
<td><input type="text" name="connect_host" id="connect_host" class="input_text" disabled></td>
402
<tr class="moreOpts" style="display: none;">
404
<td><input type="checkbox" name="connect_secure" id="connect_secure" class="input_text" disabled> <label for="connect_secure" title="Advise connection manager to connect through SSL" disabled>Allow secure conncetions only</td>
407
<tr><td> </td><td><button type="submit" id='login_button' tabindex=5 disabled>Login</button></td></tr>
414
<a href="http://sourceforge.net/donate/index.php?group_id=92011"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" border="0" alt="Support This Project" align=right /></a>
415
For details please visit <a href="http://jwchat.sourceforge.net">JWChat's Homepage</a>.
417
© 2003-2005 <a href="mailto:steve@zeank.in-berlin.de">Stefan Strigler</a> -
418
<!-- Created: Wed Feb 5 15:19:17 CET 2003 -->
420
Last modified: Fri Jan 19 14:26:00 CET 2007
373
421
<!-- hhmts end -->