1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is JavaScript Engine testing utilities.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corp.
19 * Portions created by the Initial Developer are Copyright (C) 2003
20 * the Initial Developer. All Rights Reserved.
23 * brendan@mozilla.org, pschwartau@netscape.com
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
41 * Date: 09 September 2003
42 * SUMMARY: Just seeing we don't crash on this code
43 * See http://bugzilla.mozilla.org/show_bug.cgi?id=216320
46 //-----------------------------------------------------------------------------
47 var BUGNUMBER = 216320;
48 var summary = "Just seeing we don't crash on this code";
50 printBugNumber(BUGNUMBER);
54 /* TESTCASE BEGINS HERE */
60 if(navigator.appName!="Netscape"){ if(!window.navigator.onLine){ alert(pbc0430); return false; } }
63 function vnid(formfield){
65 if(!nid.match(/^\s*$/)){
66 nl=nid.split('/').length;
73 function vnull(formfield){
75 if(text.match(/^\s*$/)){
83 function vdt(formfield){
87 year=date.substring(0,4);
89 month=date.substring(5,7);
91 day=date.substring(8,10);
94 tmn=today.getMonth()+1;
95 if(today.getYear()<2000)tyr=today.getYear()+1900;
96 else tyr=today.getYear();
97 if(date.match(/^\s*$/)) {return true; }
99 if(hy1!="/"||hy2!="/"){
104 if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){
110 if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day>31)||(year%4==0&&month==2&&day>29)||(year%4!=0&&month==2&&day>28)||((month==4||month==6||month==9||month==11)&&day>30)){
118 function vkdt(formfield){
119 date=formfield.value;
120 year=date.substring(0,4);
122 month=date.substring(5,7);
124 day=date.substring(8,10);
127 tmn=today.getMonth()+1;
128 if(today.getYear()<2000)tyr=today.getYear()+1900;
129 else tyr=today.getYear();
130 if(date.match(/^\s*$/)){
135 if(hy1!="/"||hy2!="/"){
141 if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){
147 if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day>31)||(year%4==0&&month==2&&day>29)||(year%4!=0&&month==2&&day>28)||((month==4||month==6||month==9||month==11)&&day>30)){
155 function ddif(month1,day1,year1,month2,day2,year2){
157 start.setYear(year1);
158 start.setMonth(month1-1);
165 end.setMonth(month2-1);
170 current =(end.getTime() - start.getTime());
171 days = Math.floor(current /(1000 * 60 * 60 * 24));
175 function vsub(form,status,ism,action){
176 if(!vol()){ return false; }
177 if(status<9||status==12){
178 band=form.BAND.options[form.BAND.selectedIndex].value;
186 if((status>=0&&status<5)||(status==7)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
187 if(!vnull(form.PT)) { return false; }
192 syr=stdt.substring(0,4);
193 start_hy1=stdt.charAt(4);
194 smon=stdt.substring(5,7);
195 start_hy2=stdt.charAt(7);
196 sdy=stdt.substring(8,10);
197 eyr=etdt.substring(0,4);
198 end_hy1=etdt.charAt(4);
199 emon=etdt.substring(5,7);
200 end_hy2=etdt.charAt(7);
201 edy=etdt.substring(8,10);
203 date=today.getDate();
204 month=today.getMonth()+1;
205 if(today.getYear()<2000)year=today.getYear()+1900; else year=today.getYear();
207 if(!vnull(form.STD)){ return false; }
208 if(!vnull(form.END)){ return false; }
209 if(start_hy1!="/"||start_hy2!="/"){
214 if(end_hy1!="/"||end_hy2!="/"){
219 if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){
224 if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){
229 if(((smon==1||smon==3||smon==5||smon==7||smon==8||smon==10||smon==12)&&sdy>31)||(syr%4==0&&smon==2&&sdy>29)||(syr%4!=0&&smon==2&&sdy>28)||((smon==4||smon==6||smon==9||smon==11)&&sdy>30)){
234 if(((emon==1||emon==3||emon==5||emon==7||emon==8||emon==10||emon==12)&&edy>31)||(eyr%4==0&&emon==2&&edy>29)||(eyr%4!=0&&emon==2&&edy>28)||((emon==4||emon==6||emon==9||emon==11)&&edy>30)){
239 if ((eyr==nextYear)&&(syr==year)) {
240 if ((emon>1)||(edy >31)) {
252 if(smon>emon||(smon==emon&&sdy>=edy)){
257 if((eyr!=year)&&(eyr!=year-1)){
263 if(ism=='YES'&&(status==5||status==6||status==12)){
264 if(ddif(month,date,year,emon,edy,eyr)>31){
270 if((status>2&&status<5)||(status==7)||((status>=5&&status<9||status==12)&&ism=="YES")){
281 ird1=form.IRD1.value;
282 ird2=form.IRD2.value;
283 ird3=form.IRD3.value;
284 if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
289 else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
294 if(!vdt(form.FRD1)){ return false;}
297 if(!vdt(form.IRD1)){return false;}
298 if(!vdt(form.IRD2)){return false;}
299 if(!vdt(form.IRD3)){return false;}
300 ird1=form.IRD1.value;
301 ird2=form.IRD2.value;
302 ird3=form.IRD3.value;
303 if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
308 else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
313 if(!vkdt(form.FRD1)){
319 if((status>=0&&status<2)||(status==3)||(status==7)||(status>=2&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
330 if((status==2||status==4)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
331 if(!vnull(form.WR)){return false;}
332 if(!vnull(form.ER)){return false;}
333 if(!vnull(form.TR)){return false;}
335 if((status==5||status==6||status==12)&&ism=="YES"){
336 if(!vkdt(form.FRD1)){return false;}
337 frdt=form.FRD1.value;
338 fryr=frdt.substring(0,4);
339 frmn=frdt.substring(5,7);
340 frdy=frdt.substring(8,10);
341 if(fryr<syr||(fryr==syr&&frmn<smon)||(fryr==syr&&frmn==smon&&frdy<=sdy)){
346 if((status==5||status==6||status==12)&&ism=="YES"){
348 for(i=0; i<form.INH.length; i++){
349 if(form.INH[i].checked==true){ isnh=form.INH[i].value; }
358 for(i=0; i<form.NHB.length; i++){
359 if(form.NHB[i].checked==true){ beh=form.NHB[i].value; }
362 for(i=0; i<form.NHS.length; i++){
363 if(form.NHS[i].checked==true){ skl=form.NHS[i].value; }
375 if((beh=="N"||skl=="N")&&status!=12){
376 if(form.RCD[3].checked==false){
377 if(confirm(pbc0455))srdb(form.RCD,"4");
383 if(status!=12){ for(i=0; i<form.RCD.length; i++){ if(form.RCD[i].checked==true)rating=form.RCD[i].value; } }
384 else if(status==12){ rating="4"; }
391 if(!vkdt(form.SID)){ return false; }
393 iyr=idt.substring(0,4);
394 imon=idt.substring(5,7);
395 idy=idt.substring(8,10);
396 frdt=form.FRD1.value;
397 fryr=frdt.substring(0,4);
398 frmn=frdt.substring(5,7);
399 frdy=frdt.substring(8,10);
400 if(iyr<eyr||(iyr==eyr&&imon<emon)||(iyr==eyr&&imon==emon&&idy<=edy)){
405 if(iyr<fryr||(iyr==fryr&&imon<frmn)||(iyr==fryr&&imon==frmn&&idy<=frdy)){
410 if(ddif(emon,edy,eyr,imon,idy,iyr)<30){
415 if(ddif(emon,edy,eyr,imon,idy,iyr)>90){
416 if(!confirm(pbc0439+" "+pbc0442)){
420 // MK/06-20-01 = If Rating Not equals to 4 blank out the sustained improve Date
423 if(!vnull(form.OAT)){ return false; }
424 if(form.MSRQ.checked==true){
425 if(form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){
427 form.NEW_SIGN_MGR_ID.focus();
430 if(vnid(form.NEW_SIGN_MGR_ID)==false){ return false; }
432 if(!form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){
434 form.NEW_SIGN_MGR_ID.focus();
437 if ( (form.TOC.value=="YES") && (form.RSRQ.checked==true) ) {
439 form.NEW_SEC_LINE_REV_ID.focus();
443 if(form.RSRQ.checked==true){
444 if(form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)){
446 form.NEW_SEC_LINE_REV_ID.focus();
449 if(vnid(form.NEW_SEC_LINE_REV_ID)==false){ return false; }
451 if(!form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)) {
453 form.NEW_SEC_LINE_REV_ID.focus();
456 if ( (form.TOC.value=="YES") && (form.MSRQ.checked==true) ) {
458 form.NEW_SEC_LINE_REV_ID.focus();
462 /**for returned objectives **/
464 if(conf(pbc0466) == false) return false;
468 if(status==0||status==1||status==3||status==7){
469 if(conf(pbc0456) == false) return false;
472 if(status==2||status==4||status==8){
473 if(conf(pbc0457) == false) return false;
475 } else if(ism=='YES'){
476 if(status==0||status==1||status==3||status==7){
477 if(conf(pbc0458) == false)return false;
479 if(status==2||status==4||status==8){
480 if(conf(pbc0459) == false)return false;
482 if(status==5||status==6){
483 if(form.ESRQ.checked==false){
484 if(conf(pbc0460) == false)return false;
486 if(conf(pbc0461) == false)return false;
490 if(conf(pbc0462) == false)return false;
491 } else if(ism=='YES'){
492 if(conf(pbc0463) == false)return false;
493 } else if(ism=='REVIEWER'){
494 if(conf(pbc0464) == false)return false;
497 if(status>=9&&status<=11){ snul(); }
502 function vsav(form,status,ism,action) {
503 if(!vol()){ return false; }
508 syr=stdt.substring(0,4);
509 start_hy1=stdt.charAt(4);
510 smon=stdt.substring(5,7);
511 start_hy2=stdt.charAt(7);
512 sdy=stdt.substring(8,10);
513 eyr=etdt.substring(0,4);
514 end_hy1=etdt.charAt(4);
515 emon=etdt.substring(5,7);
516 end_hy2=etdt.charAt(7);
517 edy=etdt.substring(8,10);
519 date=today.getDate();
520 month=today.getMonth()+1;
521 if(today.getYear()<2000) year=today.getYear()+1900; else year=today.getYear();
523 if(!vnull(form.STD)) return false;
524 if(!vnull(form.END)) return false;
525 if(start_hy1!="/"||start_hy2!="/"){
530 if(end_hy1!="/"||end_hy2!="/"){
535 if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){
540 if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){
545 if(((smon==1||smon==3||smon==5||smon==7||smon==8||smon==10||smon==12)&&sdy>31)||(syr%4==0&&smon==2&&sdy>29)||(syr%4!=0&&smon==2&&sdy>28)||((smon==4||smon==6||smon==9||smon==11)&&sdy>30)){
550 if(((emon==1||emon==3||emon==5||emon==7||emon==8||emon==10||emon==12)&&edy>31)||(eyr%4==0&&emon==2&&edy>29)||(eyr%4!=0&&emon==2&&edy>28)||((emon==4||emon==6||emon==9||emon==11)&&edy>30)){
555 if ((eyr==nextYear)&&(syr==year)) {
556 if ((emon>1)||(edy >31)) {
562 if ((syr<year-1) || (syr>year)) {
567 if((eyr!=year)&&(eyr!=year-1)){
572 if(smon>emon||(smon==emon&&sdy>=edy)){
578 if((status>2&&status<5)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
579 if(!vdt(form.IRD1)){return false;}
580 if(!vdt(form.IRD2)){return false;}
581 if(!vdt(form.IRD3)){ return false; }
582 ird1=form.IRD1.value;
583 ird2=form.IRD2.value;
584 ird3=form.IRD3.value;
585 if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
590 else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
595 if(!vdt(form.FRD1)){return false;}
597 if(!vdt(form.FRD1)){return false;}
600 if((status==5||status==6)&&ism=="YES"){
602 for(i=0;i<form.RCD.length;i++){
603 if(form.RCD[i].checked==true)rating=form.RCD[i].value;
606 for(i=0; i<form.INH.length; i++){
607 if(form.INH[i].checked==true){
608 isnh=form.INH[i].value;
613 for(i=0; i<form.NHB.length;i++){
614 if(form.NHB[i].checked==true){
615 beh=form.NHB[i].value;
619 for(i=0; i<form.NHS.length;i++){
620 if(form.NHS[i].checked==true){
621 skl=form.NHS[i].value;
624 if((beh=="N"||skl=="N")&&rating!=""){
625 if(form.RCD[3].checked==false){
626 if(confirm(pbc0455))srdb(form.RCD,"4");
633 if(!vdt(form.SID)){ return false;}
636 if((status==2||status==4 || status==8 || status==5 || status==6 || status==10)&&ism=='YES')
638 if(!confirm(pbc0436)){ return false;}
639 if(form.OBJECTIVE_CHANGED.value=='Y') {
640 if(confirm(pbc0452+" "+pbc0453+" "+pbc0454)){form.MRQ.value=4; } else { form.MRQ.value=0; }
641 }else if (( status==5 || status==6 || status==10) && (form.RESULTS_CHANGED.value=='Y')) {
642 if(confirm(pbc0470+" "+pbc0453+" "+pbc0454)){form.MRQ.value=8; } else { form.MRQ.value=0; }
646 if(status>=9&&status<=11){
652 function cft(formfield){
654 if(nid.match(/^\s*$/)){
659 nl=nid.split('/').length;
667 function dcf(form,pbcId,cnum,sequence,status,atyp,ver){
669 dflg=confirm("\n\n<====================== " + pbc0468 + " ======================>\n\n" + pbc0469 + "\n\n<==================================================================>");
671 form.ATYP.value=atyp;
672 form.PID.value=pbcId;
673 form.CNUM.value=cnum;
674 form.SEQ.value=sequence;
675 form.ST.value=status;
685 //if(confirm(pbc0447+" "+pbc0451)){
695 top.location="logoff.jsp";
699 if(csr==null){ top.location="logoff.jsp"; }
700 else if(csr.charAt(0)==3){ window.location="csrlogoff.jsp"; }
701 else{ top.location="logoff.jsp"; }
705 top.location="pbcmain.jsp";
709 sck("IBM004","1^NONE^1");
710 window.location="pbcmain.jsp"
714 if(confirm(pbc0434)){
715 if(navigator.appName!="Netscape"){
716 if(!window.navigator.onLine){
720 window.location='pbcmain.jsp';
724 window.location='pbcmain.jsp';
729 function crt(form,action){
730 if(!vol()){return false;}
731 band=form.BAND.options[form.BAND.selectedIndex].value;
737 if(!confirm(pbc0450)){return false;}
742 function cusat(form,action){
743 if(!vol()){return false;}
745 form.action="unsatreq.jsp";
749 function cfrt(form,ism,action){
750 if(!vol()){return false;}
753 if(confirm(pbc0449+" "+pbc0432)){
760 if(confirm(pbc0449+" "+pbc0448)){
767 if(confirm(pbc0440)){
776 if(form.ESRQ.checked==true){
777 if(!confirm(pbc0435+" "+pbc0443))form.ESRQ.checked=false;
778 else {form.ESRQ.checked=true;}
783 if(form.MSRQ.checked==true){
784 if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0445))form.MSRQ.checked=false;
786 form.MSRQ.checked=true;
792 if(form.RSRQ.checked==true){
793 if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0446))form.RSRQ.checked=false;
795 form.RSRQ.checked=true;
801 alert(pbc0412+" "+pbc0413+" "+pbc0414);
803 function cows(form,action){
807 if(confirm(pbc0437)){
814 function srdb(rdb,value) {
815 for(i=0; i<rdb.length;i++) {
816 if(rdb[i].value == value) {
817 rdb[i].checked = true;
824 function slop(lbx,value) {
825 if(lbx.options.length > 0) {
826 for(i=0;i < lbx.options.length;i++) {
827 if(lbx.options[i].value == value) {
828 lbx.options[i].selected = true;
836 function ourl(URL,WIN_NAME){
837 if(!vol()){ return; }
839 if(document.layers) {
840 child_screenX=window.screenX+50;
841 child_width=window.innerWidth-75;
842 child_height=window.innerHeight-75;
843 emp_win=window.open(URL,WIN_NAME,"screenX="+ child_screenX +",screenY=75,height="+ child_height +",width="+ child_width +",resizable,status,scrollbars");
845 child_width = screen.width-160;
846 child_height = screen.height-200;
847 emp_win=window.open(URL,WIN_NAME,"height="+ child_height +",width="+ child_width +",resizable=yes,status=no,scrollbars=yes");
848 //emp_win.moveTo(110,0);
850 //if (URL.indexOf("pbcsitehelp")==-1) { alert("Opened new window."); }
855 form.NHS[0].checked=false;
856 form.NHS[1].checked=false;
857 form.NHB[0].checked=false;
858 form.NHB[1].checked=false;
863 for(i=0; i<form.INH.length;i++)
865 if(form.INH[i].checked==true){isnh=form.INH[i].value; }
868 form.NHS[0].checked=false;
869 form.NHS[1].checked=false;
870 form.NHB[0].checked=false;
871 form.NHB[1].checked=false;
876 //if ((form.NHS[0].checked || form.NHS[1].checked) && (form.NHB[0].checked || form.NHB[1].checked))
877 if (form.NHS[1].checked || form.NHB[1].checked )
879 form.RCD[3].checked=true;
886 function err(errMsg) {
887 alert(getEncodedText(errMsg));
890 function getEncodedText(txtValue) {
891 if (txtValue.match(/^\s*$/)) return txtValue;
892 var txtValue1 = txtValue.replace((/"/g),'"');
893 var txtValue2 = txtValue1.replace((/>/g),">");
894 var txtValue3 = txtValue2.replace((/</g),"<");
898 function encodeText(txtValue) {
899 if (txtValue.match(/^\s*$/)) return txtValue;
900 var txtValue0 = txtValue.replace((/\r\n/g),'&lf;');
901 var txtValue1 = txtValue0.replace((/"/g),'"');
902 var txtValue2 = txtValue1.replace((/>/g),'>');
903 var txtValue3 = txtValue2.replace((/</g),'<');
910 mck = " " + document.cookie + ";";
911 srcnm = " " + name + "=";
912 scok = mck.indexOf(srcnm);
914 scok += srcnm.length;
915 eofck = mck.indexOf(";",scok);
916 result = unescape(mck.substring(scok,eofck));
921 function sck(name,value){
922 ckpth="path=/;domain=.ibm.com";
923 document.cookie = name + "=" + value + ";" + ckpth;
927 function testForCookie(){
928 sck("PBCTest","test");
929 if(gck("PBCTest") == "test") {
930 // alert("Cookie test is good");
934 // alert("Cookie test is bad");
940 function prn(form,l_status,l_ism,l_scf,l_locale){
944 pwin=window.open("printvw.jsp?nls="+l_locale + "ISNEWWIN=TRUE","pwin","resizable=yes,width=560,height=400,scrollbars=yes,toolbar,screenX=5,screenY=5");
948 unum=form.UNUM.value;
950 cnum=unum.substring(0,eofsn);
955 return top.confirm(msg);
958 function sact(action){
959 document.PBC_FORM.ATYP.value=action;
963 document.PBC_FORM.WO.value="";
964 document.PBC_FORM.WR.value="";
965 document.PBC_FORM.EO.value="";
966 document.PBC_FORM.ER.value="";
967 document.PBC_FORM.TO.value="";
968 document.PBC_FORM.TR.value="";
969 document.PBC_FORM.OAT.value="";
973 unum=document.PBC_FORM.UNUM.value;
975 cnum=unum.substring(0,eofsn);
978 function checkForEditPage() {
979 if(true==checkForm()){
980 if(!confirm(pbc0465)) return false;
985 function checkForm() {
986 var frms=document.forms["PBC_FORM"];
987 if (navigator.appName=="Netscape") {
988 if (frms==undefined) return false;
989 if (frms.IS_EDIT==undefined) return false;
991 if(frms==null) return false;
992 if (frms.IS_EDIT==null) return false;
999 function removeAnchor(link){
1001 indx = link.indexOf('#');
1004 link2 = link.substring(0,indx);
1005 indx=link2.indexOf("#");
1012 function gotoHREF(link){
1013 if(document.layers){
1014 var documentURL = removeAnchor(document.URL);
1015 location.href=documentURL+link;
1019 var documentURL = removeAnchor(document.URL);
1020 document.URL=documentURL+link;
1028 function init_resize_event(){
1031 function putVal2ck()
1035 function setValuesFromCookie()
1039 reportCompare('No Crash', 'No Crash', '');