Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
52
  window.open(theURL,winName,features);
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
 
69
function MM_validateForm() { //v5.0
129 ghuddy 70
   var i,p,pl,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
71
   var REresults;
72
   var pass,passc;
121 hknight 73
 
74
 
75
 
129 ghuddy 76
   // Other general validations
77
   var cleanStrRE = /^[0-9a-z_\.\(\)\-]+$/i;
78
   var pkgRE = /^[a-z][a-z0-9_-]*[a-z0-9]$/i;
79
   var versionRE = /^[0-9a-z_\.\(\)\-]+$/i;
80
   var versionNumberRE = /^\d+\.\d+\.\d+$/;
81
   var urlRE = "^https?://[a-z1-9]";
82
   //character range disallowed
83
   var HTMLchr = /[\<\>\'\"]+/i;
121 hknight 84
 
85
 
129 ghuddy 86
   for (i=0; i<(args.length-2); i+=3) {
87
      test=args[i+2];
88
      val=MM_findObj(args[i]);
121 hknight 89
 
129 ghuddy 90
      if (val) {
91
         nm=args[i+1];
92
         val=val.value;
121 hknight 93
 
94
 
95
 
129 ghuddy 96
         if (val!="") {
97
            if (test.indexOf('isEmail')!=-1) {
98
               p=val.indexOf('@');
99
               if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
100
            }
121 hknight 101
 
129 ghuddy 102
            if (test.indexOf('isDate') != -1) {
103
               if (val.indexOf("/") != -1) {
104
                  tmpARR = val.split("/");
105
                  if (tmpARR.length == 3) {
106
                     if (!(tmpARR[0]>0  && tmpARR[0]<32  && tmpARR[1]>0 && tmpARR[1]<13 && tmpARR[2]>1900 && tmpARR[2]<9999)) {
107
                        errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
108
                     }
109
                  } else {
110
                     errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
111
                  }
112
               } else {
113
                  errors += '- '+nm+' must be in DD/MM/YYYY format.\n';
114
               }
115
            }
121 hknight 116
 
129 ghuddy 117
            if (test.indexOf('isPackage')!=-1) {
118
               REresults = val.search(pkgRE);
119
               if (REresults < 0) errors += val += ' - '+nm+' is not valid. Valid characters are A-Z a-z 0-9 - _\n'
120
                        + 'Names must start with a letter and cannot contain spaces or symbols other than - and _\n';
121
            }
121 hknight 122
 
129 ghuddy 123
            if (test.indexOf('isCleanStr')!=-1) {
124
               REresults = val.search(cleanStrRE);
125
               if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
126
            }
121 hknight 127
 
129 ghuddy 128
            if (test.indexOf('isVersionStr')!=-1) {
129
               REresults = val.search(versionRE);
130
               if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
131
            }
121 hknight 132
 
129 ghuddy 133
            if (test.indexOf('isCCPath')!=-1) {
134
               var CCPathRE = /^\\|\/[a-z]+[0-9a-z_\.\-\\\/ ]+$/i;
121 hknight 135
 
129 ghuddy 136
               REresults = val.search(CCPathRE);
137
               if (REresults < 0) errors += val += '- '+nm+' uses invalid character.\nAllowed characters are \\ / A-Z a-z 0-9 . - _ SPACE\nAnd the path must begin with \\ or /';
138
            }
121 hknight 139
 
129 ghuddy 140
            if (test.indexOf('isCCLabel')!=-1) {
141
               var CCLabelRE = /^[0-9a-z_\.\-]+$/i;
121 hknight 142
 
129 ghuddy 143
               REresults = val.search(CCLabelRE);
144
               if (REresults < 0) errors += val += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . - _\n';
145
            }
121 hknight 146
 
129 ghuddy 147
            if (test.indexOf('isSVNTag')!=-1) {
148
               // Subversion TAG validation
149
               var SVNTagValidCharsRE = /^[0-9a-z_\.\-\/\@]+$/i;
150
               var SVNTagInValidTrunkAnywhereRE = /\/trunk\//i;
151
               var SVNTagInValidAt = /@[0-9]*[^0-9$]+/i;
152
               var SVNTagInValidSlashAtBOL = /^\/.*$/i;
153
               var SVNTagInValidTrunkRE = /\/trunk[^@$]+/i;
154
               var SVNTagInValidSlashAt = /\/@/i;
155
               var SVNTagInValidAtSlash = /@\//i;
156
               var SVNTagInValidSlash = /^.*\/\/.*$/i;
157
               var SVNTagValidTagAnywhereRE = /^.*\/tags\/.*$/i;
158
               var SVNTagValidBranchAnywhereRE = /^.*\/branches\/.*$/i;
159
               var SVNTagValidTrunkEOLRE = /^.*\/trunk$/i;
160
               var SVNTagValidTrunkAtNumberRE = /^.*\/trunk@[0-9]+$/i;
121 hknight 161
 
129 ghuddy 162
               if (val.search(SVNTagValidCharsRE) < 0)
163
                  errors += val += ' - '+nm+' uses invalid character. Allowed characters are / A-Z a-z 0-9 . - _ @\n';
164
               else {
165
                  if (val.search(SVNTagInValidTrunkAnywhereRE) >= 0)
166
                     errors += val += ' - '+nm+' contains /trunk/. This is not allowed.\n';
167
                  else {
168
                     if (val.search(SVNTagInValidAt) >= 0)
169
                        errors += val += ' - '+nm+' contains an @ symbol that is not followed by a numeric value and the end of the line.\n';
170
                     else {
171
                        if (val.search(SVNTagInValidSlashAtBOL) >= 0)
172
                           errors += val += ' - '+nm+' begins with a /. This is not allowed.\n';
173
                        else {
174
                           if (val.search(SVNTagInValidTrunkRE) >= 0)
175
                              errors += val += ' - '+nm+' contains invlaid /trunk. This must be followed by an @<number>, or the end of the line.\n';
176
                           else {
177
                              if ((val.search(SVNTagInValidSlashAt) >= 0) || (val.search(SVNTagInValidAtSlash) >= 0))
178
                                 errors += val += ' - '+nm+' contains /@ or @/. This is not allowed.\n';
179
                              else {
180
                                 if (val.search(SVNTagInValidSlash) >= 0)
181
                                    errors += val += ' - '+nm+' uses //. This is not allowed.\n';
182
                                 else {
183
                                    var count_valid_forms = 0;
121 hknight 184
 
129 ghuddy 185
                                    if (val.search(SVNTagValidTrunkAtNumberRE) >= 0) count_valid_forms++;
121 hknight 186
 
129 ghuddy 187
                                    if (val.search(SVNTagValidTrunkEOLRE) >= 0) count_valid_forms++;
121 hknight 188
 
129 ghuddy 189
                                    if (val.search(SVNTagValidBranchAnywhereRE) >= 0) count_valid_forms++;
121 hknight 190
 
129 ghuddy 191
                                    if (val.search(SVNTagValidTagAnywhereRE) >= 0) count_valid_forms++;
121 hknight 192
 
129 ghuddy 193
                                    if (count_valid_forms == 0) errors += val += ' - '+nm+' does not end in /trunk or /trunk@<number>,\nor does not contain /tags/ or /branches/\n';
121 hknight 194
 
129 ghuddy 195
                                    if (count_valid_forms > 1) errors += val += ' - '+nm+' cannot combine use of trunk, /tags/, or /branches/ in one subversion tag\n';
196
                                 }
197
                              }
198
                           }
199
                        }
200
                     }
201
                  }
202
               }
203
            }
204
 
205
            if (test.indexOf('isVersionNumber')!=-1) {
206
               REresults = val.search(versionNumberRE);
207
               if (REresults < 0) errors += val += ' - '+nm+' is formatted incorrectly.\nVersion number should be (major).(minor).(patch)(build)\ne.g. 1.0.2002\n';
208
            }
209
 
210
            if (test.indexOf('isURL')!=-1) {
211
               REresults = val.match(urlRE);
212
               if (REresults == null) errors += '"'+val+'" is not a valid URL.\n';
213
            }
214
 
215
            if (test.indexOf('isChangePassword')!=-1) {
216
               pass=MM_findObj('FRpassword');
217
               passc=MM_findObj('FRpasswordc');
218
               if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
219
            }
220
 
221
            if (test.indexOf('maxLength')!=-1) {
222
               p=test.indexOf(':');
223
               max=test.substring(p+1);
224
               if (val.length>max) errors+='- '+nm+' can be maximum '+max+' characters long.\n';
225
            }
226
 
227
            if (test.indexOf('notHTML')!=-1) {
228
               if (val.match(HTMLchr)) errors+='- '+nm+' has invalid characters like \'< > quotes\'\n';
229
            }
230
 
231
            if (test.charAt(0)=='R') {
232
 
233
               if (test.indexOf('isNumber') != -1) {
234
                  if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
235
               }
236
 
237
               if (test.indexOf('inRange') != -1) {
238
                  p=test.indexOf(':');
239
                  min=test.substring(8,p);
240
                  max=test.substring(p+1);
241
                  if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
242
               }
243
 
244
               if (test.indexOf('inLength')!=-1) {
245
                   pl=test.indexOf('inLength')
246
                  p=test.indexOf(':');
247
                      min=test.substring(pl+8,p);
248
                      if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
249
                }
250
            }
251
         } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
252
 
253
 
254
         if (test.indexOf('isPassword')!=-1) {
255
            pass=MM_findObj('FRpassword');
256
            passc=MM_findObj('FRpasswordc');
257
            if (!MM_findObj('FRdomainauth').checked) {
258
               if (test.indexOf('inLength')!=-1) {
259
                   pl=test.indexOf('inLength')
260
                  p=test.indexOf(':');
261
                      min=test.substring(pl+8,p);
262
                      if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
263
                }
264
               if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
265
            } else {
266
               if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
267
            }
268
         }
269
 
270
         if (test.indexOf('isDomainName')!=-1) {
271
            if (MM_findObj('FRdomainauth').checked) {
272
               if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
273
            }
274
         }
275
 
276
      }
277
   }
278
 
279
   if (errors) {
280
      alert('The following error(s) occurred:\n\n'+errors);
281
      clickedButton=false;
282
   } else {
283
      clickedButton=true;
284
   }
285
   document.MM_returnValue = (errors == '');
286
 
287
   if (MM_findObj('ProgressBar') && document.MM_returnValue) MM_findObj('ProgressBar').style.visibility='visible';
119 ghuddy 288
}
289
 
290
function isChecked(boxName, buttonId) {
291
  var formButton = document.getElementById(buttonId);
292
  var boxes = document.getElementsByName(boxName);
293
  var btnChecked = false;
294
  if (formButton) {
295
    for (var i = 0; i < boxes.length; i++) {
296
      if (boxes[i].checked) {
297
        btnChecked = true;
298
      }
299
    }
121 hknight 300
 
119 ghuddy 301
    if (btnChecked) {
302
      formButton.disabled = false;
303
      formButton.style.color="";
304
    }
305
    else {
306
      formButton.disabled = true;
307
      formButton.style.color="silver";
308
    }
309
  }
310
}
311
 
312
function confirmDelete(m)
313
{
129 ghuddy 314
   var agree=confirm('Are you sure you want to delete '+m+'?');
315
   if (agree) {
316
      if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
317
      return true;
318
   } else {
319
      return false;
320
   }
119 ghuddy 321
}
322
 
323
function confirmAction(m)
324
{
129 ghuddy 325
   var agree=confirm(m);
326
   if (agree) {
327
      if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
328
      return true;
329
   } else {
330
      return false;
331
   }
119 ghuddy 332
}
333
 
334
function DisplaySPAN(show) {
129 ghuddy 335
   if (show) {
336
      MM_findObj("spanHideDetails").style.display = "block";
337
      MM_findObj("spanPkgInfo").style.display = "block";
338
      MM_findObj("spanShowDetails").style.display = "none";
339
   } else {
340
      MM_findObj("spanHideDetails").style.display = "none";
341
      MM_findObj("spanPkgInfo").style.display = "none";
342
      MM_findObj("spanShowDetails").style.display = "block";
343
   }
119 ghuddy 344
}
345
 
346
function ToggleDisplay () {
129 ghuddy 347
   var i, args, div_name, visibility
348
   args=ToggleDisplay.arguments;
349
   for (i=0; i<(args.length); i+=1) {
350
      div_name=args[i];
351
      if ( MM_findObj(div_name).style.display == 'block' ) {
352
         MM_findObj(div_name).style.display = 'none';
353
      } else {
354
         MM_findObj(div_name).style.display = 'block';
355
      }
121 hknight 356
 
129 ghuddy 357
   }
119 ghuddy 358
}
359
 
360
function Visible () {
121 hknight 361
 
129 ghuddy 362
   var i, args, div_name, visibility
363
   args=Visible.arguments;
364
   for (i=0; i<(args.length); i+=2) {
365
      div_name=args[i];
366
      visibility=args[i+1]
367
      MM_findObj(div_name).style.display = visibility;
121 hknight 368
 
129 ghuddy 369
   }
119 ghuddy 370
}
371
 
372
function DisplayObjects () {
129 ghuddy 373
   var i, args, div_name
374
   args=DisplayObjects.arguments;
375
   for (i=0; i<(args.length); i+=1) {
376
      div_name=args[i];
377
      MM_findObj(div_name).style.display = 'block';
378
   }
119 ghuddy 379
}
380
 
121 hknight 381
function GetCookieVal (offset) {
129 ghuddy 382
   var endstr = document.cookie.indexOf (";", offset);
383
   if (endstr == -1) { endstr = document.cookie.length; }
384
   return unescape(document.cookie.substring(offset, endstr));
119 ghuddy 385
}
386
 
387
 
121 hknight 388
function GetCookie (name) {
129 ghuddy 389
   var arg = name + "=";
390
   var alen = arg.length;
391
   var clen = document.cookie.length;
392
   var i = 0;
119 ghuddy 393
 
129 ghuddy 394
   while (i < clen) {
395
      var j = i + alen;
396
      if (document.cookie.substring(i, j) == arg) return GetCookieVal (j);
397
      i = document.cookie.indexOf(" ", i) + 1;
398
      if (i == 0) break;
399
   }
119 ghuddy 400
 
129 ghuddy 401
   return null;
119 ghuddy 402
}
403
 
404
function go_submit( formname, actionname )
405
{
129 ghuddy 406
   formname.action.value = actionname;
407
   formname.submit();
119 ghuddy 408
}
409
 
410
function ExpandAll()
411
{
129 ghuddy 412
   var elem
121 hknight 413
 
129 ghuddy 414
   if (document.all)
415
   {
416
      // Run this for IE
417
      elem = document.all;
418
   } else {
419
      // Run this for other browsers
420
      elem = document.getElementsByTagName('div');
421
   }
121 hknight 422
 
129 ghuddy 423
   for (i in elem)
424
   {
425
      if (elem[i].id)
426
      {
427
         if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'none';
428
         if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'block';
429
      }
430
   }
121 hknight 431
 
119 ghuddy 432
}
433
 
434
function CollapseAll()
435
{
129 ghuddy 436
   var elem
121 hknight 437
 
129 ghuddy 438
   if (document.all)
439
   {
440
      // Run this for IE
441
      elem = document.all;
442
   } else {
443
      // Run this for other browsers
444
      elem = document.getElementsByTagName('div');
445
   }
121 hknight 446
 
129 ghuddy 447
   for (i in elem)
448
   {
449
      if (elem[i].id)
450
      {
451
         if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'block';
452
         if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'none';
453
      }
454
   }
121 hknight 455
 
119 ghuddy 456
}
457
 
458
 
459
function height()
121 hknight 460
{
129 ghuddy 461
   if( typeof( window.innerWidth ) == 'number' )
462
   {
463
      h = window.innerHeight;
464
   }
465
   else if(document.documentElement&&(document.documentElement.clientHeight ))
466
   {
467
      h = document.documentElement.clientHeight;
468
   }
469
   else if( document.body &&   ( document.body.clientWidth || document.body.clientHeight ) )
470
   {
471
      h = document.body.clientHeight;
472
   }
121 hknight 473
 
129 ghuddy 474
   var e = document.getElementById("LayerDescription");
121 hknight 475
 
129 ghuddy 476
   if (navigator.userAgent.indexOf('Internet Explorer'))
477
   {
478
      e.style.height = h - 350 + "px";
479
      e.style.overflow = "auto";
480
   }
481
   else
482
   {
483
      // This line shouldn't be run by IE; it doesn't seem to work. It gets run in Firefox, etc.
484
      e.style.minHeight= h - 350 + "px";
485
      e.style.overflow = "auto";
486
   }
119 ghuddy 487
}
488
 
121 hknight 489
//////////////////////////////////////////////////////////////////////////////////////////////////
490
//
491
// MM_ValidateVersion(pkgName, versionBase, versionExt, isAutobuild)
492
//
493
//    pkgName       eg EA_DocGen
494
//    versionBase   eg 1.2.3
129 ghuddy 495
//    versionExt   eg .cr
121 hknight 496
//    isAutobuild   true or false
497
//
498
// Returns true if version is valid, else false
499
//
500
// This function can and should be used instead of MM_validateForm to validate
501
// version numbers for new or reversioned package versions.
502
//
503
// So far, this function is used in the following situations:
504
//    1) Add new version to release (_form_new_version_page.asp)
505
//    2) Reversion existing version (_wform_rename_version.asp)
506
//    3) Add package to release (Form_add_pkg_versions.asp)
507
//////////////////////////////////////////////////////////////////////////////////////////////////
508
function MM_ValidateVersion(pkgName, versionBase, versionExt, isAutobuild)
509
{
129 ghuddy 510
   var errString = MM_ValidateVersionReturningErrString(pkgName, versionBase, versionExt, isAutobuild);
511
   if (errString.length > 0)
512
   {
513
      alert(errString);
514
      return false;
515
   }
516
   return true;
121 hknight 517
}
518
 
519
//////////////////////////////////////////////////////////////////////////////////////////////////
520
//
521
// MM_ValidateVersionReturningErrString(pkgName, versionBase, versionExt, isAutobuild)
522
//
523
//    pkgName       eg buildtool
524
//    versionBase   eg 1.2.3
129 ghuddy 525
//    versionExt   eg .cr
121 hknight 526
//    isAutobuild   true or false
527
//
528
// Returns a non-zero-length error string if version is NOT valid, else returns a zero-length string
529
//
530
// The MM_validateForm function should be modified to use this if possible, although I currently
531
// do not believe it has access to all the necessary parameter values needed.
532
//
533
//////////////////////////////////////////////////////////////////////////////////////////////////
534
function MM_ValidateVersionReturningErrString(pkgName, versionBase, versionExt, isAutobuild)
535
{
129 ghuddy 536
   var re_std_ver_format = /^\d+\.\d+\.\d+$/;
537
   var re_cots_ver_format = /^[\w]+[\w\.\-]*$/;    // starts with letter or digit or underscore, subsequent chars can be letters or digits or _ or . or -
538
   var re_cots_ver_format_exc1 = /[-_.]+[-_.]+/;   // look for any two adjacent special characters
539
   var re_cots_ver_format_exc2 = /[0-9A-Za-z]+/;   // look for any alphanumeric char
121 hknight 540
 
129 ghuddy 541
   var forPkgName = "";
542
   if (pkgName != null && pkgName.length > 0)
543
   {
544
      forPkgName = ", for package " + pkgName;
545
   }
121 hknight 546
 
129 ghuddy 547
   if(!isAutobuild)
548
   {
549
      if( versionBase.length == 0 )
550
      {
551
         return "Action failed: version number is of zero length" + forPkgName;
552
      }
553
      else if( versionExt != ".cots" && !re_std_ver_format.test(versionBase) )
554
      {
555
         return "Action failed: version is not of form (integer).(integer).(integer).(extension)" + forPkgName;
556
      }
557
      else if( versionExt == ".cots")
558
      {
559
         if( !re_cots_ver_format.test(versionBase) )
560
         {
561
            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;
562
         }
121 hknight 563
 
129 ghuddy 564
         if( re_cots_ver_format_exc1.test(versionBase) )
565
         {
566
            return "Action failed: COTS version cannot contain two adjacent special characters (underscore/dash/dot)" + forPkgName;
567
         }
121 hknight 568
 
129 ghuddy 569
         if( !re_cots_ver_format_exc2.test(versionBase) )
570
         {
571
            return "Action failed: COTS version must contain one or more alphanumeric characters" + forPkgName;
572
         }
573
      }
574
   }
121 hknight 575
 
129 ghuddy 576
   // everything ok - no error
577
   return "";
121 hknight 578
}
579
 
580
 
581
 
119 ghuddy 582
//-->