Subversion Repositories DevTools

Rev

Rev 119 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 119 Rev 121
Line 29... Line 29...
29
function MM_swapImgRestore() { //v3.0
29
function MM_swapImgRestore() { //v3.0
30
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
30
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
31
}
31
}
32
 
32
 
33
function MM_findObj(n, d) { //v4.0
33
function MM_findObj(n, d) { //v4.0
34
  var p,i,x;  
34
  var p,i,x;
35
  if(!d) d=document; 
35
  if(!d) d=document;
36
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
36
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
37
  	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
37
  	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
38
  }
38
  }
39
  if(!(x=d[n])&&d.all) x=d.all[n]; 
39
  if(!(x=d[n])&&d.all) x=d.all[n];
40
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
40
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
41
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
41
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
42
  if(!x && document.getElementById) x=document.getElementById(n); 
42
  if(!x && document.getElementById) x=document.getElementById(n);
43
  return x;
43
  return x;
44
}
44
}
45
 
45
 
46
function MM_swapImage() { //v3.0
46
function MM_swapImage() { //v3.0
47
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
47
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
Line 72... Line 72...
72
	var pass,passc;
72
	var pass,passc;
73
	//character range allowed
73
	//character range allowed
74
	cleanStrRE = /^[0-9a-z_\.\(\)\-]+$/i;
74
	cleanStrRE = /^[0-9a-z_\.\(\)\-]+$/i;
75
	pkgRE = /^[a-z][a-z0-9_-]*[a-z0-9]$/i;
75
	pkgRE = /^[a-z][a-z0-9_-]*[a-z0-9]$/i;
76
	versionRE = /^[0-9a-z_\.\(\)\-]+$/i;
76
	versionRE = /^[0-9a-z_\.\(\)\-]+$/i;
-
 
77
	versionNumberRE = /^\d+\.\d+\.\d+$/;
77
	urlRE = "^https?://[a-z1-9]";
78
	urlRE = "^https?://[a-z1-9]";
78
	//character range disallowed
79
	//character range disallowed
79
	HTMLchr = /[\<\>\'\"]+/i;
80
	HTMLchr = /[\<\>\'\"]+/i;
80
	
81
 
81
					
82
 
82
	for (i=0; i<(args.length-2); i+=3) { 
83
	for (i=0; i<(args.length-2); i+=3) {
83
		test=args[i+2]; 
84
		test=args[i+2];
84
		val=MM_findObj(args[i]);
85
		val=MM_findObj(args[i]);
85
		
86
 
86
		if (val) { 
87
		if (val) {
87
			nm=args[i+1];
88
			nm=args[i+1];
88
			val=val.value;
89
			val=val.value;
89
			
90
 
90
			
91
 
91
			
92
 
92
			if (val!="") {
93
			if (val!="") {
93
				if (test.indexOf('isEmail')!=-1) { 
94
				if (test.indexOf('isEmail')!=-1) {
94
					p=val.indexOf('@');
95
					p=val.indexOf('@');
95
					if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
96
					if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
96
				} 
97
				}
97
				
98
 
98
				if (test.indexOf('isDate') != -1) {
99
				if (test.indexOf('isDate') != -1) {
99
					if (val.indexOf("/") != -1) { 
100
					if (val.indexOf("/") != -1) {
100
						tmpARR = val.split("/");
101
						tmpARR = val.split("/");
101
						if (tmpARR.length == 3) {
102
						if (tmpARR.length == 3) {
102
							if (!(tmpARR[0]>0  && tmpARR[0]<32  && tmpARR[1]>0 && tmpARR[1]<13 && tmpARR[2]>1900 && tmpARR[2]<9999)) {
103
							if (!(tmpARR[0]>0  && tmpARR[0]<32  && tmpARR[1]>0 && tmpARR[1]<13 && tmpARR[2]>1900 && tmpARR[2]<9999)) {
103
								errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
104
								errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
104
							}
105
							}
Line 107... Line 108...
107
						}
108
						}
108
					} else {
109
					} else {
109
						errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
110
						errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
110
					}
111
					}
111
				}
112
				}
112
				
113
 
113
				if (test.indexOf('isPackage')!=-1) {
114
				if (test.indexOf('isPackage')!=-1) {
114
					REresults = val.search(pkgRE);
115
					REresults = val.search(pkgRE);
115
					if (REresults < 0) errors += val += ' - '+nm+' is not valid. Valid characters are A-Z a-z 0-9 - _\n'
116
					if (REresults < 0) errors += val += ' - '+nm+' is not valid. Valid characters are A-Z a-z 0-9 - _\n'
116
								+ 'Names must start with a letter and cannot contain spaces or symbols other than - and _\n';
117
								+ 'Names must start with a letter and cannot contain spaces or symbols other than - and _\n';
117
				}
118
				}
118
				
119
 
119
				if (test.indexOf('isCleanStr')!=-1) {
120
				if (test.indexOf('isCleanStr')!=-1) {
120
					REresults = val.search(cleanStrRE);
121
					REresults = val.search(cleanStrRE);
121
					if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
122
					if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
122
				}
123
				}
123
				
124
 
124
				if (test.indexOf('isVersionStr')!=-1) {
125
				if (test.indexOf('isVersionStr')!=-1) {
125
					REresults = val.search(versionRE);
126
					REresults = val.search(versionRE);
126
					if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
127
					if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
127
				}
128
				}
-
 
129
 
-
 
130
				if (test.indexOf('isVersionNumber')!=-1) {
-
 
131
					REresults = val.search(versionNumberRE);
-
 
132
					if (REresults < 0) errors += val += ' - '+nm+' is formatted incorrectly.\nVersion number should be (major).(minor).(patch)(build)\ne.g. 1.0.2002\n';
128
				
133
				}
-
 
134
 
129
				if (test.indexOf('isURL')!=-1) {
135
				if (test.indexOf('isURL')!=-1) {
130
					REresults = val.match(urlRE);
136
					REresults = val.match(urlRE);
131
					if (REresults == null) errors += '"'+val+'" is not a valid URL.\n';
137
					if (REresults == null) errors += '"'+val+'" is not a valid URL.\n';
132
				}
138
				}
133
				
139
 
134
				if (test.indexOf('isChangePassword')!=-1) {
140
				if (test.indexOf('isChangePassword')!=-1) {
135
					pass=MM_findObj('FRpassword');
141
					pass=MM_findObj('FRpassword');
136
					passc=MM_findObj('FRpasswordc');
142
					passc=MM_findObj('FRpasswordc');
137
					if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
143
					if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
138
				}
144
				}
139
				
145
 
140
				if (test.indexOf('maxLength')!=-1) {
146
				if (test.indexOf('maxLength')!=-1) {
141
					p=test.indexOf(':');
147
					p=test.indexOf(':');
142
					max=test.substring(p+1);
148
					max=test.substring(p+1);
143
					if (val.length>max) errors+='- '+nm+' can be maximum '+max+' characters long.\n';
149
					if (val.length>max) errors+='- '+nm+' can be maximum '+max+' characters long.\n';
144
				}
150
				}
145
				
151
 
146
				if (test.indexOf('notHTML')!=-1) {
152
				if (test.indexOf('notHTML')!=-1) {
147
					if (val.match(HTMLchr)) errors+='- '+nm+' has invalid characters like \'< > quotes\'\n';
153
					if (val.match(HTMLchr)) errors+='- '+nm+' has invalid characters like \'< > quotes\'\n';
148
				}
154
				}
149
				
155
 
150
				if (test.charAt(0)=='R') {
156
				if (test.charAt(0)=='R') {
151
					
157
 
152
					if (test.indexOf('isNumber') != -1) { 
158
					if (test.indexOf('isNumber') != -1) {
153
						if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
159
						if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
154
					}
160
					}
155
					
161
 
156
					if (test.indexOf('inRange') != -1) { 
162
					if (test.indexOf('inRange') != -1) {
157
						p=test.indexOf(':');
163
						p=test.indexOf(':');
158
						min=test.substring(8,p); 
164
						min=test.substring(8,p);
159
						max=test.substring(p+1);
165
						max=test.substring(p+1);
160
						if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
166
						if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
161
					} 
167
					}
162
					
168
 
163
					if (test.indexOf('inLength')!=-1) {
169
					if (test.indexOf('inLength')!=-1) {
164
					    pl=test.indexOf('inLength')
170
					    pl=test.indexOf('inLength')
165
						p=test.indexOf(':');
171
						p=test.indexOf(':');
166
		          		min=test.substring(pl+8,p); 
172
		          		min=test.substring(pl+8,p);
167
		          		if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
173
		          		if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
168
			    	}	
174
			    	}
169
				} 
175
				}
170
			} else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';    
176
			} else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
171
			
177
 
172
				
178
 
173
			if (test.indexOf('isPassword')!=-1) {
179
			if (test.indexOf('isPassword')!=-1) {
174
				pass=MM_findObj('FRpassword');
180
				pass=MM_findObj('FRpassword');
175
				passc=MM_findObj('FRpasswordc');
181
				passc=MM_findObj('FRpasswordc');
176
				if (!MM_findObj('FRdomainauth').checked) {
182
				if (!MM_findObj('FRdomainauth').checked) {
177
					if (test.indexOf('inLength')!=-1) {
183
					if (test.indexOf('inLength')!=-1) {
178
					    pl=test.indexOf('inLength')
184
					    pl=test.indexOf('inLength')
179
						p=test.indexOf(':');
185
						p=test.indexOf(':');
180
		          		min=test.substring(pl+8,p); 
186
		          		min=test.substring(pl+8,p);
181
		          		if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
187
		          		if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
182
			    	}	
188
			    	}
183
					if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
189
					if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
184
				} else {
190
				} else {
185
					if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';   
191
					if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
186
				}
192
				}
187
			} 
193
			}
188
			
194
 
189
			if (test.indexOf('isDomainName')!=-1) {
195
			if (test.indexOf('isDomainName')!=-1) {
190
				if (MM_findObj('FRdomainauth').checked) {
196
				if (MM_findObj('FRdomainauth').checked) {
191
					if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';  
197
					if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
192
				}
198
				}
193
			}
199
			}
194
			
200
 
195
		}
201
		}
196
	} 
202
	}
197
	
203
 
198
	if (errors) {
204
	if (errors) {
199
		alert('The following error(s) occurred:\n\n'+errors);
205
		alert('The following error(s) occurred:\n\n'+errors);
200
		clickedButton=false;
206
		clickedButton=false;
201
	} else {
207
	} else {
202
		clickedButton=true;
208
		clickedButton=true;
203
	}
209
	}
204
	document.MM_returnValue = (errors == '');
210
	document.MM_returnValue = (errors == '');
205
	
211
 
206
	if (MM_findObj('ProgressBar') && document.MM_returnValue) MM_findObj('ProgressBar').style.visibility='visible';
212
	if (MM_findObj('ProgressBar') && document.MM_returnValue) MM_findObj('ProgressBar').style.visibility='visible';
207
}
213
}
208
 
214
 
209
function isChecked(boxName, buttonId) {
215
function isChecked(boxName, buttonId) {
210
  var formButton = document.getElementById(buttonId);
216
  var formButton = document.getElementById(buttonId);
Line 214... Line 220...
214
    for (var i = 0; i < boxes.length; i++) {
220
    for (var i = 0; i < boxes.length; i++) {
215
      if (boxes[i].checked) {
221
      if (boxes[i].checked) {
216
        btnChecked = true;
222
        btnChecked = true;
217
      }
223
      }
218
    }
224
    }
219
    
225
 
220
    if (btnChecked) {
226
    if (btnChecked) {
221
      formButton.disabled = false;
227
      formButton.disabled = false;
222
      formButton.style.color="";
228
      formButton.style.color="";
223
    }
229
    }
224
    else {
230
    else {
Line 234... Line 240...
234
	if (agree) {
240
	if (agree) {
235
		if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
241
		if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
236
		return true;
242
		return true;
237
	} else {
243
	} else {
238
		return false;
244
		return false;
239
	}	
245
	}
240
}
246
}
241
 
247
 
242
function confirmAction(m)
248
function confirmAction(m)
243
{
249
{
244
	var agree=confirm(m);
250
	var agree=confirm(m);
245
	if (agree) {
251
	if (agree) {
246
		if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
252
		if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
247
		return true;
253
		return true;
248
	} else {
254
	} else {
249
		return false;
255
		return false;
250
	}	
256
	}
251
}
257
}
252
 
258
 
253
function DisplaySPAN(show) {
259
function DisplaySPAN(show) {
254
	if (show) {
260
	if (show) {
255
		MM_findObj("spanHideDetails").style.display = "block";
261
		MM_findObj("spanHideDetails").style.display = "block";
Line 270... Line 276...
270
		if ( MM_findObj(div_name).style.display == 'block' ) {
276
		if ( MM_findObj(div_name).style.display == 'block' ) {
271
			MM_findObj(div_name).style.display = 'none';
277
			MM_findObj(div_name).style.display = 'none';
272
		} else {
278
		} else {
273
			MM_findObj(div_name).style.display = 'block';
279
			MM_findObj(div_name).style.display = 'block';
274
		}
280
		}
275
		
281
 
276
	}
282
	}
277
}
283
}
278
 
284
 
279
function Visible () {
285
function Visible () {
280
	
286
 
281
	var i, args, div_name, visibility
287
	var i, args, div_name, visibility
282
	args=Visible.arguments;
288
	args=Visible.arguments;
283
	for (i=0; i<(args.length); i+=2) {
289
	for (i=0; i<(args.length); i+=2) {
284
		div_name=args[i];
290
		div_name=args[i];
285
		visibility=args[i+1]
291
		visibility=args[i+1]
286
		MM_findObj(div_name).style.display = visibility;
292
		MM_findObj(div_name).style.display = visibility;
287
		
293
 
288
	}
294
	}
289
}
295
}
290
 
296
 
291
function DisplayObjects () {
297
function DisplayObjects () {
292
	var i, args, div_name
298
	var i, args, div_name
Line 295... Line 301...
295
		div_name=args[i];
301
		div_name=args[i];
296
		MM_findObj(div_name).style.display = 'block';
302
		MM_findObj(div_name).style.display = 'block';
297
	}
303
	}
298
}
304
}
299
 
305
 
300
function GetCookieVal (offset) {  
306
function GetCookieVal (offset) {
301
	var endstr = document.cookie.indexOf (";", offset);  
307
	var endstr = document.cookie.indexOf (";", offset);
302
	if (endstr == -1) { endstr = document.cookie.length; }
308
	if (endstr == -1) { endstr = document.cookie.length; }
303
	return unescape(document.cookie.substring(offset, endstr));
309
	return unescape(document.cookie.substring(offset, endstr));
304
}
310
}
305
 
311
 
306
 
312
 
307
function GetCookie (name) {  
313
function GetCookie (name) {
308
	var arg = name + "=";  
314
	var arg = name + "=";
309
	var alen = arg.length;  
315
	var alen = arg.length;
310
	var clen = document.cookie.length;  
316
	var clen = document.cookie.length;
311
	var i = 0;  
317
	var i = 0;
312
 
318
 
313
	while (i < clen) {    
319
	while (i < clen) {
314
		var j = i + alen;    
320
		var j = i + alen;
315
		if (document.cookie.substring(i, j) == arg) return GetCookieVal (j);    
321
		if (document.cookie.substring(i, j) == arg) return GetCookieVal (j);
316
		i = document.cookie.indexOf(" ", i) + 1;    
322
		i = document.cookie.indexOf(" ", i) + 1;
317
		if (i == 0) break;   
323
		if (i == 0) break;
318
	}  
324
	}
319
 
325
 
320
	return null;
326
	return null;
321
}
327
}
322
 
328
 
323
function go_submit( formname, actionname )
329
function go_submit( formname, actionname )
Line 327... Line 333...
327
}
333
}
328
 
