2599 |
25 Aug 14 |
nicklas |
1 |
|
2599 |
25 Aug 14 |
nicklas |
var Reggie = function() |
2599 |
25 Aug 14 |
nicklas |
3 |
{ |
2599 |
25 Aug 14 |
nicklas |
var reggie = {}; |
2599 |
25 Aug 14 |
nicklas |
var internal = {}; |
2801 |
13 Oct 14 |
nicklas |
6 |
|
7446 |
20 Nov 23 |
nicklas |
reggie.VERSION = '4.51-dev'; |
2599 |
25 Aug 14 |
nicklas |
8 |
|
2662 |
12 Sep 14 |
nicklas |
var WELL_ALPHA = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; |
2662 |
12 Sep 14 |
nicklas |
10 |
|
2621 |
01 Sep 14 |
nicklas |
var GENERIC_STRATAGENE_NAME = 'Stratagene.r'; |
2621 |
01 Sep 14 |
nicklas |
12 |
|
2840 |
20 Oct 14 |
nicklas |
var CASENAME_WITH_SUFFIX = /^\d{7}(C|D)?$/; |
2599 |
25 Aug 14 |
nicklas |
var CASENAME = /^\d{7}$/; |
2599 |
25 Aug 14 |
nicklas |
15 |
|
2602 |
27 Aug 14 |
nicklas |
var RCCID_WITH_SUFFIX = /^\d{10}(B|C|D){1}$/; |
6801 |
11 Aug 22 |
nicklas |
var RCCID_NEW_PATTERN = /^\d{4}-\d{8}$/; |
2599 |
25 Aug 14 |
nicklas |
18 |
|
2698 |
25 Sep 14 |
nicklas |
var currentDirectory; |
2698 |
25 Sep 14 |
nicklas |
20 |
|
2599 |
25 Aug 14 |
nicklas |
21 |
/* |
2840 |
20 Oct 14 |
nicklas |
Verify that the 'case' name is a 7-digit value + optional C/D suffix |
2599 |
25 Aug 14 |
nicklas |
23 |
*/ |
6277 |
03 Jun 21 |
nicklas |
reggie.isValidCaseName = function(caseName, allowSuffix) |
2599 |
25 Aug 14 |
nicklas |
25 |
{ |
2599 |
25 Aug 14 |
nicklas |
return caseName.match(allowSuffix ? CASENAME_WITH_SUFFIX : CASENAME); |
2599 |
25 Aug 14 |
nicklas |
27 |
} |
2599 |
25 Aug 14 |
nicklas |
28 |
|
6277 |
03 Jun 21 |
nicklas |
29 |
/** |
6277 |
03 Jun 21 |
nicklas |
Alternate check of 'case' name that supports checking prefixes |
6277 |
03 Jun 21 |
nicklas |
and suffixes. The prefixes and suffixes are inserted into |
6277 |
03 Jun 21 |
nicklas |
the regexp as they are so they should typically be a pipe-separated |
6277 |
03 Jun 21 |
nicklas |
list of values inside parenthesis: (C|D)? |
6277 |
03 Jun 21 |
nicklas |
34 |
*/ |
6277 |
03 Jun 21 |
nicklas |
reggie.checkValidCaseName = function(caseName, prefix, suffix) |
6277 |
03 Jun 21 |
nicklas |
36 |
{ |
6277 |
03 Jun 21 |
nicklas |
var rexp = new RegExp('^'+(prefix||'')+'\\d{7}'+(suffix||'')+'$'); |
6277 |
03 Jun 21 |
nicklas |
return rexp.test(caseName); |
6277 |
03 Jun 21 |
nicklas |
39 |
} |
6277 |
03 Jun 21 |
nicklas |
40 |
|
2602 |
27 Aug 14 |
nicklas |
41 |
/* |
6801 |
11 Aug 22 |
nicklas |
Verify that the RCCID number matches either the |
6801 |
11 Aug 22 |
nicklas |
- new pattern: NNNN-NNNNNNNN where N is a digit |
6801 |
11 Aug 22 |
nicklas |
- old pattern: 10-digit value + 'B', 'C', or 'D' suffix |
2602 |
27 Aug 14 |
nicklas |
45 |
*/ |
2602 |
27 Aug 14 |
nicklas |
reggie.isValidRccidNumber = function(rccidNumber) |
2602 |
27 Aug 14 |
nicklas |
47 |
{ |
6801 |
11 Aug 22 |
nicklas |
return rccidNumber.match(RCCID_NEW_PATTERN) || rccidNumber.match(RCCID_WITH_SUFFIX); |
2602 |
27 Aug 14 |
nicklas |
49 |
} |
2602 |
27 Aug 14 |
nicklas |
50 |
|
2599 |
25 Aug 14 |
nicklas |
51 |
/** |
2602 |
27 Aug 14 |
nicklas |
Check the control digit of the given personal number. |
2602 |
27 Aug 14 |
nicklas |
@pnr The 10-digit personal number in the form YYMMDDXXXX |
2602 |
27 Aug 14 |
nicklas |
54 |
*/ |
2602 |
27 Aug 14 |
nicklas |
reggie.personalNumberControlDigitCheck = function(pnr) |
2602 |
27 Aug 14 |
nicklas |
56 |
{ |
2602 |
27 Aug 14 |
nicklas |
var sum = 0; |
2602 |
27 Aug 14 |
nicklas |
var factor = 2; |
2602 |
27 Aug 14 |
nicklas |
for (var i = 0; i < 9; i++) |
2602 |
27 Aug 14 |
nicklas |
60 |
{ |
2602 |
27 Aug 14 |
nicklas |
var digit = parseInt(pnr.substr(i, 1), 10); |
2602 |
27 Aug 14 |
nicklas |
var tmp = factor * digit; |
2602 |
27 Aug 14 |
nicklas |
sum += tmp >= 10 ? tmp - 9: tmp; |
2602 |
27 Aug 14 |
nicklas |
factor = factor == 2 ? 1 : 2; |
2602 |
27 Aug 14 |
nicklas |
65 |
} |
2602 |
27 Aug 14 |
nicklas |
66 |
|
2602 |
27 Aug 14 |
nicklas |
var control = 10 - (sum % 10); |
2602 |
27 Aug 14 |
nicklas |
if (control == 10) control = 0; |
2602 |
27 Aug 14 |
nicklas |
return (control == parseInt(pnr.substr(9, 1), 10)) |
2602 |
27 Aug 14 |
nicklas |
70 |
} |
2602 |
27 Aug 14 |
nicklas |
71 |
|
2602 |
27 Aug 14 |
nicklas |
72 |
/** |
2599 |
25 Aug 14 |
nicklas |
Autofill a date-string. |
2599 |
25 Aug 14 |
nicklas |
The supplemented date-string will have the format yyyyMMdd when it's returned. |
2599 |
25 Aug 14 |
nicklas |
If the short-date in format MMdd is larger the current date, the year before will be used. |
2599 |
25 Aug 14 |
nicklas |
76 |
|
2599 |
25 Aug 14 |
nicklas |
@param shortDate Date in format 'MMdd' or in 'yyMMdd' |
2599 |
25 Aug 14 |
nicklas |
@param allowSixDigitDates Boolean Flag indicating if 6-digit dates should be auto-filled (default = false). |
2599 |
25 Aug 14 |
nicklas |
79 |
*/ |
2599 |
25 Aug 14 |
nicklas |
reggie.autoFillDate = function(shortDate, allowSixDigitDates) |
2599 |
25 Aug 14 |
nicklas |
81 |
{ |
2599 |
25 Aug 14 |
nicklas |
shortDate = shortDate.replace("-",""); |
2599 |
25 Aug 14 |
nicklas |
var fullDate = shortDate; |
2599 |
25 Aug 14 |
nicklas |
84 |
|
2599 |
25 Aug 14 |
nicklas |
var currentDate = new Date(); |
2599 |
25 Aug 14 |
nicklas |
var currentYear = currentDate.getFullYear(); |
2599 |
25 Aug 14 |
nicklas |
var currentMonth = currentDate.getMonth()+1; |
2599 |
25 Aug 14 |
nicklas |
88 |
|
2599 |
25 Aug 14 |
nicklas |
if (shortDate.length == 4 && Dates.isDate(shortDate, 'MMdd')) |
2599 |
25 Aug 14 |
nicklas |
90 |
{ |
2599 |
25 Aug 14 |
nicklas |
var month = parseInt(shortDate.substring(0, 2), 10); |
2599 |
25 Aug 14 |
nicklas |
var day = parseInt(shortDate.substring(2), 10); |
2599 |
25 Aug 14 |
nicklas |
if ((month > currentMonth) || (month == currentMonth && day > currentDate.getDate())) |
2599 |
25 Aug 14 |
nicklas |
94 |
{ |
2599 |
25 Aug 14 |
nicklas |
currentYear--; |
2599 |
25 Aug 14 |
nicklas |
96 |
} |
2599 |
25 Aug 14 |
nicklas |
fullDate = currentYear+shortDate; |
2599 |
25 Aug 14 |
nicklas |
98 |
} |
2599 |
25 Aug 14 |
nicklas |
else if (allowSixDigitDates && shortDate.length == 6 && Dates.isDate(shortDate, 'yyMMdd')) |
2599 |
25 Aug 14 |
nicklas |
100 |
{ |
2599 |
25 Aug 14 |
nicklas |
var year = parseInt(shortDate.substring(0,2), 10); |
2599 |
25 Aug 14 |
nicklas |
fullDate = ((2000+year) > currentYear ? "19" : "20") + fullDate; |
2599 |
25 Aug 14 |
nicklas |
103 |
} |
2599 |
25 Aug 14 |
nicklas |
return fullDate; |
2599 |
25 Aug 14 |
nicklas |
105 |
} |
2599 |
25 Aug 14 |
nicklas |
106 |
|
2602 |
27 Aug 14 |
nicklas |
reggie.autoFillTime = function(shortTime) |
2602 |
27 Aug 14 |
nicklas |
108 |
{ |
2602 |
27 Aug 14 |
nicklas |
var fullTimeString = shortTime; |
2602 |
27 Aug 14 |
nicklas |
if (shortTime.length==3) |
2602 |
27 Aug 14 |
nicklas |
111 |
{ |
2602 |
27 Aug 14 |
nicklas |
fullTimeString = "0"+shortTime; |
2602 |
27 Aug 14 |
nicklas |
113 |
} |
2602 |
27 Aug 14 |
nicklas |
return fullTimeString; |
2602 |
27 Aug 14 |
nicklas |
115 |
} |
2602 |
27 Aug 14 |
nicklas |
116 |
|
2599 |
25 Aug 14 |
nicklas |
117 |
/** |
2602 |
27 Aug 14 |
nicklas |
Convert a 2-digit year to a 4-digit year. Assuming |
2602 |
27 Aug 14 |
nicklas |
that the short year is between 1 and 100 years old. |
2602 |
27 Aug 14 |
nicklas |
120 |
*/ |
2602 |
27 Aug 14 |
nicklas |
reggie.fullYear = function(shortYear) |
2602 |
27 Aug 14 |
nicklas |
122 |
{ |
2602 |
27 Aug 14 |
nicklas |
var thisYear = new Date().getFullYear(); |
2602 |
27 Aug 14 |
nicklas |
var fullYear = shortYear + 100*Math.floor((thisYear - shortYear - 1) / 100); |
2602 |
27 Aug 14 |
nicklas |
return fullYear; |
2602 |
27 Aug 14 |
nicklas |
126 |
} |
2610 |
28 Aug 14 |
nicklas |
127 |
|
6716 |
29 Apr 22 |
nicklas |
reggie.formatCount = function(count, nullValue) |
3049 |
17 Dec 14 |
nicklas |
129 |
{ |
5802 |
19 Dec 19 |
nicklas |
var unit = ''; |
7392 |
03 Nov 23 |
nicklas |
if (count > 1_000_000_000) |
3049 |
17 Dec 14 |
nicklas |
132 |
{ |
7392 |
03 Nov 23 |
nicklas |
count = count / 1_000_000_000; |
7392 |
03 Nov 23 |
nicklas |
unit = ' G'; |
3049 |
17 Dec 14 |
nicklas |
135 |
} |
7392 |
03 Nov 23 |
nicklas |
else if (count > 1_000_000) |
7392 |
03 Nov 23 |
nicklas |
137 |
{ |
7392 |
03 Nov 23 |
nicklas |
count = count / 1_000_000; |
7392 |
03 Nov 23 |
nicklas |
unit = ' M'; |
7392 |
03 Nov 23 |
nicklas |
140 |
} |
3049 |
17 Dec 14 |
nicklas |
else if (count > 1000) |
3049 |
17 Dec 14 |
nicklas |
142 |
{ |
5802 |
19 Dec 19 |
nicklas |
count = count / 1000; |
7392 |
03 Nov 23 |
nicklas |
unit = ' k'; |
3049 |
17 Dec 14 |
nicklas |
145 |
} |
5802 |
19 Dec 19 |
nicklas |
else |
5802 |
19 Dec 19 |
nicklas |
147 |
{ |
6716 |
29 Apr 22 |
nicklas |
return count == null ? nullValue || '' : count; |
5802 |
19 Dec 19 |
nicklas |
149 |
} |
7392 |
03 Nov 23 |
nicklas |
var numDecimals = count < 10 ? 2 : (count < 100 ? 1 : 0); |
5802 |
19 Dec 19 |
nicklas |
return count.toFixed(numDecimals)+unit; |
3049 |
17 Dec 14 |
nicklas |
152 |
} |
3049 |
17 Dec 14 |
nicklas |
153 |
|
4817 |
21 May 18 |
nicklas |
reggie.formatNumber = function(number, unit, baseDecimals, maxDecimals) |
2610 |
28 Aug 14 |
nicklas |
155 |
{ |
2610 |
28 Aug 14 |
nicklas |
if (number == null) return ''; |
2610 |
28 Aug 14 |
nicklas |
157 |
|
2610 |
28 Aug 14 |
nicklas |
var numDecimals; |
7341 |
11 Sep 23 |
nicklas |
if (baseDecimals == undefined || baseDecimals == null) baseDecimals = 2; |
3827 |
05 Apr 16 |
nicklas |
var tmp = Math.abs(number); |
4164 |
20 Oct 16 |
nicklas |
if (tmp < 1) |
2610 |
28 Aug 14 |
nicklas |
162 |
{ |
4164 |
20 Oct 16 |
nicklas |
numDecimals = baseDecimals+1; |
4164 |
20 Oct 16 |
nicklas |
164 |
} |
4164 |
20 Oct 16 |
nicklas |
else if (tmp < 10) |
4164 |
20 Oct 16 |
nicklas |
166 |
{ |
2610 |
28 Aug 14 |
nicklas |
numDecimals = baseDecimals; |
2610 |
28 Aug 14 |
nicklas |
168 |
} |
3827 |
05 Apr 16 |
nicklas |
else if (tmp < 100) |
2610 |
28 Aug 14 |
nicklas |
170 |
{ |
2610 |
28 Aug 14 |
nicklas |
numDecimals = baseDecimals-1; |
2610 |
28 Aug 14 |
nicklas |
172 |
} |
2610 |
28 Aug 14 |
nicklas |
else |
2610 |
28 Aug 14 |
nicklas |
174 |
{ |
2610 |
28 Aug 14 |
nicklas |
numDecimals = baseDecimals-2; |
2610 |
28 Aug 14 |
nicklas |
176 |
} |
3149 |
26 Feb 15 |
nicklas |
if (numDecimals < 0) numDecimals = 0; |
4817 |
21 May 18 |
nicklas |
if (maxDecimals && numDecimals > maxDecimals) numDecimals = maxDecimals; |
2602 |
27 Aug 14 |
nicklas |
179 |
|
2610 |
28 Aug 14 |
nicklas |
var result = number.toFixed(numDecimals); |
6879 |
22 Nov 22 |
nicklas |
if (unit) |
6879 |
22 Nov 22 |
nicklas |
182 |
{ |
6879 |
22 Nov 22 |
nicklas |
// Special case for 100% without decimals |
6879 |
22 Nov 22 |
nicklas |
if (unit=='%' && result.indexOf('100')==0) result = '100'; |
6879 |
22 Nov 22 |
nicklas |
result += unit; |
6879 |
22 Nov 22 |
nicklas |
186 |
} |
2610 |
28 Aug 14 |
nicklas |
return result; |
2610 |
28 Aug 14 |
nicklas |
188 |
} |
2610 |
28 Aug 14 |
nicklas |
189 |
|
2636 |
04 Sep 14 |
nicklas |
190 |
/** |
2636 |
04 Sep 14 |
nicklas |
Reformat a date string in YYYYMMDD or YYYYMMDD HHMM format |
2636 |
04 Sep 14 |
nicklas |
to YYYY-MM-DD HH:MM |
2636 |
04 Sep 14 |
nicklas |
193 |
*/ |
2647 |
10 Sep 14 |
nicklas |
reggie.reformatDate = function(value, defaultValue) |
2636 |
04 Sep 14 |
nicklas |
195 |
{ |
2647 |
10 Sep 14 |
nicklas |
if (!value) return defaultValue || ''; |
2636 |
04 Sep 14 |
nicklas |
if (value.length == 8) |
2636 |
04 Sep 14 |
nicklas |
198 |
{ |
2636 |
04 Sep 14 |
nicklas |
// YYYYMMDD |
2636 |
04 Sep 14 |
nicklas |
value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2); |
2636 |
04 Sep 14 |
nicklas |
201 |
} |
2636 |
04 Sep 14 |
nicklas |
else if (value.length == 13) |
2636 |
04 Sep 14 |
nicklas |
203 |
{ |
2636 |
04 Sep 14 |
nicklas |
// YYYYMMDD HHMM |
2636 |
04 Sep 14 |
nicklas |
value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2) + ' ' + value.substr(9, 2) + ':' + value.substr(11, 2); |
2636 |
04 Sep 14 |
nicklas |
206 |
} |
2636 |
04 Sep 14 |
nicklas |
return value; |
2636 |
04 Sep 14 |
nicklas |
208 |
} |
2610 |
28 Aug 14 |
nicklas |
209 |
|
5481 |
11 Jun 19 |
nicklas |
210 |
/** |
5481 |
11 Jun 19 |
nicklas |
Insert soft line breaks in the name at appropriate points |
5481 |
11 Jun 19 |
nicklas |
after '_' and '.' |
5481 |
11 Jun 19 |
nicklas |
213 |
*/ |
5481 |
11 Jun 19 |
nicklas |
reggie.softLineBreaks = function(value) |
5481 |
11 Jun 19 |
nicklas |
215 |
{ |
5481 |
11 Jun 19 |
nicklas |
if (value) |
5481 |
11 Jun 19 |
nicklas |
217 |
{ |
5481 |
11 Jun 19 |
nicklas |
value = value.replace(/([_.])+/g, '$1​'); |
5481 |
11 Jun 19 |
nicklas |
219 |
} |
5481 |
11 Jun 19 |
nicklas |
return value; |
5481 |
11 Jun 19 |
nicklas |
221 |
} |
2602 |
27 Aug 14 |
nicklas |
222 |
|
2602 |
27 Aug 14 |
nicklas |
223 |
/** |
2599 |
25 Aug 14 |
nicklas |
Get subtype information. |
2599 |
25 Aug 14 |
nicklas |
225 |
*/ |
2599 |
25 Aug 14 |
nicklas |
reggie.getSubtypeInfo = function(subtype) |
2599 |
25 Aug 14 |
nicklas |
227 |
{ |
2599 |
25 Aug 14 |
nicklas |
var url = '../Subtype.servlet?ID='+App.getSessionId(); |
2599 |
25 Aug 14 |
nicklas |
url += '&cmd=GetSubtypeInfo&name='+subtype; |
2599 |
25 Aug 14 |
nicklas |
var response = Wizard.syncJsonRequest(url); |
2599 |
25 Aug 14 |
nicklas |
return response ? response.subtype : null; |
2599 |
25 Aug 14 |
nicklas |
232 |
} |
2599 |
25 Aug 14 |
nicklas |
233 |
|
4668 |
01 Feb 18 |
nicklas |
234 |
/** |
5435 |
17 May 19 |
nicklas |
Get annotation type information. |
5435 |
17 May 19 |
nicklas |
236 |
*/ |
5435 |
17 May 19 |
nicklas |
reggie.getAnnotationTypeInfo = function(annotationType) |
5435 |
17 May 19 |
nicklas |
238 |
{ |
5435 |
17 May 19 |
nicklas |
var url = '../Subtype.servlet?ID='+App.getSessionId(); |
5435 |
17 May 19 |
nicklas |
url += '&cmd=GetAnnotationTypeInfo&name='+annotationType; |
5435 |
17 May 19 |
nicklas |
var response = Wizard.syncJsonRequest(url); |
5435 |
17 May 19 |
nicklas |
return response ? response.annotationType : null; |
5435 |
17 May 19 |
nicklas |
243 |
} |
5435 |
17 May 19 |
nicklas |
244 |
|
5435 |
17 May 19 |
nicklas |
245 |
/** |
4668 |
01 Feb 18 |
nicklas |
Get data file type information. |
4668 |
01 Feb 18 |
nicklas |
247 |
*/ |
4668 |
01 Feb 18 |
nicklas |
reggie.getDataFileTypeInfo = function(filetype) |
4668 |
01 Feb 18 |
nicklas |
249 |
{ |
4668 |
01 Feb 18 |
nicklas |
var url = '../Subtype.servlet?ID='+App.getSessionId(); |
4668 |
01 Feb 18 |
nicklas |
url += '&cmd=GetDataFileTypeInfo&name='+filetype; |
4668 |
01 Feb 18 |
nicklas |
var response = Wizard.syncJsonRequest(url); |
4668 |
01 Feb 18 |
nicklas |
return response ? response.fileType : null; |
4668 |
01 Feb 18 |
nicklas |
254 |
} |
4668 |
01 Feb 18 |
nicklas |
255 |
|
5392 |
02 May 19 |
nicklas |
256 |
/** |
5392 |
02 May 19 |
nicklas |
Get bioplate type information. |
5392 |
02 May 19 |
nicklas |
258 |
*/ |
5392 |
02 May 19 |
nicklas |
reggie.getPlateTypeInfo = function(platetype) |
5392 |
02 May 19 |
nicklas |
260 |
{ |
5392 |
02 May 19 |
nicklas |
var url = '../Subtype.servlet?ID='+App.getSessionId(); |
5392 |
02 May 19 |
nicklas |
url += '&cmd=GetPlateTypeInfo&name='+platetype; |
5392 |
02 May 19 |
nicklas |
var response = Wizard.syncJsonRequest(url); |
5392 |
02 May 19 |
nicklas |
return response ? response.plateType : null; |
5392 |
02 May 19 |
nicklas |
265 |
} |
5392 |
02 May 19 |
nicklas |
266 |
|
2666 |
15 Sep 14 |
nicklas |
reggie.setCurrentDirectory = function(path) |
2666 |
15 Sep 14 |
nicklas |
268 |
{ |
2698 |
25 Sep 14 |
nicklas |
if (path == currentDirectory) return; |
2666 |
15 Sep 14 |
nicklas |
var url = '../Session.servlet?ID='+App.getSessionId(); |
2666 |
15 Sep 14 |
nicklas |
url += '&cmd=SetCurrentDirectory&path='+encodeURIComponent(path); |
2666 |
15 Sep 14 |
nicklas |
Wizard.syncJsonRequest(url); |
2698 |
25 Sep 14 |
nicklas |
currentDirectory = path; |
2666 |
15 Sep 14 |
nicklas |
274 |
} |
2666 |
15 Sep 14 |
nicklas |
275 |
|
2599 |
25 Aug 14 |
nicklas |
276 |
/** |
2599 |
25 Aug 14 |
nicklas |
Load protocols of the given subtype and add them |
2599 |
25 Aug 14 |
nicklas |
to a selection list. This method submits an |
2599 |
25 Aug 14 |
nicklas |
async request to the server and then returns |
2599 |
25 Aug 14 |
nicklas |
immediately. |
2599 |
25 Aug 14 |
nicklas |
281 |
*/ |
3833 |
08 Apr 16 |
nicklas |
reggie.loadProtocols = function(subtype, list, annotations, filter) |
2599 |
25 Aug 14 |
nicklas |
283 |
{ |
2599 |
25 Aug 14 |
nicklas |
list = Doc.element(list); |
2599 |
25 Aug 14 |
nicklas |
list.length=0; |
2599 |
25 Aug 14 |
nicklas |
list[0] = new Option('loading...', ''); |
2599 |
25 Aug 14 |
nicklas |
Doc.addClass(list, 'list-loading'); |
2599 |
25 Aug 14 |
nicklas |
var url = '../Protocol.servlet?ID='+App.getSessionId(); |
2599 |
25 Aug 14 |
nicklas |
url += '&cmd=GetProtocols&subtype='+subtype; |
3115 |
06 Feb 15 |
nicklas |
if (annotations) |
3115 |
06 Feb 15 |
nicklas |
291 |
{ |
3115 |
06 Feb 15 |
nicklas |
url += '&annotations='+annotations; |
3115 |
06 Feb 15 |
nicklas |
293 |
} |
3833 |
08 Apr 16 |
nicklas |
if (filter) |
3833 |
08 Apr 16 |
nicklas |
295 |
{ |
3833 |
08 Apr 16 |
nicklas |
url += '&filter='+encodeURIComponent(filter); |
3833 |
08 Apr 16 |
nicklas |
297 |
} |
2599 |
25 Aug 14 |
nicklas |
Wizard.asyncJsonRequest(url, |
2599 |
25 Aug 14 |
nicklas |
function(response) |
2599 |
25 Aug 14 |
nicklas |
300 |
{ |
3269 |
23 Apr 15 |
nicklas |
internal.fillList(response.protocols, list, !list.classList.contains('required')); |
2599 |
25 Aug 14 |
nicklas |
302 |
} |
2599 |
25 Aug 14 |
nicklas |
303 |
); |
2599 |
25 Aug 14 |
nicklas |
304 |
} |
2599 |
25 Aug 14 |
nicklas |
305 |
|
2599 |
25 Aug 14 |
nicklas |
306 |
/** |
2599 |
25 Aug 14 |
nicklas |
Load software of the given subtype and add them |
2599 |
25 Aug 14 |
nicklas |
to a selection list. This method submits an |
2599 |
25 Aug 14 |
nicklas |
async request to the server and then returns |
2599 |
25 Aug 14 |
nicklas |
immediately. |
3616 |
23 Nov 15 |
nicklas |
@annotations Comma separated list of static constant names in class Annotationtype |
3616 |
23 Nov 15 |
nicklas |
@filter Comma separated list of filter values. Each value is matched against |
3616 |
23 Nov 15 |
nicklas |
the annotation type on the same position in the list |
2599 |
25 Aug 14 |
nicklas |
314 |
*/ |
3616 |
23 Nov 15 |
nicklas |
reggie.loadSoftware = function(subtype, list, annotations, filter) |
2599 |
25 Aug 14 |
nicklas |
316 |
{ |
2599 |
25 Aug 14 |
nicklas |
list = Doc.element(list); |
2599 |
25 Aug 14 |
nicklas |
list.length=0; |
2599 |
25 Aug 14 |
nicklas |
list[0] = new Option('loading...', ''); |
2599 |
25 Aug 14 |
nicklas |
Doc.addClass(list, 'list-loading'); |
2599 |
25 Aug 14 |
nicklas |
var url = '../Software.servlet?ID='+App.getSessionId(); |
2599 |
25 Aug 14 |
nicklas |
url += '&cmd=GetSoftware&subtype='+subtype; |
3115 |
06 Feb 15 |
nicklas |
if (annotations) |
3115 |
06 Feb 15 |
nicklas |
324 |
{ |
3616 |
23 Nov 15 |
nicklas |
url += '&annotations='+encodeURIComponent(annotations); |
3115 |
06 Feb 15 |
nicklas |
326 |
} |
3616 |
23 Nov 15 |
nicklas |
if (filter) |
3616 |
23 Nov 15 |
nicklas |
328 |
{ |
3616 |
23 Nov 15 |
nicklas |
url += '&filter='+encodeURIComponent(filter); |
3616 |
23 Nov 15 |
nicklas |
330 |
} |
2599 |
25 Aug 14 |
nicklas |
Wizard.asyncJsonRequest(url, |
2599 |
25 Aug 14 |
nicklas |
function(response) |
2599 |
25 Aug 14 |
nicklas |
333 |
{ |
3269 |
23 Apr 15 |
nicklas |
internal.fillList(response.software, list, !list.classList.contains('required')); |
2599 |
25 Aug 14 |
nicklas |
335 |
} |
2599 |
25 Aug 14 |
nicklas |
336 |
); |
2599 |
25 Aug 14 |
nicklas |
337 |
} |
2647 |
10 Sep 14 |
nicklas |
338 |
|
2647 |
10 Sep 14 |
nicklas |
339 |
/** |
2647 |
10 Sep 14 |
nicklas |
Load hardware of the given subtype and add them |
2647 |
10 Sep 14 |
nicklas |
to a selection list. This method submits an |
2647 |
10 Sep 14 |
nicklas |
async request to the server and then returns |
2647 |
10 Sep 14 |
nicklas |
immediately. |
2647 |
10 Sep 14 |
nicklas |
344 |
*/ |
5469 |
04 Jun 19 |
nicklas |
reggie.loadHardware = function(subtype, list, annotations, filter) |
2647 |
10 Sep 14 |
nicklas |
346 |
{ |
2647 |
10 Sep 14 |
nicklas |
list = Doc.element(list); |
2647 |
10 Sep 14 |
nicklas |
list.length=0; |
2647 |
10 Sep 14 |
nicklas |
list[0] = new Option('loading...', ''); |
2647 |
10 Sep 14 |
nicklas |
Doc.addClass(list, 'list-loading'); |
2647 |
10 Sep 14 |
nicklas |
var url = '../Hardware.servlet?ID='+App.getSessionId(); |
2647 |
10 Sep 14 |
nicklas |
url += '&cmd=GetHardware&subtype='+subtype; |
2647 |
10 Sep 14 |
nicklas |
if (annotations) |
2647 |
10 Sep 14 |
nicklas |
354 |
{ |
2647 |
10 Sep 14 |
nicklas |
url += '&annotations='+annotations; |
2647 |
10 Sep 14 |
nicklas |
356 |
} |
5469 |
04 Jun 19 |
nicklas |
if (filter) |
5469 |
04 Jun 19 |
nicklas |
358 |
{ |
5469 |
04 Jun 19 |
nicklas |
url += '&filter='+encodeURIComponent(filter); |
5469 |
04 Jun 19 |
nicklas |
360 |
} |
2647 |
10 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, |
2647 |
10 Sep 14 |
nicklas |
function(response) |
2647 |
10 Sep 14 |
nicklas |
363 |
{ |
3269 |
23 Apr 15 |
nicklas |
internal.fillList(response.hardware, list, !list.classList.contains('required')); |
2647 |
10 Sep 14 |
nicklas |
365 |
} |
2647 |
10 Sep 14 |
nicklas |
366 |
); |
2647 |
10 Sep 14 |
nicklas |
367 |
} |
2599 |
25 Aug 14 |
nicklas |
368 |
|
2599 |
25 Aug 14 |
nicklas |
// Fills a selection list with items |
2599 |
25 Aug 14 |
nicklas |
internal.fillList = function(items, list, addNoneOption) |
2599 |
25 Aug 14 |
nicklas |
371 |
{ |
2599 |
25 Aug 14 |
nicklas |
Doc.removeClass(list, 'list-loading'); |
2599 |
25 Aug 14 |
nicklas |
list.length = 0; |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < items.length; i++) |
2599 |
25 Aug 14 |
nicklas |
375 |
{ |
2599 |
25 Aug 14 |
nicklas |
var item = items[i]; |
4583 |
21 Sep 17 |
nicklas |
var option = new Option(item.name, item.id, item.isDefault, item.isDefault); |
2647 |
10 Sep 14 |
nicklas |
option.item = item; |
2647 |
10 Sep 14 |
nicklas |
list[list.length] = option; |
2599 |
25 Aug 14 |
nicklas |
380 |
} |
2599 |
25 Aug 14 |
nicklas |
if (list.length > 0) Wizard.setInputStatus(list.id, 'valid'); |
2599 |
25 Aug 14 |
nicklas |
if (addNoneOption) |
2599 |
25 Aug 14 |
nicklas |
383 |
{ |
2599 |
25 Aug 14 |
nicklas |
list[list.length] = new Option('- none -', ''); |
2599 |
25 Aug 14 |
nicklas |
385 |
} |
3115 |
06 Feb 15 |
nicklas |
Events.sendChangeEvent(list); |
2599 |
25 Aug 14 |
nicklas |
387 |
} |
2599 |
25 Aug 14 |
nicklas |
388 |
|
4990 |
01 Oct 18 |
nicklas |
389 |
/** |
4990 |
01 Oct 18 |
nicklas |
Get the list option with the specified value. |
4990 |
01 Oct 18 |
nicklas |
391 |
*/ |
4990 |
01 Oct 18 |
nicklas |
reggie.getListOption = function(list, value) |
4990 |
01 Oct 18 |
nicklas |
393 |
{ |
4990 |
01 Oct 18 |
nicklas |
list = Doc.element(list); |
4990 |
01 Oct 18 |
nicklas |
for (var i = 0; i < list.length; i++) |
4990 |
01 Oct 18 |
nicklas |
396 |
{ |
4990 |
01 Oct 18 |
nicklas |
if (list[i].value == value) return list[i]; |
4990 |
01 Oct 18 |
nicklas |
398 |
} |
4990 |
01 Oct 18 |
nicklas |
return null; |
4990 |
01 Oct 18 |
nicklas |
400 |
} |
4990 |
01 Oct 18 |
nicklas |
401 |
|
2621 |
01 Sep 14 |
nicklas |
reggie.isStratagene = function(sampleName) |
2621 |
01 Sep 14 |
nicklas |
403 |
{ |
2621 |
01 Sep 14 |
nicklas |
return sampleName.indexOf(GENERIC_STRATAGENE_NAME) == 0; |
2621 |
01 Sep 14 |
nicklas |
405 |
} |
2599 |
25 Aug 14 |
nicklas |
406 |
|
5552 |
12 Aug 19 |
nicklas |
// If the name doesn't start with 7 digits it is an external sample |
2621 |
01 Sep 14 |
nicklas |
reggie.isExternal = function(sampleName) |
2621 |
01 Sep 14 |
nicklas |
409 |
{ |
5552 |
12 Aug 19 |
nicklas |
return sampleName.search(/^\d{7}/) == -1; |
2621 |
01 Sep 14 |
nicklas |
411 |
} |
2621 |
01 Sep 14 |
nicklas |
412 |
|
2662 |
12 Sep 14 |
nicklas |
reggie.wellToAlpha = function(wellNo) |
2662 |
12 Sep 14 |
nicklas |
414 |
{ |
2662 |
12 Sep 14 |
nicklas |
return wellNo >=0 && wellNo < WELL_ALPHA.length ? WELL_ALPHA[wellNo] : '?'; |
2662 |
12 Sep 14 |
nicklas |
416 |
} |
2621 |
01 Sep 14 |
nicklas |
417 |
|
2774 |
09 Oct 14 |
nicklas |
reggie.alphaToWell = function(wellAlpha) |
2774 |
09 Oct 14 |
nicklas |
419 |
{ |
2774 |
09 Oct 14 |
nicklas |
return WELL_ALPHA.indexOf(wellAlpha.toUpperCase()); |
2774 |
09 Oct 14 |
nicklas |
421 |
} |
2774 |
09 Oct 14 |
nicklas |
422 |
|
2608 |
28 Aug 14 |
nicklas |
423 |
/** |
7372 |
06 Oct 23 |
nicklas |
Utility function for getting the 'submit' options from the given |
7372 |
06 Oct 23 |
nicklas |
'config' object. Normally, the config['submit'] value is used, but |
7372 |
06 Oct 23 |
nicklas |
if a parameterSet is enabled we also check the config['submit.paramterSet'] |
7372 |
06 Oct 23 |
nicklas |
value. If the debug option is TRUE we also add the config['submit-debug'] |
7372 |
06 Oct 23 |
nicklas |
or config['submit-debug.parameterSet']. |
7372 |
06 Oct 23 |
nicklas |
See OpenGridServlet.getExtraConfig() for more information about how the 'config' |
7372 |
06 Oct 23 |
nicklas |
object is created. |
7372 |
06 Oct 23 |
nicklas |
431 |
*/ |
7372 |
06 Oct 23 |
nicklas |
reggie.getSubmitOptions = function(config, debug, parameterSet, configKey) |
7372 |
06 Oct 23 |
nicklas |
433 |
{ |
7372 |
06 Oct 23 |
nicklas |
if (!configKey) configKey = 'submit'; |
7372 |
06 Oct 23 |
nicklas |
var opt = []; |
7372 |
06 Oct 23 |
nicklas |
if (parameterSet && config[configKey+'.'+parameterSet]) |
7372 |
06 Oct 23 |
nicklas |
437 |
{ |
7372 |
06 Oct 23 |
nicklas |
opt[opt.length] = '# parameter set: '+parameterSet; |
7372 |
06 Oct 23 |
nicklas |
opt[opt.length] = config[configKey+'.'+parameterSet]; |
7372 |
06 Oct 23 |
nicklas |
440 |
} |
7372 |
06 Oct 23 |
nicklas |
else |
7372 |
06 Oct 23 |
nicklas |
442 |
{ |
7372 |
06 Oct 23 |
nicklas |
opt[opt.length] = config[configKey]; |
7372 |
06 Oct 23 |
nicklas |
444 |
} |
7372 |
06 Oct 23 |
nicklas |
if (debug) |
7372 |
06 Oct 23 |
nicklas |
446 |
{ |
7372 |
06 Oct 23 |
nicklas |
opt[opt.length] = (parameterSet?config[configKey+'-debug.'+parameterSet]:null) || config[configKey+'-debug']; |
7372 |
06 Oct 23 |
nicklas |
448 |
} |
7372 |
06 Oct 23 |
nicklas |
return opt.join('\n'); |
7372 |
06 Oct 23 |
nicklas |
450 |
} |
7372 |
06 Oct 23 |
nicklas |
451 |
|
7372 |
06 Oct 23 |
nicklas |
452 |
/** |
2608 |
28 Aug 14 |
nicklas |
Open a popup window and copy a part of the current window to the popup |
2608 |
28 Aug 14 |
nicklas |
and make it suitable for printin. |
2608 |
28 Aug 14 |
nicklas |
455 |
|
2608 |
28 Aug 14 |
nicklas |
@param printElementId The id of a html tag in the current page that should |
2608 |
28 Aug 14 |
nicklas |
be copied to the print window |
2608 |
28 Aug 14 |
nicklas |
@param pageTitle The title of the print window |
2608 |
28 Aug 14 |
nicklas |
@param pageOrientation 'landscape' or 'portrait' (default) |
2608 |
28 Aug 14 |
nicklas |
@param printNote Optional note intended to include instructions how to configure |
2608 |
28 Aug 14 |
nicklas |
the browser for optimal printing (eg. set to landscape and scale to 75%) |
2608 |
28 Aug 14 |
nicklas |
462 |
*/ |
2608 |
28 Aug 14 |
nicklas |
reggie.openPrintWindow = function(printElementId, pageTitle, pageOrientation, printNote, reggieRoot, extraStyles) |
2608 |
28 Aug 14 |
nicklas |
464 |
{ |
2608 |
28 Aug 14 |
nicklas |
// Default width/height is for 'portrait' orientation |
2608 |
28 Aug 14 |
nicklas |
var width = 900; |
2608 |
28 Aug 14 |
nicklas |
var height = 900; |
2608 |
28 Aug 14 |
nicklas |
if (pageOrientation == 'landscape') |
2608 |
28 Aug 14 |
nicklas |
469 |
{ |
2608 |
28 Aug 14 |
nicklas |
width = 1300; |
2608 |
28 Aug 14 |
nicklas |
height = 700; |
2608 |
28 Aug 14 |
nicklas |
472 |
} |
2608 |
28 Aug 14 |
nicklas |
473 |
|
2608 |
28 Aug 14 |
nicklas |
var url = 'print_template.jsp?ID='+App.getSessionId(); |
2608 |
28 Aug 14 |
nicklas |
if (extraStyles) url += '&extraStyles='+extraStyles; |
2608 |
28 Aug 14 |
nicklas |
if (reggieRoot) url = reggieRoot+url; |
2608 |
28 Aug 14 |
nicklas |
// Open the print-window |
2612 |
29 Aug 14 |
nicklas |
internal.printOptions = { |
2612 |
29 Aug 14 |
nicklas |
'printElementId': printElementId, |
2612 |
29 Aug 14 |
nicklas |
'pageTitle': pageTitle, |
2612 |
29 Aug 14 |
nicklas |
'pageOrientation': pageOrientation, |
2612 |
29 Aug 14 |
nicklas |
'printNote': printNote |
2612 |
29 Aug 14 |
nicklas |
483 |
}; |
5780 |
10 Dec 19 |
nicklas |
var printWin = window.open(url, 'PrintWindow', 'width='+width+',height='+height+',toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'); |
2608 |
28 Aug 14 |
nicklas |
485 |
} |
2608 |
28 Aug 14 |
nicklas |
486 |
|
2612 |
29 Aug 14 |
nicklas |
reggie.finalizePrint = function(printWin) |
2612 |
29 Aug 14 |
nicklas |
488 |
{ |
2612 |
29 Aug 14 |
nicklas |
// Set page title... |
2612 |
29 Aug 14 |
nicklas |
if (internal.printOptions.pageTitle) |
2612 |
29 Aug 14 |
nicklas |
491 |
{ |
2612 |
29 Aug 14 |
nicklas |
printWin.document.title = internal.printOptions.pageTitle; |
2612 |
29 Aug 14 |
nicklas |
493 |
} |
2612 |
29 Aug 14 |
nicklas |
494 |
|
2612 |
29 Aug 14 |
nicklas |
// ...orientation... |
2612 |
29 Aug 14 |
nicklas |
if (internal.printOptions.pageOrientation) |
2612 |
29 Aug 14 |
nicklas |
497 |
{ |
2612 |
29 Aug 14 |
nicklas |
var paper = printWin.document.getElementById('paper'); |
2612 |
29 Aug 14 |
nicklas |
paper.className += ' ' + internal.printOptions.pageOrientation; |
2612 |
29 Aug 14 |
nicklas |
500 |
} |
2612 |
29 Aug 14 |
nicklas |
501 |
|
2612 |
29 Aug 14 |
nicklas |
// ... and print note |
2612 |
29 Aug 14 |
nicklas |
if (internal.printOptions.printNote) |
2612 |
29 Aug 14 |
nicklas |
504 |
{ |
2612 |
29 Aug 14 |
nicklas |
var note = printWin.document.getElementById('printNote'); |
2612 |
29 Aug 14 |
nicklas |
note.innerHTML = internal.printOptions.printNote; |
2612 |
29 Aug 14 |
nicklas |
507 |
} |
2612 |
29 Aug 14 |
nicklas |
508 |
|
2612 |
29 Aug 14 |
nicklas |
// Get the HTML from the <div> tag to be printed |
2612 |
29 Aug 14 |
nicklas |
var printElement = Doc.element(internal.printOptions.printElementId); |
2612 |
29 Aug 14 |
nicklas |
var printHtml = printElement.innerHTML; |
2612 |
29 Aug 14 |
nicklas |
// Replace all <canvas> elements with <img> |
2612 |
29 Aug 14 |
nicklas |
// since that seems the only way to make things work in IE |
2612 |
29 Aug 14 |
nicklas |
printHtml = printHtml.replace(/\<canvas.*?\<\/canvas\>/g, '<img class="canvas-copy">'); |
3544 |
15 Oct 15 |
nicklas |
// Replace <input> elements with <span> |
3544 |
15 Oct 15 |
nicklas |
printHtml = printHtml.replace(/\<input.*?\>/g, '<span class="input-copy"></span>'); |
3544 |
15 Oct 15 |
nicklas |
517 |
|
2612 |
29 Aug 14 |
nicklas |
// Copy the HTML to the print-area in the print-window |
2612 |
29 Aug 14 |
nicklas |
var printArea = printWin.document.getElementById('printarea'); |
2612 |
29 Aug 14 |
nicklas |
printArea.innerHTML = printHtml; |
2612 |
29 Aug 14 |
nicklas |
521 |
|
2612 |
29 Aug 14 |
nicklas |
// Copy the <canvas> elements as images to the <img> elements |
2612 |
29 Aug 14 |
nicklas |
// using toDataURL() |
2612 |
29 Aug 14 |
nicklas |
var srcCanvas = printElement.getElementsByTagName('canvas'); |
2612 |
29 Aug 14 |
nicklas |
var printImg = printArea.getElementsByClassName('canvas-copy'); |
2612 |
29 Aug 14 |
nicklas |
for (var i = 0; i < srcCanvas.length; i++) |
2612 |
29 Aug 14 |
nicklas |
527 |
{ |
2612 |
29 Aug 14 |
nicklas |
printImg[i].src = srcCanvas[i].toDataURL(); |
2612 |
29 Aug 14 |
nicklas |
529 |
} |
3544 |
15 Oct 15 |
nicklas |
530 |
|
3544 |
15 Oct 15 |
nicklas |
// Copy values from <input> elements to the <span> elements |
3544 |
15 Oct 15 |
nicklas |
// Radio and checkboxes are set to 'x' if checked |
3544 |
15 Oct 15 |
nicklas |
// Other elements use the 'value' property |
3544 |
15 Oct 15 |
nicklas |
var srcInput = printElement.getElementsByTagName('input'); |
3544 |
15 Oct 15 |
nicklas |
var printInput = printArea.getElementsByClassName('input-copy'); |
3544 |
15 Oct 15 |
nicklas |
for (var i = 0; i < srcInput.length; i++) |
3544 |
15 Oct 15 |
nicklas |
537 |
{ |
3544 |
15 Oct 15 |
nicklas |
var input = srcInput[i]; |
3544 |
15 Oct 15 |
nicklas |
var value = Strings.encodeTags(input.value); |
3544 |
15 Oct 15 |
nicklas |
if (input.type == 'radio' || input.type == 'checkbox') |
3544 |
15 Oct 15 |
nicklas |
541 |
{ |
3544 |
15 Oct 15 |
nicklas |
value = input.checked ? '<b>×</b>' : ''; |
3544 |
15 Oct 15 |
nicklas |
543 |
} |
3544 |
15 Oct 15 |
nicklas |
printInput[i].innerHTML = value; |
3544 |
15 Oct 15 |
nicklas |
545 |
} |
2612 |
29 Aug 14 |
nicklas |
546 |
|
2612 |
29 Aug 14 |
nicklas |
547 |
} |
2612 |
29 Aug 14 |
nicklas |
548 |
|
5019 |
10 Oct 18 |
nicklas |
549 |
|
5019 |
10 Oct 18 |
nicklas |
550 |
/** |
5019 |
10 Oct 18 |
nicklas |
Opens the case summary as a popup as a reaction to the given event. |
5019 |
10 Oct 18 |
nicklas |
The event target should contain a 'data-name' attribute with the |
5019 |
10 Oct 18 |
nicklas |
item name to show in the case summary. |
5019 |
10 Oct 18 |
nicklas |
554 |
*/ |
5019 |
10 Oct 18 |
nicklas |
reggie.openCaseSummaryPopupOnEvent = function(event) |
5019 |
10 Oct 18 |
nicklas |
556 |
{ |
5019 |
10 Oct 18 |
nicklas |
var name = Data.get(event.currentTarget, 'name'); |
5019 |
10 Oct 18 |
nicklas |
reggie.openCaseSummaryPopup(name); |
5019 |
10 Oct 18 |
nicklas |
559 |
} |
5019 |
10 Oct 18 |
nicklas |
560 |
|
5019 |
10 Oct 18 |
nicklas |
561 |
/** |
5019 |
10 Oct 18 |
nicklas |
Opens the case summary as a popup for the given item name. |
5019 |
10 Oct 18 |
nicklas |
563 |
*/ |
5019 |
10 Oct 18 |
nicklas |
reggie.openCaseSummaryPopup = function(name) |
5019 |
10 Oct 18 |
nicklas |
565 |
{ |
5019 |
10 Oct 18 |
nicklas |
if (!name) return; |
5019 |
10 Oct 18 |
nicklas |
var url = '../reports/case_summary.jsp?ID='+App.getSessionId(); |
7150 |
09 May 23 |
nicklas |
url += '&caseName='+encodeURIComponent(name); |
5019 |
10 Oct 18 |
nicklas |
url += '&highlight='+encodeURIComponent(name); |
5019 |
10 Oct 18 |
nicklas |
url += '&pageType=popup'; |
7150 |
09 May 23 |
nicklas |
Dialogs.openPopup(url, 'CaseSummary'+name.replace(/[^\w]/g, ''), 1200, 800); |
5019 |
10 Oct 18 |
nicklas |
572 |
} |
5019 |
10 Oct 18 |
nicklas |
573 |
|
2599 |
25 Aug 14 |
nicklas |
return reggie; |
2599 |
25 Aug 14 |
nicklas |
575 |
}(); |
2599 |
25 Aug 14 |
nicklas |
576 |
|
2599 |
25 Aug 14 |
nicklas |
577 |
|
2599 |
25 Aug 14 |
nicklas |
578 |
|
2599 |
25 Aug 14 |
nicklas |
579 |
|
2599 |
25 Aug 14 |
nicklas |
var Wizard = function() |
2599 |
25 Aug 14 |
nicklas |
581 |
{ |
2599 |
25 Aug 14 |
nicklas |
var wizard = {}; |
2599 |
25 Aug 14 |
nicklas |
var internal = {}; |
7444 |
20 Nov 23 |
nicklas |
var debug = 0; |
2599 |
25 Aug 14 |
nicklas |
585 |
|
2599 |
25 Aug 14 |
nicklas |
var currentStep = 1; |
2658 |
12 Sep 14 |
nicklas |
var numLiveAsyncRequests = 0; |
2658 |
12 Sep 14 |
nicklas |
var hasSentRegistration = false; |
2658 |
12 Sep 14 |
nicklas |
var forceConfirm = false; |
2803 |
14 Oct 14 |
nicklas |
var noConfirmOnFirstStep = true; |
5058 |
29 Oct 18 |
nicklas |
var noConfirm = false; |
2676 |
17 Sep 14 |
nicklas |
var hasFatalError = false; |
4477 |
03 May 17 |
nicklas |
var progressTimer = null; |
2599 |
25 Aug 14 |
nicklas |
594 |
|
2599 |
25 Aug 14 |
nicklas |
595 |
/** |
2599 |
25 Aug 14 |
nicklas |
Validate the 'date'-input field that is the target of this event |
2599 |
25 Aug 14 |
nicklas |
The date is optional unless 'required' is part if it's className. |
2599 |
25 Aug 14 |
nicklas |
Dates should be either 4 or 8 digits with month+day or year+month+day. |
2599 |
25 Aug 14 |
nicklas |
If 'data-allow-six-digits' is set on the target element, the year |
2599 |
25 Aug 14 |
nicklas |
is allowed to be only 2 digits. |
2599 |
25 Aug 14 |
nicklas |
601 |
|
2599 |
25 Aug 14 |
nicklas |
4-digit (and 6-digit) dates auto-padded to 8 digits. |
2599 |
25 Aug 14 |
nicklas |
603 |
|
2599 |
25 Aug 14 |
nicklas |
The 'data-valid' attribute is set to 1 or 0 depending on the outcome, |
2599 |
25 Aug 14 |
nicklas |
and 'data-warning' is set if the date is missing on non-required fields. |
2599 |
25 Aug 14 |
nicklas |
606 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.validateDate = function(event) |
2599 |
25 Aug 14 |
nicklas |
608 |
{ |
2599 |
25 Aug 14 |
nicklas |
var target = event.currentTarget; |
2599 |
25 Aug 14 |
nicklas |
var isValid = false; |
2599 |
25 Aug 14 |
nicklas |
var isWarning = false; |
2599 |
25 Aug 14 |
nicklas |
612 |
|
2599 |
25 Aug 14 |
nicklas |
// Reset current status |
2599 |
25 Aug 14 |
nicklas |
wizard.setInputStatus(target); |
2599 |
25 Aug 14 |
nicklas |
615 |
|
2599 |
25 Aug 14 |
nicklas |
var date = target.value; |
2599 |
25 Aug 14 |
nicklas |
if (date == '') |
2599 |
25 Aug 14 |
nicklas |
618 |
{ |
2599 |
25 Aug 14 |
nicklas |
// No date, is this an error or a warning? |
2599 |
25 Aug 14 |
nicklas |
var optional = target.className.indexOf('required') == -1; |
2599 |
25 Aug 14 |
nicklas |
wizard.setInputStatus(target, optional ? 'warning' : 'invalid', 'Missing'); |
2599 |
25 Aug 14 |
nicklas |
isValid = optional; |
2599 |
25 Aug 14 |
nicklas |
isWarning = optional; |
2599 |
25 Aug 14 |
nicklas |
624 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
626 |
{ |
2599 |
25 Aug 14 |
nicklas |
var allowSixDigits = Data.int(target, 'allow-six-digits'); |
2599 |
25 Aug 14 |
nicklas |
date = Reggie.autoFillDate(date, allowSixDigits); |
2599 |
25 Aug 14 |
nicklas |
target.value = date; |
2599 |
25 Aug 14 |
nicklas |
630 |
|
2677 |
17 Sep 14 |
nicklas |
var d = Dates.parseString(date, 'yyyyMMdd'); |
2677 |
17 Sep 14 |
nicklas |
if (d == null) |
2599 |
25 Aug 14 |
nicklas |
633 |
{ |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus(target, 'invalid', 'Not a valid date'); |
2599 |
25 Aug 14 |
nicklas |
635 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
637 |
{ |
2677 |
17 Sep 14 |
nicklas |
var disallowFutureDate = Data.int(target, 'disallow-future-date'); |
2677 |
17 Sep 14 |
nicklas |
var today = new Date(); |
2677 |
17 Sep 14 |
nicklas |
if (disallowFutureDate && (d.getTime() > today.getTime())) |
2677 |
17 Sep 14 |
nicklas |
641 |
{ |
2677 |
17 Sep 14 |
nicklas |
Wizard.setInputStatus(target, 'invalid', 'Future dates are not valid'); |
2677 |
17 Sep 14 |
nicklas |
643 |
} |
2677 |
17 Sep 14 |
nicklas |
else |
2677 |
17 Sep 14 |
nicklas |
645 |
{ |
2677 |
17 Sep 14 |
nicklas |
Wizard.setInputStatus(target, 'valid'); |
2677 |
17 Sep 14 |
nicklas |
isValid = true; |
2677 |
17 Sep 14 |
nicklas |
648 |
} |
2599 |
25 Aug 14 |
nicklas |
649 |
} |
2599 |
25 Aug 14 |
nicklas |
650 |
} |
2599 |
25 Aug 14 |
nicklas |
651 |
|
2599 |
25 Aug 14 |
nicklas |
Data.set(target, 'valid', isValid ? 1 : 0); |
2599 |
25 Aug 14 |
nicklas |
Data.set(target, 'warning', isWarning ? 1 : 0); |
2599 |
25 Aug 14 |
nicklas |
654 |
|
2599 |
25 Aug 14 |
nicklas |
if (!isValid && target.focus) target.focus(); |
2677 |
17 Sep 14 |
nicklas |
return isValid; |
2599 |
25 Aug 14 |
nicklas |
657 |
} |
2599 |
25 Aug 14 |
nicklas |
658 |
|
3319 |
11 May 15 |
nicklas |
659 |
/** |
3319 |
11 May 15 |
nicklas |
Validate the 'numeric' input field that is the target of this event |
3319 |
11 May 15 |
nicklas |
The value is optional unless 'required' is part if it's className. |
3319 |
11 May 15 |
nicklas |
662 |
|
3319 |
11 May 15 |
nicklas |
The 'data-default-value' can be set to a default value. If the |
3319 |
11 May 15 |
nicklas |
given value is changed a warning is displayed. |
3319 |
11 May 15 |
nicklas |
665 |
|
3319 |
11 May 15 |
nicklas |
The 'data-valid' attribute is set to 1 or 0 depending on the outcome, |
3319 |
11 May 15 |
nicklas |
and 'data-warning' is set if the date is missing on non-required fields. |
3319 |
11 May 15 |
nicklas |
668 |
*/ |
3319 |
11 May 15 |
nicklas |
wizard.validateNumber = function(event) |
3319 |
11 May 15 |
nicklas |
670 |
{ |
3319 |
11 May 15 |
nicklas |
var target = event.currentTarget; |
3319 |
11 May 15 |
nicklas |
var isValid = false; |
3319 |
11 May 15 |
nicklas |
var isWarning = false; |
3319 |
11 May 15 |
nicklas |
674 |
|
3319 |
11 May 15 |
nicklas |
// Reset current status |
3319 |
11 May 15 |
nicklas |
wizard.setInputStatus(target); |
3319 |
11 May 15 |
nicklas |
677 |
|
3319 |
11 May 15 |
nicklas |
var nbr = target.value; |
3319 |
11 May 15 |
nicklas |
if (nbr == '') |
3319 |
11 May 15 |
nicklas |
680 |
{ |
3319 |
11 May 15 |
nicklas |
// No value, is this an error or a warning? |
3319 |
11 May 15 |
nicklas |
var optional = target.className.indexOf('required') == -1; |
3319 |
11 May 15 |
nicklas |
wizard.setInputStatus(target, optional ? 'warning' : 'invalid', 'Missing'); |
3319 |
11 May 15 |
nicklas |
isValid = optional; |
3319 |
11 May 15 |
nicklas |
isWarning = optional; |
3319 |
11 May 15 |
nicklas |
686 |
} |
3319 |
11 May 15 |
nicklas |
else if (isNaN(parseFloat(nbr))) |
3319 |
11 May 15 |
nicklas |
688 |
{ |
3319 |
11 May 15 |
nicklas |
wizard.setInputStatus(target, 'invalid', 'Not a number'); |
3319 |
11 May 15 |
nicklas |
690 |
} |
3319 |
11 May 15 |
nicklas |
else |
3319 |
11 May 15 |
nicklas |
692 |
{ |
3319 |
11 May 15 |
nicklas |
var value = parseFloat(nbr); |
3319 |
11 May 15 |
nicklas |
var min = Data.float(target, 'min-value'); |
3319 |
11 May 15 |
nicklas |
var max = Data.float(target, 'max-value'); |
3319 |
11 May 15 |
nicklas |
var def = Data.float(target, 'default-value'); |
3319 |
11 May 15 |
nicklas |
697 |
|
3319 |
11 May 15 |
nicklas |
if (min != null && value < min) |
3319 |
11 May 15 |
nicklas |
699 |
{ |
3319 |
11 May 15 |
nicklas |
Wizard.setInputStatus(target, 'invalid', 'Must be >= ' + min); |
3319 |
11 May 15 |
nicklas |
701 |
} |
3319 |
11 May 15 |
nicklas |
else if (max != null && value > max) |
3319 |
11 May 15 |
nicklas |
703 |
{ |
3319 |
11 May 15 |
nicklas |
Wizard.setInputStatus(target, 'invalid', 'Must be <= ' + max); |
3319 |
11 May 15 |
nicklas |
705 |
} |
3319 |
11 May 15 |
nicklas |
else |
3319 |
11 May 15 |
nicklas |
707 |
{ |
3319 |
11 May 15 |
nicklas |
isValid = true; |
3319 |
11 May 15 |
nicklas |
if (def != null && def != value) |
3319 |
11 May 15 |
nicklas |
710 |
{ |
3319 |
11 May 15 |
nicklas |
Wizard.setInputStatus(target, 'warning', 'Default: ' + def); |
3319 |
11 May 15 |
nicklas |
isWarning = true; |
3319 |
11 May 15 |
nicklas |
713 |
} |
3319 |
11 May 15 |
nicklas |
else |
3319 |
11 May 15 |
nicklas |
715 |
{ |
3319 |
11 May 15 |
nicklas |
Wizard.setInputStatus(target, 'valid'); |
3319 |
11 May 15 |
nicklas |
717 |
} |
3319 |
11 May 15 |
nicklas |
718 |
} |
3319 |
11 May 15 |
nicklas |
719 |
} |
3319 |
11 May 15 |
nicklas |
720 |
|
3319 |
11 May 15 |
nicklas |
Data.set(target, 'valid', isValid ? 1 : 0); |
3319 |
11 May 15 |
nicklas |
Data.set(target, 'warning', isWarning ? 1 : 0); |
3319 |
11 May 15 |
nicklas |
723 |
|
3319 |
11 May 15 |
nicklas |
if (!isValid && target.focus) target.focus(); |
3319 |
11 May 15 |
nicklas |
return isValid; |
3319 |
11 May 15 |
nicklas |
726 |
|
3319 |
11 May 15 |
nicklas |
727 |
} |
2599 |
25 Aug 14 |
nicklas |
728 |
|
2599 |
25 Aug 14 |
nicklas |
wizard.isValid = function(element) |
2599 |
25 Aug 14 |
nicklas |
730 |
{ |
2666 |
15 Sep 14 |
nicklas |
return Data.int(element, 'valid', 1); |
2599 |
25 Aug 14 |
nicklas |
732 |
} |
2599 |
25 Aug 14 |
nicklas |
733 |
|
2666 |
15 Sep 14 |
nicklas |
734 |
|
2666 |
15 Sep 14 |
nicklas |
wizard.initFileSelectionField = function(element) |
2666 |
15 Sep 14 |
nicklas |
736 |
{ |
2666 |
15 Sep 14 |
nicklas |
element = Doc.element(element); |
2666 |
15 Sep 14 |
nicklas |
738 |
|
2666 |
15 Sep 14 |
nicklas |
var subtype = Data.get(element, 'subtype'); |
2666 |
15 Sep 14 |
nicklas |
if (subtype) |
2666 |
15 Sep 14 |
nicklas |
741 |
{ |
2675 |
17 Sep 14 |
nicklas |
element.subtype = Reggie.getSubtypeInfo(subtype); |
2666 |
15 Sep 14 |
nicklas |
743 |
} |
2666 |
15 Sep 14 |
nicklas |
744 |
|
4627 |
21 Nov 17 |
nicklas |
if (element.type != 'file') |
4627 |
21 Nov 17 |
nicklas |
746 |
{ |
4627 |
21 Nov 17 |
nicklas |
Buttons.addClickHandler(element.id + '.btn', wizard.browseOnClick, { 'file-field': element.id }); |
4627 |
21 Nov 17 |
nicklas |
Events.doOnEnter(element, wizard.browseOnClick); |
4627 |
21 Nov 17 |
nicklas |
749 |
} |
2666 |
15 Sep 14 |
nicklas |
750 |
|
2666 |
15 Sep 14 |
nicklas |
Events.addEventHandler(element, 'base-selected', wizard.fileSelected); |
2666 |
15 Sep 14 |
nicklas |
Events.addEventHandler(element, 'change', wizard.fileChanged); |
2675 |
17 Sep 14 |
nicklas |
Events.sendChangeEvent(element); |
2666 |
15 Sep 14 |
nicklas |
754 |
} |
2666 |
15 Sep 14 |
nicklas |
755 |
|
2666 |
15 Sep 14 |
nicklas |
wizard.browseOnClick = function(event) |
2666 |
15 Sep 14 |
nicklas |
757 |
{ |
2666 |
15 Sep 14 |
nicklas |
var fileField = Doc.element(Data.get(event.currentTarget, 'file-field', event.currentTarget.id)); |
2666 |
15 Sep 14 |
nicklas |
759 |
|
2666 |
15 Sep 14 |
nicklas |
var url = '&resetTemporary=1'; |
2666 |
15 Sep 14 |
nicklas |
var nameFilter = Data.get(fileField, 'name-filter'); |
2666 |
15 Sep 14 |
nicklas |
if (nameFilter) |
2666 |
15 Sep 14 |
nicklas |
763 |
{ |
2666 |
15 Sep 14 |
nicklas |
url += '&tmpfilter:STRING:name='+encodeURIComponent(nameFilter); |
2666 |
15 Sep 14 |
nicklas |
765 |
} |
2666 |
15 Sep 14 |
nicklas |
766 |
|
2666 |
15 Sep 14 |
nicklas |
var subtype = fileField.subtype; |
2666 |
15 Sep 14 |
nicklas |
if (subtype) |
2666 |
15 Sep 14 |
nicklas |
769 |
{ |
2666 |
15 Sep 14 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtype.id; |
2666 |
15 Sep 14 |
nicklas |
771 |
} |
2666 |
15 Sep 14 |
nicklas |
772 |
|
2666 |
15 Sep 14 |
nicklas |
var directory = Data.get(fileField, 'directory'); |
2675 |
17 Sep 14 |
nicklas |
if (directory && !Data.get(fileField, 'has-browsed')) |
2666 |
15 Sep 14 |
nicklas |
775 |
{ |
2666 |
15 Sep 14 |
nicklas |
Reggie.setCurrentDirectory(directory); |
2675 |
17 Sep 14 |
nicklas |
Data.set(fileField, 'has-browsed', 1); |
2666 |
15 Sep 14 |
nicklas |
778 |
} |
2666 |
15 Sep 14 |
nicklas |
779 |
|
2666 |
15 Sep 14 |
nicklas |
Dialogs.selectItem('FILE', fileField, 0, url); |
2666 |
15 Sep 14 |
nicklas |
781 |
} |
2666 |
15 Sep 14 |
nicklas |
782 |
|
2666 |
15 Sep 14 |
nicklas |
wizard.fileSelected = function(event) |
2666 |
15 Sep 14 |
nicklas |
784 |
{ |
2666 |
15 Sep 14 |
nicklas |
event.currentTarget.value = event.detail.name; |
7160 |
11 May 23 |
nicklas |
Data.set(event.currentTarget, 'file-id', event.detail.id); |
2666 |
15 Sep 14 |
nicklas |
Events.sendChangeEvent(event.currentTarget); |
2666 |
15 Sep 14 |
nicklas |
788 |
} |
2666 |
15 Sep 14 |
nicklas |
789 |
|
2666 |
15 Sep 14 |
nicklas |
wizard.fileChanged = function(event) |
2666 |
15 Sep 14 |
nicklas |
791 |
{ |
2666 |
15 Sep 14 |
nicklas |
var target = event.currentTarget; |
2666 |
15 Sep 14 |
nicklas |
793 |
|
2666 |
15 Sep 14 |
nicklas |
var isValid = false; |
2666 |
15 Sep 14 |
nicklas |
var isWarning = false; |
2666 |
15 Sep 14 |
nicklas |
796 |
|
2666 |
15 Sep 14 |
nicklas |
// Reset current status |
2666 |
15 Sep 14 |
nicklas |
wizard.setInputStatus(target); |
2666 |
15 Sep 14 |
nicklas |
799 |
|
2666 |
15 Sep 14 |
nicklas |
var path = target.value; |
2666 |
15 Sep 14 |
nicklas |
if (path == '') |
2666 |
15 Sep 14 |
nicklas |
802 |
{ |
2666 |
15 Sep 14 |
nicklas |
// No file, is this an error or a warning? |
2666 |
15 Sep 14 |
nicklas |
var optional = target.className.indexOf('required') == -1; |
2666 |
15 Sep 14 |
nicklas |
wizard.setInputStatus(target, optional ? 'warning' : 'invalid', 'Missing'); |
2666 |
15 Sep 14 |
nicklas |
isValid = optional; |
2666 |
15 Sep 14 |
nicklas |
isWarning = optional; |
2666 |
15 Sep 14 |
nicklas |
808 |
} |
2666 |
15 Sep 14 |
nicklas |
else |
2666 |
15 Sep 14 |
nicklas |
810 |
{ |
2666 |
15 Sep 14 |
nicklas |
Wizard.setInputStatus(target, 'valid'); |
2666 |
15 Sep 14 |
nicklas |
isValid = true; |
2666 |
15 Sep 14 |
nicklas |
813 |
} |
2666 |
15 Sep 14 |
nicklas |
814 |
|
2666 |
15 Sep 14 |
nicklas |
Data.set(target, 'valid', isValid ? 1 : 0); |
2666 |
15 Sep 14 |
nicklas |
Data.set(target, 'warning', isWarning ? 1 : 0); |
2666 |
15 Sep 14 |
nicklas |
817 |
|
2666 |
15 Sep 14 |
nicklas |
if (!isValid && target.focus) target.focus(); |
2666 |
15 Sep 14 |
nicklas |
819 |
} |
2666 |
15 Sep 14 |
nicklas |
820 |
|
2666 |
15 Sep 14 |
nicklas |
821 |
|
2599 |
25 Aug 14 |
nicklas |
822 |
/** |
2599 |
25 Aug 14 |
nicklas |
Change display status for an input field. |
2599 |
25 Aug 14 |
nicklas |
@param prefix ID prefix to locate tags |
2599 |
25 Aug 14 |
nicklas |
@param clazz The message clazz (valid, invalid, warning) or empty |
2599 |
25 Aug 14 |
nicklas |
@param message The message (may be empty) |
2599 |
25 Aug 14 |
nicklas |
827 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.setInputStatus = function(prefix, clazz, message) |
2599 |
25 Aug 14 |
nicklas |
829 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (prefix.id) prefix = prefix.id; |
2599 |
25 Aug 14 |
nicklas |
831 |
|
2599 |
25 Aug 14 |
nicklas |
var statusTag = Doc.element(prefix + '.status'); |
2599 |
25 Aug 14 |
nicklas |
833 |
|
3270 |
23 Apr 15 |
nicklas |
if (statusTag) |
2629 |
02 Sep 14 |
nicklas |
835 |
{ |
3270 |
23 Apr 15 |
nicklas |
statusTag.className = 'status ' + (clazz || ''); |
3270 |
23 Apr 15 |
nicklas |
var trTag = statusTag.parentNode; |
3270 |
23 Apr 15 |
nicklas |
var trClass = Data.get(trTag, 'original-class'); |
3270 |
23 Apr 15 |
nicklas |
if (!trClass) |
3270 |
23 Apr 15 |
nicklas |
840 |
{ |
3270 |
23 Apr 15 |
nicklas |
trClass = trTag.className || 'foo'; |
3270 |
23 Apr 15 |
nicklas |
Data.set(trTag, 'original-class', trClass); |
3270 |
23 Apr 15 |
nicklas |
843 |
} |
3270 |
23 Apr 15 |
nicklas |
trTag.className = trClass + ' ' + (clazz || ''); |
2629 |
02 Sep 14 |
nicklas |
845 |
} |
2629 |
02 Sep 14 |
nicklas |
846 |
|
2599 |
25 Aug 14 |
nicklas |
var msgTag = Doc.element(prefix + '.message'); |
2599 |
25 Aug 14 |
nicklas |
if (msgTag) |
2599 |
25 Aug 14 |
nicklas |
849 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (message) |
2599 |
25 Aug 14 |
nicklas |
851 |
{ |
2599 |
25 Aug 14 |
nicklas |
msgTag.innerHTML = message; |
2641 |
09 Sep 14 |
nicklas |
Doc.show(msgTag, Data.get(msgTag, 'display', 'inline')); |
2599 |
25 Aug 14 |
nicklas |
854 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
856 |
{ |
2599 |
25 Aug 14 |
nicklas |
msgTag.innerHTML = message; |
2599 |
25 Aug 14 |
nicklas |
Doc.hide(msgTag); |
2599 |
25 Aug 14 |
nicklas |
859 |
} |
2599 |
25 Aug 14 |
nicklas |
860 |
} |
3270 |
23 Apr 15 |
nicklas |
else if (statusTag) |
2599 |
25 Aug 14 |
nicklas |
862 |
{ |
2599 |
25 Aug 14 |
nicklas |
statusTag.title = message || ''; |
2599 |
25 Aug 14 |
nicklas |
864 |
} |
2599 |
25 Aug 14 |
nicklas |
865 |
} |
2599 |
25 Aug 14 |
nicklas |
866 |
|
2599 |
25 Aug 14 |
nicklas |
867 |
|
2599 |
25 Aug 14 |
nicklas |
868 |
/** |
2599 |
25 Aug 14 |
nicklas |
Event handler for input fields, that go to the |
2599 |
25 Aug 14 |
nicklas |
next wizard step if TAB or ENTER key is pressed. |
2599 |
25 Aug 14 |
nicklas |
A short delay is used to allow other event handler |
2599 |
25 Aug 14 |
nicklas |
to run first (eg. for validation). |
2599 |
25 Aug 14 |
nicklas |
873 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.goNextOnTabOrEnter = function(event) |
2599 |
25 Aug 14 |
nicklas |
875 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (event.keyCode == 9 || event.keyCode == 13) |
2599 |
25 Aug 14 |
nicklas |
877 |
{ |
6997 |
20 Jan 23 |
nicklas |
if (event.keyCode == 13 && event.target.blur) event.target.blur(); |
2599 |
25 Aug 14 |
nicklas |
setTimeout(function() { wizard.goNext(true) }, 200); |
2599 |
25 Aug 14 |
nicklas |
880 |
} |
2599 |
25 Aug 14 |
nicklas |
881 |
} |
2599 |
25 Aug 14 |
nicklas |
882 |
|
2599 |
25 Aug 14 |
nicklas |
883 |
/** |
2677 |
17 Sep 14 |
nicklas |
Event handler for input fields, that go to the |
2677 |
17 Sep 14 |
nicklas |
next wizard step if TAB key is pressed. |
2677 |
17 Sep 14 |
nicklas |
A short delay is used to allow other event handler |
2677 |
17 Sep 14 |
nicklas |
to run first (eg. for validation). |
2677 |
17 Sep 14 |
nicklas |
888 |
*/ |
2677 |
17 Sep 14 |
nicklas |
wizard.goNextOnTab = function(event) |
2677 |
17 Sep 14 |
nicklas |
890 |
{ |
2677 |
17 Sep 14 |
nicklas |
if (event.keyCode == 9) |
2677 |
17 Sep 14 |
nicklas |
892 |
{ |
2677 |
17 Sep 14 |
nicklas |
setTimeout(function() { wizard.goNext(true) }, 200); |
2677 |
17 Sep 14 |
nicklas |
894 |
} |
2677 |
17 Sep 14 |
nicklas |
895 |
} |
2677 |
17 Sep 14 |
nicklas |
896 |
|
2677 |
17 Sep 14 |
nicklas |
897 |
/** |
2599 |
25 Aug 14 |
nicklas |
Event handler for input fields, that changes |
2599 |
25 Aug 14 |
nicklas |
focus to the next element. The next element |
2599 |
25 Aug 14 |
nicklas |
should be defined by 'data-next-focus' attribute. |
2599 |
25 Aug 14 |
nicklas |
It is recommended that this is consisistent with TAB. |
2599 |
25 Aug 14 |
nicklas |
902 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.focusOnEnter = function(event) |
2599 |
25 Aug 14 |
nicklas |
904 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (event.keyCode == 13) |
2599 |
25 Aug 14 |
nicklas |
906 |
{ |
2599 |
25 Aug 14 |
nicklas |
var nextFocus = Doc.element(Data.get(event.currentTarget, 'next-focus')); |
2599 |
25 Aug 14 |
nicklas |
if (nextFocus && nextFocus.focus) nextFocus.focus(); |
2599 |
25 Aug 14 |
nicklas |
909 |
} |
2599 |
25 Aug 14 |
nicklas |
910 |
} |
2599 |
25 Aug 14 |
nicklas |
911 |
|
2599 |
25 Aug 14 |
nicklas |
// Event handler for the 'Next' navigation button |
6824 |
30 Aug 22 |
nicklas |
wizard.goNextOnClick = function() |
2599 |
25 Aug 14 |
nicklas |
914 |
{ |
2599 |
25 Aug 14 |
nicklas |
wizard.goNext(false); |
2599 |
25 Aug 14 |
nicklas |
916 |
} |
2599 |
25 Aug 14 |
nicklas |
917 |
|
2599 |
25 Aug 14 |
nicklas |
918 |
/** |
2599 |
25 Aug 14 |
nicklas |
Go to the next step in the wizard. This method will first |
2599 |
25 Aug 14 |
nicklas |
submit 'wizard-validate' event to the current step. If at |
2599 |
25 Aug 14 |
nicklas |
least one event handler calls 'Event.preventDefault()' the |
2599 |
25 Aug 14 |
nicklas |
processing is aborted. |
2599 |
25 Aug 14 |
nicklas |
923 |
|
2599 |
25 Aug 14 |
nicklas |
Otherwise, the current step is disabled and the 'wizard-initialize' |
2599 |
25 Aug 14 |
nicklas |
event is sent to the next step. The event handler is responsible |
2599 |
25 Aug 14 |
nicklas |
for calling 'Wizard.setCurrentStep' to display the next step. |
2599 |
25 Aug 14 |
nicklas |
927 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.goNext = function(auto) |
2599 |
25 Aug 14 |
nicklas |
929 |
{ |
2602 |
27 Aug 14 |
nicklas |
var verify = Doc.element('verifyGoNext'); |
2602 |
27 Aug 14 |
nicklas |
if (verify && !verify.checked) return; |
2602 |
27 Aug 14 |
nicklas |
932 |
|
6277 |
03 Jun 21 |
nicklas |
// Send 'wizard-validate' event to current step |
2602 |
27 Aug 14 |
nicklas |
var details = { 'auto': auto }; |
6277 |
03 Jun 21 |
nicklas |
if (!wizard.validateCurrentStep(details)) return; |
2599 |
25 Aug 14 |
nicklas |
936 |
|
2599 |
25 Aug 14 |
nicklas |
// Hide all navigation buttons and disable form controls in current step |
2599 |
25 Aug 14 |
nicklas |
internal.hideButtons('navigation'); |
6277 |
03 Jun 21 |
nicklas |
internal.disableStep('step-'+currentStep); |
2599 |
25 Aug 14 |
nicklas |
940 |
|
2599 |
25 Aug 14 |
nicklas |
// Send 'wizard-initialize' to the next step |
2599 |
25 Aug 14 |
nicklas |
var nextStep = Doc.element('step-'+(currentStep+1)); |
6824 |
30 Aug 22 |
nicklas |
var evt = new CustomEvent('wizard-initialize', {'bubbles': true, 'cancelable': true, 'detail': details}); |
2599 |
25 Aug 14 |
nicklas |
nextStep.dispatchEvent(evt); |
2599 |
25 Aug 14 |
nicklas |
945 |
} |
2599 |
25 Aug 14 |
nicklas |
946 |
|
6277 |
03 Jun 21 |
nicklas |
wizard.validateCurrentStep = function(details) |
6277 |
03 Jun 21 |
nicklas |
948 |
{ |
6277 |
03 Jun 21 |
nicklas |
// Send 'wizard-validate' event to current step |
6277 |
03 Jun 21 |
nicklas |
var step = Doc.element('step-'+currentStep); |
6824 |
30 Aug 22 |
nicklas |
var evt = new CustomEvent('wizard-validate', {'bubbles': true, 'cancelable': true, 'detail': details}); |
6277 |
03 Jun 21 |
nicklas |
if (!step.dispatchEvent(evt)) |
6277 |
03 Jun 21 |
nicklas |
953 |
{ |
6277 |
03 Jun 21 |
nicklas |
wizard.notifyError(); |
6277 |
03 Jun 21 |
nicklas |
return false; |
6277 |
03 Jun 21 |
nicklas |
956 |
} |
6277 |
03 Jun 21 |
nicklas |
return true; |
6277 |
03 Jun 21 |
nicklas |
958 |
} |
6277 |
03 Jun 21 |
nicklas |
959 |
|
2653 |
11 Sep 14 |
nicklas |
wizard.notifyError = function() |
2653 |
11 Sep 14 |
nicklas |
961 |
{ |
2653 |
11 Sep 14 |
nicklas |
Doc.addClass('wizard', 'flash-error'); |
2653 |
11 Sep 14 |
nicklas |
setTimeout(internal.stopFlashing, 2000); |
2653 |
11 Sep 14 |
nicklas |
964 |
} |
2653 |
11 Sep 14 |
nicklas |
965 |
|
2629 |
02 Sep 14 |
nicklas |
internal.stopFlashing = function() |
2629 |
02 Sep 14 |
nicklas |
967 |
{ |
2629 |
02 Sep 14 |
nicklas |
Doc.removeClass('wizard', 'flash-error'); |
2629 |
02 Sep 14 |
nicklas |
969 |
} |
2629 |
02 Sep 14 |
nicklas |
970 |
|
2599 |
25 Aug 14 |
nicklas |
971 |
/** |
2599 |
25 Aug 14 |
nicklas |
Finalize the registration of the wizard. This method will |
2599 |
25 Aug 14 |
nicklas |
first submit 'wizard-validate' to the current step. If at |
2599 |
25 Aug 14 |
nicklas |
least one event handler calls 'Event.preventDefault()' the |
2599 |
25 Aug 14 |
nicklas |
processing is aborted. |
2599 |
25 Aug 14 |
nicklas |
976 |
|
2599 |
25 Aug 14 |
nicklas |
Otherwise, the current step is disabled and the 'wizard-submit' |
2599 |
25 Aug 14 |
nicklas |
event is sent to the 'wizard'. The event handler is responsible |
2599 |
25 Aug 14 |
nicklas |
for finalizing the registration and displaying a proper |
2599 |
25 Aug 14 |
nicklas |
message, for example, by calling Wizard.showFinalMessage() |
3787 |
17 Mar 16 |
nicklas |
981 |
|
3787 |
17 Mar 16 |
nicklas |
The 'data' is passed on to the 'wizard-validate' and |
3787 |
17 Mar 16 |
nicklas |
'wizard-submit' events as the Event.details object. |
2599 |
25 Aug 14 |
nicklas |
984 |
*/ |
3787 |
17 Mar 16 |
nicklas |
wizard.goRegister = function(data) |
2599 |
25 Aug 14 |
nicklas |
986 |
{ |
2602 |
27 Aug 14 |
nicklas |
// Check if verification is enabled |
2602 |
27 Aug 14 |
nicklas |
var verify = Doc.element('verifyGoNext'); |
2602 |
27 Aug 14 |
nicklas |
if (verify && !verify.checked) return; |
2602 |
27 Aug 14 |
nicklas |
990 |
|
2599 |
25 Aug 14 |
nicklas |
// Send 'wizard-validate' event to current step |
2599 |
25 Aug 14 |
nicklas |
var step = Doc.element('step-'+currentStep); |
6824 |
30 Aug 22 |
nicklas |
var evt = new CustomEvent('wizard-validate', {'bubbles': true, 'cancelable': true, 'detail': data}); |
2629 |
02 Sep 14 |
nicklas |
if (!step.dispatchEvent(evt)) |
2629 |
02 Sep 14 |
nicklas |
995 |
{ |
2686 |
22 Sep 14 |
nicklas |
wizard.notifyError(); |
2629 |
02 Sep 14 |
nicklas |
return; |
2629 |
02 Sep 14 |
nicklas |
998 |
} |
2599 |
25 Aug 14 |
nicklas |
999 |
|
2599 |
25 Aug 14 |
nicklas |
internal.hideButtons('navigation'); |
2599 |
25 Aug 14 |
nicklas |
internal.disableStep(step); |
2599 |
25 Aug 14 |
nicklas |
1002 |
|
2599 |
25 Aug 14 |
nicklas |
// Send 'wizard-submit' to the next step |
2599 |
25 Aug 14 |
nicklas |
var wiz = Doc.element('wizard'); |
2658 |
12 Sep 14 |
nicklas |
hasSentRegistration = true; |
6824 |
30 Aug 22 |
nicklas |
var evt = new CustomEvent('wizard-submit', {'bubbles': true, 'cancelable': true, 'detail': data}); |
2599 |
25 Aug 14 |
nicklas |
wiz.dispatchEvent(evt); |
2924 |
13 Nov 14 |
nicklas |
wizard.hideDebugTools(); |
2599 |
25 Aug 14 |
nicklas |
1009 |
} |
2599 |
25 Aug 14 |
nicklas |
1010 |
|
2803 |
14 Oct 14 |
nicklas |
wizard.setNoConfirmOnFirstStep = function(cf) |
2803 |
14 Oct 14 |
nicklas |
1012 |
{ |
2803 |
14 Oct 14 |
nicklas |
noConfirmOnFirstStep = cf; |
2803 |
14 Oct 14 |
nicklas |
1014 |
} |
2803 |
14 Oct 14 |
nicklas |
1015 |
|
5058 |
29 Oct 18 |
nicklas |
wizard.setNoConfirm = function(nc) |
5058 |
29 Oct 18 |
nicklas |
1017 |
{ |
5058 |
29 Oct 18 |
nicklas |
noConfirm = nc; |
5058 |
29 Oct 18 |
nicklas |
1019 |
} |
5058 |
29 Oct 18 |
nicklas |
1020 |
|
2599 |
25 Aug 14 |
nicklas |
// Ask the user for confirmation and then restart the wizard |
2599 |
25 Aug 14 |
nicklas |
wizard.cancelWizard = function() |
2599 |
25 Aug 14 |
nicklas |
1023 |
{ |
2658 |
12 Sep 14 |
nicklas |
forceConfirm = true; |
2658 |
12 Sep 14 |
nicklas |
wizard.restartWizard(); |
2599 |
25 Aug 14 |
nicklas |
1026 |
} |
2599 |
25 Aug 14 |
nicklas |
1027 |
|
2599 |
25 Aug 14 |
nicklas |
// Restart the wizard without asking the user for confirmation |
2599 |
25 Aug 14 |
nicklas |
wizard.restartWizard = function() |
2599 |
25 Aug 14 |
nicklas |
1030 |
{ |
2599 |
25 Aug 14 |
nicklas |
var url = location.href; |
2599 |
25 Aug 14 |
nicklas |
if (url.indexOf('&restart=1') == -1) url += '&restart=1'; |
2599 |
25 Aug 14 |
nicklas |
location.href = url; |
2599 |
25 Aug 14 |
nicklas |
1034 |
} |
2599 |
25 Aug 14 |
nicklas |
1035 |
|
2653 |
11 Sep 14 |
nicklas |
wizard.goPrint = function() |
2653 |
11 Sep 14 |
nicklas |
1037 |
{ |
2653 |
11 Sep 14 |
nicklas |
window.print(); |
2653 |
11 Sep 14 |
nicklas |
1039 |
} |
2653 |
11 Sep 14 |
nicklas |
1040 |
|
2599 |
25 Aug 14 |
nicklas |
wizard.setCurrentStep = function(stepNo) |
2599 |
25 Aug 14 |
nicklas |
1042 |
{ |
2599 |
25 Aug 14 |
nicklas |
currentStep = stepNo; |
2599 |
25 Aug 14 |
nicklas |
internal.enableStep(Doc.element('step-'+currentStep)); |
2599 |
25 Aug 14 |
nicklas |
1045 |
} |
2599 |
25 Aug 14 |
nicklas |
1046 |
|
2599 |
25 Aug 14 |
nicklas |
internal.disableStep = function(step) |
2599 |
25 Aug 14 |
nicklas |
1048 |
{ |
2599 |
25 Aug 14 |
nicklas |
step = Doc.element(step); |
2599 |
25 Aug 14 |
nicklas |
internal.disableAllFormElements(step); |
2599 |
25 Aug 14 |
nicklas |
Doc.addClass(step, 'disabled'); |
2602 |
27 Aug 14 |
nicklas |
Doc.hide('gonext-message'); |
2599 |
25 Aug 14 |
nicklas |
var stepNo = step.getElementsByClassName('step-no')[0]; |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler(stepNo, 'click', internal.togglePastStep, {'step-id': step.id}); |
2599 |
25 Aug 14 |
nicklas |
stepNo.title = 'Show/hide this section'; |
2599 |
25 Aug 14 |
nicklas |
1056 |
} |
2599 |
25 Aug 14 |
nicklas |
1057 |
|
2599 |
25 Aug 14 |
nicklas |
internal.enableStep = function(step) |
2599 |
25 Aug 14 |
nicklas |
1059 |
{ |
2599 |
25 Aug 14 |
nicklas |
step = Doc.element(step); |
2599 |
25 Aug 14 |
nicklas |
Doc.removeClass(step, 'disabled'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show(step); |
2599 |
25 Aug 14 |
nicklas |
1063 |
} |
2599 |
25 Aug 14 |
nicklas |
1064 |
|
2599 |
25 Aug 14 |
nicklas |
// Toggle visibility of a past step |
2599 |
25 Aug 14 |
nicklas |
// The step is hidden if the 'auto-hide' class is present |
2599 |
25 Aug 14 |
nicklas |
internal.togglePastStep = function(event) |
2599 |
25 Aug 14 |
nicklas |
1068 |
{ |
2599 |
25 Aug 14 |
nicklas |
var step = Data.get(event.currentTarget, 'step-id'); |
2599 |
25 Aug 14 |
nicklas |
Doc.addOrRemoveClass(step, 'auto-hide'); |
2599 |
25 Aug 14 |
nicklas |
1071 |
} |
2599 |
25 Aug 14 |
nicklas |
1072 |
|
2599 |
25 Aug 14 |
nicklas |
wizard.syncJsonRequest = function(url, method, postdata) |
2599 |
25 Aug 14 |
nicklas |
1074 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (debug) |
2599 |
25 Aug 14 |
nicklas |
1076 |
{ |
2599 |
25 Aug 14 |
nicklas |
App.debug((method || 'GET') + ': ' + url); |
2599 |
25 Aug 14 |
nicklas |
if (postdata) App.debug(postdata); |
2599 |
25 Aug 14 |
nicklas |
1079 |
} |
2599 |
25 Aug 14 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
2599 |
25 Aug 14 |
nicklas |
request.open(method || 'GET', url, false); |
2599 |
25 Aug 14 |
nicklas |
if (postdata) |
2599 |
25 Aug 14 |
nicklas |
1083 |
{ |
3752 |
17 Feb 16 |
nicklas |
request.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); |
2599 |
25 Aug 14 |
nicklas |
1085 |
} |
2599 |
25 Aug 14 |
nicklas |
request.send(postdata || null); |
2599 |
25 Aug 14 |
nicklas |
1087 |
|
2599 |
25 Aug 14 |
nicklas |
if (debug) App.debug(request.responseText); |
2676 |
17 Sep 14 |
nicklas |
if (!hasFatalError) Wizard.hideWizardStatus(); |
2599 |
25 Aug 14 |
nicklas |
1090 |
|
2599 |
25 Aug 14 |
nicklas |
var response = null; |
2599 |
25 Aug 14 |
nicklas |
var errorMsg = null; |
2599 |
25 Aug 14 |
nicklas |
try |
2599 |
25 Aug 14 |
nicklas |
1094 |
{ |
2599 |
25 Aug 14 |
nicklas |
response = JSON.parse(request.responseText); |
2599 |
25 Aug 14 |
nicklas |
if (response.status != 'ok') |
2599 |
25 Aug 14 |
nicklas |
1097 |
{ |
2599 |
25 Aug 14 |
nicklas |
errorMsg = response.message; |
2599 |
25 Aug 14 |
nicklas |
1099 |
} |
2599 |
25 Aug 14 |
nicklas |
1100 |
} |
2599 |
25 Aug 14 |
nicklas |
catch (err) |
2599 |
25 Aug 14 |
nicklas |
1102 |
{ |
2599 |
25 Aug 14 |
nicklas |
errorMsg = err.toString ? err.toString() : err; |
2599 |
25 Aug 14 |
nicklas |
1104 |
} |
2599 |
25 Aug 14 |
nicklas |
1105 |
|
2599 |
25 Aug 14 |
nicklas |
if (errorMsg) |
2599 |
25 Aug 14 |
nicklas |
1107 |
{ |
2599 |
25 Aug 14 |
nicklas |
Wizard.setFatalError(errorMsg); |
2599 |
25 Aug 14 |
nicklas |
return null; |
2599 |
25 Aug 14 |
nicklas |
1110 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
1112 |
{ |
2599 |
25 Aug 14 |
nicklas |
return response; |
2599 |
25 Aug 14 |
nicklas |
1114 |
} |
2599 |
25 Aug 14 |
nicklas |
1115 |
} |
2599 |
25 Aug 14 |
nicklas |
1116 |
|
2599 |
25 Aug 14 |
nicklas |
1117 |
/** |
2599 |
25 Aug 14 |
nicklas |
Submit an ansynchronous request for JSON data. 'GET' method |
2599 |
25 Aug 14 |
nicklas |
is used if 'method' parameter is not set. |
2599 |
25 Aug 14 |
nicklas |
The 'callback' should be a method accepting a single |
2599 |
25 Aug 14 |
nicklas |
JSON parameter object. If the 'status' of the response |
2599 |
25 Aug 14 |
nicklas |
is not 'ok' this method will call setFatalError and |
2599 |
25 Aug 14 |
nicklas |
without calling the callback method. |
3998 |
15 Jun 16 |
nicklas |
1124 |
|
3998 |
15 Jun 16 |
nicklas |
The 'errorCallback' is an optional function parameter that should |
3998 |
15 Jun 16 |
nicklas |
take two parameters. The first is an Error object and the second is |
3998 |
15 Jun 16 |
nicklas |
the JSON response. The seconds parameter only has a value if the error |
3998 |
15 Jun 16 |
nicklas |
happens after parsing the response and is null otherwise. |
2599 |
25 Aug 14 |
nicklas |
1129 |
*/ |
3998 |
15 Jun 16 |
nicklas |
wizard.asyncJsonRequest = function(url, callback, method, postdata, errorCallback) |
2599 |
25 Aug 14 |
nicklas |
1131 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (debug) |
2599 |
25 Aug 14 |
nicklas |
1133 |
{ |
2599 |
25 Aug 14 |
nicklas |
App.debug((method || 'GET') + ': ' + url); |
2599 |
25 Aug 14 |
nicklas |
if (postdata) App.debug(postdata); |
2599 |
25 Aug 14 |
nicklas |
1136 |
} |
2599 |
25 Aug 14 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
2599 |
25 Aug 14 |
nicklas |
request.jsonCallback = callback; |
3998 |
15 Jun 16 |
nicklas |
request.errorCallback = errorCallback; |
2599 |
25 Aug 14 |
nicklas |
request.open(method || 'GET', url, true); |
3786 |
17 Mar 16 |
olle |
// Firefox only adds request header with needed "boundary" info, if request header is not set explicitly |
5910 |
17 Apr 20 |
nicklas |
if (postdata && !(postdata instanceof FormData) && !(postdata instanceof File)) |
2599 |
25 Aug 14 |
nicklas |
1143 |
{ |
3752 |
17 Feb 16 |
nicklas |
request.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); |
2599 |
25 Aug 14 |
nicklas |
1145 |
} |
2599 |
25 Aug 14 |
nicklas |
Ajax.setReadyStateHandler(request, internal.asyncCallbackWrapper, internal.asyncCallbackWrapper); |
2658 |
12 Sep 14 |
nicklas |
numLiveAsyncRequests++; |
2599 |
25 Aug 14 |
nicklas |
request.send(postdata || null); |
2599 |
25 Aug 14 |
nicklas |
1149 |
} |
2599 |
25 Aug 14 |
nicklas |
1150 |
|
2599 |
25 Aug 14 |
nicklas |
1151 |
/** |
2599 |
25 Aug 14 |
nicklas |
Callback wrapper for ansynchronous requests. |
2599 |
25 Aug 14 |
nicklas |
1153 |
*/ |
2599 |
25 Aug 14 |
nicklas |
internal.asyncCallbackWrapper = function(request) |
2599 |
25 Aug 14 |
nicklas |
1155 |
{ |
2658 |
12 Sep 14 |
nicklas |
numLiveAsyncRequests--; |
2599 |
25 Aug 14 |
nicklas |
if (debug) App.debug(request.responseText); |
2676 |
17 Sep 14 |
nicklas |
if (!hasFatalError) Wizard.hideWizardStatus(); |
2599 |
25 Aug 14 |
nicklas |
1159 |
|
2599 |
25 Aug 14 |
nicklas |
var response = null; |
2675 |
17 Sep 14 |
nicklas |
var messages = null; |
2599 |
25 Aug 14 |
nicklas |
try |
2599 |
25 Aug 14 |
nicklas |
1163 |
{ |
2603 |
27 Aug 14 |
nicklas |
if (request.status != 200) |
2599 |
25 Aug 14 |
nicklas |
1165 |
{ |
2622 |
02 Sep 14 |
nicklas |
throw new Error(request.responseText); |
2599 |
25 Aug 14 |
nicklas |
1167 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
1169 |
{ |
2603 |
27 Aug 14 |
nicklas |
if (request.getResponseHeader('Content-Type').indexOf('json') != -1) |
2603 |
27 Aug 14 |
nicklas |
1171 |
{ |
2603 |
27 Aug 14 |
nicklas |
response = JSON.parse(request.responseText); |
2675 |
17 Sep 14 |
nicklas |
messages = response.messages; |
2603 |
27 Aug 14 |
nicklas |
if (response.status != 'ok') |
2603 |
27 Aug 14 |
nicklas |
1175 |
{ |
2622 |
02 Sep 14 |
nicklas |
throw new Error(response.message || response.stacktrace); |
2603 |
27 Aug 14 |
nicklas |
1177 |
} |
2603 |
27 Aug 14 |
nicklas |
1178 |
} |
2603 |
27 Aug 14 |
nicklas |
else |
2603 |
27 Aug 14 |
nicklas |
1180 |
{ |
2603 |
27 Aug 14 |
nicklas |
response = request.responseText; |
2603 |
27 Aug 14 |
nicklas |
1182 |
} |
2671 |
16 Sep 14 |
nicklas |
if (request.jsonCallback && request.jsonCallback.call) |
2671 |
16 Sep 14 |
nicklas |
1184 |
{ |
2671 |
16 Sep 14 |
nicklas |
request.jsonCallback.call(null, response); |
2671 |
16 Sep 14 |
nicklas |
1186 |
} |
2599 |
25 Aug 14 |
nicklas |
1187 |
} |
2599 |
25 Aug 14 |
nicklas |
1188 |
} |
2599 |
25 Aug 14 |
nicklas |
catch (err) |
2599 |
25 Aug 14 |
nicklas |
1190 |
{ |
3998 |
15 Jun 16 |
nicklas |
if (request.errorCallback && request.errorCallback.call) |
3998 |
15 Jun 16 |
nicklas |
1192 |
{ |
3998 |
15 Jun 16 |
nicklas |
request.errorCallback.call(null, err, response); |
3998 |
15 Jun 16 |
nicklas |
1194 |
} |
3998 |
15 Jun 16 |
nicklas |
else |
3998 |
15 Jun 16 |
nicklas |
1196 |
{ |
3998 |
15 Jun 16 |
nicklas |
Wizard.setFatalError(err, messages); |
3998 |
15 Jun 16 |
nicklas |
1198 |
} |
2599 |
25 Aug 14 |
nicklas |
1199 |
} |
2599 |
25 Aug 14 |
nicklas |
1200 |
} |
2599 |
25 Aug 14 |
nicklas |
1201 |
|
2599 |
25 Aug 14 |
nicklas |
1202 |
|
2599 |
25 Aug 14 |
nicklas |
1203 |
/** |
2599 |
25 Aug 14 |
nicklas |
A fatal error has occurred and the wizard will not be able to continue. |
2599 |
25 Aug 14 |
nicklas |
This method will display the error message, disable all form input fields |
2599 |
25 Aug 14 |
nicklas |
and buttons (except the 'Restart' button). |
2599 |
25 Aug 14 |
nicklas |
1207 |
*/ |
2675 |
17 Sep 14 |
nicklas |
wizard.setFatalError = function(err, messages) |
2599 |
25 Aug 14 |
nicklas |
1209 |
{ |
2676 |
17 Sep 14 |
nicklas |
hasFatalError = true; |
2662 |
12 Sep 14 |
nicklas |
var msg = err; |
2662 |
12 Sep 14 |
nicklas |
if (err.toString) |
2662 |
12 Sep 14 |
nicklas |
1213 |
{ |
2662 |
12 Sep 14 |
nicklas |
App.debug(err.toString()); |
2662 |
12 Sep 14 |
nicklas |
msg = Strings.encodeTags(err.toString()); |
2675 |
17 Sep 14 |
nicklas |
if (err.stack && !messages) |
2670 |
15 Sep 14 |
nicklas |
1217 |
{ |
2670 |
15 Sep 14 |
nicklas |
App.debug(err.stack); |
2670 |
15 Sep 14 |
nicklas |
msg += '<br><pre>'+Strings.encodeTags(err.stack)+'</pre>'; |
2670 |
15 Sep 14 |
nicklas |
1220 |
} |
2662 |
12 Sep 14 |
nicklas |
1221 |
} |
2662 |
12 Sep 14 |
nicklas |
else |
2662 |
12 Sep 14 |
nicklas |
1223 |
{ |
2662 |
12 Sep 14 |
nicklas |
App.debug(msg); |
2662 |
12 Sep 14 |
nicklas |
1225 |
} |
2662 |
12 Sep 14 |
nicklas |
1226 |
|
2675 |
17 Sep 14 |
nicklas |
if (messages) |
2675 |
17 Sep 14 |
nicklas |
1228 |
{ |
2675 |
17 Sep 14 |
nicklas |
msg = '<div class="messagecontainer error">'+msg+'</div>'+internal.generateMessageList(messages).html; |
2803 |
14 Oct 14 |
nicklas |
wizard.setWizardStatus('success', msg); |
2675 |
17 Sep 14 |
nicklas |
1231 |
} |
2675 |
17 Sep 14 |
nicklas |
else |
2675 |
17 Sep 14 |
nicklas |
1233 |
{ |
2803 |
14 Oct 14 |
nicklas |
wizard.setWizardStatus('messagecontainer error', msg || 'Unexpected failure!'); |
2675 |
17 Sep 14 |
nicklas |
1235 |
} |
2675 |
17 Sep 14 |
nicklas |
1236 |
|
2599 |
25 Aug 14 |
nicklas |
Doc.addClass('wizard', 'disabled'); |
2599 |
25 Aug 14 |
nicklas |
internal.disableAllFormElements('wizard', true); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('gorestart'); |
2599 |
25 Aug 14 |
nicklas |
1240 |
} |
2599 |
25 Aug 14 |
nicklas |
1241 |
|
2599 |
25 Aug 14 |
nicklas |
1242 |
|
2599 |
25 Aug 14 |
nicklas |
1243 |
/** |
2599 |
25 Aug 14 |
nicklas |
Display a 'loading' global wizard-status message. |
3904 |
29 Apr 16 |
nicklas |
The 'progress' parameter is optional. If given, |
3904 |
29 Apr 16 |
nicklas |
it should be the name of a progress reporter. |
3904 |
29 Apr 16 |
nicklas |
This activates the display of a progress bar which |
3904 |
29 Apr 16 |
nicklas |
Reggie will update at regular intervals in the background. |
3904 |
29 Apr 16 |
nicklas |
See SessionServlet (cmd=GetProgress) for more information. |
2599 |
25 Aug 14 |
nicklas |
1250 |
*/ |
3904 |
29 Apr 16 |
nicklas |
wizard.showLoadingAnimation = function(msg, progress) |
2599 |
25 Aug 14 |
nicklas |
1252 |
{ |
3904 |
29 Apr 16 |
nicklas |
if (progress) |
3904 |
29 Apr 16 |
nicklas |
1254 |
{ |
5962 |
03 Jun 20 |
nicklas |
var progressMain = Doc.element('wizard-progress'); |
5962 |
03 Jun 20 |
nicklas |
1256 |
|
3904 |
29 Apr 16 |
nicklas |
// Get/create child elements |
5962 |
03 Jun 20 |
nicklas |
var progressMsg = Doc.element('wizard-progress-msg'); |
5962 |
03 Jun 20 |
nicklas |
if (!progressMsg) |
5962 |
03 Jun 20 |
nicklas |
1260 |
{ |
5962 |
03 Jun 20 |
nicklas |
progressMsg = document.createElement('div'); |
5962 |
03 Jun 20 |
nicklas |
progressMsg.id = 'wizard-progress-msg'; |
5962 |
03 Jun 20 |
nicklas |
progressMsg.className = 'progress-bar-message loading'; |
5962 |
03 Jun 20 |
nicklas |
progressMain.appendChild(progressMsg); |
5962 |
03 Jun 20 |
nicklas |
1265 |
} |
5962 |
03 Jun 20 |
nicklas |
progressMsg.innerHTML = msg || 'Working, please wait...'; |
5962 |
03 Jun 20 |
nicklas |
1267 |
|
5962 |
03 Jun 20 |
nicklas |
var progressBar = Doc.element('wizard-progress-bar'); |
5962 |
03 Jun 20 |
nicklas |
if (!progressBar) |
5962 |
03 Jun 20 |
nicklas |
1270 |
{ |
5962 |
03 Jun 20 |
nicklas |
progressBar = document.createElement('div'); |
5962 |
03 Jun 20 |
nicklas |
progressBar.id = 'wizard-progress-bar'; |
5962 |
03 Jun 20 |
nicklas |
progressBar.className = 'progress-bar'; |
5962 |
03 Jun 20 |
nicklas |
progressMain.appendChild(progressBar); |
5962 |
03 Jun 20 |
nicklas |
1275 |
} |
5962 |
03 Jun 20 |
nicklas |
1276 |
|
3904 |
29 Apr 16 |
nicklas |
var done = Doc.element('wizard-progress-done'); |
3904 |
29 Apr 16 |
nicklas |
if (!done) |
3904 |
29 Apr 16 |
nicklas |
1279 |
{ |
3904 |
29 Apr 16 |
nicklas |
done = document.createElement('span'); |
3904 |
29 Apr 16 |
nicklas |
done.id = 'wizard-progress-done'; |
3906 |
29 Apr 16 |
nicklas |
done.className = 'progress-bar-done bg-filled-100 topborder bottomborder leftborder'; |
3904 |
29 Apr 16 |
nicklas |
progressBar.appendChild(done); |
3904 |
29 Apr 16 |
nicklas |
1284 |
} |
3904 |
29 Apr 16 |
nicklas |
var remain = Doc.element('wizard-progress-remain'); |
3904 |
29 Apr 16 |
nicklas |
if (!remain) |
3904 |
29 Apr 16 |
nicklas |
1287 |
{ |
3904 |
29 Apr 16 |
nicklas |
remain = document.createElement('span'); |
3904 |
29 Apr 16 |
nicklas |
remain.id = 'wizard-progress-remain'; |
3906 |
29 Apr 16 |
nicklas |
remain.className = 'progress-bar-remain topborder bottomborder rightborder'; |
3904 |
29 Apr 16 |
nicklas |
progressBar.appendChild(remain); |
3904 |
29 Apr 16 |
nicklas |
1292 |
} |
3904 |
29 Apr 16 |
nicklas |
1293 |
|
3904 |
29 Apr 16 |
nicklas |
progressBar.setAttribute('value', '0%'); |
3904 |
29 Apr 16 |
nicklas |
done.style.width = '0%'; |
3904 |
29 Apr 16 |
nicklas |
remain.style.width = '100%'; |
5962 |
03 Jun 20 |
nicklas |
Doc.show(progressMain); |
5962 |
03 Jun 20 |
nicklas |
Doc.hide('wizard-status'); |
3904 |
29 Apr 16 |
nicklas |
1299 |
|
3904 |
29 Apr 16 |
nicklas |
// Initial request for updating the progress bar |
4477 |
03 May 17 |
nicklas |
progressTimer = setTimeout(internal.requestProgressUpdate, 1500, progress); |
3904 |
29 Apr 16 |
nicklas |
1302 |
} |
5962 |
03 Jun 20 |
nicklas |
else |
5962 |
03 Jun 20 |
nicklas |
1304 |
{ |
5962 |
03 Jun 20 |
nicklas |
wizard.setWizardStatus('loading', msg || 'Working, please wait...'); |
5962 |
03 Jun 20 |
nicklas |
1306 |
} |
2599 |
25 Aug 14 |
nicklas |
1307 |
} |
3904 |
29 Apr 16 |
nicklas |
1308 |
|
3904 |
29 Apr 16 |
nicklas |
1309 |
/** |
3904 |
29 Apr 16 |
nicklas |
Make a request for the progress information. The 'progress' |
3904 |
29 Apr 16 |
nicklas |
parameter is the name of a progress bar. |
3904 |
29 Apr 16 |
nicklas |
1312 |
*/ |
3904 |
29 Apr 16 |
nicklas |
internal.requestProgressUpdate = function(progress) |
3904 |
29 Apr 16 |
nicklas |
1314 |
{ |
3904 |
29 Apr 16 |
nicklas |
if (hasFatalError) return; |
3904 |
29 Apr 16 |
nicklas |
var url = '../Session.servlet?ID='+App.getSessionId(); |
3904 |
29 Apr 16 |
nicklas |
url += '&cmd=GetProgress'; |
3904 |
29 Apr 16 |
nicklas |
url += '&name='+encodeURIComponent(progress); |
3904 |
29 Apr 16 |
nicklas |
1319 |
|
3904 |
29 Apr 16 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
3904 |
29 Apr 16 |
nicklas |
request.open("GET", url, true); |
3904 |
29 Apr 16 |
nicklas |
Ajax.setReadyStateHandler(request, internal.onProgressReport, internal.onProgressReport); |
3904 |
29 Apr 16 |
nicklas |
request.send(null); |
3904 |
29 Apr 16 |
nicklas |
1324 |
} |
3904 |
29 Apr 16 |
nicklas |
1325 |
|
3904 |
29 Apr 16 |
nicklas |
1326 |
/** |
3904 |
29 Apr 16 |
nicklas |
Callback when receiving a progress update. |
3904 |
29 Apr 16 |
nicklas |
1328 |
*/ |
3904 |
29 Apr 16 |
nicklas |
internal.onProgressReport = function(request) |
3904 |
29 Apr 16 |
nicklas |
1330 |
{ |
3904 |
29 Apr 16 |
nicklas |
if (hasFatalError) return; |
3904 |
29 Apr 16 |
nicklas |
if (debug) App.debug(Strings.encodeTags(request.responseText)); |
3904 |
29 Apr 16 |
nicklas |
var response; |
3904 |
29 Apr 16 |
nicklas |
var error = false; |
3904 |
29 Apr 16 |
nicklas |
try |
3904 |
29 Apr 16 |
nicklas |
1336 |
{ |
3904 |
29 Apr 16 |
nicklas |
response = JSON.parse(request.responseText); |
3904 |
29 Apr 16 |
nicklas |
if (response.status != 'ok') |
3904 |
29 Apr 16 |
nicklas |
1339 |
{ |
3904 |
29 Apr 16 |
nicklas |
error = response.message || response.stacktrace || 'Unexpected error'; |
3904 |
29 Apr 16 |
nicklas |
1341 |
} |
3904 |
29 Apr 16 |
nicklas |
1342 |
} |
3904 |
29 Apr 16 |
nicklas |
catch (ex) |
3904 |
29 Apr 16 |
nicklas |
1344 |
{ |
3904 |
29 Apr 16 |
nicklas |
error = ex; |
3904 |
29 Apr 16 |
nicklas |
1346 |
} |
3904 |
29 Apr 16 |
nicklas |
1347 |
|
3904 |
29 Apr 16 |
nicklas |
if (error) |
3904 |
29 Apr 16 |
nicklas |
1349 |
{ |
3904 |
29 Apr 16 |
nicklas |
return; |
3904 |
29 Apr 16 |
nicklas |
1351 |
} |
2599 |
25 Aug 14 |
nicklas |
1352 |
|
3904 |
29 Apr 16 |
nicklas |
var progress = response.progress; |
5962 |
03 Jun 20 |
nicklas |
var progressMain = Doc.element('wizard-progress'); |
3904 |
29 Apr 16 |
nicklas |
1355 |
|
5962 |
03 Jun 20 |
nicklas |
if (!progress || progress.percent >= 100) |
3904 |
29 Apr 16 |
nicklas |
1357 |
{ |
5962 |
03 Jun 20 |
nicklas |
// Give up if no progress information or finished |
5962 |
03 Jun 20 |
nicklas |
progressTimer = null; |
5962 |
03 Jun 20 |
nicklas |
Doc.hide(progressMain); |
3904 |
29 Apr 16 |
nicklas |
return; |
3904 |
29 Apr 16 |
nicklas |
1362 |
} |
3904 |
29 Apr 16 |
nicklas |
1363 |
|
5962 |
03 Jun 20 |
nicklas |
var progressBar = Doc.element('wizard-progress-bar'); |
5962 |
03 Jun 20 |
nicklas |
var progressMsg = Doc.element('wizard-progress-msg'); |
3904 |
29 Apr 16 |
nicklas |
var done = Doc.element('wizard-progress-done'); |
3904 |
29 Apr 16 |
nicklas |
var remain = Doc.element('wizard-progress-remain'); |
3904 |
29 Apr 16 |
nicklas |
1368 |
|
3904 |
29 Apr 16 |
nicklas |
progressBar.setAttribute('value', progress.percent+'%'); |
3904 |
29 Apr 16 |
nicklas |
done.style.width = progress.percent+'%'; |
3904 |
29 Apr 16 |
nicklas |
remain.style.width = (100-progress.percent)+'%'; |
3904 |
29 Apr 16 |
nicklas |
1372 |
|
3904 |
29 Apr 16 |
nicklas |
if (progress.message) |
3904 |
29 Apr 16 |
nicklas |
1374 |
{ |
5962 |
03 Jun 20 |
nicklas |
progressMsg.innerHTML = Strings.encodeTags(progress.message); |
3904 |
29 Apr 16 |
nicklas |
1376 |
} |
3904 |
29 Apr 16 |
nicklas |
1377 |
|
3904 |
29 Apr 16 |
nicklas |
if (progress.percent < 100) |
3904 |
29 Apr 16 |
nicklas |
1379 |
{ |
3904 |
29 Apr 16 |
nicklas |
// Continue to request updates until we 100% has been reached |
4477 |
03 May 17 |
nicklas |
progressTimer = setTimeout(internal.requestProgressUpdate, 1500, progress.name); |
3904 |
29 Apr 16 |
nicklas |
1382 |
} |
3904 |
29 Apr 16 |
nicklas |
1383 |
} |
3904 |
29 Apr 16 |
nicklas |
1384 |
|
2618 |
01 Sep 14 |
nicklas |
wizard.showStatusMessage = function(msg) |
2618 |
01 Sep 14 |
nicklas |
1386 |
{ |
2803 |
14 Oct 14 |
nicklas |
wizard.setWizardStatus('messagecontainer note', msg); |
2618 |
01 Sep 14 |
nicklas |
1388 |
} |
2618 |
01 Sep 14 |
nicklas |
1389 |
|
5017 |
09 Oct 18 |
nicklas |
wizard.showGoNextConfirmation = function(verify, msg, defaultChecked) |
2602 |
27 Aug 14 |
nicklas |
1391 |
{ |
2602 |
27 Aug 14 |
nicklas |
var check = ''; |
2602 |
27 Aug 14 |
nicklas |
if (verify) |
2602 |
27 Aug 14 |
nicklas |
1394 |
{ |
5017 |
09 Oct 18 |
nicklas |
check = '<input type="checkbox" name="verifyGoNext" id="verifyGoNext"'+(defaultChecked?' checked':'')+'>'; |
5017 |
09 Oct 18 |
nicklas |
if (!defaultChecked) |
5017 |
09 Oct 18 |
nicklas |
1397 |
{ |
5017 |
09 Oct 18 |
nicklas |
Doc.addClass('gonext', 'disabled'); |
5017 |
09 Oct 18 |
nicklas |
Doc.addClass('goregister', 'disabled'); |
5017 |
09 Oct 18 |
nicklas |
1400 |
} |
2602 |
27 Aug 14 |
nicklas |
1401 |
} |
2602 |
27 Aug 14 |
nicklas |
1402 |
|
2602 |
27 Aug 14 |
nicklas |
var gonext = Doc.element('gonext-message'); |
2602 |
27 Aug 14 |
nicklas |
gonext.innerHTML = check + msg; |
2602 |
27 Aug 14 |
nicklas |
Doc.show(gonext); |
2602 |
27 Aug 14 |
nicklas |
1406 |
|
2602 |
27 Aug 14 |
nicklas |
if (verify) |
2602 |
27 Aug 14 |
nicklas |
1408 |
{ |
2602 |
27 Aug 14 |
nicklas |
Events.addEventHandler('verifyGoNext', 'click', internal.verifyInternalOnClick); |
2602 |
27 Aug 14 |
nicklas |
1410 |
} |
2602 |
27 Aug 14 |
nicklas |
1411 |
} |
2602 |
27 Aug 14 |
nicklas |
1412 |
|
2602 |
27 Aug 14 |
nicklas |
wizard.hideGoNextConfirmation = function() |
2602 |
27 Aug 14 |
nicklas |
1414 |
{ |
2602 |
27 Aug 14 |
nicklas |
var gonext = Doc.element('gonext-message'); |
2602 |
27 Aug 14 |
nicklas |
gonext.innerHTML = ''; |
2602 |
27 Aug 14 |
nicklas |
Doc.hide(gonext); |
2602 |
27 Aug 14 |
nicklas |
Doc.removeClass('gonext', 'disabled'); |
2602 |
27 Aug 14 |
nicklas |
Doc.removeClass('goregister', 'disabled'); |
2602 |
27 Aug 14 |
nicklas |
1420 |
} |
2602 |
27 Aug 14 |
nicklas |
1421 |
|
2602 |
27 Aug 14 |
nicklas |
internal.verifyInternalOnClick = function(event) |
2602 |
27 Aug 14 |
nicklas |
1423 |
{ |
2602 |
27 Aug 14 |
nicklas |
var checked = event.currentTarget.checked; |
2602 |
27 Aug 14 |
nicklas |
Doc.addOrRemoveClass('goregister', 'disabled', !checked); |
2602 |
27 Aug 14 |
nicklas |
Doc.addOrRemoveClass('gonext', 'disabled', !checked); |
2602 |
27 Aug 14 |
nicklas |
1427 |
} |
2602 |
27 Aug 14 |
nicklas |
1428 |
|
2599 |
25 Aug 14 |
nicklas |
1429 |
/** |
2599 |
25 Aug 14 |
nicklas |
Show final registration messages in a list. |
2599 |
25 Aug 14 |
nicklas |
1431 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.showFinalMessage = function(messages) |
2599 |
25 Aug 14 |
nicklas |
1433 |
{ |
2675 |
17 Sep 14 |
nicklas |
var msg = internal.generateMessageList(messages); |
2803 |
14 Oct 14 |
nicklas |
wizard.setWizardStatus('success', msg.html); |
4477 |
03 May 17 |
nicklas |
if (progressTimer) clearTimeout(progressTimer); |
2675 |
17 Sep 14 |
nicklas |
return { 'errors': msg.errors, 'warnings': msg.warnings }; |
2675 |
17 Sep 14 |
nicklas |
1438 |
} |
2675 |
17 Sep 14 |
nicklas |
1439 |
|
2924 |
13 Nov 14 |
nicklas |
1440 |
/** |
2924 |
13 Nov 14 |
nicklas |
Show the debug toolbar. |
2924 |
13 Nov 14 |
nicklas |
1442 |
*/ |
2924 |
13 Nov 14 |
nicklas |
wizard.showDebugTools = function() |
2924 |
13 Nov 14 |
nicklas |
1444 |
{ |
2924 |
13 Nov 14 |
nicklas |
var debugTools = Doc.element('debug-tools'); |
2924 |
13 Nov 14 |
nicklas |
if (!debugTools) |
2924 |
13 Nov 14 |
nicklas |
1447 |
{ |
2924 |
13 Nov 14 |
nicklas |
debugTools = document.createElement('div'); |
2924 |
13 Nov 14 |
nicklas |
debugTools.id = 'debug-tools'; |
2924 |
13 Nov 14 |
nicklas |
var wiz = Doc.element('wizard'); |
2924 |
13 Nov 14 |
nicklas |
wiz.parentNode.appendChild(debugTools); |
2924 |
13 Nov 14 |
nicklas |
1452 |
} |
2924 |
13 Nov 14 |
nicklas |
var debugTitle = Doc.element('debug-tools-title'); |
2924 |
13 Nov 14 |
nicklas |
if (!debugTitle) |
2924 |
13 Nov 14 |
nicklas |
1455 |
{ |
2924 |
13 Nov 14 |
nicklas |
debugTitle = document.createElement('div'); |
2924 |
13 Nov 14 |
nicklas |
debugTitle.id = 'debug-tools-title'; |
2924 |
13 Nov 14 |
nicklas |
debugTitle.innerHTML = 'DEBUG TOOLS — USE FOR DEBUGGING ONLY — DO NOT USE ON PRODUCTION SERVER'; |
2924 |
13 Nov 14 |
nicklas |
debugTools.parentNode.insertBefore(debugTitle, debugTools); |
2924 |
13 Nov 14 |
nicklas |
1460 |
} |
2924 |
13 Nov 14 |
nicklas |
Doc.show(debugTools, 'table-cell'); |
2924 |
13 Nov 14 |
nicklas |
Doc.show('debug-tools-title'); |
5161 |
30 Nov 18 |
nicklas |
Doc.addClass('wizard', 'debug-mode'); |
2924 |
13 Nov 14 |
nicklas |
1464 |
} |
2924 |
13 Nov 14 |
nicklas |
1465 |
|
2924 |
13 Nov 14 |
nicklas |
1466 |
/** |
2924 |
13 Nov 14 |
nicklas |
Hide the debug toolbar. |
2924 |
13 Nov 14 |
nicklas |
1468 |
*/ |
2924 |
13 Nov 14 |
nicklas |
wizard.hideDebugTools = function() |
2924 |
13 Nov 14 |
nicklas |
1470 |
{ |
2924 |
13 Nov 14 |
nicklas |
Doc.hide('debug-tools'); |
2924 |
13 Nov 14 |
nicklas |
Doc.hide('debug-tools-title'); |
5161 |
30 Nov 18 |
nicklas |
Doc.removeClass('wizard', 'debug-mode'); |
2924 |
13 Nov 14 |
nicklas |
1474 |
} |
2924 |
13 Nov 14 |
nicklas |
1475 |
|
2691 |
24 Sep 14 |
nicklas |
1476 |
|
2691 |
24 Sep 14 |
nicklas |
1477 |
/* |
2691 |
24 Sep 14 |
nicklas |
Call this method once to start a repeating timer that will submit |
2691 |
24 Sep 14 |
nicklas |
an Ajax request at regular intervals in order to keep the current login |
2691 |
24 Sep 14 |
nicklas |
session alive. Once started there is no way to stop the timer except |
2691 |
24 Sep 14 |
nicklas |
navigating away from the page. |
2691 |
24 Sep 14 |
nicklas |
@param reggieRoot Optional relative path to the root of the Reggie installation (for pages in a subdirectory) |
2691 |
24 Sep 14 |
nicklas |
1483 |
*/ |
2691 |
24 Sep 14 |
nicklas |
wizard.keepSessionAlive = function() |
2691 |
24 Sep 14 |
nicklas |
1485 |
{ |
2691 |
24 Sep 14 |
nicklas |
if (debug) |
2691 |
24 Sep 14 |
nicklas |
1487 |
{ |
2691 |
24 Sep 14 |
nicklas |
// Create a 'simulate timeout' checkbox |
2691 |
24 Sep 14 |
nicklas |
var div = document.createElement('div'); |
2774 |
09 Oct 14 |
nicklas |
div.id = 'simulateTimeoutDiv'; |
2691 |
24 Sep 14 |
nicklas |
div.style.textAlign = 'center'; |
2691 |
24 Sep 14 |
nicklas |
div.innerHTML = '<label><input type="checkbox" id="simulateTimeout">Simulate session timeout</label>'; |
2924 |
13 Nov 14 |
nicklas |
1493 |
|
2924 |
13 Nov 14 |
nicklas |
wizard.showDebugTools(); |
2924 |
13 Nov 14 |
nicklas |
var p = Doc.element('debug-tools'); |
2924 |
13 Nov 14 |
nicklas |
p.appendChild(div); |
2691 |
24 Sep 14 |
nicklas |
1497 |
} |
2691 |
24 Sep 14 |
nicklas |
1498 |
|
2691 |
24 Sep 14 |
nicklas |
internal.scheduleKeepAlive(); |
2691 |
24 Sep 14 |
nicklas |
1500 |
} |
2691 |
24 Sep 14 |
nicklas |
1501 |
|
2691 |
24 Sep 14 |
nicklas |
// Schedule a keep-alive request |
2691 |
24 Sep 14 |
nicklas |
internal.scheduleKeepAlive = function() |
2691 |
24 Sep 14 |
nicklas |
1504 |
{ |
2691 |
24 Sep 14 |
nicklas |
setTimeout(internal.sendKeepAlive, debug ? 5000 : 30000); |
2691 |
24 Sep 14 |
nicklas |
1506 |
} |
2691 |
24 Sep 14 |
nicklas |
1507 |
|
2691 |
24 Sep 14 |
nicklas |
// Send a keep-alive request |
2691 |
24 Sep 14 |
nicklas |
internal.sendKeepAlive = function() |
2691 |
24 Sep 14 |
nicklas |
1510 |
{ |
2774 |
09 Oct 14 |
nicklas |
if (hasSentRegistration || hasFatalError) |
2774 |
09 Oct 14 |
nicklas |
1512 |
{ |
2774 |
09 Oct 14 |
nicklas |
if (debug) Doc.hide('simulateTimeoutDiv'); |
2774 |
09 Oct 14 |
nicklas |
return; |
2774 |
09 Oct 14 |
nicklas |
1515 |
} |
2691 |
24 Sep 14 |
nicklas |
var simulateTimeout = false; |
2691 |
24 Sep 14 |
nicklas |
if (debug) |
2691 |
24 Sep 14 |
nicklas |
1518 |
{ |
2691 |
24 Sep 14 |
nicklas |
var msg = 'Checking if session '+App.getSessionId() + ' is alive'; |
2691 |
24 Sep 14 |
nicklas |
var timeoutDiv = Doc.element('simulateTimeout'); |
2691 |
24 Sep 14 |
nicklas |
if (timeoutDiv && timeoutDiv.checked) |
2691 |
24 Sep 14 |
nicklas |
1522 |
{ |
2691 |
24 Sep 14 |
nicklas |
simulateTimeout = true; |
2691 |
24 Sep 14 |
nicklas |
timeoutDiv.checked = false; |
2691 |
24 Sep 14 |
nicklas |
msg += ' (simulating a session timeout)' |
2691 |
24 Sep 14 |
nicklas |
1526 |
} |
2691 |
24 Sep 14 |
nicklas |
App.debug(msg); |
2691 |
24 Sep 14 |
nicklas |
1528 |
} |
2691 |
24 Sep 14 |
nicklas |
1529 |
|
2691 |
24 Sep 14 |
nicklas |
var url = '../Session.servlet?ID='+App.getSessionId(); |
2691 |
24 Sep 14 |
nicklas |
url += '&cmd=CheckSession'; |
2691 |
24 Sep 14 |
nicklas |
if (simulateTimeout) url += '&simulateTimeout=1'; |
2691 |
24 Sep 14 |
nicklas |
1533 |
|
5605 |
13 Sep 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
5605 |
13 Sep 19 |
nicklas |
request.open("GET", url, true); |
5605 |
13 Sep 19 |
nicklas |
Ajax.setReadyStateHandler(request, internal.onKeepAliveResponse, internal.onKeepAliveResponse); |
5605 |
13 Sep 19 |
nicklas |
request.send(null); |
2691 |
24 Sep 14 |
nicklas |
1538 |
} |
2691 |
24 Sep 14 |
nicklas |
1539 |
|
2691 |
24 Sep 14 |
nicklas |
1540 |
|
5605 |
13 Sep 19 |
nicklas |
internal.onKeepAliveResponse = function(request) |
2691 |
24 Sep 14 |
nicklas |
1542 |
{ |
5605 |
13 Sep 19 |
nicklas |
if (debug) App.debug(request.responseText); |
5605 |
13 Sep 19 |
nicklas |
var response = null; |
5605 |
13 Sep 19 |
nicklas |
try |
5605 |
13 Sep 19 |
nicklas |
1546 |
{ |
5605 |
13 Sep 19 |
nicklas |
if (request.status != 200) |
5605 |
13 Sep 19 |
nicklas |
1548 |
{ |
5605 |
13 Sep 19 |
nicklas |
throw new Error(request.responseText); |
5605 |
13 Sep 19 |
nicklas |
1550 |
} |
5605 |
13 Sep 19 |
nicklas |
else |
5605 |
13 Sep 19 |
nicklas |
1552 |
{ |
5605 |
13 Sep 19 |
nicklas |
if (request.getResponseHeader('Content-Type').indexOf('json') != -1) |
5605 |
13 Sep 19 |
nicklas |
1554 |
{ |
5605 |
13 Sep 19 |
nicklas |
response = JSON.parse(request.responseText); |
5605 |
13 Sep 19 |
nicklas |
if (response.status != 'ok') |
5605 |
13 Sep 19 |
nicklas |
1557 |
{ |
5605 |
13 Sep 19 |
nicklas |
throw new Error(response.message || response.stacktrace); |
5605 |
13 Sep 19 |
nicklas |
1559 |
} |
5605 |
13 Sep 19 |
nicklas |
1560 |
} |
5605 |
13 Sep 19 |
nicklas |
1561 |
} |
5605 |
13 Sep 19 |
nicklas |
1562 |
} |
5605 |
13 Sep 19 |
nicklas |
catch (err) |
5605 |
13 Sep 19 |
nicklas |
1564 |
{ |
5605 |
13 Sep 19 |
nicklas |
Wizard.setFatalError(err); |
5605 |
13 Sep 19 |
nicklas |
return; |
5605 |
13 Sep 19 |
nicklas |
1567 |
} |
5605 |
13 Sep 19 |
nicklas |
1568 |
|
2691 |
24 Sep 14 |
nicklas |
if (!response.session) |
2691 |
24 Sep 14 |
nicklas |
1570 |
{ |
2691 |
24 Sep 14 |
nicklas |
// Hide navigation buttons |
2691 |
24 Sep 14 |
nicklas |
Doc.hide('navigation'); |
2691 |
24 Sep 14 |
nicklas |
Doc.addClass('wizard', 'disabled'); |
2691 |
24 Sep 14 |
nicklas |
1574 |
|
2691 |
24 Sep 14 |
nicklas |
// Show message |
2691 |
24 Sep 14 |
nicklas |
var div = Doc.element('timeoutMessage'); |
2691 |
24 Sep 14 |
nicklas |
if (!div) |
2691 |
24 Sep 14 |
nicklas |
1578 |
{ |
2691 |
24 Sep 14 |
nicklas |
div = document.createElement('div'); |
2691 |
24 Sep 14 |
nicklas |
div.id = 'timeoutMessage'; |
2691 |
24 Sep 14 |
nicklas |
div.className = 'messagecontainer error link'; |
2691 |
24 Sep 14 |
nicklas |
div.innerHTML = 'You have been logged out due to inactivity or unstable internet connection. Click HERE to login again!'; |
2691 |
24 Sep 14 |
nicklas |
div.addEventListener('click', internal.openLoginWindow, false); |
2691 |
24 Sep 14 |
nicklas |
div.addEventListener('logged-in', internal.loggedInAgain, false); |
2691 |
24 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2691 |
24 Sep 14 |
nicklas |
frm.appendChild(div); |
2691 |
24 Sep 14 |
nicklas |
1587 |
} |
2691 |
24 Sep 14 |
nicklas |
Doc.show(div); |
2691 |
24 Sep 14 |
nicklas |
1589 |
} |
2691 |
24 Sep 14 |
nicklas |
else |
2691 |
24 Sep 14 |
nicklas |
1591 |
{ |
2691 |
24 Sep 14 |
nicklas |
internal.scheduleKeepAlive(); |
2691 |
24 Sep 14 |
nicklas |
1593 |
} |
2691 |
24 Sep 14 |
nicklas |
1594 |
} |
2691 |
24 Sep 14 |
nicklas |
1595 |
|
2691 |
24 Sep 14 |
nicklas |
// Open popup window for logging in again |
2691 |
24 Sep 14 |
nicklas |
internal.openLoginWindow = function() |
2691 |
24 Sep 14 |
nicklas |
1598 |
{ |
2691 |
24 Sep 14 |
nicklas |
if (debug) App.debug('Need to login again!'); |
2691 |
24 Sep 14 |
nicklas |
var url = '../keep_session_alive.jsp?ID='+App.getSessionId(); |
2691 |
24 Sep 14 |
nicklas |
Dialogs.openPopup(url, 'KeepSessionAlive', 800, 600); |
2691 |
24 Sep 14 |
nicklas |
1602 |
} |
2691 |
24 Sep 14 |
nicklas |
1603 |
|
2691 |
24 Sep 14 |
nicklas |
// Callback when the user has been successfully logged in |
2691 |
24 Sep 14 |
nicklas |
internal.loggedInAgain = function() |
2691 |
24 Sep 14 |
nicklas |
1606 |
{ |
2691 |
24 Sep 14 |
nicklas |
if (debug) App.debug('Logged in again!'); |
2691 |
24 Sep 14 |
nicklas |
Doc.removeClass('wizard', 'disabled'); |
2691 |
24 Sep 14 |
nicklas |
Doc.hide('timeoutMessage'); |
2691 |
24 Sep 14 |
nicklas |
Doc.show('navigation'); |
2691 |
24 Sep 14 |
nicklas |
internal.scheduleKeepAlive(); |
2691 |
24 Sep 14 |
nicklas |
1612 |
} |
2691 |
24 Sep 14 |
nicklas |
1613 |
|
2675 |
17 Sep 14 |
nicklas |
internal.generateMessageList = function(messages) |
2675 |
17 Sep 14 |
nicklas |
1615 |
{ |
2599 |
25 Aug 14 |
nicklas |
var msg = '<ul>'; |
6352 |
18 Aug 21 |
nicklas |
var debugMsg = ''; |
2675 |
17 Sep 14 |
nicklas |
var numWarnings = 0; |
2675 |
17 Sep 14 |
nicklas |
var numErrors = 0; |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < messages.length; i++) |
2599 |
25 Aug 14 |
nicklas |
1621 |
{ |
2599 |
25 Aug 14 |
nicklas |
var msgLine = messages[i]; |
6914 |
01 Dec 22 |
nicklas |
if (msgLine.indexOf('[HTML]') >= 0) |
6914 |
01 Dec 22 |
nicklas |
1624 |
{ |
6914 |
01 Dec 22 |
nicklas |
msgLine = msgLine.replace('[HTML]', ''); |
6914 |
01 Dec 22 |
nicklas |
1626 |
} |
6914 |
01 Dec 22 |
nicklas |
else |
6914 |
01 Dec 22 |
nicklas |
1628 |
{ |
6914 |
01 Dec 22 |
nicklas |
msgLine = Strings.encodeTags(msgLine); |
6914 |
01 Dec 22 |
nicklas |
1630 |
} |
2599 |
25 Aug 14 |
nicklas |
if (msgLine.indexOf('[Warning]') >= 0) |
2599 |
25 Aug 14 |
nicklas |
1632 |
{ |
6914 |
01 Dec 22 |
nicklas |
msg += '<li class="warning">'+msgLine.replace('[Warning]', ''); |
2675 |
17 Sep 14 |
nicklas |
numWarnings++; |
2599 |
25 Aug 14 |
nicklas |
1635 |
} |
2675 |
17 Sep 14 |
nicklas |
else if (msgLine.indexOf('[Error]') >= 0) |
2675 |
17 Sep 14 |
nicklas |
1637 |
{ |
6914 |
01 Dec 22 |
nicklas |
msg += '<li class="error">'+msgLine.replace('[Error]', ''); |
2675 |
17 Sep 14 |
nicklas |
numErrors++; |
2675 |
17 Sep 14 |
nicklas |
1640 |
} |
4973 |
20 Sep 18 |
nicklas |
else if (msgLine.indexOf('[Debug]') >= 0) |
4973 |
20 Sep 18 |
nicklas |
1642 |
{ |
6914 |
01 Dec 22 |
nicklas |
debugMsg += '<li class="debug">'+msgLine.replace('[Debug]', ''); |
4973 |
20 Sep 18 |
nicklas |
1644 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
1646 |
{ |
6914 |
01 Dec 22 |
nicklas |
msg += '<li class="ok">'+msgLine; |
2599 |
25 Aug 14 |
nicklas |
1648 |
} |
2599 |
25 Aug 14 |
nicklas |
1649 |
} |
6352 |
18 Aug 21 |
nicklas |
if (debug) msg += debugMsg; |
6352 |
18 Aug 21 |
nicklas |
msg += '</ul>'; |
2675 |
17 Sep 14 |
nicklas |
return { 'html': msg, 'errors': numErrors, 'warnings': numWarnings }; |
2599 |
25 Aug 14 |
nicklas |
1653 |
} |
2599 |
25 Aug 14 |
nicklas |
1654 |
|
2599 |
25 Aug 14 |
nicklas |
1655 |
/** |
2599 |
25 Aug 14 |
nicklas |
Hide the current global wizard-status message. |
2599 |
25 Aug 14 |
nicklas |
1657 |
*/ |
2599 |
25 Aug 14 |
nicklas |
wizard.hideWizardStatus = function() |
2599 |
25 Aug 14 |
nicklas |
1659 |
{ |
2599 |
25 Aug 14 |
nicklas |
Doc.hide('wizard-status'); |
3904 |
29 Apr 16 |
nicklas |
Doc.hide('wizard-progress'); |
2599 |
25 Aug 14 |
nicklas |
1662 |
} |
2599 |
25 Aug 14 |
nicklas |
1663 |
|
2599 |
25 Aug 14 |
nicklas |
1664 |
/** |
2599 |
25 Aug 14 |
nicklas |
Initialize the wizard: |
2599 |
25 Aug 14 |
nicklas |
1666 |
|
2599 |
25 Aug 14 |
nicklas |
* Check that a project is active |
2599 |
25 Aug 14 |
nicklas |
1668 |
*/ |
2599 |
25 Aug 14 |
nicklas |
internal.initWizard = function() |
2599 |
25 Aug 14 |
nicklas |
1670 |
{ |
2599 |
25 Aug 14 |
nicklas |
// Check if project is enabled |
2599 |
25 Aug 14 |
nicklas |
var wiz = Doc.element('wizard'); |
2599 |
25 Aug 14 |
nicklas |
if (wiz) |
2599 |
25 Aug 14 |
nicklas |
1674 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (!App.getActiveProjectId()) |
2599 |
25 Aug 14 |
nicklas |
1676 |
{ |
2599 |
25 Aug 14 |
nicklas |
wizard.setFatalError('No project has been selected.'); |
2599 |
25 Aug 14 |
nicklas |
1678 |
} |
2658 |
12 Sep 14 |
nicklas |
window.addEventListener('beforeunload', internal.confirmLeaveWizard); |
2599 |
25 Aug 14 |
nicklas |
1680 |
} |
2801 |
13 Oct 14 |
nicklas |
1681 |
|
3513 |
24 Sep 15 |
nicklas |
var path = document.getElementsByClassName('path'); |
2801 |
13 Oct 14 |
nicklas |
if (path && path.length) |
2801 |
13 Oct 14 |
nicklas |
1684 |
{ |
3513 |
24 Sep 15 |
nicklas |
var reggieVersion = document.createElement('span'); |
3513 |
24 Sep 15 |
nicklas |
reggieVersion.id = 'reggie-version'; |
3513 |
24 Sep 15 |
nicklas |
reggieVersion.innerHTML = '[Reggie '+Reggie.VERSION+']'; |
3513 |
24 Sep 15 |
nicklas |
path[0].appendChild(reggieVersion); |
2801 |
13 Oct 14 |
nicklas |
1689 |
} |
2924 |
13 Nov 14 |
nicklas |
1690 |
|
2599 |
25 Aug 14 |
nicklas |
1691 |
} |
2599 |
25 Aug 14 |
nicklas |
1692 |
|
2658 |
12 Sep 14 |
nicklas |
internal.confirmLeaveWizard = function(event) |
2658 |
12 Sep 14 |
nicklas |
1694 |
{ |
2676 |
17 Sep 14 |
nicklas |
if (hasFatalError) return; |
2658 |
12 Sep 14 |
nicklas |
if (!forceConfirm) |
2658 |
12 Sep 14 |
nicklas |
1697 |
{ |
5058 |
29 Oct 18 |
nicklas |
if (currentStep == 1 && noConfirmOnFirstStep || noConfirm) return; |
2658 |
12 Sep 14 |
nicklas |
if (hasSentRegistration && numLiveAsyncRequests == 0) return; |
2658 |
12 Sep 14 |
nicklas |
1700 |
} |
2658 |
12 Sep 14 |
nicklas |
forceConfirm = false; |
2658 |
12 Sep 14 |
nicklas |
event.preventDefault(); |
2658 |
12 Sep 14 |
nicklas |
1703 |
} |
2658 |
12 Sep 14 |
nicklas |
1704 |
|
2599 |
25 Aug 14 |
nicklas |
// Initialize some event handlers |
2599 |
25 Aug 14 |
nicklas |
internal.initElements = function(element, autoInit) |
2599 |
25 Aug 14 |
nicklas |
1707 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (autoInit == 'focus-on-enter') |
2599 |
25 Aug 14 |
nicklas |
1709 |
{ |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler(element, 'keypress', wizard.focusOnEnter); |
2599 |
25 Aug 14 |
nicklas |
1711 |
} |
2599 |
25 Aug 14 |
nicklas |
1712 |
} |
2599 |
25 Aug 14 |
nicklas |
1713 |
|
2599 |
25 Aug 14 |
nicklas |
1714 |
/** |
2599 |
25 Aug 14 |
nicklas |
Display a global wizard-status message. This may for example be |
2599 |
25 Aug 14 |
nicklas |
an error message, a work-in-progress indicator, etc. |
2599 |
25 Aug 14 |
nicklas |
1717 |
*/ |
2803 |
14 Oct 14 |
nicklas |
wizard.setWizardStatus = function(className, msg) |
2599 |
25 Aug 14 |
nicklas |
1719 |
{ |
2599 |
25 Aug 14 |
nicklas |
var status = Doc.element('wizard-status'); |
2599 |
25 Aug 14 |
nicklas |
status.className = className; |
2599 |
25 Aug 14 |
nicklas |
status.innerHTML = msg; |
2599 |
25 Aug 14 |
nicklas |
Doc.show(status); |
2599 |
25 Aug 14 |
nicklas |
1724 |
} |
2599 |
25 Aug 14 |
nicklas |
1725 |
|
2599 |
25 Aug 14 |
nicklas |
// Disable all form elements inside the given container |
2599 |
25 Aug 14 |
nicklas |
internal.disableAllFormElements = function(container, hideButtons) |
2599 |
25 Aug 14 |
nicklas |
1728 |
{ |
2599 |
25 Aug 14 |
nicklas |
container = Doc.element(container); |
2599 |
25 Aug 14 |
nicklas |
var input = container.getElementsByTagName('input'); |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < input.length; i++) |
2599 |
25 Aug 14 |
nicklas |
1732 |
{ |
2599 |
25 Aug 14 |
nicklas |
input[i].disabled = true; |
2599 |
25 Aug 14 |
nicklas |
1734 |
} |
2599 |
25 Aug 14 |
nicklas |
var select = container.getElementsByTagName('select'); |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < select.length; i++) |
2599 |
25 Aug 14 |
nicklas |
1737 |
{ |
2599 |
25 Aug 14 |
nicklas |
select[i].disabled = true; |
2599 |
25 Aug 14 |
nicklas |
1739 |
} |
2599 |
25 Aug 14 |
nicklas |
var text = container.getElementsByTagName('textarea'); |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < text.length; i++) |
2599 |
25 Aug 14 |
nicklas |
1742 |
{ |
2599 |
25 Aug 14 |
nicklas |
text[i].disabled = true; |
2599 |
25 Aug 14 |
nicklas |
1744 |
} |
2599 |
25 Aug 14 |
nicklas |
if (hideButtons) |
2599 |
25 Aug 14 |
nicklas |
1746 |
{ |
2599 |
25 Aug 14 |
nicklas |
internal.hideButtons(container); |
2599 |
25 Aug 14 |
nicklas |
1748 |
} |
2599 |
25 Aug 14 |
nicklas |
1749 |
} |
2599 |
25 Aug 14 |
nicklas |
1750 |
|
2599 |
25 Aug 14 |
nicklas |
// Hide all 'basicbuttons':s in the given container |
2599 |
25 Aug 14 |
nicklas |
internal.hideButtons = function(container) |
2599 |
25 Aug 14 |
nicklas |
1753 |
{ |
2599 |
25 Aug 14 |
nicklas |
container = Doc.element(container); |
2599 |
25 Aug 14 |
nicklas |
var buttons = container.getElementsByClassName('basicbutton'); |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < buttons.length; i++) |
2599 |
25 Aug 14 |
nicklas |
1757 |
{ |
2599 |
25 Aug 14 |
nicklas |
Doc.hide(buttons[i]); |
2599 |
25 Aug 14 |
nicklas |
1759 |
} |
2599 |
25 Aug 14 |
nicklas |
1760 |
} |
2599 |
25 Aug 14 |
nicklas |
1761 |
|
2599 |
25 Aug 14 |
nicklas |
Doc.addFinalizer(internal.initWizard); |
2599 |
25 Aug 14 |
nicklas |
Doc.addElementInitializer(internal.initElements); |
2599 |
25 Aug 14 |
nicklas |
return wizard; |
2599 |
25 Aug 14 |
nicklas |
1765 |
}(); |
2599 |
25 Aug 14 |
nicklas |
1766 |
|