PMCORE-1123

This commit is contained in:
Julio Cesar Laura Avendaño
2020-01-30 16:26:32 -04:00
parent 1983ab0063
commit fd49f88aa2
9 changed files with 158 additions and 67 deletions

View File

@@ -42,7 +42,7 @@ if (isset($_GET['ux'])) {
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
} }
echo "try {parent.parent.updateCasesTree();} catch(e) {}"; echo "try {parent.parent.updateCasesTree();parent.parent.highlightCasesTree();} catch(e) {}";
?> ?>
} }
</script> </script>

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\DB;
use ProcessMaker\Model\Delegation;
// Get the self service query for the current user
$query = Delegation::getSelfServiceQuery($_SESSION['USER_LOGGED']);
// Mutate query and execute
if (!is_string($query)) {
$query->limit(1);
$items = $query->get();
$atLeastOne = $items->count() > 0;
} else {
$query .= " LIMIT 1";
$items = DB::select($query);
$atLeastOne = !empty($items);
}
// Initializing the response variable
$response = [];
// The scope for the first version of this feature is only for unassigned list, so, this value is currently fixed
$response[] = ['item' => 'CASES_SELFSERVICE', 'highlight' => $atLeastOne];
// Print the response in JSON format
header('Content-Type: application/json');
echo json_encode($response);

View File

