All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rhino1.7.6.testsrc.tests.js1_5.Regress.regress-216320.js Maven / Gradle / Ivy

Go to download

Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users.

There is a newer version: 1.7.15
Show newest version
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
 *
 * Date:    09 September 2003
 * SUMMARY: Just seeing we don't crash on this code
 * See http://bugzilla.mozilla.org/show_bug.cgi?id=216320
 *
 */
//-----------------------------------------------------------------------------
var gTestfile = 'regress-216320.js';
var BUGNUMBER = 216320;
var summary = "Just seeing we don't crash on this code";

printBugNumber(BUGNUMBER);
printStatus(summary);


/* TESTCASE BEGINS HERE */
status=0;
ism='NO';
scf='N';

function vol(){
  if(navigator.appName!="Netscape"){	if(!window.navigator.onLine){	alert(pbc0430);	return false;	} }
  return true; }

function vnid(formfield){
  nid=formfield.value;
  if(!nid.match(/^\s*$/)){
    nl=nid.split('/').length;
    if(nl!=2&&nl!=3){
      alert(pbc0420);
      formfield.focus();
      return false;
    }}}

function vnull(formfield){
  text=formfield.value;
  if(text.match(/^\s*$/)){
    alert(pbc0425);
    formfield.focus();
    return false;
  }
  return true;
}

function vdt(formfield){
  date=formfield.value;
//MM/DD/YYYY
//YYYY/MM/DD
  year=date.substring(0,4);
  hy1=date.charAt(4);
  month=date.substring(5,7);
  hy2=date.charAt(7);
  day=date.substring(8,10);
  today=new Date();
  tdy=today.getDate();
  tmn=today.getMonth()+1;
  if(today.getYear()<2000)tyr=today.getYear()+1900;
  else tyr=today.getYear();
  if(date.match(/^\s*$/))	{return true;	}

  if(hy1!="/"||hy2!="/"){
    alert(pbc0409);
    formfield.focus();
    return false;
  }
  if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){
    alert(pbc0409);
    formfield.focus();
    return false;
  }

  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)){
    alert(pbc0409);
    formfield.focus();
    return false;
  }
  return true;
}

function vkdt(formfield){
  date=formfield.value;
  year=date.substring(0,4);
  hy1=date.charAt(4);
  month=date.substring(5,7);
  hy2=date.charAt(7);
  day=date.substring(8,10);
  today=new Date();
  tdy=today.getDate();
  tmn=today.getMonth()+1;
  if(today.getYear()<2000)tyr=today.getYear()+1900;
  else tyr=today.getYear();
  if(date.match(/^\s*$/)){
    alert(pbc0425);
    formfield.focus();
    return false;
  }
  if(hy1!="/"||hy2!="/"){
    alert(pbc0409);
    formfield.focus();
    return false;
  }

  if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){
    alert(pbc0409);
    formfield.focus();
    return false;
  }

  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)){
    alert(pbc0409);
    formfield.focus();
    return false;
  }
  return true;
}

function ddif(month1,day1,year1,month2,day2,year2){
  start = new Date();
  start.setYear(year1);
  start.setMonth(month1-1);
  start.setDate(day1);
  start.setMinutes(0);
  start.setHours(0);
  start.setSeconds(0);
  end = new Date();
  end.setYear(year2);
  end.setMonth(month2-1);
  end.setDate(day2);
  end.setMinutes(0);
  end.setHours(0);
  end.setSeconds(0);
  current =(end.getTime() - start.getTime());
  days = Math.floor(current /(1000 * 60 * 60 * 24));
  return(days);
}

