HOR-2293
This commit is contained in:
@@ -3549,10 +3549,25 @@ var saveAndRedirectForm = function(oObject, oLocation) {
|
||||
}
|
||||
};
|
||||
|
||||
var getGridFieldId = function(sFieldName){
|
||||
var arrayLabel = sFieldName.split("[");
|
||||
var arrayLabelSanitized = [];
|
||||
arrayLabel.map( function(n){ arrayLabelSanitized.push(n.replace(/]|\[/g, ''));} );
|
||||
var gridFieldId = "form["+arrayLabelSanitized[0]+"]["+arrayLabelSanitized[1]+"]["+arrayLabelSanitized[2]+"]";
|
||||
return gridFieldId;
|
||||
};
|
||||
|
||||
var removeRequiredById = function(sFieldName) {
|
||||
if (!notValidateThisFields.inArray(sFieldName)) {
|
||||
notValidateThisFields.push(sFieldName);
|
||||
var fieldId;
|
||||
if(sFieldName.indexOf("]") > 1) {
|
||||
fieldId = getGridFieldId(sFieldName);
|
||||
} else {
|
||||
fieldId = "form["+sFieldName+"]";
|
||||
}
|
||||
document.getElementById(fieldId).setAttribute('pm:required','0');
|
||||
|
||||
var oAux = document.getElementById('__notValidateThisFields__');
|
||||
if (oAux) {
|
||||
oAux.value = notValidateThisFields.toJSONString();
|
||||
@@ -3562,6 +3577,14 @@ var removeRequiredById = function(sFieldName) {
|
||||
|
||||
var enableRequiredById = function(sFieldName) {
|
||||
if (notValidateThisFields.inArray(sFieldName)) {
|
||||
var fieldId;
|
||||
if(sFieldName.indexOf("]") > -1) {
|
||||
fieldId = getGridFieldId(sFieldName);
|
||||
} else {
|
||||
fieldId = "form["+sFieldName+"]";
|
||||
}
|
||||
document.getElementById(fieldId).setAttribute('pm:required','1');
|
||||
|
||||
var i;
|
||||
var aAux = [];
|
||||
for(i = 0; i < notValidateThisFields.length; i++) {
|
||||
|
||||
@@ -1191,7 +1191,9 @@ return oAux;};var saveAndRefreshForm=function(oObject){if(oObject){oObject.form.
|
||||
else{var oAux=window.document.getElementsByTagName('form');if(oAux.length>0){oAux[0].action+='&_REFRESH_=1';oAux[0].submit();}}};var sessionPersits=function(){var rpc=new leimnud.module.rpc.xmlhttp({url:'../services/sessionPersists',args:'dynaformRestoreValues='+(typeof(__dynaformSVal__)!='undefined'?__dynaformSVal__:''),async:false});rpc.make();var response=rpc.xmlhttp.responseText.parseJSON();return response.status;};var showPromptLogin=function(lastAction){lastActionPerformed=lastAction;promptPanel=new leimnud.module.panel();promptPanel.options={statusBarButtons:[{value:_('LOGIN')}],position:{center:true},size:{w:300,h:130},control:{close:false,resize:false},fx:{modal:true}};promptPanel.setStyle={content:{padding:10,paddingBottom:2,textAlign:'left',paddingLeft:50,backgroundRepeat:'no-repeat',backgroundPosition:'10 50%',backgroundColor:'transparent',borderWidth:0}};promptPanel.make();promptPanel.addContent(_('ID_DYNAFORM_EDITOR_LOGIN_AGAIN'));promptPanel.addContent('<br />');var thePassword=$dce('input');thePassword.type='password';thePassword.id='thePassword';leimnud.dom.setStyle(thePassword,{font:'normal 8pt Tahoma,MiscFixed',color:'#000',width:'100%',marginTop:3,backgroundColor:'white',border:'1px solid #919B9C'});promptPanel.addContent(thePassword);thePassword.focus();thePassword.onkeyup=function(evt)
|
||||
{var evt=(window.event)?window.event:evt;var key=(evt.which)?evt.which:evt.keyCode;if(key==13){verifyLogin();}}.extend(this);promptPanel.fixContent();promptPanel.elements.statusBarButtons[0].onmouseup=verifyLogin;};var verifyLogin=function(){if(document.getElementById('thePassword').value.trim()==''){alert(_('ID_WRONG_PASS'));return;}
|
||||
var rpc=new leimnud.module.rpc.xmlhttp({url:'../login/authentication',args:'form[USR_USERNAME]='+__usernameLogged__+'&form[USR_PASSWORD]='+document.getElementById('thePassword').value.trim()+'&form[USR_LANG]='+SYS_LANG});rpc.callback=function(rpc){if(rpc.xmlhttp.responseText.indexOf('form[USR_USERNAME]')==-1){promptPanel.remove();lastActionPerformed='';}else{alert(_('ID_WRONG_PASS'));}}.extend(this);rpc.make();};var saveForm=function(oObject,actionParameter){if(oObject){var actionUrl=actionParameter||oObject.form.action.replace('cases_SaveData','saveForm');ajax_post(actionUrl,oObject.form,'POST');}
|
||||
else{var oAux=window.document.getElementsByTagName('form');if(oAux.length>0){var actionUrl=actionParameter||oAux[0].action.replace('cases_SaveData','saveForm');ajax_post(actionUrl,oAux[0],'POST');}}};var validateURL=function(url){var regexp=/http?s?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?/;if(regexp.test(url)){return true;}else{return false;}};var saveAndRedirectForm=function(oObject,oLocation){saveForm(oObject);if(validateURL(oLocation)){if(typeof(parent)!="undefined"){parent.location.href=oLocation;}else{document.location.href=oLocation;}}};var removeRequiredById=function(sFieldName){if(!notValidateThisFields.inArray(sFieldName)){notValidateThisFields.push(sFieldName);var oAux=document.getElementById('__notValidateThisFields__');if(oAux){oAux.value=notValidateThisFields.toJSONString();}}};var enableRequiredById=function(sFieldName){if(notValidateThisFields.inArray(sFieldName)){var i;var aAux=[];for(i=0;i<notValidateThisFields.length;i++){if(notValidateThisFields[i]!=sFieldName){aAux.push(notValidateThisFields[i]);}}
|
||||
else{var oAux=window.document.getElementsByTagName('form');if(oAux.length>0){var actionUrl=actionParameter||oAux[0].action.replace('cases_SaveData','saveForm');ajax_post(actionUrl,oAux[0],'POST');}}};var validateURL=function(url){var regexp=/http?s?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?/;if(regexp.test(url)){return true;}else{return false;}};var saveAndRedirectForm=function(oObject,oLocation){saveForm(oObject);if(validateURL(oLocation)){if(typeof(parent)!="undefined"){parent.location.href=oLocation;}else{document.location.href=oLocation;}}};var getGridFieldId=function(sFieldName){var arrayLabel=sFieldName.split("[");var arrayLabelSanitized=[];arrayLabel.map(function(n){arrayLabelSanitized.push(n.replace(/]|\[/g,''));});var gridFieldId="form["+arrayLabelSanitized[0]+"]["+arrayLabelSanitized[1]+"]["+arrayLabelSanitized[2]+"]";return gridFieldId;};var removeRequiredById=function(sFieldName){if(!notValidateThisFields.inArray(sFieldName)){notValidateThisFields.push(sFieldName);var fieldId;if(sFieldName.indexOf("]")>1){fieldId=getGridFieldId(sFieldName);}else{fieldId="form["+sFieldName+"]";}
|
||||
document.getElementById(fieldId).setAttribute('pm:required','0');var oAux=document.getElementById('__notValidateThisFields__');if(oAux){oAux.value=notValidateThisFields.toJSONString();}}};var enableRequiredById=function(sFieldName){if(notValidateThisFields.inArray(sFieldName)){var fieldId;if(sFieldName.indexOf("]")>-1){fieldId=getGridFieldId(sFieldName);}else{fieldId="form["+sFieldName+"]";}
|
||||
document.getElementById(fieldId).setAttribute('pm:required','1');var i;var aAux=[];for(i=0;i<notValidateThisFields.length;i++){if(notValidateThisFields[i]!=sFieldName){aAux.push(notValidateThisFields[i]);}}
|
||||
notValidateThisFields=aAux;var oAux=document.getElementById('__notValidateThisFields__');if(oAux){oAux.value=notValidateThisFields.toJSONString();}}};function dynaformVerifyFieldName(){pme_validating=true;setTimeout('verifyFieldName1();',0);return true;}
|
||||
function verifyFieldName1(){if(getField('PME_VALIDATE_NAME').value=='__error_session__'){showPrompt('refreshDynaformEditor');return;}
|
||||
verifyFieldNameFunction();}
|
||||
|
||||
@@ -358,14 +358,40 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
$_POST['next_step'] = $aNextStep;
|
||||
$_POST['previous_step'] = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
$_POST['req_val'] = $missing_req_values;
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
exit( 0 );
|
||||
/*hotfix notValidateThisFields */
|
||||
$validate = false;
|
||||
$string = serialize($missing_req_values);
|
||||
if(!is_array($_POST['__notValidateThisFields__'])) {
|
||||
$notValidateThisFields = explode("," ,$_POST['__notValidateThisFields__']);
|
||||
} else {
|
||||
$notValidateThisFields = $_POST['__notValidateThisFields__'];
|
||||
}
|
||||
|
||||
foreach($notValidateThisFields as $val) {
|
||||
if(strpos($val,"]")) {
|
||||
$gridField = substr($val,strrpos($val,"["),strlen($val));
|
||||
$gridField = preg_replace("/[^a-zA-Z0-9_-]+/", "", $gridField);
|
||||
$pattern = "/".$gridField."/i";
|
||||
} else {
|
||||
$pattern = "/".$val."/i";
|
||||
}
|
||||
preg_match($pattern, $string, $matches, PREG_OFFSET_CAPTURE);
|
||||
if(sizeof($matches)) {
|
||||
$validate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$validate && !sizeof($matches)) {
|
||||
$_POST['next_step'] = $aNextStep;
|
||||
$_POST['previous_step'] = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
$_POST['req_val'] = $missing_req_values;
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
exit( 0 );
|
||||
}
|
||||
/*end hotfix notValidateThisFields */
|
||||
}
|
||||
|
||||
G::header( 'location: ' . $aNextStep['PAGE'] );
|
||||
|
||||
Reference in New Issue
Block a user