334
 
329
function ExpandAll()
335
function ExpandAll()
330
{
336
{
331
	var elem
337
	var elem
332
		
338
 
333
	if (document.all)
339
	if (document.all)
334
	{
340
	{
335
		// Run this for IE
341
		// Run this for IE
336
		elem = document.all;
342
		elem = document.all;
337
	} else {
343
	} else {
338
		// Run this for other browsers
344
		// Run this for other browsers
339
		elem = document.getElementsByTagName('div');
345
		elem = document.getElementsByTagName('div');
340
	}
346
	}
341
	
347
 
342
	for (i in elem)
348
	for (i in elem)
343
	{
349
	{
344
		if (elem[i].id)
350
		if (elem[i].id)
345
		{	
351
		{
346
			if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'none';
352
			if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'none';
347
			if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'block';
353
			if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'block';
348
		}
354
		}
349
	}
355
	}
350
 
356
 
351
}
357
}
352
 
358
 
353
function CollapseAll()
359
function CollapseAll()
354
{
360
{
355
	var elem
361
	var elem
356
		
362
 
357
	if (document.all)
363
	if (document.all)
358
	{
364
	{
359
		// Run this for IE
365
		// Run this for IE
360
		elem = document.all;
366
		elem = document.all;
361
	} else {
367
	} else {
362
		// Run this for other browsers
368
		// Run this for other browsers
363
		elem = document.getElementsByTagName('div');
369
		elem = document.getElementsByTagName('div');
364
	}
370
	}
365
	
371
 
366
	for (i in elem)
372
	for (i in elem)
367
	{
373
	{
368
		if (elem[i].id)
374
		if (elem[i].id)
369
		{	
375
		{
370
			if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'block';
376
			if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'block';
371
			if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'none';
377
			if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'none';
372
		}
378
		}
373
	}
379
	}
374
 
380
 
375
}
381
}
376
 
