From dbaa10be2d5f69d4ab90bae2717492d0284bbe77 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Thu, 5 Apr 2012 17:11:50 -0400 Subject: [PATCH] BUG 8765 "Problema al descargar documentos del Processmaker cuando..." SOLVED - When the plugin is enabled Knowledgetree displays an error when you download the file - Was added the necessary code to download the file when the plugin Knowledgetree is enabled - Also added code in the plugin Knowledgetree, for this change to work properly --- workflow/engine/classes/model/AppFolder.php | 37 ++++++++++++++++++- .../engine/templates/cases/casesDocuments.js | 33 ++++++++++++++++- 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/model/AppFolder.php b/workflow/engine/classes/model/AppFolder.php index 1c29c2352..759c0784d 100755 --- a/workflow/engine/classes/model/AppFolder.php +++ b/workflow/engine/classes/model/AppFolder.php @@ -336,7 +336,7 @@ if($limit != 0){ break; case "INPUT" : - $oInputDocument = new InputDocument ( ); + $oInputDocument = new InputDocument(); if ($docUid != - 1) { if ($oInputDocument->InputExists ( $docUid )) { $row4 = $oInputDocument->load ( $docUid ); @@ -357,7 +357,42 @@ if($limit != 0){ $downloadLabel = G::LoadTranslation ( 'ID_DOWNLOAD' ); $downloadLabel1 = ""; } + + /////// + if (!empty($row1["APP_DOC_PLUGIN"])) { + $pluginRegistry = &PMPluginRegistry::getSingleton(); + $addonName = $row1["APP_DOC_PLUGIN"]; + $fieldValue = ""; + + if (file_exists(PATH_PLUGINS . $addonName . ".php")) { + $addonDetails = $pluginRegistry->getPluginDetails($addonName . ".php"); + + if ($addonDetails) { + if ($addonDetails->enabled) { + require_once (PATH_PLUGINS . $addonName . PATH_SEP . "class." . $addonName . ".php"); + + $addonNameClass = $addonName . "Class"; + + $objClass = new $addonNameClass(); + + if (method_exists($objClass, "getNameMethodGetUrlDownload")) { + $addonDetails->sMethodGetUrlDownload = $objClass->getNameMethodGetUrlDownload(); + + if (!empty($addonDetails->sMethodGetUrlDownload)) { + eval("\$url = \$objClass->" . $addonDetails->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");"); + $downloadLink = $url; + + $fieldValue = $row1["APP_DOC_PLUGIN"]; + } + } + } + } + } + + $row1["APP_DOC_PLUGIN"] = $fieldValue; + } break; + default : $row4 = array (); $versioningEnabled = false; diff --git a/workflow/engine/templates/cases/casesDocuments.js b/workflow/engine/templates/cases/casesDocuments.js index d18fdad14..8e7366af0 100755 --- a/workflow/engine/templates/cases/casesDocuments.js +++ b/workflow/engine/templates/cases/casesDocuments.js @@ -420,7 +420,33 @@ function openActionDialog( caller, action ) { fileName=ext_itemgrid.getSelectionModel().getSelected().get('name'); // alert(ext_itemgrid.getSelectionModel().getSelected().get('downloadLink')); // alert(ext_itemgrid.getSelectionModel().getSelected().get('downloadLabel')); - streamFilefromPM(ext_itemgrid.getSelectionModel().getSelected().get('downloadLink')); + + var urlDownload = ext_itemgrid.getSelectionModel().getSelected().get("downloadLink"); + + if (ext_itemgrid.getSelectionModel().getSelected().get("appDocPlugin") != "") { + messageText = TRANSLATIONS.ID_DOWNLOADING_FILE + " " + ext_itemgrid.getSelectionModel().getSelected().get("name"); + statusBarMessage(messageText, true, true); + + try { + Ext.destroy(Ext.get("downloadIframe")); + } + catch (e) { + } + + Ext.DomHelper.append(document.body, { + tag: "iframe", + id: "downloadIframe", + frameBorder: 0, + width: 0, + height: 0, + css: "display: none; visibility: hidden; height: 0px;", + src: urlDownload + }); + } + else { + streamFilefromPM(urlDownload); + } + /* * if(document.location = * ext_itemgrid.getSelectionModel().getSelected().get('downloadLink')){ @@ -730,6 +756,8 @@ datastore = new Ext.data.Store({ name : "appDocType" }, { name : "appDocCreateDate" + }, { + name : "appDocPlugin" }, { name : "appLabel" }, { @@ -1128,6 +1156,9 @@ var cm = new Ext.grid.ColumnModel([{ hidden:true // align : 'right' // renderer : renderType +}, { + dataIndex: "appDocPlugin", + hidden: true }, { header : TRANSLATIONS.ID_TYPE, dataIndex : 'type',