From 9ff77104279ed4d2ed57e6c0d7b4a1735ef46860 Mon Sep 17 00:00:00 2001 From: safan Date: Tue, 14 Dec 2010 15:07:01 +0000 Subject: [PATCH] 1.) fixed deleting input and output doc and dynaform code 2.) Added saving function code for output doc --- .../methods/dynaforms/dynaforms_Delete.php | 5 +- .../methods/dynaforms/dynaforms_Save.php | 1 + .../methods/inputdocs/inputdocs_Delete.php | 5 +- .../methods/outputdocs/outputdocs_Save.php | 36 +++-- .../engine/templates/bpmn/ProcessOptions.js | 134 ++++++++++++++---- workflow/engine/templates/bpmn/TaskContext.js | 35 +++-- 6 files changed, 157 insertions(+), 59 deletions(-) diff --git a/workflow/engine/methods/dynaforms/dynaforms_Delete.php b/workflow/engine/methods/dynaforms/dynaforms_Delete.php index 913fc1304..f3de30a2c 100644 --- a/workflow/engine/methods/dynaforms/dynaforms_Delete.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Delete.php @@ -34,7 +34,10 @@ require_once 'classes/model/CaseTrackerObject.php'; In here we are deleting all datas about this Dynaform into DB */ -$sfunction =$_POST['function']; +if(isset($_POST['function'])) + $sfunction =$_POST['function']; +else + $sfunction =$_POST['functions']; switch($sfunction){ diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save.php b/workflow/engine/methods/dynaforms/dynaforms_Save.php index e12bda1dd..1db947288 100644 --- a/workflow/engine/methods/dynaforms/dynaforms_Save.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save.php @@ -41,6 +41,7 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons if(isset($aData['FIELDS'])) { //$test = '{"1":{"TESTID":"1223","PRO_VARIABLE":"saaa"},"2":{"TESTID":"420","PRO_VARIABLE":"sas"}}'; + //$aData['FIELDS'] = (array)$oJSON->decode($test); $oData = $oJSON->decode($_POST['FIELDS']); $aData['FIELDS'] = ''; for($i=0;$icreate($_POST['form']); + if ($aData['OUT_DOC_UID'] == '') { + if ((isset($aData['OUT_DOC_TYPE']))&&( $aData['OUT_DOC_TYPE'] == 'JRXML' )) { + $dynaformUid = $aData['DYN_UID']; + + $outDocUid = $oOutputDocument->create($aData); G::LoadClass ('javaBridgePM'); $jbpm = new JavaBridgePM (); print $jbpm->generateJrxmlFromDynaform ( $outDocUid, $dynaformUid, 'classic' ); } else { - $outDocUid = $oOutputDocument->create($_POST['form']); + $outDocUid = $oOutputDocument->create($aData); } } else { - $oOutputDocument->update($_POST['form']); + $oOutputDocument->update($aData); } - if( isset($_POST['form']['PRO_UID']) ){ + if( isset($aData['PRO_UID']) ){ //refresh dbarray with the last change in outputDocument $oMap = new processMap(); - $oCriteria = $oMap->getOutputDocumentsCriteria($_POST['form']['PRO_UID']); + $oCriteria = $oMap->getOutputDocumentsCriteria($aData['PRO_UID']); } } } diff --git a/workflow/engine/templates/bpmn/ProcessOptions.js b/workflow/engine/templates/bpmn/ProcessOptions.js index 89c4212b6..ab6131d0d 100755 --- a/workflow/engine/templates/bpmn/ProcessOptions.js +++ b/workflow/engine/templates/bpmn/ProcessOptions.js @@ -52,21 +52,59 @@ ProcessOptions.prototype.addDynaform= function(_5625) url : '../dynaforms/dynaforms_Delete.php', method: 'POST', params: { + functions : 'getDynaformAssign', + PRO_UID : pro_uid, DYN_UID : dynUID }, success: function(response) { - Ext.MessageBox.alert ('Status','Dynaform has been removed successfully.'); + //First check whether selected Dynaform is assigned to a task steps or not. + //If response.responseText == 1 i.e it is assigned, => it cannot be deleted + if(response.responseText == "") + { + Ext.Ajax.request({ + url : '../dynaforms/dynaforms_Delete.php', + method: 'POST', + params: { + functions : 'getRelationInfDynaform', + DYN_UID : dynUID + }, + success: function(response) { + //Second check whether selected Dynaform is assigned to a processes supervisors or not. + //If response.responseText == 1 i.e it is assigned, => it cannot be deleted + if(response.responseText == "") + { + Ext.Ajax.request({ + url : '../dynaforms/dynaforms_Delete.php', + method: 'POST', + params: { + functions : 'deleteDynaform', + DYN_UID : dynUID + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Dynaform has been removed successfully.'); + //Secondly deleting from Grid + taskDynaform.remove(r); + //Reloading store after deleting dynaform + taskDynaform.reload(); + } + }); + } + else + Ext.MessageBox.alert ('Status','Dynaform assigned to a process supervisors cannot be deleted.'); + } + }); + } + else + Ext.MessageBox.alert ('Status','Dynaform assigned to a task steps cannot be deleted.'); } - }); + }); } - - //Secondly deleting from Grid - taskDynaform.remove(r); + } } }); - var tb = new Ext.Toolbar({ + var tb = new Ext.Toolbar({ items: [btnAdd, btnRemove] }); @@ -497,16 +535,35 @@ ProcessOptions.prototype.addInputDoc= function(_5625) url : '../inputdocs/inputdocs_Delete.php', method: 'POST', params: { + functions : 'getRelationInfDoc', INP_DOC_UID : inputDocUID }, success: function(response) { - Ext.MessageBox.alert ('Status','Input document has been removed successfully.'); + //First check whether selected input document is assigned to a process supervisor or not. + //If response.responseText == 1 i.e it is assigned, => it cannot be deleted + if(response.responseText == "") + { + Ext.Ajax.request({ + url : '../inputdocs/inputdocs_Delete.php', + method: 'POST', + params: { + functions : 'deleteInputDocument', + INP_DOC_UID : inputDocUID + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Input document has been removed successfully.'); + //Secondly deleting from Grid + inputDocStore.remove(r); + //reloading store after deleting input document + inputDocStore.reload(); + } + }); + } + else + Ext.MessageBox.alert ('Status','Input document assigned to a process supervisors cannot be deleted.'); } }); } - - //Secondly deleting from Grid - inputDocStore.remove(r); } } }); @@ -881,12 +938,14 @@ ProcessOptions.prototype.addOutputDoc= function(_5625) }, success: function(response) { Ext.MessageBox.alert ('Status','Output document has been removed successfully.'); + + //Secondly deleting from Grid + outputDocStore.remove(r); + //reloading store after deleting output document + outputDocStore.reload(); } }); } - - //Secondly deleting from Grid - outputDocStore.remove(r); } } }); @@ -1214,24 +1273,43 @@ ProcessOptions.prototype.addOutputDoc= function(_5625) url : '../outputdocs/outputdocs_Save.php', method: 'POST', params:{ - OUT_DOC_TITLE :sDocTitle, - OUT_DOC_FILENAME : sFilename, - OUT_DOC_DESCRIPTION : sDesc, - OUT_DOC_LANDSCAPE : sLandscape, - OUT_DOC_MEDIA : sMedia, - OUT_DOC_LEFT_MARGIN : sLeftMargin, - OUT_DOC_RIGHT_MARGIN : sRightMargin, - OUT_DOC_TOP_MARGIN : sTopMargin, - OUT_DOC_BOTTOM_MARGIN : sBottomMargin, - OUT_DOC_GENERATE : sGenerated, - OUT_DOC_VERSIONING : sVersioning, - OUT_DOC_DESTINATION_PATH : sDestPath, - OUT_DOC_TAGS : sTags + functions : 'lookForNameOutput', + NAMEOUTPUT : sDocTitle, + proUid : pro_uid }, success: function(response) { - Ext.MessageBox.alert ('Status','Input document has been created successfully.'); + if(response.responseText == "1") + { + Ext.Ajax.request({ + url : '../outputdocs/outputdocs_Save.php', + method: 'POST', + params:{ + OUT_DOC_UID : '', + OUT_DOC_TITLE : sDocTitle, + OUT_DOC_FILENAME : sFilename, + OUT_DOC_DESCRIPTION : sDesc, + OUT_DOC_LANDSCAPE : sLandscape, + OUT_DOC_MEDIA : sMedia, + OUT_DOC_LEFT_MARGIN : sLeftMargin, + OUT_DOC_RIGHT_MARGIN : sRightMargin, + OUT_DOC_TOP_MARGIN : sTopMargin, + OUT_DOC_BOTTOM_MARGIN : sBottomMargin, + OUT_DOC_GENERATE : sGenerated, + OUT_DOC_VERSIONING : sVersioning, + OUT_DOC_DESTINATION_PATH : sDestPath, + OUT_DOC_TAGS : sTags, + PRO_UID : pro_uid + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Output document has been created successfully.'); + } + }); + } - }); + else + Ext.MessageBox.alert ('Status','Output document title exist with same name.'); + } + }); newOPWindow.close(); outputDocStore.reload(); diff --git a/workflow/engine/templates/bpmn/TaskContext.js b/workflow/engine/templates/bpmn/TaskContext.js index 754c7e311..661df9e87 100755 --- a/workflow/engine/templates/bpmn/TaskContext.js +++ b/workflow/engine/templates/bpmn/TaskContext.js @@ -101,14 +101,15 @@ TaskContext.prototype.editTaskSteps = function(_3252){ }, success: function(response) { Ext.MessageBox.alert ('Status','Step has been removed successfully.'); + //Secondly deleting from Grid + taskSteps.remove(r); + //Reloading store after removing steps + availableSteps.reload(); } }); } - - //Secondly deleting from Grid - taskSteps.remove(r); - //Reloading store after removing steps - availableSteps.reload(); + else + taskSteps.remove(r); } } }); @@ -524,14 +525,16 @@ TaskContext.prototype.editUsers= function(_5625) },*/ success: function(response) { Ext.MessageBox.alert ('Status','User has been removed successfully.'); + //Secondly deleting from Grid + taskUsers.remove(r); + + //Reloading available user store + storeUsers.reload(); } }); } - //Secondly deleting from Grid - taskUsers.remove(r); - - //Reloading available user store - storeUsers.reload(); + else + taskUsers.remove(r); } } }); @@ -1547,14 +1550,16 @@ TaskContext.prototype.stepTriggers = function(_5625) url : '../steps/steps_Ajax.php' + urlparams, success: function(response) { Ext.MessageBox.alert ('Status','Trigger has been removed successfully.'); + + //Secondly deleting from Grid + stepsTriggers.remove(r); + + availableTriggers.reload(); } }); } - - //Secondly deleting from Grid - stepsTriggers.remove(r); - - availableTriggers.reload(); + else + stepsTriggers.remove(r); } } });