Skip to content

Commit 1ac4ff4

Browse files
committed
replaced the ajax alert messages for failed ajax requests with a central alert function.
1 parent c827cef commit 1ac4ff4

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

interface/web/js/scrigo.js.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,21 @@
66

77
redirect = '';
88

9+
function reportError(request) {
10+
/* Error reporting is disabled by default as some browsers like safari
11+
sometimes throw errors when a ajax request is delayed even if the
12+
ajax request worked. */
13+
14+
/*alert(request);*/
15+
}
16+
917
function loadContentRefresh(pagename) {
1018
var pageContentCallbackRefresh = {
1119
success: function(o) {
1220
document.getElementById('pageContent').innerHTML = o.responseText;
1321
},
1422
failure: function(o) {
15-
alert('Ajax Request was not successful.'+pagename);
23+
reportError('Ajax Request was not successful.'+pagename);
1624
}
1725
}
1826

@@ -36,7 +44,7 @@ function capp(module) {
3644
loadMenus();
3745
},
3846
failure: function(o) {
39-
alert('Ajax Request was not successful.');
47+
reportError('Ajax Request was not successful.'+module);
4048
}
4149
}
4250
var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback);
@@ -61,7 +69,7 @@ function submitLoginForm(formname) {
6169
loadMenus();
6270
},
6371
failure: function(o) {
64-
alert('Ajax Request was not successful.');
72+
reportError('Ajax Request was not successful.110');
6573
}
6674
}
6775

@@ -105,7 +113,7 @@ function submitForm(formname,target) {
105113
},
106114
failure: function(o) {
107115
var parts = o.responseText.split(':');
108-
alert('Ajax Request was not successful.');
116+
reportError('Ajax Request was not successful. 111');
109117
}
110118
}
111119

@@ -145,7 +153,7 @@ function submitUploadForm(formname,target) {
145153
}
146154
},
147155
failure: function(o) {
148-
alert('Ajax Request was not successful.');
156+
reportError('Ajax Request was not successful. 112');
149157
}
150158
}
151159

@@ -173,7 +181,7 @@ function loadContent(pagename) {
173181
}
174182
},
175183
failure: function(o) {
176-
alert('Ajax Request was not successful.');
184+
reportError('Ajax Request was not successful. 113');
177185
}
178186
}
179187

@@ -207,7 +215,7 @@ function loadInitContent() {
207215
*/
208216
},
209217
failure: function(o) {
210-
alert('Ajax Request was not successful.');
218+
reportError('Ajax Request was not successful. 114');
211219
}
212220
}
213221

@@ -252,7 +260,7 @@ function loadMenus() {
252260
document.getElementById('sideNav').innerHTML = o.responseText;
253261
},
254262
failure: function(o) {
255-
alert('Ajax Request was not successful.');
263+
reportError('Ajax Request was not successful. 115');
256264
}
257265
}
258266

@@ -263,7 +271,7 @@ function loadMenus() {
263271
document.getElementById('topNav').innerHTML = o.responseText;
264272
},
265273
failure: function(o) {
266-
alert('Ajax Request was not successful.');
274+
reportError('Ajax Request was not successful. 116');
267275
}
268276
}
269277

@@ -276,13 +284,6 @@ function changeTab(tab,target) {
276284
document.pageForm.next_tab.value = tab;
277285
submitForm('pageForm',target);
278286
}
279-
280-
281-
282-
function reportError(request)
283-
{
284-
alert('Sorry. There was an error.');
285-
}
286287

287288
function del_record(link,confirmation) {
288289
if(window.confirm(confirmation)) {
@@ -296,7 +297,7 @@ function loadContentInto(elementid,pagename) {
296297
document.getElementById(elementid).innerHTML = o.responseText;
297298
},
298299
failure: function(o) {
299-
alert('Ajax Request was not successful.');
300+
reportError('Ajax Request was not successful. 118');
300301
}
301302
}
302303

@@ -320,7 +321,7 @@ function loadOptionInto(elementid,pagename) {
320321
}
321322
},
322323
failure: function(o) {
323-
alert('Ajax Request was not successful.');
324+
reportError('Ajax Request was not successful. 119');
324325
}
325326
}
326327
var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);
@@ -332,7 +333,7 @@ function keepalive() {
332333
setTimeout( keepalive, 1000000 );
333334
},
334335
failure: function(o) {
335-
alert('Sorry. There was an error.');
336+
reportError('Session expired. Please login again.');
336337
}
337338
}
338339

0 commit comments

Comments
 (0)