diff --git a/workflow/engine/classes/model/AppFolder.php b/workflow/engine/classes/model/AppFolder.php
index 7f9700822..f689e612e 100755
--- a/workflow/engine/classes/model/AppFolder.php
+++ b/workflow/engine/classes/model/AppFolder.php
@@ -323,12 +323,14 @@ class AppFolder extends BaseAppFolder
$numRecTotal = AppDocumentPeer::doCount($oCriteria);
+ /*
$auxCriteria = clone $oCriteria;
$auxCriteria->addJoin(AppDocumentPeer::DOC_UID, OutputDocumentPeer::OUT_DOC_UID);
$auxCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
$auxCriteria->add(OutputDocumentPeer::OUT_DOC_UID, '-1', Criteria::NOT_EQUAL);
$auxCriteria->add(OutputDocumentPeer::OUT_DOC_GENERATE, 'BOTH');
$numRecTotal += AppDocumentPeer::doCount($auxCriteria);
+ */
$oCase->verifyTable();
diff --git a/workflow/engine/methods/appFolder/appFolderAjax.php b/workflow/engine/methods/appFolder/appFolderAjax.php
index e93eb16fe..d431ed9b3 100755
--- a/workflow/engine/methods/appFolder/appFolderAjax.php
+++ b/workflow/engine/methods/appFolder/appFolderAjax.php
@@ -284,12 +284,14 @@ function expandNode()
if (isset($folderContent)) {
foreach ($folderContent as $key => $obj) {
- $tempTree ['text'] = $obj['APP_DOC_FILENAME'];
- $tempTree ['name'] = $obj['APP_DOC_FILENAME'];
- $mimeInformation=getMime($obj['APP_DOC_FILENAME']);
- $tempTree ['type'] = $mimeInformation['description'];
- $tempTree ['icon'] = $mimeInformation['icon'];
+ $mimeInformation = getMime($obj["APP_DOC_FILENAME"]);
+ $tempTree["text"] = $obj["APP_DOC_FILENAME"];
+ $tempTree["name"] = $obj["APP_DOC_FILENAME"];
+ $tempTree["type"] = $mimeInformation["description"];
+ $tempTree["icon"] = $mimeInformation["icon"];
+
+ /*
if (isset($obj['OUT_DOC_GENERATE'])) {
if ($obj['OUT_DOC_GENERATE'] == "BOTH") {
$arrayType=array("PDF","DOC");
@@ -304,6 +306,7 @@ function expandNode()
$tempTree ['icon'.$fileType] = $mimeInformation['icon'];
}
}
+ */
$tempTree ['appdocid'] = $obj['APP_DOC_UID'];
$tempTree ['id'] = $obj['APP_DOC_UID_VERSION'];
@@ -378,20 +381,53 @@ function expandNode()
$tempTree ['expanded'] = true;
}
*/
- if (isset($obj['OUT_DOC_GENERATE'])) {
- foreach ($arrayType as $keyType => $fileType) {
- $tempTree ['text'] = $tempTree ['text'.$fileType];
- $tempTree ['name'] = $tempTree ['name'.$fileType];
- $tempTree ['type'] = $tempTree ['type'.$fileType];
- $tempTree ['icon'] = $tempTree ['icon'.$fileType];
- $tempTree ['appDocFileName'] = $tempTree ['name'.$fileType];
+ $tempTree["outDocGenerate"] = "";
- $tempTree ['downloadLabel'] = $tempTree ['downloadLabel'.$fileType];
- $tempTree ['downloadLink'] = $tempTree ['downloadLink'.$fileType];
+ if (isset($obj["OUT_DOC_GENERATE"])) {
+ switch ($obj["OUT_DOC_GENERATE"]) {
+ case "PDF":
+ case "DOC":
+ $mimeInformation = getMime($obj["APP_DOC_FILENAME"] . "." . strtolower($obj["OUT_DOC_GENERATE"]));
- $tempTree ['id']=$tempTree ['id']."_".$fileType;
- $processListTree [] = $tempTree;
+ $tempTree["text"] = $obj["APP_DOC_FILENAME"] . "." . strtolower($obj["OUT_DOC_GENERATE"]);
+ $tempTree["name"] = $obj["APP_DOC_FILENAME"] . "." . strtolower($obj["OUT_DOC_GENERATE"]);
+ $tempTree["type"] = $mimeInformation["description"];
+ $tempTree["icon"] = $mimeInformation["icon"];
+ $tempTree["appDocFileName"] = $tempTree["name"];
+
+ $tempTree["downloadLabel"] = $tempTree["downloadLabel" . $obj["OUT_DOC_GENERATE"]];
+ $tempTree["downloadLink"] = $tempTree["downloadLink" . $obj["OUT_DOC_GENERATE"]];
+
+ $tempTree["id"] = $tempTree["id"] . "_" . $obj["OUT_DOC_GENERATE"];
+
+ $processListTree[] = $tempTree;
+ break;
+ case "BOTH":
+ $strExpander = null;
+ $mimeInformation = getMime($obj["APP_DOC_FILENAME"] . ".pdf");
+ $strExpander = $strExpander . "
" . $obj["APP_DOC_FILENAME"] . ".pdf (" . $mimeInformation["description"] . ")";
+ $strExpander = $strExpander . "
";
+ $mimeInformation = getMime($obj["APP_DOC_FILENAME"] . ".doc");
+ $strExpander = $strExpander . "
" . $obj["APP_DOC_FILENAME"] . ".pdf (" . $mimeInformation["description"] . ")";
+
+ $tempTree["outDocGenerate"] = $strExpander;
+
+ $tempTree["text"] = $obj["APP_DOC_FILENAME"];
+ $tempTree["name"] = $obj["APP_DOC_FILENAME"];
+ $tempTree["type"] = "";
+ $tempTree["icon"] = "/images/documents/extension/document.png";
+ $tempTree["appDocFileName"] = $tempTree["name"];
+
+ //$tempTree["downloadLabel"] = $obj["DOWNLOAD_LABEL"];
+ //$tempTree["downloadLink"] = $obj["DOWNLOAD_LINK"];
+
+ $tempTree["id"] = $tempTree["id"] . "_" . $obj["OUT_DOC_GENERATE"];
+
+ $processListTree[] = $tempTree;
+ break;
+ //case "NOFILE":
+ // break;
}
} else {
if ($obj["APP_DOC_TYPE"] == "OUTPUT" &&
@@ -407,9 +443,10 @@ function expandNode()
$tempTree["icon"] = $mimeInformation["icon"];
}
- $processListTree [] = $tempTree;
+ $processListTree[] = $tempTree;
}
- $tempTree=array();
+
+ $tempTree = array();
}
}
diff --git a/workflow/engine/templates/cases/casesDocuments.js b/workflow/engine/templates/cases/casesDocuments.js
index 06b895d87..fefb29a5b 100755
--- a/workflow/engine/templates/cases/casesDocuments.js
+++ b/workflow/engine/templates/cases/casesDocuments.js
@@ -274,7 +274,8 @@ function getURLParam( strParamName, myWindow){
return strReturn;
}
-function openActionDialog( caller, action ) {
+function openActionDialog(caller, action, dataAux)
+{
// console.log("Dialog open: "+caller+" ->"+action);
var dialog;
var selectedRows = ext_itemgrid.getSelectionModel().getSelections();
@@ -460,28 +461,34 @@ function openActionDialog( caller, action ) {
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);
+ if (selectedRows.length == 1) {
+ if (ext_itemgrid.getSelectionModel().getSelected().get("appDocType") == "Output" && ext_itemgrid.getSelectionModel().getSelected().get("outDocGenerate") != "") {
+ dataAux = (dataAux != "")? dataAux : "pdf";
- try {
- Ext.destroy(Ext.get("downloadIframe"));
- }
- catch (e) {
- }
+ urlDownload = stringReplace("&ext=.{3,}&", "&ext=" + dataAux + "&", urlDownload);
+ }
- 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 (ext_itemgrid.getSelectionModel().getSelected().get("appDocPlugin") != "") {
+ messageText = _("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);
+ }
}
/*
@@ -510,7 +517,7 @@ function handleCallback(requestParams, node) {
if( json.success == "success"){
statusBarMessage( json.message, false, true );
if (options.params.action == 'rename') {
- node = dirTree.getSelectionModel().getSelectedNode();
+ node = dirTree.getSelectionModel().getSelectedNode();
}
try {
if( typeof(dropEvent) != 'undefined' ) {
@@ -820,8 +827,9 @@ datastore = new Ext.data.Store({
name : "downloadLink"
},{
name : "downloadLabel"
+ }, {
+ name: "outDocGenerate"
}
-
])),
// turn on remote sorting
@@ -856,13 +864,20 @@ function renderFileName(value, p, record) {
' {1}',
record.get('icon'), value);
}
-function renderType(value, p, record) {
- if(record.get('appDocType')!=""){
- return String.format('{1}, {0}', value,record.get('appDocType'));
- }else{
- return String.format('{0}', value);
- }
+
+function renderType(value, p, record)
+{
+ if (record.get("appDocType") != "") {
+ if (record.get("appDocType") == "Output" && record.get("outDocGenerate") != "") {
+ return String.format("{0}", _("ID_OUTPUT_DOCUMENT"));
+ } else {
+ return String.format("{1}, {0}", value, record.get("appDocType"));
+ }
+ } else {
+ return String.format("{0}", value);
+ }
}
+
function renderVersion(value, p, record) {
if(record.get("appDocVersionable")=="1"){
if(value>1){
@@ -951,7 +966,7 @@ var gridtb = new Ext.Toolbar(
disabled : true,
hidden: true,
handler : function() {
- openActionDialog(this, 'search');
+ openActionDialog(this, "search", "");
}
},
'-',
@@ -965,7 +980,7 @@ var gridtb = new Ext.Toolbar(
cls : 'x-btn-icon',
// disabled : false,
handler : function() {
- openActionDialog(this, 'newFolder');
+ openActionDialog(this, "newFolder", "");
}
},
{
@@ -979,7 +994,7 @@ var gridtb = new Ext.Toolbar(
disabled : false,
hidden: true,
handler : function() {
- openActionDialog(this, 'copyAction');
+ openActionDialog(this, "copyAction", "");
}
},
{
@@ -992,7 +1007,7 @@ var gridtb = new Ext.Toolbar(
disabled : false,
hidden: true,
handler : function() {
- openActionDialog(this, 'moveAction');
+ openActionDialog(this, "moveAction", "");
}
},
{
@@ -1006,8 +1021,8 @@ var gridtb = new Ext.Toolbar(
disabled : false,
// hidden: (showdelete==1)?false:true,
handler : function() {
- openActionDialog(this, 'delete');
-// openActionDialog(this, 'deleteDir');
+ openActionDialog(this, "delete", "");
+// openActionDialog(this, "deleteDir", "");
}
},
{
@@ -1020,7 +1035,7 @@ var gridtb = new Ext.Toolbar(
disabled : true,
hidden: true,
handler : function() {
- openActionDialog(this, 'rename');
+ openActionDialog(this, "rename", "");
}
},
'-',
@@ -1034,7 +1049,7 @@ var gridtb = new Ext.Toolbar(
cls : 'x-btn-icon',
// disabled : true,
handler : function() {
- openActionDialog(this, 'download');
+ openActionDialog(this, "download", "");
}
},
{
@@ -1054,10 +1069,10 @@ var gridtb = new Ext.Toolbar(
* .load("/scripts/extjs3-ext/ux.swfupload/SwfUpload.js");
* Ext.ux.OnDemandLoad .load(
* "/scripts/extjs3-ext/ux.swfupload/SwfUploadPanel.js",
- * function(options) { openActionDialog(this, 'upload');
+ * function(options) { openActionDialog(this, "upload", "");
* });
*/
- openActionDialog(this, 'uploadDocument');
+ openActionDialog(this, "uploadDocument", "");
}
},
'-',
@@ -1146,13 +1161,13 @@ var getGrid = function( data, element) {
return grid;
};
+/*
var expander = new Ext.ux.grid.RowExpander({
tpl : '
Company: {company}
Summary: - * {desc}
' ), - */ + + //* tpl : new Ext.Template( 'Company: {company}
Summary: + //* {desc}
' ), // width : 50, @@ -1172,11 +1187,19 @@ var expander = new Ext.ux.grid.RowExpander({ }, renderer : renderVersionExpander }); +*/ + +var rowExpander = new Ext.ux.grid.RowExpander({ + tpl: new Ext.Template( + "{outDocGenerate}" + ) +}); //The column model has information about grid columns //dataIndex maps the column to the specific data field in //the data store -var cm = new Ext.grid.ColumnModel([{ +var cm = new Ext.grid.ColumnModel([ +rowExpander, { id: "gridcm", //id assigned so we can apply custom css (e.g. -> .x-grid-col-topic b { color:#333 }) header: _("ID_NAME"), dataIndex: "name", @@ -1288,6 +1311,10 @@ var cm = new Ext.grid.ColumnModel([{ dataIndex: "id", hidden: true, hideable: false +}, { + dataIndex: "outDocGenerate", + hidden: true, + hideable: false }]); //By default columns are sortable @@ -1380,7 +1407,7 @@ gridCtxMenu = new Ext.menu.Menu({ // '/images/documents/_editcopy.png', text : TRANSLATIONS.ID_COPY, handler : function() { - openActionDialog(this, 'copyAction'); + openActionDialog(this, "copyAction", ""); } }, { id : 'gc_move', @@ -1388,7 +1415,7 @@ gridCtxMenu = new Ext.menu.Menu({ // '/images/documents/_move.png', text : TRANSLATIONS.ID_MOVE, handler : function() { - openActionDialog(this, 'moveAction'); + openActionDialog(this, "moveAction", ""); } },*/ { id : 'gc_delete', @@ -1396,8 +1423,8 @@ gridCtxMenu = new Ext.menu.Menu({ // '/images/documents/_editdelete.png', text : TRANSLATIONS.ID_DELETE, handler : function() { - openActionDialog(this, 'delete'); -// openActionDialog(this, 'deleteDocument'); + openActionDialog(this, "delete", ""); +// openActionDialog(this, "deleteDocument", ""); } }, '-', { @@ -1406,7 +1433,7 @@ gridCtxMenu = new Ext.menu.Menu({ // '/images/documents/_down.png', text : TRANSLATIONS.ID_DOWNLOAD, handler : function() { - openActionDialog(this, 'download'); + openActionDialog(this, "download", ""); } }, @@ -1522,7 +1549,7 @@ var dirCtxMenu = new Ext.menu.Menu( text : TRANSLATIONS.ID_NEW_FOLDER, handler : function() { dirCtxMenu.hide(); - openActionDialog(this, 'newFolder'); + openActionDialog(this, "newFolder", ""); } }, { @@ -1531,7 +1558,7 @@ var dirCtxMenu = new Ext.menu.Menu( text : TRANSLATIONS.ID_RENAME, handler : function() { dirCtxMenu.hide(); - openActionDialog(this, 'rename'); + openActionDialog(this, "rename", ""); } }, { @@ -1542,7 +1569,7 @@ var dirCtxMenu = new Ext.menu.Menu( text : TRANSLATIONS.ID_COPY, handler : function() { dirCtxMenu.hide(); - openActionDialog(this, 'copyAction'); + openActionDialog(this, "copyAction", ""); } }, { @@ -1553,7 +1580,7 @@ var dirCtxMenu = new Ext.menu.Menu( text : TRANSLATIONS.ID_MOVE, handler : function() { dirCtxMenu.hide(); - openActionDialog(this, 'moveAction'); + openActionDialog(this, "moveAction", ""); } }, { @@ -1762,7 +1789,8 @@ var documentsTab = { bbar : gridbb, ddGroup : 'TreeDD', enableDragDrop: true, - plugins: expander, + //plugins: expander, + plugins: rowExpander, selModel : new Ext.grid.RowSelectionModel({ listeners : { 'rowselect' : { @@ -1780,8 +1808,7 @@ var documentsTab = { ctrl : true, stopEvent : true, handler : function() { - openActionDialog(this, - 'copyAction'); + openActionDialog(this, "copyAction", ""); } }, @@ -1790,8 +1817,7 @@ var documentsTab = { ctrl : true, stopEvent : true, handler : function() { - openActionDialog(this, - 'moveAction'); + openActionDialog(this, "moveAction", ""); } }, @@ -1808,8 +1834,7 @@ var documentsTab = { { key : Ext.EventObject.DELETE, handler : function() { - openActionDialog(this, - 'delete'); + openActionDialog(this, "delete", ""); } } ], listeners : { @@ -1845,12 +1870,10 @@ var documentsTab = { .get('id')); } else if (selections[0] .get('is_editable')) { - openActionDialog(this, - 'edit'); + openActionDialog(this, "edit", ""); } else if (selections[0] .get('is_readable')) { - openActionDialog(this, - 'view'); + openActionDialog(this, "view", ""); } } }