function vsub(form,status,ism,action){
  if(!vol()){ return false; }
  if(status<9||status==12){
    band=form.BAND.options[form.BAND.selectedIndex].value;
    if(band=="00"){
      alert(pbc0425);
      form.BAND.focus();
      return false;
    }
  }

  if((status>=0&&status<5)||(status==7)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
    if(!vnull(form.PT))	{	return false;	}
    adt1=form.STD;
    adt2=form.END;
    stdt=adt1.value;
    etdt=adt2.value;
    syr=stdt.substring(0,4);
    start_hy1=stdt.charAt(4);
    smon=stdt.substring(5,7);
    start_hy2=stdt.charAt(7);
    sdy=stdt.substring(8,10);
    eyr=etdt.substring(0,4);
    end_hy1=etdt.charAt(4);
    emon=etdt.substring(5,7);
    end_hy2=etdt.charAt(7);
    edy=etdt.substring(8,10);
    today=new Date();
    date=today.getDate();
    month=today.getMonth()+1;
    if(today.getYear()<2000)year=today.getYear()+1900;	else year=today.getYear();
    nextYear=year+1;
    if(!vnull(form.STD)){	return false;	}
    if(!vnull(form.END)){	return false;	}
    if(start_hy1!="/"||start_hy2!="/"){
      alert(pbc0409);
      form.STD.focus();
      return false;
    }
    if(end_hy1!="/"||end_hy2!="/"){
      alert(pbc0409);
      form.END.focus();
      return false;
    }
    if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){
      alert(pbc0409);
      form.STD.focus();
      return false;
    }
    if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){
      alert(pbc0409);
      form.END.focus();
      return false;
    }
    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)){
      alert(pbc0409);
      form.STD.focus();
      return false;
    }
    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)){
      alert(pbc0409);
      form.END.focus();
      return false;
    }
    if ((eyr==nextYear)&&(syr==year)) {
      if ((emon>1)||(edy >31)) {
	alert(pbc0401);
	form.END.focus();
	return false;
      }
    } else {

      if ((syr!=eyr)){
	alert(pbc0406);
	form.STD.focus();
	return false;
      }
      if(smon>emon||(smon==emon&&sdy>=edy)){
	alert(pbc0402);
	form.STD.focus();
	return false;
      }
      if((eyr!=year)&&(eyr!=year-1)){
	alert(pbc0405);
	form.END.focus();
	return false;
      }
    }
    if(ism=='YES'&&(status==5||status==6||status==12)){
      if(ddif(month,date,year,emon,edy,eyr)>31){
	alert(pbc0421);
	form.END.focus();
	return false;
      }
    }
    if((status>2&&status<5)||(status==7)||((status>=5&&status<9||status==12)&&ism=="YES")){
      if(status!=5){
	if(!vdt(form.IRD1)){
	  return false;
	}
	if(!vdt(form.IRD2)){
	  return false;
	}
	if(!vdt(form.IRD3)){
	  return false;
	}
	ird1=form.IRD1.value;
	ird2=form.IRD2.value;
	ird3=form.IRD3.value;
	if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
	  alert(pbc0417);
	  form.IRD1.focus();
	  return false;
	}
	else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
	  alert(pbc0417);
	  form.IRD2.focus();
	  return false;
	}
	if(!vdt(form.FRD1)){ return false;}
      }
      if(status==5){
	if(!vdt(form.IRD1)){return false;}
	if(!vdt(form.IRD2)){return false;}
	if(!vdt(form.IRD3)){return false;}
	ird1=form.IRD1.value;
	ird2=form.IRD2.value;
	ird3=form.IRD3.value;
	if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
	  alert(pbc0417);
	  form.IRD1.focus();
	  return false;
	}
	else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
	  alert(pbc0417);
	  form.IRD2.focus();
	  return false;
	}
	if(!vkdt(form.FRD1)){
	  return false;
	}
      }
    }
  }
  if((status>=0&&status<2)||(status==3)||(status==7)||(status>=2&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
    if(!vnull(form.WO)){
      return false;
    }
    if(!vnull(form.EO)){
      return false;
    }
    if(!vnull(form.TO)){
      return false;
    }
  }
  if((status==2||status==4)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
    if(!vnull(form.WR)){return false;}
    if(!vnull(form.ER)){return false;}
    if(!vnull(form.TR)){return false;}
  }
  if((status==5||status==6||status==12)&&ism=="YES"){
    if(!vkdt(form.FRD1)){return false;}
    frdt=form.FRD1.value;
    fryr=frdt.substring(0,4);
    frmn=frdt.substring(5,7);
    frdy=frdt.substring(8,10);
    if(fryr90){
	if(!confirm(pbc0439+" "+pbc0442)){
	  form.SID.focus();
	  return false;
	}}} else {
// MK/06-20-01 = If Rating Not equals to 4 blank out the sustained improve Date
      form.SID.value="";
    }
    if(!vnull(form.OAT)){ return false; }
    if(form.MSRQ.checked==true){
      if(form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){
	alert(pbc0418);
	form.NEW_SIGN_MGR_ID.focus();
	return false;
      }
      if(vnid(form.NEW_SIGN_MGR_ID)==false){	return false; }
    } else {
      if(!form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){
	alert(pbc0422);
	form.NEW_SIGN_MGR_ID.focus();
	return false;
      }
      if ( (form.TOC.value=="YES") && (form.RSRQ.checked==true) ) {
	alert(pbc0429);
	form.NEW_SEC_LINE_REV_ID.focus();
	return false;
      }
    }
    if(form.RSRQ.checked==true){
      if(form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)){
	alert(pbc0418);
	form.NEW_SEC_LINE_REV_ID.focus();
	return false;
      }
      if(vnid(form.NEW_SEC_LINE_REV_ID)==false){	return false; }
    } else {
      if(!form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)) {
	alert(pbc0423);
	form.NEW_SEC_LINE_REV_ID.focus();
	return false;
      }
      if ( (form.TOC.value=="YES") && (form.MSRQ.checked==true) ) {
	alert(pbc0431);
	form.NEW_SEC_LINE_REV_ID.focus();
	return false;
      }}}
  if(status!=9){
/**for returned objectives **/
    if(status==3){
      if(conf(pbc0466) == false) return false;
    }

    if(ism=='NO'){
      if(status==0||status==1||status==3||status==7){
	if(conf(pbc0456) == false) return false;
      }

      if(status==2||status==4||status==8){
	if(conf(pbc0457) == false) return false;
      }
    } else if(ism=='YES'){
      if(status==0||status==1||status==3||status==7){
	if(conf(pbc0458) == false)return false;
      }
      if(status==2||status==4||status==8){
	if(conf(pbc0459) == false)return false;
      }
      if(status==5||status==6){
	if(form.ESRQ.checked==false){
	  if(conf(pbc0460) == false)return false;
	} else {
	  if(conf(pbc0461) == false)return false;
	}}}}
  if(status==9){
    if(ism=='NO'){
      if(conf(pbc0462) == false)return false;
    } else if(ism=='YES'){
      if(conf(pbc0463) == false)return false;
    } else if(ism=='REVIEWER'){
      if(conf(pbc0464) == false)return false;
    }}
  sact(action);
  if(status>=9&&status<=11){ snul(); }
  form.submit();
  return true;
}

