worked on saving triggers part
This commit is contained in:
@@ -28,11 +28,11 @@ require_once('classes/model/Triggers.php');
|
|||||||
require_once('classes/model/Content.php');
|
require_once('classes/model/Content.php');
|
||||||
|
|
||||||
if( isset($_POST['function']) )
|
if( isset($_POST['function']) )
|
||||||
$sfunction = $_POST['function'];
|
$sfunction = $_POST['function']; //for old processmap
|
||||||
else if( isset($_POST['functions']) )
|
else if( isset($_POST['functions']) )
|
||||||
$sfunction = $_POST['functions'];
|
$sfunction = $_POST['functions']; //for extjs
|
||||||
|
|
||||||
if(isset($sfunction) && $sfunction=='lookforNameTrigger'){
|
if(isset($sfunction) && $sfunction=='lookforNameTrigger'){
|
||||||
$snameTrigger=urldecode($_POST['NAMETRIGGER']);
|
$snameTrigger=urldecode($_POST['NAMETRIGGER']);
|
||||||
$sPRO_UID=urldecode($_POST['proUid']);
|
$sPRO_UID=urldecode($_POST['proUid']);
|
||||||
|
|
||||||
@@ -56,14 +56,14 @@ if( isset($_POST['function']) )
|
|||||||
$oDataset1->next();
|
$oDataset1->next();
|
||||||
$aRow1 = $oDataset1->getRow();
|
$aRow1 = $oDataset1->getRow();
|
||||||
|
|
||||||
if($aRow1['TRIGGERS'])$flag=false;
|
if($aRow1['TRIGGERS']) $flag=false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
print $flag;
|
print $flag;
|
||||||
//print'krlos';return ;
|
//print'krlos';return ;
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
$oTrigger = new Triggers();
|
$oTrigger = new Triggers();
|
||||||
|
|
||||||
G::LoadClass('processMap');
|
G::LoadClass('processMap');
|
||||||
@@ -84,7 +84,16 @@ if( isset($_POST['function']) )
|
|||||||
}
|
}
|
||||||
//print_r($_POST['form']);die;
|
//print_r($_POST['form']);die;
|
||||||
$oTrigger->update($value);
|
$oTrigger->update($value);
|
||||||
|
|
||||||
$oProcessMap->triggersList($value['PRO_UID']);
|
if(!isset($_POST['mode']))
|
||||||
}
|
$oProcessMap->triggersList($value['PRO_UID']);
|
||||||
|
|
||||||
|
$result->success = true;
|
||||||
|
$result->msg = G::LoadTranslation('ID_TRIGGERS_SAVED');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$result->success = false;
|
||||||
|
$result->msg = $e->getMessage();
|
||||||
|
}
|
||||||
|
print G::json_encode($result);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
@@ -3209,8 +3209,6 @@ var triggersForm = new Ext.FormPanel({
|
|||||||
items : [{
|
items : [{
|
||||||
xtype : 'textfield',
|
xtype : 'textfield',
|
||||||
width : 200,
|
width : 200,
|
||||||
//id : 'DestPath',
|
|
||||||
//fieldLabel : _('ID_DESTINATION_PATH'),
|
|
||||||
name : 'TRI_WEBBOT',
|
name : 'TRI_WEBBOT',
|
||||||
anchor :'100%'
|
anchor :'100%'
|
||||||
}]
|
}]
|
||||||
@@ -3244,39 +3242,63 @@ var triggersForm = new Ext.FormPanel({
|
|||||||
var desc = getForm.TRI_DESCRIPTION;
|
var desc = getForm.TRI_DESCRIPTION;
|
||||||
|
|
||||||
if(title == '')
|
if(title == '')
|
||||||
PMExt.notify( _('ID_ERROR') , _('ID_DYNAFORM_TITLE_REQUIRED') );
|
PMExt.notify( _('ID_ERROR') , _('ID_TRIGGER_TITLE_REQUIRED') );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ext.Ajax.request({
|
//First check whether trigger name already exist or not
|
||||||
|
Ext.Ajax.request({
|
||||||
url : '../triggers/triggers_Save.php',
|
url : '../triggers/triggers_Save.php',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
params:{
|
params: {
|
||||||
//functions : 'lookforNameTrigger',
|
functions : 'lookforNameTrigger',
|
||||||
TRI_TITLE : title,
|
proUid : pro_uid,
|
||||||
PRO_UID : pro_uid,
|
NAMETRIGGER : title
|
||||||
TRI_UID :'',
|
},
|
||||||
TRI_PARAM :'',
|
|
||||||
TRI_TYPE :'SCRIPT',
|
|
||||||
TRI_DESCRIPTION :desc,
|
|
||||||
TRI_WEBBOT :condition
|
|
||||||
},
|
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// var result = Ext.util.JSON.decode(response.responseText);
|
var result = response.responseText;
|
||||||
PMExt.notify( _('ID_STATUS') , _('ID_DYANFORM_CREATED') );
|
if(result) {
|
||||||
triggerStore.reload();
|
//now save trigger
|
||||||
formWindow.hide();
|
Ext.Ajax.request({
|
||||||
}
|
url : '../triggers/triggers_Save.php',
|
||||||
});
|
method: 'POST',
|
||||||
}
|
params:{
|
||||||
}
|
//functions : 'lookforNameTrigger',
|
||||||
},{
|
TRI_TITLE : title,
|
||||||
text: _('ID_CANCEL'),
|
PRO_UID : pro_uid,
|
||||||
handler: function(){
|
TRI_UID :'',
|
||||||
// when this button clicked,
|
TRI_PARAM :'',
|
||||||
formWindow.hide();
|
TRI_TYPE :'SCRIPT',
|
||||||
}
|
TRI_DESCRIPTION :desc,
|
||||||
}]
|
TRI_WEBBOT :condition,
|
||||||
|
mode :'ext'
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
var result = Ext.util.JSON.decode(response.responseText);
|
||||||
|
if( result.success ){
|
||||||
|
PMExt.notify( _('ID_STATUS') , result.msg);
|
||||||
|
|
||||||
|
//Reloading store after saving triggers
|
||||||
|
triggerStore.reload();
|
||||||
|
formWindow.hide();
|
||||||
|
} else {
|
||||||
|
PMExt.error(_('ID_ERROR'), result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
PMExt.error(_('ID_VALIDATION_ERROR'), 'There is a triggers with the same name in this process.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
text: _('ID_CANCEL'),
|
||||||
|
handler: function(){
|
||||||
|
// when this button clicked,
|
||||||
|
formWindow.hide();
|
||||||
|
}
|
||||||
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
var formWindow = new Ext.Window({
|
var formWindow = new Ext.Window({
|
||||||
|
|||||||
Reference in New Issue
Block a user