382
 
377
 
383
 
378
function height()
384
function height()
379
{ 
385
{
380
	if( typeof( window.innerWidth ) == 'number' ) 
386
	if( typeof( window.innerWidth ) == 'number' )
381
	{
387
	{
382
		h = window.innerHeight;
388
		h = window.innerHeight;
383
	}
389
	}
384
	else if(document.documentElement&&(document.documentElement.clientHeight ))
390
	else if(document.documentElement&&(document.documentElement.clientHeight ))
385
	{
391
	{
386
		h = document.documentElement.clientHeight;
392
		h = document.documentElement.clientHeight;
387
	} 
393
	}
388
	else if( document.body &&	( document.body.clientWidth || document.body.clientHeight ) )
394
	else if( document.body &&	( document.body.clientWidth || document.body.clientHeight ) )
389
	{
395
	{
390
		h = document.body.clientHeight;
396
		h = document.body.clientHeight;
391
	} 
397
	}
392
	
398
 
393
	var e = document.getElementById("LayerDescription");
399
	var e = document.getElementById("LayerDescription");
394
	
400
 
395
	if (navigator.userAgent.indexOf('Internet Explorer'))
401
	if (navigator.userAgent.indexOf('Internet Explorer'))
396
	{
402
	{
397
		e.style.height = h - 350 + "px";
403
		e.style.height = h - 350 + "px";
398
		e.style.overflow = "auto";
404
		e.style.overflow = "auto";
399
	}
405
	}
Line 403... Line 409...
403
		e.style.minHeight= h - 350 + "px";
409
		e.style.minHeight= h - 350 + "px";
404
		e.style.overflow = "auto";
410
		e.style.overflow = "auto";
405
	}
411
	}
