diff --git a/workflow/engine/js/processmap/core/processmap.js b/workflow/engine/js/processmap/core/processmap.js index 2013a2d4d..6de3b2320 100755 --- a/workflow/engine/js/processmap/core/processmap.js +++ b/workflow/engine/js/processmap/core/processmap.js @@ -382,7 +382,7 @@ var processmap=function(){ panel.loader.show(); var r = new leimnud.module.rpc.xmlhttp({ url:this.options.dataServer, - args:"action=process_Export&data="+{ + args:"action=process_Export&processMap=1&data="+{ pro_uid :this.options.uid }.toJSONString() }); diff --git a/workflow/engine/methods/processes/processes_Export.php b/workflow/engine/methods/processes/processes_Export.php index 249bab613..f886a9271 100755 --- a/workflow/engine/methods/processes/processes_Export.php +++ b/workflow/engine/methods/processes/processes_Export.php @@ -95,9 +95,27 @@ try { } /* Render page */ - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_Export', '', $Fields ); - G::RenderPage( 'publish', 'raw' ); + if (isset($_REQUEST["processMap"]) && $_REQUEST["processMap"] == 1) { + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent("xmlform", "xmlform", "processes/processes_Export", "", $Fields); + + G::RenderPage("publish", "raw"); + } + else { + $xmlFrm = new xmlform(); + $xmlFrm->parseFile(PATH_XMLFORM . "processes" . PATH_SEP . "processes_Export.xml" , SYS_LANG, true); + + $Fields["xmlFrmFieldLabel"] = array( + "title" => $xmlFrm->fields["TITLE"]->label, + "proTitle" => $xmlFrm->fields["PRO_TITLE"]->label, + "proDescription" => $xmlFrm->fields["PRO_DESCRIPTION"]->label, + "size" => $xmlFrm->fields["SIZE"]->label, + "fileName" => $xmlFrm->fields["FILENAME_LABEL"]->label, + "fileNameXPDL" => $xmlFrm->fields["FILENAME_LABEL1"]->label, + ); + + echo G::json_encode($Fields); + } } catch ( Exception $e ){ diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 23795a3c7..6ba0b8969 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -61,9 +61,16 @@ Ext.onReady(function(){ {name : 'CASES_COUNT_COMPLETED', type:'float'}, {name : 'CASES_COUNT_CANCELLED', type:'float'} ] - })//, + }), + //sortInfo:{field: 'PRO_TITLE', direction: "ASC"} //groupField:'PRO_CATEGORY_LABEL' + + listeners: { + load: function (store) { + Ext.ComponentMgr.get("export").setDisabled(true); + } + } }); var expander = new Ext.ux.grid.RowExpander({ @@ -237,6 +244,15 @@ Ext.onReady(function(){ handler:deleteProcess },{ xtype: 'tbseparator' + },{ + id: "export", + disabled: true, + text: _("ID_EXPORT"), + iconCls: "silk-add", + icon: "/images/export.png", + handler: function () { + exportProcess(); + } },{ text: _('ID_IMPORT'), iconCls: 'silk-add', @@ -318,7 +334,10 @@ Ext.onReady(function(){ processesGrid.getSelectionModel().on('rowselect', function(){ var rowSelected = processesGrid.getSelectionModel().getSelected(); var activator = Ext.getCmp('activator'); + activator.setDisabled(false); + Ext.ComponentMgr.get("export").setDisabled(false); + if( rowSelected.data.PRO_STATUS == 'ACTIVE' ){ activator.setIcon('/images/deactivate.png'); activator.setText( _('ID_DEACTIVATE') ); @@ -390,6 +409,12 @@ Ext.onReady(function(){ text: _('ID_DELETE'), icon: '/images/delete.png', handler: deleteProcess + }, { + text: _("ID_EXPORT"), + icon: "/images/export.png", + handler: function () { + exportProcess(); + } } ] }); @@ -633,6 +658,104 @@ deleteProcess = function(){ } } +var winExportProcess = new Ext.Window({ + //layout: "fit", + width: 625, + height: 240, + modal: true, + closeAction: "hide", + resizable: false, + autoScroll: true, + bodyStyle: "padding: 15px 15px 15px 15px;", + + title: "", + + items: [ + new Ext.FormPanel({ + id: "frmExportProcess", + + width: 560, + autoHeight: true, + labelWidth: 1, + + //title: "_", + + items: [ + { + xtype: "displayfield", + fieldLabel: "" + } + ] + }) + ] +}); + +function exportProcess() { + var record = processesGrid.getSelectionModel().getSelections(); + + if(record.length == 1) { + var myMask = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING")}); + myMask.show(); + + /////// + var proUid = record[0].get("PRO_UID"); + var proTitle = record[0].get("PRO_TITLE"); + var titleLength = 60; + + title = (titleLength - proTitle.length >= 0)? proTitle : proTitle.substring(0, (titleLength - 1) + 1) + "..."; + + /////// + Ext.Ajax.request({ + url: "../processes/processes_Ajax", + method: "POST", + params: { + "action": "process_Export", + "data": "{\"pro_uid\": \"" + proUid + "\"}", + "processMap": 0 + }, + + success: function (response, opts) { + myMask.hide(); + + /////// + var dataResponse = eval("(" + response.responseText + ")"); //json + + var frm = Ext.ComponentMgr.get("frmExportProcess"); + var frmItems = frm.form.items; + var tdAttribute = " align=\"right\" valign=\"top\" nowrap=\"nowrap\" style=\"color: #515151; font-weight: bold;\""; + var aStyle = "color: #2078A8; text-decoration: none;"; + + var str = ""; + str = str + "" + dataResponse.xmlFrmFieldLabel.proTitle + ""; + str = str + "" + dataResponse.xmlFrmFieldLabel.proDescription + ""; + str = str + "" + dataResponse.xmlFrmFieldLabel.size + ""; + str = str + "" + dataResponse.xmlFrmFieldLabel.fileName + ""; + str = str + "" + dataResponse.xmlFrmFieldLabel.fileNameXPDL + ""; + str = str + "
" + dataResponse.PRO_TITLE + "
" + dataResponse.PRO_DESCRIPTION + "
" + dataResponse.SIZE + "
" + dataResponse.FILENAME + "
" + dataResponse.FILENAMEXPDL + "
"; + + //frm.setTitle(dataResponse.xmlFrmFieldLabel.title); + frmItems.items[0].setValue(str); + + /////// + winExportProcess.setTitle(_("ID_EXPORT_PROCESS") + ": " + title); + winExportProcess.show(); + }, + + failure: function (response, opts) { + myMask.hide(); + } + }); + } + else { + Ext.Msg.show({ + title: "", + msg: _("ID_NO_SELECTION_WARNING"), + icon: Ext.MessageBox.INFO, + buttons: Ext.MessageBox.OK + }); + } +} + importProcessExistGroup = function() {