function vsav(form,status,ism,action) {
  if(!vol()){ return false; }
  adt1=form.STD;
  adt2=form.END;
  stdt=adt1.value;
  etdt=adt2.value;
  syr=stdt.substring(0,4);
  start_hy1=stdt.charAt(4);
  smon=stdt.substring(5,7);
  start_hy2=stdt.charAt(7);
  sdy=stdt.substring(8,10);
  eyr=etdt.substring(0,4);
  end_hy1=etdt.charAt(4);
  emon=etdt.substring(5,7);
  end_hy2=etdt.charAt(7);
  edy=etdt.substring(8,10);
  today=new Date();
  date=today.getDate();
  month=today.getMonth()+1;
  if(today.getYear()<2000) year=today.getYear()+1900; else year=today.getYear();
  nextYear=year+1;
  if(!vnull(form.STD)) return false;
  if(!vnull(form.END)) return false;
  if(start_hy1!="/"||start_hy2!="/"){
    alert(pbc0409);
    form.STD.focus();
    return false;
  }
  if(end_hy1!="/"||end_hy2!="/"){
    alert(pbc0409);
    form.END.focus();
    return false;
  }
  if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){
    alert(pbc0409);
    form.STD.focus();
    return false;
  }
  if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){
    alert(pbc0409);
    form.END.focus();
    return false;
  }
  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)){
    alert(pbc0409);
    form.STD.focus();
    return false;
  }
  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)){
    alert(pbc0409);
    form.END.focus();
    return false;
  }
  if ((eyr==nextYear)&&(syr==year)) {
    if ((emon>1)||(edy >31)) {
      alert(pbc0401);
      form.END.focus();
      return false;
    }
  } else {
    if ((syryear)) {
      alert(pbc0407);
      form.STD.focus();
      return false;
    }
    if((eyr!=year)&&(eyr!=year-1)){
      alert(pbc0405);
      form.END.focus();
      return false;
    }
    if(smon>emon||(smon==emon&&sdy>=edy)){
      alert(pbc0403);
      form.STD.focus();
      return false;
    }
  }
  if((status>2&&status<5)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
    if(!vdt(form.IRD1)){return false;}
    if(!vdt(form.IRD2)){return false;}
    if(!vdt(form.IRD3)){	return false;	}
    ird1=form.IRD1.value;
    ird2=form.IRD2.value;
    ird3=form.IRD3.value;
    if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
      alert(pbc0417);
      form.IRD1.focus();
      return false;
    }
    else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
      alert(pbc0417);
      form.IRD2.focus();
      return false;
    }
    if(!vdt(form.FRD1)){return false;}
    if(ism=="YES"){
      if(!vdt(form.FRD1)){return false;}
    }
  }
  if((status==5||status==6)&&ism=="YES"){
    rating="";
    for(i=0;i=9&&status<=11){
    snul();
  }
  form.submit();
  return true;
}
function cft(formfield){
  nid=formfield.value;
  if(nid.match(/^\s*$/)){
    alert(pbc0419);
    formfield.focus();
    return false;
  }
  nl=nid.split('/').length;
  if(nl!=2&&nl!=3){
    alert(pbc0420);
    formfield.focus();
    return false;
  }
  return true;
}
function dcf(form,pbcId,cnum,sequence,status,atyp,ver){
  if(!vol()){}
  dflg=confirm("\n\n<====================== " + pbc0468 + " ======================>\n\n" + pbc0469 + "\n\n<==================================================================>");
  if(dflg==true) {
    form.ATYP.value=atyp;
    form.PID.value=pbcId;
    form.CNUM.value=cnum;
    form.SEQ.value=sequence;
    form.ST.value=status;
    form.VER.value=ver;
    form.submit();
  }

}