406
}
412
}
407
 
413
 
-
 
414
//////////////////////////////////////////////////////////////////////////////////////////////////
-
 
415
//
-
 
416
// MM_ValidateVersion(pkgName, versionBase, versionExt, isAutobuild)
-
 
417
//
-
 
418
//    pkgName       eg EA_DocGen
-
 
419
//    versionBase   eg 1.2.3
-
 
420
//    versionExt	eg .cr
-
 
421
//    isAutobuild   true or false
-
 
422
//
-
 
423
// Returns true if version is valid, else false
-
 
424
//
-
 
425
// This function can and should be used instead of MM_validateForm to validate
-
 
426
// version numbers for new or reversioned package versions.
-
 
427
//
-
 
428
// So far, this function is used in the following situations:
-
 
429
//    1) Add new version to release (_form_new_version_page.asp)
-
 
430
//    2) Reversion existing version (_wform_rename_version.asp)
-
 
431
//    3) Add package to release (Form_add_pkg_versions.asp)
-
 
432
//////////////////////////////////////////////////////////////////////////////////////////////////
-
 
433
function MM_ValidateVersion(pkgName, versionBase, versionExt, isAutobuild)
-
 
434
{
-
 
435
	var errString = MM_ValidateVersionReturningErrString(pkgName, versionBase, versionExt, isAutobuild);
-
 
436
	if (errString.length > 0)
-
 
437
	{
-
 
438
		alert(errString);
-
 
439
		return false;
-
 
440
	}
-
 
441
	return true;
-
 
442
}
-
 