@@ -21,78 +21,78 @@ function getLoadTreeMenuData()
{ {
header("content-type: text/xml"); header("content-type: text/xml");
global $G_TMP_MENU; $menuInstance = new Menu();
$oMenu = new Menu(); $menuInstance->load('cases');
$oMenu->load('cases');
$oCases = new Cases(); $types = ['to_do', 'draft', 'cancelled', 'sent', 'paused', 'completed'];
$aTypes = array('to_do','draft','cancelled','sent','paused','completed','selfservice'); $typesId = ['CASES_INBOX' => 'to_do', 'CASES_DRAFT' => 'draft', 'CASES_CANCELLED' => 'cancelled',
//'to_revise', 'CASES_SENT' => 'sent', 'CASES_PAUSED' => 'paused', 'CASES_COMPLETED' => 'completed'];
//'to_reassign'
$aTypesID = array('CASES_INBOX' => 'to_do','CASES_DRAFT' => 'draft','CASES_CANCELLED' => 'cancelled','CASES_SENT' => 'sent','CASES_PAUSED' => 'paused','CASES_COMPLETED' => 'completed','CASES_SELFSERVICE' => 'selfservice'); // If the feature for highlight the home folders is disabled, add unassigned list to tree options with counters
if (!HIGHLIGHT_HOME_FOLDER_ENABLE) {
$types[] = 'selfservice';
$typesId['CASES_SELFSERVICE'] = 'selfservice';
}
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$licensedFeatures = PMLicensedFeatures::getSingleton(); $licensedFeatures = PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) { if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
$aTypesID['CONSOLIDATED_CASES'] = 'batch_routing'; $typesId['CONSOLIDATED_CASES'] = 'batch_routing';
$aTypes[] = 'batch_routing'; $types[] = 'batch_routing';
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
//'CASES_TO_REVISE'=>'to_revise', $list = [];
//'CASES_TO_REASSIGN'=>'to_reassign'
$list = array();
$list['count'] = ' '; $list['count'] = ' ';
$empty = array(); $empty = [];
foreach ($aTypes as $key => $val) { foreach ($types as $key => $val) {
$empty[$val] = $list; $empty[$val] = $list;
} }
$aCount = $empty; //$oCases->getAllConditionCasesCount($aTypes, true); $count = $empty;
$processNameMaxSize = 20;
//now drawing the treeview using the menu options from menu/cases.php // Now drawing the tree view using the menu options from menu/cases.php
$menuCases = array(); $menuCases = [];
for ($i = 0; $i < count($oMenu->Options); $i++) { for ($i = 0; $i < count($menuInstance->Options); $i++) {
if ($oMenu->Types[$i] == 'blockHeader') { if ($menuInstance->Types[$i] == 'blockHeader') {
$CurrentBlockID = $oMenu->Id[$i]; $currentBlockID = $menuInstance->Id[$i];
$menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; $menuCases[$currentBlockID]['blockTitle'] = $menuInstance->Labels[$i];
if ($oMenu->Options[$i] != "") { if ($menuInstance->Options[$i] != "") {
$menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i]; $menuCases[$currentBlockID]['link'] = $menuInstance->Options[$i];
} }
} elseif ($oMenu->Types[$i] == 'blockNestedTree') { } elseif ($menuInstance->Types[$i] == 'blockNestedTree') {
$CurrentBlockID = $oMenu->Id[$i]; $currentBlockID = $menuInstance->Id[$i];
$menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; $menuCases[$currentBlockID]['blockTitle'] = $menuInstance->Labels[$i];
$menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i]; $menuCases[$currentBlockID]['blockType'] = $menuInstance->Types[$i];
$menuCases[$CurrentBlockID]['loaderurl'] = $oMenu->Options[$i]; $menuCases[$currentBlockID]['loaderurl'] = $menuInstance->Options[$i];
} elseif ($oMenu->Types[$i] == 'blockHeaderNoChild') { } elseif ($menuInstance->Types[$i] == 'blockHeaderNoChild') {
$CurrentBlockID = $oMenu->Id[$i]; $currentBlockID = $menuInstance->Id[$i];
$menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; $menuCases[$currentBlockID]['blockTitle'] = $menuInstance->Labels[$i];
$menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i]; $menuCases[$currentBlockID]['blockType'] = $menuInstance->Types[$i];
$menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i]; $menuCases[$currentBlockID]['link'] = $menuInstance->Options[$i];
} elseif ($oMenu->Types[$i] == 'rootNode') { } elseif ($menuInstance->Types[$i] == 'rootNode') {
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]] = array( $menuCases[$currentBlockID]['blockItems'][$menuInstance->Id[$i]] = [
'label' => $oMenu->Labels[$i], 'label' => $menuInstance->Labels[$i],
'link' => $oMenu->Options[$i], 'link' => $menuInstance->Options[$i],
'icon' => (isset($oMenu->Icons[$i]) && $oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'kcmdf.png' 'icon' => (isset($menuInstance->Icons[$i]) && $menuInstance->Icons[$i] != '') ? $menuInstance->Icons[$i] : 'kcmdf.png'
); ];
$index = $i; $index = $i;
list($childs, $index) = getChilds($oMenu, ++$index); list($childs, $index) = getChilds($menuInstance, ++$index);
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]]['childs'] = $childs; $menuCases[$currentBlockID]['blockItems'][$menuInstance->Id[$i]]['childs'] = $childs;
$i = $index; $i = $index;
} else { } else {
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]] = array( $menuCases[$currentBlockID]['blockItems'][$menuInstance->Id[$i]] = [
'label' => $oMenu->Labels[$i], 'label' => $menuInstance->Labels[$i],
'link' => $oMenu->Options[$i], 'link' => $menuInstance->Options[$i],
'icon' => (isset($oMenu->Icons[$i]) && $oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'kcmdf.png' 'icon' => (isset($menuInstance->Icons[$i]) && $menuInstance->Icons[$i] != '') ? $menuInstance->Icons[$i] : 'kcmdf.png'
); ];
if (isset($aTypesID[$oMenu->Id[$i]])) { if (isset($typesId[$menuInstance->Id[$i]])) {
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]]['cases_count'] = $aCount[$aTypesID[$oMenu->Id[$i]]]['count']; $menuCases[$currentBlockID]['blockItems'][$menuInstance->Id[$i]]['cases_count'] = $count[$typesId[$menuInstance->Id[$i]]]['count'];
} }
} }
} }
@@ -114,8 +114,8 @@ function getLoadTreeMenuData()
} }
} }
//This function generates an xml, so it prevents the output of a badly formed xml // This function generates an xml, so it prevents the output of a badly formed xml
//by cleaning any content prior to this function with ob_clean // by cleaning any content prior to this function with ob_clean
ob_clean(); ob_clean();
echo $xml->asXML(); echo $xml->asXML();
die; die;
@@ -134,7 +134,7 @@ function getLoadTreeMenuData()
$menuBlockNode->addAttribute('url', $menuBlock['link']); $menuBlockNode->addAttribute('url', $menuBlock['link']);
} }
// adding "menu_block" childs nodes // Adding "menu_block" child nodes
foreach ($menuBlock['blockItems'] as $id => $menu) { foreach ($menuBlock['blockItems'] as $id => $menu) {
if (! empty($menu['childs'])) { if (! empty($menu['childs'])) {
$rootNode = $menuBlockNode->addChild('menu_block'); $rootNode = $menuBlockNode->addChild('menu_block');
@@ -177,8 +177,8 @@ function getLoadTreeMenuData()
} }
} }
//This function generates an xml, so it prevents the output of a badly formed xml // This function generates an xml, so it prevents the output of a badly formed xml
//by cleaning any content prior to this function with ob_clean // by cleaning any content prior to this function with ob_clean
ob_clean(); ob_clean();
echo $xml->asXML(); echo $xml->asXML();
die; die;

