| 119 |
ghuddy |
1 |
/*
|
| 129 |
ghuddy |
2 |
* COMMON JAVASCRIPTS
|
| 119 |
ghuddy |
3 |
*/
|
|
|
4 |
|
|
|
5 |
<!--
|
|
|
6 |
var clickedButton = false;
|
|
|
7 |
function check() {
|
| 129 |
ghuddy |
8 |
if (clickedButton) {
|
|
|
9 |
clickedButton = false;
|
| 119 |
ghuddy |
10 |
return true;
|
|
|
11 |
} else {
|
| 129 |
ghuddy |
12 |
return false;
|
|
|
13 |
}
|
| 119 |
ghuddy |
14 |
}
|
|
|
15 |
|
|
|
16 |
function MM_reloadPage(init) { //reloads the window if Nav4 resized
|
|
|
17 |
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
|
|
|
18 |
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
|
|
|
19 |
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
|
|
|
20 |
}
|
|
|
21 |
MM_reloadPage(true);
|
|
|
22 |
|
|
|
23 |
function MM_preloadImages() { //v3.0
|
|
|
24 |
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
|
|
25 |
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
|
|
26 |
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
|
|
27 |
}
|
|
|
28 |
|
|
|
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;
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
function MM_findObj(n, d) { //v4.0
|
| 121 |
hknight |
34 |
var p,i,x;
|
|
|
35 |
if(!d) d=document;
|
| 119 |
ghuddy |
36 |
if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
| 129 |
ghuddy |
37 |
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
|
| 119 |
ghuddy |
38 |
}
|
| 121 |
hknight |
39 |
if(!(x=d[n])&&d.all) x=d.all[n];
|
| 119 |
ghuddy |
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);
|
| 121 |
hknight |
42 |
if(!x && document.getElementById) x=document.getElementById(n);
|
| 119 |
ghuddy |
43 |
return x;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
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)
|
|
|
48 |
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
function MM_openBrWindow(theURL,winName,features) { //v2.0
|
| 2546 |
dpurdie |
52 |
window.open(theURL,winName,'left=20,top=20,'+features);
|
| 119 |
ghuddy |
53 |
}
|
|
|
54 |
|
|
|
55 |
function MM_jumpMenu(targ,selObj,restore){ //v3.1
|
|
|
56 |
if (selObj.options[selObj.selectedIndex].value) {
|
| 129 |
ghuddy |
57 |
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
|
|
|
58 |
if (restore) selObj.selectedIndex=0;
|
| 119 |
ghuddy |
59 |
}
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
function Cascaded_Menu(targ,url,selObj,restore){ //v3.1
|
|
|
63 |
if (selObj.options[selObj.selectedIndex].value) {
|
| 129 |
ghuddy |
64 |
eval(targ+".location='"+url+selObj.options[selObj.selectedIndex].value+"'");
|
|
|
65 |
if (restore) selObj.selectedIndex=0;
|
| 119 |
ghuddy |
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
| 3899 |
dpurdie |
69 |
//
|
|
|
70 |
// Validate Forms
|
|
|
71 |
// Arguments:
|
|
|
72 |
// --Silent - Optional. Supresses alert
|
|
|
73 |
// Triplets - Zero or more triplets.
|
|
|
74 |
// Eg: 'FRpkgName','Package Name','RisPackage'
|
|
|
75 |
// FormObject - Form Object ID
|
|
|
76 |
// TextPrefix - Error message Prefix
|
|
|
77 |
// TestType - Type of test to perfom.
|
|
|
78 |
// First letter may be R - Required.
|
|
|
79 |
//
|
|
|
80 |
function MM_validateForm() {
|
| 1372 |
dpurdie |
81 |
var ii,p,pl,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
|
| 129 |
ghuddy |
82 |
var REresults;
|
|
|
83 |
var pass,passc;
|
| 3894 |
dpurdie |
84 |
var showAlert = true;
|
| 121 |
hknight |
85 |
|
| 129 |
ghuddy |
86 |
// Other general validations
|
|
|
87 |
var cleanStrRE = /^[0-9a-z_\.\(\)\-]+$/i;
|
|
|
88 |
var pkgRE = /^[a-z][a-z0-9_-]*[a-z0-9]$/i;
|
|
|
89 |
var versionRE = /^[0-9a-z_\.\(\)\-]+$/i;
|
| 145 |
ghuddy |
90 |
var re_patch_ver_format = /^\d+\.\d+\.\d+\.p\d+\.[a-zA-Z0-9]+$/;
|
| 129 |
ghuddy |
91 |
var urlRE = "^https?://[a-z1-9]";
|
|
|
92 |
//character range disallowed
|
|
|
93 |
var HTMLchr = /[\<\>\'\"]+/i;
|
| 171 |
brianf |
94 |
var alphanumRE = /^[a-z0-9]+$/i;
|
| 121 |
hknight |
95 |
|
| 3894 |
dpurdie |
96 |
// Options are first
|
| 3899 |
dpurdie |
97 |
for (ii=0; ii<(args.length-2) && typeof(args[ii]) === 'string' && args[ii].indexOf('--') == 0; ii++) {
|
| 3894 |
dpurdie |
98 |
switch(args[ii].toLowerCase()) {
|
|
|
99 |
case "--silent" :
|
|
|
100 |
showAlert = false;
|
|
|
101 |
break;
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
|
| 3895 |
dpurdie |
105 |
// Iterate over arguments
|
| 3894 |
dpurdie |
106 |
// These are in triplets
|
| 3895 |
dpurdie |
107 |
// Name of form object - Value is extracted for user as 'val'
|
|
|
108 |
// Text Prefix for error - 'nm'
|
|
|
109 |
// Type of Test to Perform -'test'
|
| 3894 |
dpurdie |
110 |
for (; ii<(args.length-2); ii+=3) {
|
| 3899 |
dpurdie |
111 |
nm=args[ii+1];
|
| 1372 |
dpurdie |
112 |
test=args[ii+2];
|
| 3899 |
dpurdie |
113 |
if ( typeof(args[ii]) === 'string' ) {
|
|
|
114 |
val=MM_findObj(args[ii]);
|
|
|
115 |
if (val) {
|
|
|
116 |
val=val.value;
|
| 121 |
hknight |
117 |
|
| 3899 |
dpurdie |
118 |
if (val!="") {
|
|
|
119 |
if (test.indexOf('isEmail')!=-1) {
|
|
|
120 |
p=val.indexOf('@');
|
|
|
121 |
if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
|
|
|
122 |
}
|
| 121 |
hknight |
123 |
|
| 3899 |
dpurdie |
124 |
if (test.indexOf('isDate') != -1) {
|
|
|
125 |
if (val.indexOf("/") != -1) {
|
|
|
126 |
tmpARR = val.split("/");
|
|
|
127 |
if (tmpARR.length == 3) {
|
|
|
128 |
if (!(tmpARR[0]>0 && tmpARR[0]<32 && tmpARR[1]>0 && tmpARR[1]<13 && tmpARR[2]>1900 && tmpARR[2]<9999)) {
|
|
|
129 |
errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
|
|
|
130 |
}
|
|
|
131 |
} else {
|
|
|
132 |
errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
|
|
|
133 |
}
|
|
|
134 |
} else {
|
|
|
135 |
errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
|
|
|
136 |
}
|
|
|
137 |
}
|
| 121 |
hknight |
138 |
|
| 3899 |
dpurdie |
139 |
if (test.indexOf('isPackage')!=-1) {
|
|
|
140 |
REresults = val.search(pkgRE);
|
|
|
141 |
if (REresults < 0) errors += val + ' - '+nm+' is not valid. Valid characters are A-Z a-z 0-9 - _\n'
|
|
|
142 |
+ 'Names must start with a letter and cannot contain spaces or symbols other than - and _\n';
|
|
|
143 |
}
|
| 121 |
hknight |
144 |
|
| 3899 |
dpurdie |
145 |
if (test.indexOf('isCleanStr')!=-1) {
|
|
|
146 |
REresults = val.search(cleanStrRE);
|
|
|
147 |
if (REresults < 0) errors += val + '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
|
|
|
148 |
}
|
| 121 |
hknight |
149 |
|
| 3899 |
dpurdie |
150 |
if (test.indexOf('isVersionStr')!=-1) {
|
|
|
151 |
REresults = val.search(versionRE);
|
|
|
152 |
if (REresults < 0) errors += val + '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
|
|
|
153 |
}
|
| 121 |
hknight |
154 |
|
| 3899 |
dpurdie |
155 |
if (test.indexOf('isPatchVersionStr')!=-1) {
|
|
|
156 |
if ( !re_patch_ver_format.test(val) ) {
|
|
|
157 |
errors += val + '- '+nm+' is not of form (integer).(integer).(integer).p(integer).(extension)\n';
|
|
|
158 |
}
|
|
|
159 |
}
|
| 121 |
hknight |
160 |
|
| 3899 |
dpurdie |
161 |
if (test.indexOf('isCCPath')!=-1) {
|
|
|
162 |
var CCPathRE = /^\\|\/[a-z]+[0-9a-z_\.\-\\\/ ]+$/i;
|
| 145 |
ghuddy |
163 |
|
| 3899 |
dpurdie |
164 |
REresults = val.search(/^(\\|\/)/);
|
|
|
165 |
if (REresults < 0) errors += val + '- '+nm+' must begin with \\ or /\n';
|
| 2362 |
dpurdie |
166 |
|
| 3899 |
dpurdie |
167 |
REresults = val.search(CCPathRE);
|
|
|
168 |
if (REresults < 0) errors += val + '- '+nm+' uses invalid character.\nAllowed characters are \\ / A-Z a-z 0-9 . - _ SPACE\n';
|
|
|
169 |
}
|
| 121 |
hknight |
170 |
|
| 3899 |
dpurdie |
171 |
if (test.indexOf('isCCLabel')!=-1) {
|
|
|
172 |
var CCLabelRE = /^[0-9a-z_\.\-]+$/i;
|
| 121 |
hknight |
173 |
|
| 3899 |
dpurdie |
174 |
REresults = val.search(CCLabelRE);
|
|
|
175 |
if (REresults < 0) errors += val + '- '+nm+' uses invalid character.\nAllowed characters are A-Z a-z 0-9 . - _\n';
|
|
|
176 |
}
|
| 121 |
hknight |
177 |
|
| 3899 |
dpurdie |
178 |
if (test.indexOf('isSVNTag')!=-1) {
|
|
|
179 |
// Subversion Tag validation
|
|
|
180 |
var SVNTagValidPeg = /^@?\d+$/;
|
|
|
181 |
var SVNTagRE = /^[0-9a-z_\.\-]+$/i;
|
| 1339 |
dpurdie |
182 |
|
| 3899 |
dpurdie |
183 |
if ( val.search(SVNTagValidPeg) < 0) {
|
| 1339 |
dpurdie |
184 |
|
| 3899 |
dpurdie |
185 |
var stripped;
|
|
|
186 |
stripped = val.replace (/@\d+$/,"");
|
|
|
187 |
if (stripped.search(SVNTagRE) < 0)
|
|
|
188 |
errors += val + '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
|
|
|
189 |
}
|
|
|
190 |
}
|
| 1372 |
dpurdie |
191 |
|
| 3899 |
dpurdie |
192 |
if (test.indexOf('isSVNPegTag')!=-1 && ! errors) {
|
|
|
193 |
// Subversion Tag has peg - Must have done valid check first
|
|
|
194 |
var SVNTagPegged = /@?\d+$/;
|
| 1372 |
dpurdie |
195 |
|
| 3899 |
dpurdie |
196 |
if ( val.search(SVNTagPegged) < 0) {
|
|
|
197 |
errors += val + '- '+nm+' Must be pegged for Manually Versioned Package. ie:tag@pegNumber\n';
|
|
|
198 |
}
|
|
|
199 |
}
|
| 1339 |
dpurdie |
200 |
|
| 3899 |
dpurdie |
201 |
if (test.indexOf('isSVNPath')!=-1) {
|
|
|
202 |
// Subversion Base Path validation
|
|
|
203 |
var SVNTagValidCharsRE = /^[0-9a-z_\.\-\/]+$/i;
|
|
|
204 |
var SVNTagInValidSlashAtBOL = /^\/.*$/i;
|
|
|
205 |
var SVNTagInValidSlashAtEOL = /\/$/i;
|
|
|
206 |
var SVNTagInValidSlash = /^.*\/\/.*$/i;
|
|
|
207 |
var SVNTagInValidTrunkAnywhereRE = /\/trunk\//i;
|
|
|
208 |
var SVNTagValidTagAnywhereRE = /^.*\/tags\/.*$/i;
|
| 121 |
hknight |
209 |
|
| 3899 |
dpurdie |
210 |
if (val.search(SVNTagValidCharsRE) < 0)
|
|
|
211 |
errors += val + ' - '+nm+' uses invalid character. Allowed characters are / A-Z a-z 0-9 . - _\n';
|
|
|
212 |
else if (val.search(SVNTagInValidSlashAtBOL) >= 0)
|
|
|
213 |
errors += val + ' - '+nm+' begins with a /. This is not allowed.\n';
|
|
|
214 |
else if (val.search(SVNTagInValidSlashAtEOL) >= 0)
|
|
|
215 |
errors += val + ' - '+nm+' ends with a /. This is not allowed.\n';
|
|
|
216 |
else if (val.search(SVNTagInValidSlash) >= 0)
|
|
|
217 |
errors += val + ' - '+nm+' uses //. This is not allowed.\n';
|
|
|
218 |
else if (val.search(SVNTagValidTagAnywhereRE) >= 0)
|
|
|
219 |
errors += val + ' - '+nm+' contains /tags/. This is not allowed.\n';
|
|
|
220 |
else if (val.search(SVNTagInValidTrunkAnywhereRE) >= 0)
|
|
|
221 |
errors += val + ' - '+nm+' contains /trunk/. This is not allowed.\n';
|
|
|
222 |
else {
|
|
|
223 |
var bits = val.split("/");
|
|
|
224 |
if ( bits.length < 4 )
|
|
|
225 |
errors += val + ' - Must contain at least 4 path items.\n';
|
| 1339 |
dpurdie |
226 |
|
| 3899 |
dpurdie |
227 |
var ttbcount = 0;
|
|
|
228 |
var i
|
|
|
229 |
for (i=0; i < bits.length; i++ )
|
|
|
230 |
{
|
|
|
231 |
var el = bits[i];
|
|
|
232 |
if ( el == 'tags') ttbcount++;
|
|
|
233 |
if ( el == 'trunk') ttbcount++;
|
|
|
234 |
if ( el == 'branches') ttbcount++;
|
|
|
235 |
}
|
|
|
236 |
if ( ttbcount != 1 )
|
|
|
237 |
errors += val + ' - '+nm+' must contain exactly one of tags, trunk or branches. It contains '+ttbcount+'.\n';
|
| 1339 |
dpurdie |
238 |
|
| 3899 |
dpurdie |
239 |
if ( bits.pop() == 'branches' )
|
|
|
240 |
errors += val + ' - '+nm+' must not end in branches.\n';
|
| 1339 |
dpurdie |
241 |
|
| 3899 |
dpurdie |
242 |
}
|
|
|
243 |
}
|
| 129 |
ghuddy |
244 |
|
| 3899 |
dpurdie |
245 |
// No longer used in this simple form
|
|
|
246 |
if (test.indexOf('isVersionNumber')!=-1) {
|
|
|
247 |
REresults = -1;
|
|
|
248 |
if (REresults < 0) errors += val + ' - '+nm+' isVersionNumber is no longer supported in this form';
|
|
|
249 |
}
|
| 129 |
ghuddy |
250 |
|
| 3899 |
dpurdie |
251 |
if (test.indexOf('isURL')!=-1) {
|
|
|
252 |
REresults = val.match(urlRE);
|
|
|
253 |
if (REresults == null) errors += '"'+val+'" is not a valid URL.\n';
|
|
|
254 |
}
|
| 129 |
ghuddy |
255 |
|
| 3899 |
dpurdie |
256 |
if (test.indexOf('isAlphaNum')!=-1) {
|
|
|
257 |
REresults = val.match(alphanumRE);
|
|
|
258 |
if (REresults == null) errors += '"'+nm+'" must be an alphanumeric value.\n';
|
|
|
259 |
}
|
| 171 |
brianf |
260 |
|
| 3899 |
dpurdie |
261 |
if (test.indexOf('isChangePassword')!=-1) {
|
|
|
262 |
pass=MM_findObj('FRpassword');
|
|
|
263 |
passc=MM_findObj('FRpasswordc');
|
|
|
264 |
if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
|
|
|
265 |
}
|
| 129 |
ghuddy |
266 |
|
| 3899 |
dpurdie |
267 |
if (test.indexOf('maxLength')!=-1) {
|
|
|
268 |
p=test.indexOf(':');
|
|
|
269 |
max=test.substring(p+1);
|
|
|
270 |
if (val.length>max) errors+='- '+nm+' can be maximum '+max+' characters long.\n';
|
|
|
271 |
}
|
| 129 |
ghuddy |
272 |
|
| 3899 |
dpurdie |
273 |
if (test.indexOf('notHTML')!=-1) {
|
|
|
274 |
if (val.match(HTMLchr)) errors+='- '+nm+' has invalid characters like \'< > quotes\'\n';
|
|
|
275 |
}
|
| 129 |
ghuddy |
276 |
|
| 3899 |
dpurdie |
277 |
if (test.charAt(0)=='R') {
|
| 129 |
ghuddy |
278 |
|
| 3899 |
dpurdie |
279 |
if (test.indexOf('isNumber') != -1) {
|
|
|
280 |
if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
|
|
|
281 |
}
|
| 129 |
ghuddy |
282 |
|
| 3899 |
dpurdie |
283 |
if (test.indexOf('inRange') != -1) {
|
|
|
284 |
p=test.indexOf(':');
|
|
|
285 |
min=test.substring(8,p);
|
|
|
286 |
max=test.substring(p+1);
|
|
|
287 |
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
|
|
|
288 |
}
|
| 129 |
ghuddy |
289 |
|
| 3899 |
dpurdie |
290 |
if (test.indexOf('inLength')!=-1) {
|
|
|
291 |
pl=test.indexOf('inLength')
|
|
|
292 |
p=test.indexOf(':');
|
|
|
293 |
min=test.substring(pl+8,p);
|
|
|
294 |
if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
} else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
|
| 129 |
ghuddy |
298 |
|
|
|
299 |
|
| 3899 |
dpurdie |
300 |
if (test.indexOf('isPassword')!=-1) {
|
|
|
301 |
pass=MM_findObj('FRpassword');
|
|
|
302 |
passc=MM_findObj('FRpasswordc');
|
|
|
303 |
if (!MM_findObj('FRdomainauth').checked) {
|
|
|
304 |
if (test.indexOf('inLength')!=-1) {
|
|
|
305 |
pl=test.indexOf('inLength')
|
|
|
306 |
p=test.indexOf(':');
|
|
|
307 |
min=test.substring(pl+8,p);
|
|
|
308 |
if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
|
|
|
309 |
}
|
|
|
310 |
if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
|
|
|
311 |
} else {
|
|
|
312 |
if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
|
|
|
313 |
}
|
|
|
314 |
}
|
| 129 |
ghuddy |
315 |
|
| 3899 |
dpurdie |
316 |
if (test.indexOf('isDomainName')!=-1) {
|
|
|
317 |
if (MM_findObj('FRdomainauth').checked) {
|
|
|
318 |
if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
|
|
|
319 |
}
|
|
|
320 |
}
|
|
|
321 |
}
|
| 3892 |
dpurdie |
322 |
}
|
| 3899 |
dpurdie |
323 |
else {
|
|
|
324 |
// Alternate form. First item is an object
|
|
|
325 |
// Contents are test specific
|
|
|
326 |
var valp = args[ii];
|
|
|
327 |
|
|
|
328 |
// Expects object with data to examine
|
|
|
329 |
if (test.indexOf('isVersionNumber')!=-1) {
|
|
|
330 |
var rv = MM_ValidateVersion(valp.vBase, valp.vExt, valp.isAuto || false, valp.isPatch || false);
|
|
|
331 |
if ( rv )
|
|
|
332 |
errors += '- ' +nm+rv;
|
|
|
333 |
}
|
|
|
334 |
}
|
| 129 |
ghuddy |
335 |
}
|
|
|
336 |
|
|
|
337 |
if (errors) {
|
| 3895 |
dpurdie |
338 |
if ( showAlert )
|
|
|
339 |
alert('The following error(s) occurred:\n\n'+errors);
|
| 129 |
ghuddy |
340 |
clickedButton=false;
|
|
|
341 |
} else {
|
|
|
342 |
clickedButton=true;
|
|
|
343 |
}
|
|
|
344 |
document.MM_returnValue = (errors == '');
|
| 3892 |
dpurdie |
345 |
document.MM_error = errors;
|
| 129 |
ghuddy |
346 |
|
| 3895 |
dpurdie |
347 |
if (document.MM_returnValue && showAlert)
|
|
|
348 |
MM_showProgressBar();
|
| 119 |
ghuddy |
349 |
}
|
|
|
350 |
|
| 3895 |
dpurdie |
351 |
function MM_showProgressBar() {
|
|
|
352 |
var pb = MM_findObj('ProgressBar');
|
|
|
353 |
if ( pb )
|
|
|
354 |
pb.style.visibility='visible';
|
|
|
355 |
}
|
|
|
356 |
|
|
|
357 |
function MM_hideProgressBar() {
|
|
|
358 |
var pb = MM_findObj('ProgressBar');
|
|
|
359 |
if ( pb )
|
|
|
360 |
pb.style.visibility='hidden';
|
|
|
361 |
}
|
|
|
362 |
|
| 119 |
ghuddy |
363 |
function isChecked(boxName, buttonId) {
|
|
|
364 |
var formButton = document.getElementById(buttonId);
|
|
|
365 |
var boxes = document.getElementsByName(boxName);
|
|
|
366 |
var btnChecked = false;
|
|
|
367 |
if (formButton) {
|
|
|
368 |
for (var i = 0; i < boxes.length; i++) {
|
|
|
369 |
if (boxes[i].checked) {
|
|
|
370 |
btnChecked = true;
|
|
|
371 |
}
|
|
|
372 |
}
|
| 121 |
hknight |
373 |
|
| 119 |
ghuddy |
374 |
if (btnChecked) {
|
|
|
375 |
formButton.disabled = false;
|
|
|
376 |
formButton.style.color="";
|
|
|
377 |
}
|
|
|
378 |
else {
|
|
|
379 |
formButton.disabled = true;
|
|
|
380 |
formButton.style.color="silver";
|
|
|
381 |
}
|
|
|
382 |
}
|
|
|
383 |
}
|
|
|
384 |
|
|
|
385 |
function confirmDelete(m)
|
|
|
386 |
{
|
| 129 |
ghuddy |
387 |
var agree=confirm('Are you sure you want to delete '+m+'?');
|
|
|
388 |
if (agree) {
|
| 3895 |
dpurdie |
389 |
MM_showProgressBar();
|
| 129 |
ghuddy |
390 |
return true;
|
|
|
391 |
} else {
|
|
|
392 |
return false;
|
|
|
393 |
}
|
| 119 |
ghuddy |
394 |
}
|
|
|
395 |
|
|
|
396 |
function confirmAction(m)
|
|
|
397 |
{
|
| 129 |
ghuddy |
398 |
var agree=confirm(m);
|
|
|
399 |
if (agree) {
|
| 3895 |
dpurdie |
400 |
MM_showProgressBar();
|
| 129 |
ghuddy |
401 |
return true;
|
|
|
402 |
} else {
|
|
|
403 |
return false;
|
|
|
404 |
}
|
| 119 |
ghuddy |
405 |
}
|
|
|
406 |
|
|
|
407 |
function DisplaySPAN(show) {
|
| 129 |
ghuddy |
408 |
if (show) {
|
|
|
409 |
MM_findObj("spanHideDetails").style.display = "block";
|
|
|
410 |
MM_findObj("spanPkgInfo").style.display = "block";
|
|
|
411 |
MM_findObj("spanShowDetails").style.display = "none";
|
|
|
412 |
} else {
|
|
|
413 |
MM_findObj("spanHideDetails").style.display = "none";
|
|
|
414 |
MM_findObj("spanPkgInfo").style.display = "none";
|
|
|
415 |
MM_findObj("spanShowDetails").style.display = "block";
|
|
|
416 |
}
|
| 119 |
ghuddy |
417 |
}
|
|
|
418 |
|
|
|
419 |
function ToggleDisplay () {
|
| 129 |
ghuddy |
420 |
var i, args, div_name, visibility
|
|
|
421 |
args=ToggleDisplay.arguments;
|
|
|
422 |
for (i=0; i<(args.length); i+=1) {
|
|
|
423 |
div_name=args[i];
|
|
|
424 |
if ( MM_findObj(div_name).style.display == 'block' ) {
|
|
|
425 |
MM_findObj(div_name).style.display = 'none';
|
|
|
426 |
} else {
|
|
|
427 |
MM_findObj(div_name).style.display = 'block';
|
|
|
428 |
}
|
| 121 |
hknight |
429 |
|
| 129 |
ghuddy |
430 |
}
|
| 119 |
ghuddy |
431 |
}
|
|
|
432 |
|
|
|
433 |
function Visible () {
|
| 121 |
hknight |
434 |
|
| 129 |
ghuddy |
435 |
var i, args, div_name, visibility
|
|
|
436 |
args=Visible.arguments;
|
|
|
437 |
for (i=0; i<(args.length); i+=2) {
|
|
|
438 |
div_name=args[i];
|
|
|
439 |
visibility=args[i+1]
|
|
|
440 |
MM_findObj(div_name).style.display = visibility;
|
| 121 |
hknight |
441 |
|
| 129 |
ghuddy |
442 |
}
|
| 119 |
ghuddy |
443 |
}
|
|
|
444 |
|
|
|
445 |
function DisplayObjects () {
|
| 129 |
ghuddy |
446 |
var i, args, div_name
|
|
|
447 |
args=DisplayObjects.arguments;
|
|
|
448 |
for (i=0; i<(args.length); i+=1) {
|
|
|
449 |
div_name=args[i];
|
|
|
450 |
MM_findObj(div_name).style.display = 'block';
|
|
|
451 |
}
|
| 119 |
ghuddy |
452 |
}
|
|
|
453 |
|
| 121 |
hknight |
454 |
function GetCookieVal (offset) {
|
| 129 |
ghuddy |
455 |
var endstr = document.cookie.indexOf (";", offset);
|
|
|
456 |
if (endstr == -1) { endstr = document.cookie.length; }
|
|
|
457 |
return unescape(document.cookie.substring(offset, endstr));
|
| 119 |
ghuddy |
458 |
}
|
|
|
459 |
|
|
|
460 |
|
| 121 |
hknight |
461 |
function GetCookie (name) {
|
| 129 |
ghuddy |
462 |
var arg = name + "=";
|
|
|
463 |
var alen = arg.length;
|
|
|
464 |
var clen = document.cookie.length;
|
|
|
465 |
var i = 0;
|
| 119 |
ghuddy |
466 |
|
| 129 |
ghuddy |
467 |
while (i < clen) {
|
|
|
468 |
var j = i + alen;
|
|
|
469 |
if (document.cookie.substring(i, j) == arg) return GetCookieVal (j);
|
|
|
470 |
i = document.cookie.indexOf(" ", i) + 1;
|
|
|
471 |
if (i == 0) break;
|
|
|
472 |
}
|
| 119 |
ghuddy |
473 |
|
| 129 |
ghuddy |
474 |
return null;
|
| 119 |
ghuddy |
475 |
}
|
|
|
476 |
|
|
|
477 |
function go_submit( formname, actionname )
|
|
|
478 |
{
|
| 129 |
ghuddy |
479 |
formname.action.value = actionname;
|
|
|
480 |
formname.submit();
|
| 119 |
ghuddy |
481 |
}
|
|
|
482 |
|
|
|
483 |
function ExpandAll()
|
|
|
484 |
{
|
| 129 |
ghuddy |
485 |
var elem
|
| 121 |
hknight |
486 |
|
| 129 |
ghuddy |
487 |
if (document.all)
|
|
|
488 |
{
|
|
|
489 |
// Run this for IE
|
|
|
490 |
elem = document.all;
|
|
|
491 |
} else {
|
|
|
492 |
// Run this for other browsers
|
|
|
493 |
elem = document.getElementsByTagName('div');
|
|
|
494 |
}
|
| 121 |
hknight |
495 |
|
| 129 |
ghuddy |
496 |
for (i in elem)
|
|
|
497 |
{
|
|
|
498 |
if (elem[i].id)
|
|
|
499 |
{
|
|
|
500 |
if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'none';
|
|
|
501 |
if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'block';
|
|
|
502 |
}
|
|
|
503 |
}
|
| 121 |
hknight |
504 |
|
| 119 |
ghuddy |
505 |
}
|
|
|
506 |
|
|
|
507 |
function CollapseAll()
|
|
|
508 |
{
|
| 129 |
ghuddy |
509 |
var elem
|
| 121 |
hknight |
510 |
|
| 129 |
ghuddy |
511 |
if (document.all)
|
|
|
512 |
{
|
|
|
513 |
// Run this for IE
|
|
|
514 |
elem = document.all;
|
|
|
515 |
} else {
|
|
|
516 |
// Run this for other browsers
|
|
|
517 |
elem = document.getElementsByTagName('div');
|
|
|
518 |
}
|
| 121 |
hknight |
519 |
|
| 129 |
ghuddy |
520 |
for (i in elem)
|
|
|
521 |
{
|
|
|
522 |
if (elem[i].id)
|
|
|
523 |
{
|
|
|
524 |
if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'block';
|
|
|
525 |
if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'none';
|
|
|
526 |
}
|
|
|
527 |
}
|
| 121 |
hknight |
528 |
|
| 119 |
ghuddy |
529 |
}
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
function height()
|
| 121 |
hknight |
533 |
{
|
| 129 |
ghuddy |
534 |
if( typeof( window.innerWidth ) == 'number' )
|
|
|
535 |
{
|
|
|
536 |
h = window.innerHeight;
|
|
|
537 |
}
|
|
|
538 |
else if(document.documentElement&&(document.documentElement.clientHeight ))
|
|
|
539 |
{
|
|
|
540 |
h = document.documentElement.clientHeight;
|
|
|
541 |
}
|
|
|
542 |
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
|
|
|
543 |
{
|
|
|
544 |
h = document.body.clientHeight;
|
|
|
545 |
}
|
| 121 |
hknight |
546 |
|
| 129 |
ghuddy |
547 |
var e = document.getElementById("LayerDescription");
|
| 121 |
hknight |
548 |
|
| 129 |
ghuddy |
549 |
if (navigator.userAgent.indexOf('Internet Explorer'))
|
|
|
550 |
{
|
|
|
551 |
e.style.height = h - 350 + "px";
|
|
|
552 |
e.style.overflow = "auto";
|
|
|
553 |
}
|
|
|
554 |
else
|
|
|
555 |
{
|
|
|
556 |
// This line shouldn't be run by IE; it doesn't seem to work. It gets run in Firefox, etc.
|
|
|
557 |
e.style.minHeight= h - 350 + "px";
|
|
|
558 |
e.style.overflow = "auto";
|
|
|
559 |
}
|
| 119 |
ghuddy |
560 |
}
|
|
|
561 |
|
| 121 |
hknight |
562 |
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
563 |
//
|
| 3899 |
dpurdie |
564 |
// MM_ValidateVersion(versionBase, versionExt, isAutobuild isPatch)
|
|
|
565 |
// Should NOT be used externally. Use MM_validateForm to access this function
|
| 121 |
hknight |
566 |
//
|
|
|
567 |
// versionBase eg 1.2.3
|
| 3899 |
dpurdie |
568 |
// versionExt eg .cr
|
| 121 |
hknight |
569 |
// isAutobuild true or false
|
| 133 |
ghuddy |
570 |
// isPatch true or false
|
| 121 |
hknight |
571 |
//
|
|
|
572 |
// Returns a non-zero-length error string if version is NOT valid, else returns a zero-length string
|
|
|
573 |
//
|
|
|
574 |
//////////////////////////////////////////////////////////////////////////////////////////////////
|
| 3899 |
dpurdie |
575 |
function MM_ValidateVersion(versionBase, versionExt, isAutobuild, isPatch)
|
| 121 |
hknight |
576 |
{
|
| 133 |
ghuddy |
577 |
var re_std_ver_format = /^\d+\.\d+\.\d+$/;
|
|
|
578 |
var re_patch_ver_format = /^\d+\.\d+\.\d+\.p\d+$/;
|
|
|
579 |
var re_cots_ver_format = /^[\w]+[\w\.\-]*$/; // starts with letter or digit or underscore, subsequent chars can be letters or digits or _ or . or -
|
| 129 |
ghuddy |
580 |
var re_cots_ver_format_exc1 = /[-_.]+[-_.]+/; // look for any two adjacent special characters
|
|
|
581 |
var re_cots_ver_format_exc2 = /[0-9A-Za-z]+/; // look for any alphanumeric char
|
| 3899 |
dpurdie |
582 |
var isCots = versionExt == ".cots" || versionExt == ".tool";
|
| 121 |
hknight |
583 |
|
| 3899 |
dpurdie |
584 |
if (!isAutobuild) {
|
|
|
585 |
if ( versionBase.length == 0 ) {
|
|
|
586 |
return " is of zero length";
|
|
|
587 |
} else if ( !isCots) {
|
|
|
588 |
if ( isPatch ) {
|
|
|
589 |
if ( !re_patch_ver_format.test(versionBase) ) {
|
|
|
590 |
return " is not of form (integer).(integer).(integer).p(integer)";
|
| 133 |
ghuddy |
591 |
}
|
| 3899 |
dpurdie |
592 |
} else {
|
|
|
593 |
if ( !re_std_ver_format.test(versionBase) ) {
|
|
|
594 |
return " is not of form (integer).(integer).(integer)";
|
| 133 |
ghuddy |
595 |
}
|
|
|
596 |
}
|
| 3899 |
dpurdie |
597 |
} else if (isCots) {
|
| 3621 |
dpurdie |
598 |
var extName = versionExt.toUpperCase().substr(1);
|
|
|
599 |
|
| 3899 |
dpurdie |
600 |
if ( !re_cots_ver_format.test(versionBase) ) {
|
|
|
601 |
return " " + extName + " package must begin with letter/digit/underscore, cannot contain any whitespace, and only special characters underscore/dash/dot are allowed";
|
| 129 |
ghuddy |
602 |
}
|
| 121 |
hknight |
603 |
|
| 3899 |
dpurdie |
604 |
if ( re_cots_ver_format_exc1.test(versionBase) ) {
|
|
|
605 |
return " " + extName + " package cannot contain two adjacent special characters (underscore/dash/dot)";
|
| 129 |
ghuddy |
606 |
}
|
| 121 |
hknight |
607 |
|
| 3899 |
dpurdie |
608 |
if ( !re_cots_ver_format_exc2.test(versionBase) ) {
|
|
|
609 |
return " " + extName + " package must contain one or more alphanumeric characters";
|
| 129 |
ghuddy |
610 |
}
|
|
|
611 |
}
|
|
|
612 |
}
|
| 121 |
hknight |
613 |
|
| 129 |
ghuddy |
614 |
// everything ok - no error
|
|
|
615 |
return "";
|
| 121 |
hknight |
616 |
}
|
|
|
617 |
|
|
|
618 |
|
| 3895 |
dpurdie |
619 |
// Manipulate the class list for a given element
|
|
|
620 |
function hasClass(ele, cls) {
|
|
|
621 |
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
|
|
|
622 |
}
|
| 121 |
hknight |
623 |
|
| 3895 |
dpurdie |
624 |
function addClass(ele, cls) {
|
|
|
625 |
if (!this.hasClass(ele, cls)) ele.className += " " + cls;
|
|
|
626 |
}
|
|
|
627 |
|
|
|
628 |
function removeClass(ele, cls) {
|
|
|
629 |
if (hasClass(ele, cls)) {
|
|
|
630 |
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
|
|
|
631 |
ele.className = ele.className.replace(reg, ' ');
|
|
|
632 |
}
|
|
|
633 |
}
|
|
|
634 |
|
|
|
635 |
function toggleClass(ele, cls1, cls2){
|
|
|
636 |
if(hasClass(ele, cls1)){
|
|
|
637 |
replaceClass(ele, cls1, cls2);
|
|
|
638 |
}else if(hasClass(ele, cls2)){
|
|
|
639 |
replaceClass(ele, cls2, cls1);
|
|
|
640 |
}else{
|
|
|
641 |
addClass(ele, cls1);
|
|
|
642 |
}
|
|
|
643 |
}
|
|
|
644 |
|
|
|
645 |
// Highlight combobox if selection is zero
|
|
|
646 |
// Returns true: None-zero selection
|
|
|
647 |
// Returns false: Invalid element or item-0 selected
|
|
|
648 |
function checkSeletion(el)
|
|
|
649 |
{
|
|
|
650 |
if (el ) {
|
|
|
651 |
if ( el.selectedIndex == 0) {
|
|
|
652 |
addClass(el, 'form_error');
|
|
|
653 |
} else {
|
|
|
654 |
removeClass(el, 'form_error');
|
|
|
655 |
return true;
|
|
|
656 |
}
|
|
|
657 |
}
|
|
|
658 |
return false;
|
|
|
659 |
}
|
|
|
660 |
|
| 3898 |
dpurdie |
661 |
function getElementsByClassName(classname, node) {
|
|
|
662 |
if(!node) node = document.getElementsByTagName("body")[0];
|
|
|
663 |
var a = [];
|
|
|
664 |
var re = new RegExp('\\b' + classname + '\\b');
|
|
|
665 |
var els = node.getElementsByTagName("*");
|
|
|
666 |
for(var i=0,j=els.length; i<j; i++)
|
|
|
667 |
if(re.test(els[i].className))a.push(els[i]);
|
|
|
668 |
return a;
|
|
|
669 |
}
|
|
|
670 |
|
|
|
671 |
function setCookie(c_name,value,exdays)
|
|
|
672 |
{
|
|
|
673 |
var exdate=new Date();
|
|
|
674 |
exdate.setDate(exdate.getDate() + exdays);
|
|
|
675 |
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
|
|
|
676 |
document.cookie=c_name + "=" + c_value;
|
|
|
677 |
}
|
|
|
678 |
|
|
|
679 |
function getCookie(c_name)
|
|
|
680 |
{
|
|
|
681 |
var c_value = document.cookie;
|
|
|
682 |
var c_start = c_value.indexOf(" " + c_name + "=");
|
|
|
683 |
if (c_start == -1)
|
|
|
684 |
{
|
|
|
685 |
c_start = c_value.indexOf(c_name + "=");
|
|
|
686 |
}
|
|
|
687 |
if (c_start == -1)
|
|
|
688 |
{
|
|
|
689 |
c_value = null;
|
|
|
690 |
}
|
|
|
691 |
else
|
|
|
692 |
{
|
|
|
693 |
c_start = c_value.indexOf("=", c_start) + 1;
|
|
|
694 |
var c_end = c_value.indexOf(";", c_start);
|
|
|
695 |
if (c_end == -1)
|
|
|
696 |
{
|
|
|
697 |
c_end = c_value.length;
|
|
|
698 |
}
|
|
|
699 |
c_value = unescape(c_value.substring(c_start,c_end));
|
|
|
700 |
}
|
|
|
701 |
return c_value;
|
|
|
702 |
}
|
|
|
703 |
|
| 119 |
ghuddy |
704 |
//-->
|