443
 
-
 
444
//////////////////////////////////////////////////////////////////////////////////////////////////
-
 
445
//
-
 
446
// MM_ValidateVersionReturningErrString(pkgName, versionBase, versionExt, isAutobuild)
-
 
447
//
-
 
448
//    pkgName       eg buildtool
-
 
449
//    versionBase   eg 1.2.3
-
 
450
//    versionExt	eg .cr
-
 
451
//    isAutobuild   true or false
-
 
452
//
-
 
453
// Returns a non-zero-length error string if version is NOT valid, else returns a zero-length string
-
 
454
//
-
 
455
// The MM_validateForm function should be modified to use this if possible, although I currently
-
 
456
// do not believe it has access to all the necessary parameter values needed.
-
 
457
//
-
 
458
//////////////////////////////////////////////////////////////////////////////////////////////////
-
 
459
function MM_ValidateVersionReturningErrString(pkgName, versionBase, versionExt, isAutobuild)
-
 
460
{
-
 
461
	var re_std_ver_format = /^\d+\.\d+\.\d+$/;
-
 
462
	var re_cots_ver_format = /^[\w]+[\w\.\-]*$/;    // starts with letter or digit or underscore, subsequent chars can be letters or digits or _ or . or -
-
 
463
	var re_cots_ver_format_exc1 = /[-_.]+[-_.]+/;	// look for any two adjacent special characters
-
 
464
	var re_cots_ver_format_exc2 = /[0-9A-Za-z]+/;	// look for any alphanumeric char
-
 
465
 
-
 
466
	var forPkgName = "";
-
 
467
	if (pkgName != null && pkgName.length > 0)
-
 
468
	{
-
 
469
		forPkgName = ", for package " + pkgName;
-
 
470
	}
-
 
471
 
-
 
472
	if(!isAutobuild)
-
 
473
	{
-
 
474
		if( versionBase.length == 0 )
-
 
475
		{
-
 
476
			return "Action failed: version number is of zero length" + forPkgName;
-
 
477
		}
-
 
478
		else if( versionExt != ".cots" && !re_std_ver_format.test(versionBase) )
-
 
479
		{
-
 
480
			return "Action failed: version is not of form (integer).(integer).(integer).(extension)" + forPkgName;
-
 
481
		}
-
 
482
		else if( versionExt == ".cots")
-
 
483
		{
-
 
484
			if( !re_cots_ver_format.test(versionBase) )
-
 
485
			{
-
 
486
				return "Action failed: COTS version must begin with letter/digit/underscore, cannot contain any whitespace, and only special characters underscore/dash/dot are allowed" + forPkgName;
-
 
487
			}
-
 
488
 
-
 
489
			if( re_cots_ver_format_exc1.test(versionBase) )
-
 
490
			{
-
 
491
				return "Action failed: COTS version cannot contain two adjacent special characters (underscore/dash/dot)" + forPkgName;
-
 
492
			}
-
 
493
 
-
 
494
			if( !re_cots_ver_format_exc2.test(versionBase) )
-
 
495
			{
-
 
496
				return "Action failed: COTS version must contain one or more alphanumeric characters" + forPkgName;
-
 
497
			}
-
 
498
		}
-
 
499
	}
-
 
500
 
-
 
501
	// everything ok - no error
-
 
502
	return "";
-
 
503
}
-
 
504
 
-
 
505
 
-
 
506
 
408
//-->
507
//-->