View File

@@ -126,6 +126,15 @@ $oHeadPublisher->assign('urlProxy', $urlProxy); //sending the urlProxy to make
$oHeadPublisher->assign("_nodeId", isset($confDefaultOption) ? $confDefaultOption : "PM_USERS"); //User menu permissions $oHeadPublisher->assign("_nodeId", isset($confDefaultOption) ? $confDefaultOption : "PM_USERS"); //User menu permissions
$oHeadPublisher->assign("FORMATS", $conf->getFormats()); $oHeadPublisher->assign("FORMATS", $conf->getFormats());
/*----------------------------------********---------------------------------*/
// If the feature for highlight the home folders is enabled, set some javascript variables
if (HIGHLIGHT_HOME_FOLDER_ENABLE) {
$oHeadPublisher->assign("highlightUrlProxy", "casesMenuHighlight?r=");
$oHeadPublisher->assign("highlightRefreshTime", HIGHLIGHT_HOME_FOLDER_REFRESH_TIME);
$oHeadPublisher->assign("highlightScope", HIGHLIGHT_HOME_FOLDER_SCOPE);
}
/*----------------------------------********---------------------------------*/
$_SESSION["current_ux"] = "NORMAL"; $_SESSION["current_ux"] = "NORMAL";
G::RenderPage("publish", "extJs"); G::RenderPage("publish", "extJs");

View File

@@ -56,7 +56,7 @@ class Lists
*/ */
public function __construct() public function __construct()
{ {
$this->mapList = array( $this->mapList = [
'ListInbox' => 'CASES_INBOX', 'ListInbox' => 'CASES_INBOX',
'ListDraft' => 'CASES_DRAFT', 'ListDraft' => 'CASES_DRAFT',
'ListCanceled' => 'CASES_CANCELLED', 'ListCanceled' => 'CASES_CANCELLED',
@@ -66,8 +66,7 @@ class Lists
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
'ListConsolidated' => 'CONSOLIDATED_CASES', 'ListConsolidated' => 'CONSOLIDATED_CASES',
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
'ListSelfService' => 'CASES_SELFSERVICE' ];
);
$this->ListInbox = new \ListInbox(); $this->ListInbox = new \ListInbox();
$this->ListDraft = new \ListInbox(); $this->ListDraft = new \ListInbox();
@@ -77,8 +76,12 @@ class Lists
$this->ListCompleted = new \ListCompleted(); $this->ListCompleted = new \ListCompleted();
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$this->ListConsolidated = new Consolidated(); $this->ListConsolidated = new Consolidated();
// If the feature for highlight the home folders is disabled, add/initialize properties related to self-service list
if (!HIGHLIGHT_HOME_FOLDER_ENABLE) {
$this->mapList['ListSelfService'] = 'CASES_SELFSERVICE';
$this->ListSelfService = new \ListUnassigned();
}
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$this->ListSelfService = new \ListUnassigned();
} }
@@ -150,8 +153,11 @@ class Lists
$listpeer = 'ListMyInboxPeer'; $listpeer = 'ListMyInboxPeer';
break; break;
case 'unassigned': case 'unassigned':
$list = new \ListUnassigned(); // If the feature for highlight the home folders is disabled, initialize the variables for unassigned list
$listpeer = 'ListUnassignedPeer'; if (!HIGHLIGHT_HOME_FOLDER_ENABLE) {
$list = new \ListUnassigned();
$listpeer = 'ListUnassignedPeer';
}
break; break;
} }

View File