function lop(){
//if(confirm(pbc0447+" "+pbc0451)){
  sck("timer","");
  sck("PBC_AUTH4","");
  sck("IBM004","");
  this.close();
//}

}

function csrlop(){
  top.location="logoff.jsp";
}
function lof(){
  csr=gck("IBM004");
  if(csr==null){ top.location="logoff.jsp";  }
  else if(csr.charAt(0)==3){ window.location="csrlogoff.jsp"; }
  else{ top.location="logoff.jsp";  }
}

function goToHome(){
  top.location="pbcmain.jsp";
}

function docsr(){
  sck("IBM004","1^NONE^1");
  window.location="pbcmain.jsp"
    }

function ccd(){
  if(confirm(pbc0434)){
    if(navigator.appName!="Netscape"){
      if(!window.navigator.onLine){
	window.close();
      }
      else {
	window.location='pbcmain.jsp';
      }
    }
    else {
      window.location='pbcmain.jsp';
    }
  }
}

function crt(form,action){
  if(!vol()){return false;}
  band=form.BAND.options[form.BAND.selectedIndex].value;
  if(band=="00"){
    alert(pbc0425);
    form.BAND.focus();
    return false;
  }
  if(!confirm(pbc0450)){return false;}
  sact(action);
  form.submit();
  return true;
}
function cusat(form,action){
  if(!vol()){return false;}
  sact(action);
  form.action="unsatreq.jsp";
  form.submit();
  return true;
}
function cfrt(form,ism,action){
  if(!vol()){return false;}
  sact(action);
  if(ism=="NO"){
    if(confirm(pbc0449+" "+pbc0432)){
      snul();
      form.submit();
      return true;
    }
  }
  if(ism=="REVIEWER"){
    if(confirm(pbc0449+" "+pbc0448)){
      snul();
      form.submit();
      return true;
    }
  }
  if(ism=="YES"){
    if(confirm(pbc0440)){
      snul();
      form.submit();
      return true;
    }
  }
}

function cces(form){
  if(form.ESRQ.checked==true){
    if(!confirm(pbc0435+" "+pbc0443))form.ESRQ.checked=false;
    else {form.ESRQ.checked=true;}
  }
}

function ccms(form){
  if(form.MSRQ.checked==true){
    if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0445))form.MSRQ.checked=false;
    else {
      form.MSRQ.checked=true;
    }
  }
}

function ccrs(form){
  if(form.RSRQ.checked==true){
    if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0446))form.RSRQ.checked=false;
    else {
      form.RSRQ.checked=true;
    }
  }
}

function seo(){
  alert(pbc0412+" "+pbc0413+" "+pbc0414);
}
function cows(form,action){
  if(!vol()){
    return false;
  }
  if(confirm(pbc0437)){
    sact(action);
    form.submit();
    return true;
  }
}

function srdb(rdb,value) {
  for(i=0; i 0)  {
    for(i=0;i < lbx.options.length;i++) {
      if(lbx.options[i].value == value) {
	lbx.options[i].selected = true;
	return true;
      }
    }
  }
  return true;
}

function ourl(URL,WIN_NAME){
  if(!vol()){ return; }
  var emp_win;
  if(document.layers) {
    child_screenX=window.screenX+50;
    child_width=window.innerWidth-75;
    child_height=window.innerHeight-75;
    emp_win=window.open(URL,WIN_NAME,"screenX="+ child_screenX +",screenY=75,height="+ child_height +",width="+ child_width +",resizable,status,scrollbars");
  } else{
    child_width = screen.width-160;
    child_height = screen.height-200;
    emp_win=window.open(URL,WIN_NAME,"height="+ child_height +",width="+ child_width +",resizable=yes,status=no,scrollbars=yes");
//emp_win.moveTo(110,0);
  }
//if (URL.indexOf("pbcsitehelp")==-1) { alert("Opened new window."); }
  emp_win.focus();
}

function dnh(form){
  form.NHS[0].checked=false;
  form.NHS[1].checked=false;
  form.NHB[0].checked=false;
  form.NHB[1].checked=false;
}

function cnh(form){
  isnh="";
  for(i=0; i");
  var txtValue3 = txtValue2.replace((/</g),"<");
  return txtValue3;
}

function encodeText(txtValue) {
  if (txtValue.match(/^\s*$/)) return txtValue;
  var txtValue0 = txtValue.replace((/\r\n/g),'&lf;');
  var txtValue1 = txtValue0.replace((/"/g),'"');
var txtValue2 = txtValue1.replace((/>/g),'>');
var txtValue3 = txtValue2.replace((/




© 2015 - 2024 Weber Informatics LLC | Privacy Policy