From fb3db8169bf7235144921a38c38a95f5242f7ffc Mon Sep 17 00:00:00 2001 From: safan Date: Wed, 22 Dec 2010 11:44:15 +0000 Subject: [PATCH] editing function part of input document. --- .../engine/methods/bpmn/proxyDynaform.php | 11 -- .../methods/bpmn/proxyInputDocument.php | 19 ++- .../methods/inputdocs/inputdocs_Save.php | 2 +- .../engine/templates/bpmn/ProcessOptions.js | 123 ++++++++++++++---- 4 files changed, 114 insertions(+), 41 deletions(-) diff --git a/workflow/engine/methods/bpmn/proxyDynaform.php b/workflow/engine/methods/bpmn/proxyDynaform.php index a72a1af6d..52a8655c6 100755 --- a/workflow/engine/methods/bpmn/proxyDynaform.php +++ b/workflow/engine/methods/bpmn/proxyDynaform.php @@ -35,14 +35,3 @@ try catch ( Exception $e ) { print json_encode ( $e->getMessage() ); } - - - G::LoadClass('processMap'); - $oProcessMap = new processMap(new DBConnection); - - $rows = $oProcessMap->showExtDBConnList(); - array_shift($rows); - - $result['totalCount'] = count($rows); - $result['data'] = $rows; - print json_encode( $result ) ; \ No newline at end of file diff --git a/workflow/engine/methods/bpmn/proxyInputDocument.php b/workflow/engine/methods/bpmn/proxyInputDocument.php index c34f30e09..ca8f40ec7 100644 --- a/workflow/engine/methods/bpmn/proxyInputDocument.php +++ b/workflow/engine/methods/bpmn/proxyInputDocument.php @@ -8,10 +8,21 @@ try $rows = $oProcessMap->getExtInputDocumentsCriteria($_GET['pid']); array_shift($rows); } - - $result['totalCount'] = count($rows); - $result['data'] = $rows; - print json_encode( $result) ; + + if (isset($_GET['INP_DOC_UID'])) { + require_once 'classes/model/InputDocument.php'; + $oInputDocument = new InputDocument(); + $rows = $oInputDocument->load($_GET['INP_DOC_UID']); + } +// $result['totalCount'] = count($rows); +// $result['data'] = $rows; +// print json_encode( $result) ; + $tmpData = json_encode( $rows ) ; + $tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes + + $result = $tmpData; + echo $result; + } catch ( Exception $e ) { diff --git a/workflow/engine/methods/inputdocs/inputdocs_Save.php b/workflow/engine/methods/inputdocs/inputdocs_Save.php index e42d588cc..34cdf2792 100644 --- a/workflow/engine/methods/inputdocs/inputdocs_Save.php +++ b/workflow/engine/methods/inputdocs/inputdocs_Save.php @@ -40,7 +40,7 @@ try { if(isset($_POST['function'])) $sfunction =$_POST['function']; else - $sfunction =''; + $sfunction =$_POST['functions']; switch($sfunction){ case 'lookForNameInput': diff --git a/workflow/engine/templates/bpmn/ProcessOptions.js b/workflow/engine/templates/bpmn/ProcessOptions.js index ae60e90aa..49306a62d 100755 --- a/workflow/engine/templates/bpmn/ProcessOptions.js +++ b/workflow/engine/templates/bpmn/ProcessOptions.js @@ -595,6 +595,32 @@ ProcessOptions.prototype.addInputDoc= function(_5625) } }); + var btnEdit = new Ext.Button({ + id: 'btnEdit', + text: 'Edit', + iconCls: 'application_add', + handler: function (s) { + var selectedRow = inputDocGrid.getSelectionModel().getSelections(); + var inputDocUID = selectedRow[0].data.INP_DOC_UID; + + //Loading Task Details into the form + inputDocForm.form.load({ + url:'proxyInputDocument.php?INP_DOC_UID=' +inputDocUID, + method:'GET', + waitMsg:'Loading', + success:function(form, action) { + //Ext.MessageBox.alert('Message', 'Loaded OK'); + newIOWindow.show(); + Ext.getCmp("INP_DOC_UID").setValue(inputDocUID); + }, + failure:function(form, action) { + Ext.MessageBox.alert('Message', 'Load failed'); + } + }); + } + + }); + var inputDocForm = new Ext.FormPanel({ labelWidth: 100, bodyStyle :'padding:5px 5px 0', @@ -744,6 +770,10 @@ ProcessOptions.prototype.addInputDoc= function(_5625) //anchor:'15%' }] }] + },{ + id : 'INP_DOC_UID', + xtype: 'hidden', + name : 'INP_DOC_UID' }] }] }); @@ -773,7 +803,7 @@ ProcessOptions.prototype.addInputDoc= function(_5625) var tb = new Ext.Toolbar({ - items: [btnAdd, btnRemove] + items: [btnAdd, btnRemove,btnEdit] }); var inputDocGrid = new Ext.grid.GridPanel({ @@ -810,6 +840,7 @@ ProcessOptions.prototype.addInputDoc= function(_5625) buttonAlign: 'center' }); + var newIOWindow = new Ext.Window({ title: 'Input Document', collapsible: false, @@ -828,7 +859,8 @@ ProcessOptions.prototype.addInputDoc= function(_5625) handler: function(){ var getForm = inputDocForm.getForm().getValues(); - var sDocType = getForm.INP_DOC_TITLE + var sDocUID = getForm.INP_DOC_UID; + var sDocTitle = getForm.INP_DOC_TITLE; var sFormNeeded = getForm.INP_DOC_FORM_NEEDED; var sOrig = getForm.INP_DOC_ORIGINAL; if(sOrig == 'LEGAL COPY') @@ -852,30 +884,69 @@ ProcessOptions.prototype.addInputDoc= function(_5625) var sDestPath = getForm.INP_DOC_DESTINATION_PATH; var sTags = getForm.INP_DOC_TAGS; - Ext.Ajax.request({ - url : '../inputdocs/inputdocs_Save.php', - method: 'POST', - params:{ - INP_DOC_TITLE :sDocType, - INP_DOC_UID : '', - PRO_UID : pro_uid, - INP_DOC_FORM_NEEDED : sFormNeeded, - INP_DOC_ORIGINAL : sOrig, - INP_DOC_VERSIONING : sVers, - INP_DOC_TAGS : 'INPUT', //By Default - INP_DOC_DESCRIPTION : sDesc - }, - success: function(response) { - Ext.MessageBox.alert ('Status','Input document has been created successfully.'); + if(sDocUID == "") + { + Ext.Ajax.request({ + url : '../inputdocs/inputdocs_Save.php', + method: 'POST', + params:{ + functions : 'lookForNameInput', + NAMEINPUT : sDocTitle, + proUid : pro_uid + }, + success: function(response) { + if(response.responseText == "1") + { + Ext.Ajax.request({ + url : '../inputdocs/inputdocs_Save.php', + method: 'POST', + params:{ + functions : '', + INP_DOC_TITLE : sDocTitle, + INP_DOC_UID : sDocUID, + PRO_UID : pro_uid, + INP_DOC_FORM_NEEDED : sFormNeeded, + INP_DOC_ORIGINAL : sOrig, + INP_DOC_VERSIONING : sVers, + INP_DOC_TAGS : 'INPUT', //By Default + INP_DOC_DESCRIPTION : sDesc + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Input document has been created successfully.'); + newIOWindow.close(); + inputDocStore.reload(); + } + }); + } + else + Ext.MessageBox.alert ('Status','There is an Input Document with the same name in this process. It is not saving'); } - }); - - //var getData = getstore.data.items; - //taskExtObj.saveTaskUsers(getData); - - newIOWindow.close(); - inputDocStore.reload(); - } + }) + } + else + { + Ext.Ajax.request({ + url : '../inputdocs/inputdocs_Save.php', + method: 'POST', + params:{ + functions : '', + INP_DOC_TITLE : sDocTitle, + INP_DOC_UID : sDocUID, + PRO_UID : pro_uid, + INP_DOC_FORM_NEEDED : sFormNeeded, + INP_DOC_ORIGINAL : sOrig, + INP_DOC_VERSIONING : sVers, + INP_DOC_TAGS : 'INPUT', //By Default + INP_DOC_DESCRIPTION : sDesc + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Input document has been updated successfully.'); + newIOWindow.close(); + inputDocStore.reload(); + } + }); + } + } },{ text: 'Cancel', handler: function(){ @@ -885,6 +956,7 @@ ProcessOptions.prototype.addInputDoc= function(_5625) }] }); gridWindow.show(); + } @@ -985,6 +1057,7 @@ ProcessOptions.prototype.addOutputDoc= function(_5625) var selectedRow = outputDocGrid.getSelectionModel().getSelections(); var outDocUID = selectedRow[0].data.OUT_DOC_UID; } + }); var btnProperties = new Ext.Button({