BUG 0000 Improvements & refactoring to Case Suammary Info Panel
This commit is contained in:
94
workflow/engine/controllers/appProxy.php
Normal file
94
workflow/engine/controllers/appProxy.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* App controller
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||
* @inherits Controller
|
||||
* @access public
|
||||
*/
|
||||
|
||||
class AppProxy extends HttpProxyController
|
||||
{
|
||||
function requestOpenSummary($httpData)
|
||||
{
|
||||
global $RBAC;
|
||||
$this->success = true;
|
||||
$this->dynUid = '';
|
||||
|
||||
switch ($RBAC->userCanAccess('PM_CASES')) {
|
||||
case -2:
|
||||
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
|
||||
break;
|
||||
case -1:
|
||||
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE'));
|
||||
break;
|
||||
}
|
||||
|
||||
G::LoadClass('case');
|
||||
$case = new Cases();
|
||||
|
||||
if ($RBAC->userCanAccess('PM_ALLCASES') < 0 && $case->userParticipatedInCase($httpData->appUid, $_SESSION['USER_LOGGED']) == 0) {
|
||||
throw new Exception(G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED'));
|
||||
}
|
||||
|
||||
$applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex);
|
||||
$process = new Process();
|
||||
$processData = $process->load($applicationFields['PRO_UID']);
|
||||
|
||||
if (isset($processData['PRO_DYNAFORMS']['PROCESS'])) {
|
||||
$this->dynUid = $processData['PRO_DYNAFORMS']['PROCESS'];
|
||||
}
|
||||
|
||||
$_SESSION['_applicationFields'] = $applicationFields;
|
||||
$_SESSION['_processData'] = $processData;
|
||||
}
|
||||
|
||||
function getSummary($httpData)
|
||||
{
|
||||
$labels = array();
|
||||
$form = new Form('cases/cases_Resume', PATH_XMLFORM, SYS_LANG);
|
||||
G::LoadClass('case');
|
||||
$case = new Cases();
|
||||
|
||||
foreach($form->fields as $fieldName => $field) {
|
||||
$labels[$fieldName] = $field->label;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['_applicationFields']) && $_SESSION['_processData']) {
|
||||
$applicationFields = $_SESSION['_applicationFields'];
|
||||
unset($_SESSION['_applicationFields']);
|
||||
$processData = $_SESSION['_processData'];
|
||||
unset($_SESSION['_processData']);
|
||||
}
|
||||
else {
|
||||
$applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex);
|
||||
$process = new Process();
|
||||
$processData = $process->load($applicationFields['PRO_UID']);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$task = new Task();
|
||||
$taskData = $task->load($applicationFields['TAS_UID']);
|
||||
$currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '[' . G::LoadTranslation('ID_UNASSIGNED') . ']';
|
||||
|
||||
$data[] = array('label'=>$labels['PRO_TITLE'] , 'value' => $processData['PRO_TITLE'], 'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['TITLE'] , 'value' => $applicationFields['TITLE'], 'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['APP_NUMBER'] , 'value' => $applicationFields['APP_NUMBER'], 'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['STATUS'] , 'value' => $applicationFields['STATUS'], 'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['APP_UID'] , 'value' => $applicationFields['APP_UID'], 'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['CREATOR'] , 'value' => $applicationFields['CREATOR'], 'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['CREATE_DATE'] , 'value' => $applicationFields['CREATE_DATE'],'section'=>$labels['TITLE1']);
|
||||
$data[] = array('label'=>$labels['UPDATE_DATE'] , 'value' => $applicationFields['UPDATE_DATE'],'section'=>$labels['TITLE1']);
|
||||
|
||||
$data[] = array('label'=>$labels['TAS_TITLE'] , 'value' => $taskData['TAS_TITLE'], 'section'=>$labels['TITLE2']);
|
||||
$data[] = array('label'=>$labels['CURRENT_USER'] , 'value' => $currentUser, 'section'=>$labels['TITLE2']);
|
||||
$data[] = array('label'=>$labels['DEL_DELEGATE_DATE'] , 'value' => $applicationFields['DEL_DELEGATE_DATE'],'section'=>$labels['TITLE2']);
|
||||
$data[] = array('label'=>$labels['DEL_INIT_DATE'] , 'value' => $applicationFields['DEL_INIT_DATE'], 'section'=>$labels['TITLE2']);
|
||||
$data[] = array('label'=>$labels['DEL_TASK_DUE_DATE'] , 'value' => $applicationFields['DEL_TASK_DUE_DATE'],'section'=>$labels['TITLE2']);
|
||||
$data[] = array('label'=>$labels['DEL_FINISH_DATE'] , 'value' => $applicationFields['DEL_FINISH_DATE'], 'section'=>$labels['TITLE2']);
|
||||
//$data[] = array('label'=>$labels['DYN_UID'] , 'value' => $processData['PRO_DYNAFORMS']['PROCESS'];, 'section'=>$labels['DYN_UID']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -116,7 +116,8 @@
|
||||
$c = new Configurations();
|
||||
|
||||
$oHeadPublisher->usingExtJs('ux/GridRowActions');
|
||||
$oHeadPublisher->addExtJsScript('cases/caseUtils', true);
|
||||
//$oHeadPublisher->addExtJsScript('cases/caseUtils', true);
|
||||
$oHeadPublisher->addExtJsScript('app/main', true);
|
||||
$oHeadPublisher->addExtJsScript('cases/casesList', false ); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent( 'cases/casesListExtJs'); //adding a html file .html.
|
||||
$oHeadPublisher->assign('FORMATS',$c->getFormats());
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* summaryAjax.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
if (!isset($_REQUEST['action'])) {
|
||||
$_REQUEST['action'] = 'getDataSummary';
|
||||
}
|
||||
if ($_REQUEST['action'] == '') {
|
||||
$_REQUEST['action'] = 'getDataSummary';
|
||||
}
|
||||
|
||||
try {
|
||||
global $RBAC;
|
||||
switch ($RBAC->userCanAccess('PM_CASES')) {
|
||||
case -2:
|
||||
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
|
||||
break;
|
||||
case -1:
|
||||
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE'));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['APP_UID']) || !isset($_REQUEST['DEL_INDEX'])) {
|
||||
throw new Exception(G::LoadTranslation('ID_REQUIRED_FIELDS_ERROR') . ' (APP_UID, DEL_INDEX)');
|
||||
}
|
||||
|
||||
G::LoadClass('case');
|
||||
$case = new Cases();
|
||||
if ($RBAC->userCanAccess('PM_ALLCASES') < 0 && $case->userParticipatedInCase($_REQUEST['APP_UID'], $_SESSION['USER_LOGGED']) == 0) {
|
||||
throw new Exception(G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED'));
|
||||
}
|
||||
|
||||
$json = new Services_JSON();
|
||||
$response = new stdclass();
|
||||
$response->type = 'OK';
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'getDataSummary':
|
||||
$response->labels = new stdclass();
|
||||
$form = new Form('cases/cases_Resume', PATH_XMLFORM, SYS_LANG);
|
||||
foreach($form->fields as $fieldName => $field) {
|
||||
$response->labels->{$fieldName} = $field->label;
|
||||
}
|
||||
$applicationFields = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
|
||||
$process = new Process();
|
||||
$processData = $process->load($applicationFields['PRO_UID']);
|
||||
if (!isset($processData['PRO_DYNAFORMS']['PROCESS'])) {
|
||||
$processData['PRO_DYNAFORMS']['PROCESS'] = '';
|
||||
}
|
||||
$task = new Task();
|
||||
$taskData = $task->load($applicationFields['TAS_UID']);
|
||||
$response->values = new stdclass();
|
||||
$response->values->PRO_TITLE = $processData['PRO_TITLE'];
|
||||
$response->values->TITLE = $applicationFields['TITLE'];
|
||||
$response->values->APP_NUMBER = $applicationFields['APP_NUMBER'];
|
||||
$response->values->STATUS = $applicationFields['STATUS'];
|
||||
$response->values->APP_UID = $applicationFields['APP_UID'];
|
||||
$response->values->CREATOR = $applicationFields['CREATOR'];
|
||||
$response->values->CREATE_DATE = $applicationFields['CREATE_DATE'];
|
||||
$response->values->UPDATE_DATE = $applicationFields['UPDATE_DATE'];
|
||||
$response->values->TAS_TITLE = $taskData['TAS_TITLE'];
|
||||
$response->values->CURRENT_USER = $applicationFields['CURRENT_USER'];
|
||||
$response->values->DEL_DELEGATE_DATE = $applicationFields['DEL_DELEGATE_DATE'];
|
||||
$response->values->DEL_INIT_DATE = $applicationFields['DEL_INIT_DATE'];
|
||||
$response->values->DEL_TASK_DUE_DATE = $applicationFields['DEL_TASK_DUE_DATE'];
|
||||
$response->values->DEL_FINISH_DATE = $applicationFields['DEL_FINISH_DATE'];
|
||||
$response->values->DYN_UID = $processData['PRO_DYNAFORMS']['PROCESS'];
|
||||
break;
|
||||
}
|
||||
die($json->encode($response));
|
||||
}
|
||||
catch (Exception $error) {
|
||||
$response = new stdclass();
|
||||
$response->type = 'ERROR';
|
||||
$response->message = $error->getMessage();
|
||||
$json = new Services_JSON();
|
||||
die($json->encode($response));
|
||||
}
|
||||
164
workflow/engine/templates/cases/caseUtils.js → workflow/engine/templates/app/main.js
Executable file → Normal file
164
workflow/engine/templates/cases/caseUtils.js → workflow/engine/templates/app/main.js
Executable file → Normal file
@@ -291,171 +291,71 @@ function statusBarMessage( msg, isLoading, success ) {
|
||||
|
||||
/* Case Notes - End */
|
||||
/* Case Summary - Start */
|
||||
Ext.util.Format.capitalize = (function(){
|
||||
var re = /(^|[^\w])([a-z])/g,
|
||||
fn = function(m, a, b) {
|
||||
return a + b.toUpperCase();
|
||||
};
|
||||
return function(v) {
|
||||
return v.toLowerCase().replace(re, fn);
|
||||
}
|
||||
})();
|
||||
|
||||
var openSummaryWindow = function(applicationUID, delegation) {
|
||||
var summaryForm = new Ext.FormPanel({
|
||||
title: Ext.util.Format.capitalize(_('ID_GENERATE_INFO')),
|
||||
frame : true,
|
||||
height: 440,
|
||||
labelWidth: 150,
|
||||
items : [{
|
||||
xtype: 'displayfield',
|
||||
name: 'TITLE1',
|
||||
labelStyle: 'font-weight:bold;'
|
||||
var openSummaryWindow = function(appUid, delIndex)
|
||||
{
|
||||
Ext.Ajax.request({
|
||||
url : '../appProxy/requestOpenSummary',
|
||||
params : {
|
||||
appUid : appUid,
|
||||
delIndex: delIndex
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'PRO_TITLE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'TITLE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'APP_NUMBER'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'STATUS'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'APP_UID'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'CREATOR'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'CREATE_DATE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'UPDATE_DATE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'TITLE2',
|
||||
labelStyle: 'font-weight:bold;'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'TAS_TITLE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'CURRENT_USER'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'DEL_DELEGATE_DATE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'DEL_INIT_DATE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'DEL_TASK_DUE_DATE'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'DEL_FINISH_DATE'
|
||||
}]
|
||||
});
|
||||
success: function (result, request) {
|
||||
var response = Ext.util.JSON.decode(result.responseText);
|
||||
if (response.success) {
|
||||
var sumaryInfPanel = PMExt.createInfoPanel('../appProxy/getSummary', {appUid: appUid, delIndex: delIndex});
|
||||
sumaryInfPanel.setTitle(_('ID_GENERATE_INFO'));
|
||||
|
||||
var summaryWindow = new Ext.Window({
|
||||
title: _('ID_SUMMARY'),
|
||||
id: 'summaryWindow',
|
||||
width: 750,
|
||||
height: 500,
|
||||
minWidth: 750,
|
||||
minHeight: 500,
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 500,
|
||||
height: 420,
|
||||
resizable: false,
|
||||
closable: true,
|
||||
modal: true,
|
||||
autoScroll:true,
|
||||
shadow: true,
|
||||
bodyBorder: false,
|
||||
keys: {
|
||||
key: 27,
|
||||
fn: function() {
|
||||
summaryWindow.close();
|
||||
}
|
||||
},
|
||||
buttons : [
|
||||
{
|
||||
buttons : [{
|
||||
text : _('ID_CANCEL'),
|
||||
handler : function(){
|
||||
summaryWindow.close();
|
||||
}
|
||||
}
|
||||
}}
|
||||
],
|
||||
listeners: {
|
||||
show: function() {
|
||||
this.loadMask = new Ext.LoadMask(this.body, {
|
||||
msg: _('ID_LOADING')
|
||||
});
|
||||
this.loadMask.show();
|
||||
Ext.Ajax.request({
|
||||
url : '../cases/summaryAjax',
|
||||
params : {
|
||||
action : 'getDataSummary',
|
||||
APP_UID: applicationUID,
|
||||
DEL_INDEX: delegation
|
||||
},
|
||||
success: function (result, request) {
|
||||
var response = Ext.util.JSON.decode(result.responseText);
|
||||
var tabs = [];
|
||||
if (response.values.DYN_UID != '') {
|
||||
|
||||
if (response.dynUid != '') {
|
||||
var tabs = new Array();
|
||||
tabs.push(sumaryInfPanel);
|
||||
tabs.push({title: Ext.util.Format.capitalize(_('ID_MORE_INFORMATION')), bodyCfg: {
|
||||
tag: 'iframe',
|
||||
id: 'summaryIFrame',
|
||||
src: '../cases/summary?APP_UID=' + applicationUID + '&DEL_INDEX=' + delegation + '&DYN_UID=' + response.values.DYN_UID,
|
||||
src: '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid,
|
||||
style: {border: '0px none', height: '440px'},
|
||||
onload: ''
|
||||
}});
|
||||
}
|
||||
for (var fieldName in response.labels) {
|
||||
var field = summaryForm.getForm().findField(fieldName);
|
||||
if (field) {
|
||||
field.fieldLabel = response.labels[fieldName];
|
||||
}
|
||||
}
|
||||
summaryForm.getForm().setValues(response.values);
|
||||
tabs.push(summaryForm);
|
||||
var summaryTabs = new Ext.TabPanel({
|
||||
activeTab: 0,
|
||||
items: tabs
|
||||
});
|
||||
summaryWindow.add(summaryTabs);
|
||||
}
|
||||
else {
|
||||
summaryWindow.add(sumaryInfPanel);
|
||||
}
|
||||
summaryWindow.doLayout();
|
||||
summaryWindow.loadMask.hide();
|
||||
summaryWindow.show();
|
||||
}
|
||||
else {
|
||||
PMExt.warning(_('ID_WARNING'), response.message);
|
||||
}
|
||||
},
|
||||
failure: function (result, request) {
|
||||
Ext.MessageBox.alert('Failed', result.responseText);
|
||||
PMExt.error(_('ID_ERROR'), result.responseText);
|
||||
}
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
var summaryIFrame = document.getElementById('summaryIFrame');
|
||||
delete(summaryIFrame);
|
||||
}
|
||||
}
|
||||
});
|
||||
summaryWindow.show();
|
||||
};
|
||||
}
|
||||
/* Case Summary - End*/
|
||||
Reference in New Issue
Block a user