@@ -31,6 +31,7 @@ Ext.onReady(function(){
} }
e.stopEvent(); e.stopEvent();
updateCasesTree(); updateCasesTree();
highlightCasesTree();
} }
else else
Ext.Msg.alert(_('ID_REFRESH_LABEL'),_('ID_REFRESH_MESSAGE')); Ext.Msg.alert(_('ID_REFRESH_LABEL'),_('ID_REFRESH_MESSAGE'));
@@ -132,6 +133,7 @@ Ext.onReady(function(){
if (defaultOption.indexOf('open') > -1) { if (defaultOption.indexOf('open') > -1) {
//if it is, then update cases trees //if it is, then update cases trees
updateCasesTree(); updateCasesTree();
highlightCasesTree();
} }
if (_nodeId !== '') { if (_nodeId !== '') {
treePanel1 = Ext.getCmp('tree-panel'); treePanel1 = Ext.getCmp('tree-panel');
@@ -142,6 +144,7 @@ Ext.onReady(function(){
node.select(); node.select();
if (_nodeId === 'CASES_START_CASE') { if (_nodeId === 'CASES_START_CASE') {
updateCasesTree(); updateCasesTree();
highlightCasesTree();
} }
} }
} }
@@ -177,7 +180,8 @@ Ext.onReady(function(){
treeMenuItems treeMenuItems
] ]
}); });
mainMenu.setTitle("<div style=\"height: 18px;\"><a href=\"javascript:;\"><img id=\"refreshNotifiers\" src=\"/images/refresh.gif\" onclick=\"updateCasesTree(); updateCasesView();\" /></a></div>"); mainMenu.setTitle("<div style=\"height: 18px;\"><a href=\"javascript:;\"><img id=\"refreshNotifiers\" " +
"src=\"/images/refresh.gif\" onclick=\"updateCasesTree(); highlightCasesTree(); updateCasesView();\" /></a></div>");
propStore = new Ext.data.Store({ propStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'debug_vars'}), proxy: new Ext.data.HttpProxy({url: 'debug_vars'}),
@@ -499,9 +503,15 @@ Ext.onReady(function(){
// Get the counters the first time // Get the counters the first time
updateCasesTree(); updateCasesTree();
highlightCasesTree();
// FORMATS.casesListRefreshTime is in seconds // FORMATS.casesListRefreshTime is in seconds
setInterval("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000); setInterval("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000);
// If the feature for highlight the home folders is enabled, add timer for highlight the tree options
if (typeof highlightUrlProxy !== "undefined") {
setInterval("highlightCasesTree()", (parseInt(highlightRefreshTime) * 60) * 1000);
}
}); });
function updateCasesView(viewList) { function updateCasesView(viewList) {
@@ -530,8 +540,6 @@ function updateCasesView(viewList) {
function updateCasesTree() { function updateCasesTree() {
document.getElementById('refreshNotifiers').src = '/images/ext/default/grid/loading.gif'; document.getElementById('refreshNotifiers').src = '/images/ext/default/grid/loading.gif';
itemsTypes = Array('CASES_INBOX', 'CASES_DRAFT', 'CASES_CANCELLED', 'CASES_SENT', 'CASES_PAUSED', 'CASES_COMPLETED', 'CASES_SELFSERVICE');
Ext.Ajax.request({ Ext.Ajax.request({
url: urlProxy + Math.random(), url: urlProxy + Math.random(),
success: function (response) { success: function (response) {
@@ -561,6 +569,36 @@ function updateCasesTree() {
}); });
} }
/**
* Function to highlight the tree options
*/
function highlightCasesTree() {
if (typeof highlightUrlProxy !== "undefined") {
document.getElementById('refreshNotifiers').src = '/images/ext/default/grid/loading.gif';
Ext.Ajax.request({
url: highlightUrlProxy + Math.random(),
success: function (response) {
var result = Ext.util.JSON.decode(response.responseText);
var treePanelObject = Ext.getCmp('tree-panel');
for (var i = 0; i < result.length; i++) {
var nodeObject = treePanelObject.getNodeById(result[i].item);
// Set the style for the option
if (result[i].highlight) {
nodeObject.setCls('row_updated');
} else {
nodeObject.setCls('');
}
}
document.getElementById('refreshNotifiers').src = '/images/refresh.gif';
},
failure: function () {
// Nothing to do for now...
}
});
}
}
function timer() { function timer() {
if (flagRefresh) { if (flagRefresh) {
updateCasesTree(); updateCasesTree();

View File

@@ -1081,6 +1081,7 @@ Ext.onReady(function(){
try { try {
parent.notify("", _("ID_CASE_CANCELLED", stringReplace("\\: ", "", _APP_NUM))); parent.notify("", _("ID_CASE_CANCELLED", stringReplace("\\: ", "", _APP_NUM)));
parent.updateCasesTree(); parent.updateCasesTree();
parent.highlightCasesTree();
} }
catch (e) { catch (e) {
} }
@@ -1348,6 +1349,7 @@ Ext.onReady(function(){
try { try {
parent.notify('', data.msg); parent.notify('', data.msg);
parent.updateCasesTree(); parent.updateCasesTree();
parent.highlightCasesTree();
} }
catch (e) { catch (e) {
} }
@@ -1548,6 +1550,7 @@ Ext.onReady(function(){
try { try {
parent.notify('PAUSE CASE', req.result.msg); parent.notify('PAUSE CASE', req.result.msg);
parent.updateCasesTree(); parent.updateCasesTree();
parent.highlightCasesTree();
}catch (e) { }catch (e) {
} }
location.href = urlToRedirectAfterPause; location.href = urlToRedirectAfterPause;
@@ -1587,6 +1590,7 @@ Ext.onReady(function(){
try { try {
parent.PMExt.notify(_('ID_UNPAUSE_ACTION'), data.msg); parent.PMExt.notify(_('ID_UNPAUSE_ACTION'), data.msg);
parent.updateCasesTree(); parent.updateCasesTree();
parent.highlightCasesTree();
} }
catch (e) { catch (e) {
} }
@@ -1641,6 +1645,7 @@ Ext.onReady(function(){
try { try {
parent.PMExt.notify(_('ID_DELETE_ACTION'), data.msg); parent.PMExt.notify(_('ID_DELETE_ACTION'), data.msg);
parent.updateCasesTree(); parent.updateCasesTree();
parent.highlightCasesTree();
} }
catch (e) { catch (e) {
} }

View File

@@ -3,7 +3,8 @@
$filter = new InputFilter(); $filter = new InputFilter();
if (isset($_POST['NextStep'])) { if (isset($_POST['NextStep'])) {
$nextStep = $filter->xssFilterHard($_POST['NextStep'], "url"); $nextStep = $filter->xssFilterHard($_POST['NextStep'], "url");
$refresh = $nextStep == 'cases_Step?breakpoint=triggerdebug' ? 'try {parent.parent.updateCasesTree();} catch(e) {}' : ''; $refresh = $nextStep == 'cases_Step?breakpoint=triggerdebug' ? 'try {parent.parent.updateCasesTree();' .
'parent.parent.highlightCasesTree();} catch(e) {}' : '';
?> ?>
<div class="ui-widget-header ui-corner-all" width="100%" align="center"> <div class="ui-widget-header ui-corner-all" width="100%" align="center">
Processmaker - Debugger (Break Point)&nbsp;&nbsp;&nbsp;&nbsp; Processmaker - Debugger (Break Point)&nbsp;&nbsp;&nbsp;&nbsp;
@@ -12,4 +13,3 @@ if (isset($_POST['NextStep'])) {
</div> </div>
<?php <?php
} }

View File

@@ -336,6 +336,11 @@ define('LOGS_MAX_FILES', $config['logs_max_files']);
define('LOGS_LOCATION', $config['logs_location']); define('LOGS_LOCATION', $config['logs_location']);
define('LOGGING_LEVEL', $config['logging_level']); define('LOGGING_LEVEL', $config['logging_level']);
define('TIME_ZONE', ini_get('date.timezone')); define('TIME_ZONE', ini_get('date.timezone'));
/*----------------------------------********---------------------------------*/
define('HIGHLIGHT_HOME_FOLDER_ENABLE', $config['highlight_home_folder_enable'] === "1");
define('HIGHLIGHT_HOME_FOLDER_REFRESH_TIME', $config['highlight_home_folder_refresh_time']);
define('HIGHLIGHT_HOME_FOLDER_SCOPE', $config['highlight_home_folder_scope']);
/*----------------------------------********---------------------------------*/
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it. // IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME']; $_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];