function RuleExceptions(){
this.addRuleException=addRuleExceptionRuleExceptions;
this.hasRuleExceptions=hasRuleExceptionsRuleExceptions;
this.getRuleException=getRuleExceptionPorID;
this.size=sizeRuleExceptions;
this.errorMap=new HashMap();
}
function addRuleExceptionRuleExceptions(_1,_2){
var _3=this.errorMap.get(_1);
if(_3!=null){
_3.push(_2);
}else{
_3=new Array();
_3.push(_2);
this.errorMap.put(_1,_3);
}
}
function hasRuleExceptionsRuleExceptions(){
return this.errorMap.values.length>0;
}
function getRuleExceptionPorID(_4){
var _5=this.errorMap.get(_4);
return _5;
}
function sizeRuleExceptions(){
return this.errorMap.values.length;
}
function RuleException(_6){
this.key=_6;
this.params=new Array();
this.getMensajeError=getMensajeErrorRuleException;
var i=1;
while(arguments[i]!=null){
this.params.push(arguments[i++]);
}
}
function getMensajeErrorRuleException(){
var _8=getFormErrorMsg(this.key).errorMsgFormat;
for(var i=0;i<this.params.length;i++){
_8=_8.replace("{"+i+"}",this.params[i]);
}
return _8;
}
function AvatarFormValidator(_a){
this.formName=_a;
this.res=new RuleExceptions();
this.cantidadMaxEnterosBD=20;
this.cantidadMaxDecimalesBD=10;
this.flagSignoBD=false;
this.validate=validateAvatarFormValidator;
this.addValidacionTxtObligatorio=addValidacionTxtObligatorioAvatarFormValidator;
this.addValidacionTxtAlfanumerico=addValidacionTxtAlfanumericoAvatarFormValidator;
this.addValidacionTxtCaracteresValidos=addValidacionTxtCaracteresValidosAvatarFormValidator;
this.addValidacionTxtNumeroReal=addValidacionTxtNumeroRealAvatarFormValidator;
this.addValidacionTxtNumeroEntero=addValidacionTxtNumeroEnteroAvatarFormValidator;
this.addValidacionTxtNumeroMayorIgualCero=addValidacionTxtNumeroMayorIgualCeroAvatarFormValidator;
this.addValidacionTxtNumeroEnteroMayorCero=addValidacionTxtNumeroEnteroMayorCeroAvatarFormValidator;
this.addValidacionTxtPorcentaje=addValidacionTxtPorcentajeAvatarFormValidator;
this.addValidacionTxtEmail=addValidacionTxtEmailAvatarFormValidator;
this.addValidacionTxtURL=addValidacionTxtURLAvatarFormValidator;
this.addValidacionTxtTelefono=addValidacionTxtTelefonoAvatarFormValidator;
this.addValidacionFileObligatorio=addValidacionFileObligatorioAvatarFormValidator;
this.addValidacionFileExtension=addValidacionFileExtensionAvatarFormValidator;
this.addValidacionFileImagenExtension=addValidacionFileImagenExtensionAvatarFormValidator;
this.addValidacionCmbObligatorio=addValidacionCmbObligatorioAvatarFormValidator;
this.addValidacionChkMinimaCantidadSel=addValidacionChkMinimaCantidadSelAvatarFormValidator;
this.addValidacionChkGrupoMinimaCantidadSel=addValidacionChkGrupoMinimaCantidadSelAvatarFormValidator;
this.addValidacionChkMaximaCantidadSel=addValidacionChkMaximaCantidadSelAvatarFormValidator;
this.addValidacionChkGrupoMaximaCantidadSel=addValidacionChkGrupoMaximaCantidadSelAvatarFormValidator;
this.addValidacionRadObligatorio=addValidacionRadObligatorioAvatarFormValidator;
this.addValidacionLstMinimaCantidadSel=addValidacionLstMinimaCantidadSelAvatarFormValidator;
this.addValidacionLstMaximaCantidadSel=addValidacionLstMaximaCantidadSelAvatarFormValidator;
this.addValidacionLstMinimaCantidad=addValidacionLstMinimaCantidadAvatarFormValidator;
this.addValidacionLstMaximaCantidad=addValidacionLstMaximaCantidadAvatarFormValidator;
this.addValidacionVerificacionCampos=addValidacionVerificacionCamposAvatarFormValidator;
this.addValidacionCampoMinimaCantidad=addValidacionCampoMinimaCantidadAvatarFormValidator;
this.addValidacionCompararFechas=addValidacionCompararFechasAvatarFormValidator;
this.addValidacionCampoCantidad=addValidacionCampoCantidadAvatarFormValidator;
}
function validateAvatarFormValidator(){
return this.res;
}
function addValidacionTxtObligatorioAvatarFormValidator(_b,_c,_d){
var _e=getFormElement(this.formName,_b,_d);
var _f=formarIdLabelError(_b);
if(_e==null||_e.value==null){
this.res.addRuleException(_f,new RuleException("global.000",_c));
return;
}
var _10=_e.value.trim();
if(esCadenaVacia(_10)){
this.res.addRuleException(_f,new RuleException("global.001",_c));
return;
}
}
function addValidacionTxtAlfanumericoAvatarFormValidator(_11,_12,_13,_14){
var _15=getFormElement(this.formName,_11,_14);
var _16=formarIdLabelError(_11);
if(_15==null||_15.value==null){
this.res.addRuleException(_16,new RuleException("global.000",_12));
return;
}
var _17=_15.value.trim();
if(esCadenaVacia(_17)){
if(_13){
this.res.addRuleException(_16,new RuleException("global.001",_12));
}
return;
}
if(!esCadenaAlfanumerica(_17)){
this.res.addRuleException(_16,new RuleException("global.006",_12));
}
}
function addValidacionTxtCaracteresValidosAvatarFormValidator(_18,_19,_1a,_1b){
var _1c=getFormElement(this.formName,_18,_1b);
var _1d=formarIdLabelError(_18);
if(_1c==null||_1c.value==null){
this.res.addRuleException(_1d,new RuleException("global.000",_19));
return;
}
var _1e=_1c.value.trim();
if(esCadenaVacia(_1e)){
if(_1a){
this.res.addRuleException(_1d,new RuleException("global.001",_19));
}
return;
}
if(tieneCaracterNoValido(_1e)){
this.res.addRuleException(_1d,new RuleException("global.007",_19));
}
}
function addValidacionTxtNumeroRealAvatarFormValidator(_1f,_20,_21,_22){
var _23=getFormElement(this.formName,_1f,_22);
var _24=formarIdLabelError(_1f);
if(_23==null||_23.value==null){
this.res.addRuleException(_24,new RuleException("global.000",_20));
return;
}
var _25=_23.value.trim();
if(esCadenaVacia(_25)){
if(_21){
this.res.addRuleException(_24,new RuleException("global.001",_20));
}
return;
}
if(!esNumeroReal(_25)){
this.res.addRuleException(_24,new RuleException("global.008",_20));
return;
}
if(!esNumeroRealBD(_25,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_24,new RuleException("global.020",_20));
return;
}
}
function addValidacionTxtNumeroEnteroAvatarFormValidator(_26,_27,_28,_29){
var _2a=getFormElement(this.formName,_26,_29);
var _2b=formarIdLabelError(_26);
if(_2a==null||_2a.value==null){
this.res.addRuleException(_2b,new RuleException("global.000",_27));
return;
}
var _2c=_2a.value.trim();
if(esCadenaVacia(_2c)){
if(_28){
this.res.addRuleException(_2b,new RuleException("global.001",_27));
}
return;
}
if(!esNumeroEntero(_2c)){
this.res.addRuleException(_2b,new RuleException("global.009",_27));
return;
}
if(!esNumeroRealBD(_2c,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_2b,new RuleException("global.020",_27));
return;
}
}
function addValidacionTxtNumeroMayorIgualCeroAvatarFormValidator(_2d,_2e,_2f,_30){
var _31=getFormElement(this.formName,_2d,_30);
var _32=formarIdLabelError(_2d);
if(_31==null||_31.value==null){
this.res.addRuleException(_32,new RuleException("global.000",_2e));
return;
}
var _33=_31.value.trim();
if(esCadenaVacia(_33)){
if(_2f){
this.res.addRuleException(_32,new RuleException("global.001",_2e));
}
return;
}
if(!esNumeroReal(_33)){
this.res.addRuleException(_32,new RuleException("global.008",_2e));
return;
}
if(!esNumeroRealBD(_33,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_32,new RuleException("global.020",_2e));
return;
}
var num=parseFloat(_33);
if(num<0){
this.res.addRuleException(_32,new RuleException("global.019",_2e));
return;
}
}
function addValidacionTxtNumeroEnteroMayorCeroAvatarFormValidator(_35,_36,_37,_38){
var _39=getFormElement(this.formName,_35,_38);
var _3a=formarIdLabelError(_35);
if(_39==null||_39.value==null){
this.res.addRuleException(_3a,new RuleException("global.000",_36));
return;
}
var _3b=_39.value.trim();
if(esCadenaVacia(_3b)){
if(_37){
this.res.addRuleException(_3a,new RuleException("global.001",_36));
}
return;
}
if(!esNumeroEntero(_3b)){
this.res.addRuleException(_3a,new RuleException("global.009",_36));
return;
}
if(!esNumeroRealBD(_3b,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_3a,new RuleException("global.020",_36));
return;
}
var num=parseFloat(_3b);
if(num<=0){
this.res.addRuleException(_3a,new RuleException("global.023",_36));
return;
}
}
function addValidacionTxtPorcentajeAvatarFormValidator(_3d,_3e,_3f,_40,_41){
var _42=getFormElement(this.formName,_3d,_41);
var _43=formarIdLabelError(_3d);
if(_42==null||_42.value==null){
this.res.addRuleException(_43,new RuleException("global.000",_3e));
return;
}
var _44=_42.value.trim();
if(esCadenaVacia(_44)){
if(_3f){
this.res.addRuleException(_43,new RuleException("global.001",_3e));
}
return;
}
if(!esNumeroReal(_44)){
this.res.addRuleException(_43,new RuleException("global.008",_3e));
return;
}
if(!esNumeroRealBD(_44,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_43,new RuleException("global.020",_3e));
return;
}
if(!esPorcentaje(_44,_40)){
this.res.addRuleException(_43,new RuleException("global.016",_3e));
}
}
function addValidacionTxtEmailAvatarFormValidator(_45,_46,_47,_48){
var _49=getFormElement(this.formName,_45,_48);
var _4a=formarIdLabelError(_45);
if(_49==null||_49.value==null){
this.res.addRuleException(_4a,new RuleException("global.000",_46));
return;
}
var _4b=_49.value.trim();
if(esCadenaVacia(_4b)){
if(_47){
this.res.addRuleException(_4a,new RuleException("global.001",_46));
}
return;
}
if(!esEmail(_4b)){
this.res.addRuleException(_4a,new RuleException("global.010",_46));
}
}
function addValidacionTxtURLAvatarFormValidator(_4c,_4d,_4e,_4f){
var _50=getFormElement(this.formName,_4c,_4f);
var _51=formarIdLabelError(_4c);
if(_50==null||_50.value==null){
this.res.addRuleException(_51,new RuleException("global.000",_4d));
return;
}
var _52=_50.value.trim();
if(esCadenaVacia(_52)){
if(_4e){
this.res.addRuleException(_51,new RuleException("global.001",_4d));
}
return;
}
if(!esURL(_52)){
this.res.addRuleException(_51,new RuleException("global.018",_4d));
}
}
function addValidacionTxtTelefonoAvatarFormValidator(_53,_54,_55,_56){
var _57=getFormElement(this.formName,_53,_56);
var _58=formarIdLabelError(_53);
if(_57==null||_57.value==null){
this.res.addRuleException(_58,new RuleException("global.000",_54));
return;
}
var _59=_57.value.trim();
if(esCadenaVacia(_59)){
if(_55){
this.res.addRuleException(_58,new RuleException("global.001",_54));
}
return;
}
if(!esTelefono(_59)){
this.res.addRuleException(_58,new RuleException("global.017",_54));
}
}
function addValidacionFileObligatorioAvatarFormValidator(_5a,_5b,_5c){
var _5d=getFormElement(this.formName,_5a,_5c);
var _5e=formarIdLabelError(_5a);
if(_5d==null||_5d.value==null){
this.res.addRuleException(_5e,new RuleException("global.000",_5b));
return;
}
var _5f=_5d.value.trim();
if(esCadenaVacia(_5f)){
this.res.addRuleException(_5e,new RuleException("global.001",_5b));
return;
}
}
function addValidacionFileExtensionAvatarFormValidator(_60,_61,_62,_63,_64){
var _65=getFormElement(this.formName,_60,_64);
var _66=formarIdLabelError(_60);
if(_65==null||_65.value==null){
this.res.addRuleException(_66,new RuleException("global.000",_61));
return;
}
var _67=_65.value.trim();
if(esCadenaVacia(_67)){
if(_62){
this.res.addRuleException(_66,new RuleException("global.001",_61));
}
return;
}
if(_63!=null){
if(!esExtensionUploadValida(_67,_63)){
this.res.addRuleException(_66,new RuleException("global.004",_61));
return;
}
}else{
if(!esExtensionImagenUploadValida(_67)){
this.res.addRuleException(_66,new RuleException("global.004",_61));
return;
}
}
}
function addValidacionFileImagenExtensionAvatarFormValidator(_68,_69,_6a,_6b){
var _6c=getFormElement(this.formName,_68,_6b);
var _6d=formarIdLabelError(_68);
if(_6c==null||_6c.value==null){
this.res.addRuleException(_6d,new RuleException("global.000",_69));
return;
}
var _6e=_6c.value.trim();
if(esCadenaVacia(_6e)){
if(_6a){
this.res.addRuleException(_6d,new RuleException("global.001",_69));
}
return;
}
if(!esExtensionImagenUploadValida(_6e)){
this.res.addRuleException(_6d,new RuleException("global.004",_69));
return;
}
}
function addValidacionCmbObligatorioAvatarFormValidator(_6f,_70,_71){
var _72=getFormElement(this.formName,_6f,_71);
var _73=formarIdLabelError(_6f);
if(_72==null||_72.value==null){
this.res.addRuleException(_73,new RuleException("global.000",_70));
return;
}
var _74=_72.value.trim();
if(esCadenaVacia(_74)){
this.res.addRuleException(_73,new RuleException("global.001",_70));
return;
}
}
function addValidacionChkMinimaCantidadSelAvatarFormValidator(_75,_76,_77){
var i;
var _79=getFormElement(this.formName,_75);
var _7a=formarIdLabelError(_75);
if(_79==null){
this.res.addRuleException(_7a,new RuleException("global.000",_76));
return;
}
var _7b=0;
if(_79.length){
for(i=0;i<_79.length;i++){
if(getFormElement(this.formName,_75,i).checked){
_7b++;
}
}
}else{
if(getFormElement(this.formName,_75).checked){
_7b++;
}
}
if(_7b<_77){
this.res.addRuleException(_7a,new RuleException("global.011",_76,_77));
return;
}
}
function addValidacionChkGrupoMinimaCantidadSelAvatarFormValidator(_7c,_7d,_7e){
var i;
var _80=formarIdLabelError(_7c);
if(_7c==null){
this.res.addRuleException(_80,new RuleException("global.000",_7d));
return;
}
for(i=0;i<_7c.length;i++){
if(getFormElement(this.formName,_7c[i])==null){
this.res.addRuleException(_80,new RuleException("global.000",_7d));
return;
}
}
var _81=0;
for(i=0;i<_7c.length;i++){
if(getFormElement(this.formName,_7c[i]).checked){
_81++;
}
}
if(_81<_7e){
this.res.addRuleException(_80,new RuleException("global.011",_7d,_7e));
return;
}
}
function addValidacionChkMaximaCantidadSelAvatarFormValidator(_82,_83,_84){
var i;
var _86=getFormElement(this.formName,_82);
var _87=formarIdLabelError(_82);
if(_86==null){
this.res.addRuleException(_87,new RuleException("global.000",_83));
return;
}
var _88=0;
if(_86.length){
for(i=0;i<_86.length;i++){
if(getFormElement(this.formName,_82,i).checked){
_88++;
}
}
}else{
if(getFormElement(this.formName,_82).checked){
_88++;
}
}
if(_88>_84){
this.res.addRuleException(_87,new RuleException("global.012",_83,_84));
return;
}
}
function addValidacionChkGrupoMaximaCantidadSelAvatarFormValidator(_89,_8a,_8b){
var i;
var _8d=formarIdLabelError(_89);
if(_89==null){
this.res.addRuleException(_8d,new RuleException("global.000",_8a));
return;
}
for(i=0;i<_89.length;i++){
if(getFormElement(this.formName,_89[i])==null){
this.res.addRuleException(_8d,new RuleException("global.000",_8a));
return;
}
}
var _8e=0;
for(i=0;i<_89.length;i++){
if(getFormElement(this.formName,_89[i]).checked){
_8e++;
}
}
if(_8e>_8b){
this.res.addRuleException(_8d,new RuleException("global.012",_8a,_8b));
return;
}
}
function addValidacionRadObligatorioAvatarFormValidator(_8f,_90){
var i;
var _92=getFormElement(this.formName,_8f);
var _93=formarIdLabelError(_8f);
if(_92==null){
this.res.addRuleException(_93,new RuleException("global.000",_90));
return;
}
var _94=0;
if(_92.length){
for(i=0;i<_92.length;i++){
if(getFormElement(this.formName,_8f,i).checked){
_94++;
}
}
}else{
if(getFormElement(this.formName,_8f).checked){
_94++;
}
}
if(_94==0){
this.res.addRuleException(_93,new RuleException("global.013",_90));
return;
}
}
function addValidacionLstMinimaCantidadSelAvatarFormValidator(_95,_96,_97){
var i;
var _99=getFormElement(this.formName,_95);
var _9a=formarIdLabelError(_95);
if(_99==null){
this.res.addRuleException(_9a,new RuleException("global.000",_96));
return;
}
var _9b=0;
for(i=0;i<_99.options.length;i++){
if(_99.options[i].selected){
_9b++;
}
}
if(_9b<_97){
this.res.addRuleException(_9a,new RuleException("global.014",_96,_97));
return;
}
}
function addValidacionLstMaximaCantidadSelAvatarFormValidator(_9c,_9d,_9e){
var i;
var _a0=getFormElement(this.formName,_9c);
var _a1=formarIdLabelError(_9c);
if(_a0==null){
this.res.addRuleException(_a1,new RuleException("global.000",_9d));
return;
}
var _a2=0;
for(i=0;i<_a0.options.length;i++){
if(_a0.options[i].selected){
_a2++;
}
}
if(_a2>_9e){
this.res.addRuleException(_a1,new RuleException("global.015",_9d,_9e));
return;
}
}
function addValidacionLstMaximaCantidadSelAvatarFormValidator(_a3,_a4,_a5){
var i;
var _a7=getFormElement(this.formName,_a3);
var _a8=formarIdLabelError(_a3);
if(_a7==null){
this.res.addRuleException(_a8,new RuleException("global.000",_a4));
return;
}
var _a9=0;
for(i=0;i<_a7.options.length;i++){
if(_a7.options[i].selected){
_a9++;
}
}
if(_a9>_a5){
this.res.addRuleException(_a8,new RuleException("global.015",_a4,_a5));
return;
}
}
function addValidacionLstMinimaCantidadAvatarFormValidator(_aa,_ab,_ac){
var i;
var _ae=getFormElement(this.formName,_aa);
var _af=formarIdLabelError(_aa);
if(_ae==null){
this.res.addRuleException(_af,new RuleException("global.000",_ab));
return;
}
var _b0=_ae.options.length;
if(_b0<_ac){
this.res.addRuleException(_af,new RuleException("global.021",_ab,_ac));
return;
}
}
function addValidacionLstMaximaCantidadAvatarFormValidator(_b1,_b2,_b3){
var i;
var _b5=getFormElement(this.formName,_b1);
var _b6=formarIdLabelError(_b1);
if(_b5==null){
this.res.addRuleException(_b6,new RuleException("global.000",_b2));
return;
}
var _b7=_b5.options.length;
if(_b7>_b3){
this.res.addRuleException(_b6,new RuleException("global.022",_b2,_b3));
return;
}
}
function addValidacionVerificacionCamposAvatarFormValidator(_b8,_b9,_ba){
var _bb=getFormElement(this.formName,_b8);
var _bc=getFormElement(this.formName,_b9);
var _bd=formarIdLabelError(_b8);
var _be=formarIdLabelError(_b9);
if(_bb==null){
this.res.addRuleException(_bd,new RuleException("global.002",_ba));
return;
}
if(_bc==null){
this.res.addRuleException(_be,new RuleException("global.002",_ba));
return;
}
if(_bb.value!=_bc.value){
this.res.addRuleException(_be,new RuleException("store.001",_ba));
return;
}
}
function addValidacionCampoMinimaCantidadAvatarFormValidator(_bf,_c0,_c1){
var i;
var _c3=getFormElement(this.formName,_bf);
var _c4=formarIdLabelError(_bf);
if(_c3==null){
this.res.addRuleException(_c4,new RuleException("global.000",_c0));
return;
}
var _c5=_c3.value;
if(_c5<_c1){
this.res.addRuleException(_c4,new RuleException("global.021",_c0,_c1));
return;
}
}
function addValidacionCampoCantidadAvatarFormValidator(_c6,_c7,_c8){
var i;
var _ca=getFormElement(this.formName,_c6);
var _cb=formarIdLabelError(_c6);
if(_ca==null){
this.res.addRuleException(_cb,new RuleException("global.000",_c7));
return;
}
var _cc=_ca.value.length;
if(!(_cc==_c8)){
this.res.addRuleException(_cb,new RuleException("global.024",_c7,_c8));
return;
}
}
function addValidacionCompararFechasAvatarFormValidator(_cd,_ce){
if(compararFechas(getValorComboFecha(this.formName,_cd),getValorComboFecha(this.formName,_ce))==1){
this.res.addRuleException("ID_CONTROL_DEFAULT",new RuleException("global.202"));
return;
}
}
function formarIdLabelError(_cf){
var _d0=_cf.substring(0,1).upper;
var _d1=_cf.substring(1);
var _d2="lblError"+_cf;
return _d2;
}


