Subversion Repositories ALCASAR

Rev

Rev 528 | Rev 764 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 528 Rev 537
Line 2... Line 2...
2
chilliController.host = "alcasar";
2
chilliController.host = "alcasar";
3
chilliController.port = 3990;
3
chilliController.port = 3990;
4
chilliController.onUpdate = updateUI ;
4
chilliController.onUpdate = updateUI ;
5
chilliController.onError  = handleError ;
5
chilliController.onError  = handleError ;
6
chilliClock.onTick = function () { }
6
chilliClock.onTick = function () { }
-
 
7
 
7
var isloggedout = false;
8
var isloggedout = false;
8
 
9
 
9
if (!window.queryObj) {
10
if (!window.queryObj) {
10
    window.queryObj = new Object();
11
    window.queryObj = new Object();
11
    window.location.search.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"), function($0,$1,$2,$3) { queryObj[$1] = $3; });
12
    window.location.search.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"), function($0,$1,$2,$3) { queryObj[$1] = $3; });
Line 101... Line 102...
101
function handleError( code ) {
102
function handleError( code ) {
102
    clearTimeout(delayTimer);
103
    clearTimeout(delayTimer);
103
    //showErrorPage(code);
104
    //showErrorPage(code);
104
}
105
}
105
 
106
 
106
/* Action triggered when buttons are pressed */
-
 
107
function connect() {
-
 
108
    var username =  document.getElementById('username').value ;
-
 
109
    var password =  document.getElementById('password').value ;
-
 
110
 
-
 
111
    if (username == null || username == '')
-
 
112
	return setElementValue('logonMessage', 'Username is required');
-
 
113
    
-
 
114
    showWaitPage(1000);
-
 
115
    chilliController.logon( username , password ) ;
-
 
116
}
-
 
117
 
-
 
118
function disconnect() {
-
 
119
    if (confirm("Are you sure you want to disconnect now?")) {
-
 
120
	chilliClock.stop();
-
 
121
	showWaitPage(1000);
-
 
122
	chilliController.logoff();
-
 
123
    }
-
 
124
    return false;
-
 
125
}
-
 
126
 
-
 
127
/* User interface pages update */
107
/* User interface pages update */
128
function showLoggedOutPage() {
108
function showLoggedOutPage() {
129
	isloggedout = true;
109
	isloggedout = true;
130
    showPage("loggedOutPage");
110
    showPage("loggedOutPage");
131
    hidePage("statusPage");
111
    hidePage("statusPage");
Line 211... Line 191...
211
    hidePage("waitPage");
191
    hidePage("waitPage");
212
    showPage("errorPage");
192
    showPage("errorPage");
213
    setElementValue("errorMessage", str);
193
    setElementValue("errorMessage", str);
214
}
194
}
215
 
195
 
-
 
196
function closePopup(){
-
 
197
	this.focus();
-
 
198
	self.opener=this;
-
 
199
	self.close();
-
 
200
}
-
 
201
function alcasarLogoff(){
-
 
202
	if (isloggedout == false){
-
 
203
  		chilliClock.stop();
-
 
204
		chilliController.logoff();
-
 
205
	}
-
 
206
	showWaitPage(1000);
-
 
207
	isloggedout = true;
-
 
208
}
-
 
209
function logout() {
-
 
210
	alcasarLogoff();
-
 
211
	window.setTimeout("closePopup()",1000);
-
 
212
}
-
 
213
function logoutWithConfirmation(msg) {
-
 
214
	if (confirm(msg)) {
-
 
215
		logout();
-
 
216
	}
-
 
217
return false;
-
 
218
}
-
 
219
	
216
var chillijsWindowOnLoad = window.onload;
220
var chillijsWindowOnLoad = window.onload;
217
var delayTimer; // global reference to delayTimer
221
var delayTimer; // global reference to delayTimer
218
 
222
 
219
window.onload = function() {
223
window.onload = function() {
220
    if (chillijsWindowOnLoad) 
224
    if (chillijsWindowOnLoad) 
221
	chillijsWindowOnLoad();
225
	chillijsWindowOnLoad();
222
 
226
 
223
    //var logonForm = document.getElementById('logonForm');
-
 
224
	var logonForm = document.getElementById('loggedOutPage');
-
 
225
 
-
 
226
    var head = document.getElementsByTagName("head")[0];
227
    var head = document.getElementsByTagName("head")[0];
227
    if (head == null) head = document.body;
228
    if (head == null) head = document.body;
228
 
229
 
229
    if (logonForm == null) {
-
 
230
        logonForm = document.getElementById('loginForm');
-
 
231
    }
-
 
232
    showWaitPage(); 
230
    showWaitPage(); 
233
    setTimeout('chilliController.refresh()', 500);
231
    setTimeout('chilliController.refresh()', 500);
234
}
-
 
235
 
232
}
-
 
233
 
-
 
234
// The event window.onbeforeunload doesn't work with some browsers like 'opera' or 'Safari'.
-
 
235
// In the next version of alcasar, 30' without the status window do an automatic logout.
-
 
236
var alcasarOnbeforeUnload = window.onbeforeunload;
-
 
237
 
-
 
238
window.onbeforeunload = function(){
-
 
239
	if (alcasarOnbeforeUnload)
-
 
240
		alcasarOnbeforeUnload();
-
 
241
	alcasarLogoff();
-
 
242
}
-
 
243