PMCORE-1123
This commit is contained in:
@@ -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>
|
||||
28
workflow/engine/methods/cases/casesMenuHighlight.php
Normal file
28
workflow/engine/methods/cases/casesMenuHighlight.php
Normal 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);
|
||||
@@ -21,78 +21,78 @@ function getLoadTreeMenuData()
|
||||
{
|
||||
header("content-type: text/xml");
|
||||
|
||||
global $G_TMP_MENU;
|
||||
$oMenu = new Menu();
|
||||
$oMenu->load('cases');
|
||||
$menuInstance = new Menu();
|
||||
$menuInstance->load('cases');
|
||||
|
||||
$oCases = new Cases();
|
||||
$aTypes = array('to_do','draft','cancelled','sent','paused','completed','selfservice');
|
||||
//'to_revise',
|
||||
//'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');
|
||||
$types = ['to_do', 'draft', 'cancelled', 'sent', 'paused', 'completed'];
|
||||
$typesId = ['CASES_INBOX' => 'to_do', 'CASES_DRAFT' => 'draft', 'CASES_CANCELLED' => 'cancelled',
|
||||
'CASES_SENT' => 'sent', 'CASES_PAUSED' => 'paused', 'CASES_COMPLETED' => 'completed'];
|
||||
|
||||
// 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();
|
||||
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
|
||||
$aTypesID['CONSOLIDATED_CASES'] = 'batch_routing';
|
||||
$aTypes[] = 'batch_routing';
|
||||
$typesId['CONSOLIDATED_CASES'] = 'batch_routing';
|
||||
$types[] = 'batch_routing';
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
//'CASES_TO_REVISE'=>'to_revise',
|
||||
//'CASES_TO_REASSIGN'=>'to_reassign'
|
||||
$list = array();
|
||||
$list = [];
|
||||
$list['count'] = ' ';
|
||||
|
||||
$empty = array();
|
||||
foreach ($aTypes as $key => $val) {
|
||||
$empty = [];
|
||||
foreach ($types as $key => $val) {
|
||||
$empty[$val] = $list;
|
||||
}
|
||||
|
||||
$aCount = $empty; //$oCases->getAllConditionCasesCount($aTypes, true);
|
||||
$processNameMaxSize = 20;
|
||||
$count = $empty;
|
||||
|
||||
//now drawing the treeview using the menu options from menu/cases.php
|
||||
$menuCases = array();
|
||||
for ($i = 0; $i < count($oMenu->Options); $i++) {
|
||||
if ($oMenu->Types[$i] == 'blockHeader') {
|
||||
$CurrentBlockID = $oMenu->Id[$i];
|
||||
$menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i];
|
||||
if ($oMenu->Options[$i] != "") {
|
||||
$menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i];
|
||||
// Now drawing the tree view using the menu options from menu/cases.php
|
||||
$menuCases = [];
|
||||
for ($i = 0; $i < count($menuInstance->Options); $i++) {
|
||||
if ($menuInstance->Types[$i] == 'blockHeader') {
|
||||
$currentBlockID = $menuInstance->Id[$i];
|
||||
$menuCases[$currentBlockID]['blockTitle'] = $menuInstance->Labels[$i];
|
||||
if ($menuInstance->Options[$i] != "") {
|
||||
$menuCases[$currentBlockID]['link'] = $menuInstance->Options[$i];
|
||||
}
|
||||
} elseif ($oMenu->Types[$i] == 'blockNestedTree') {
|
||||
$CurrentBlockID = $oMenu->Id[$i];
|
||||
$menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i];
|
||||
$menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i];
|
||||
$menuCases[$CurrentBlockID]['loaderurl'] = $oMenu->Options[$i];
|
||||
} elseif ($oMenu->Types[$i] == 'blockHeaderNoChild') {
|
||||
$CurrentBlockID = $oMenu->Id[$i];
|
||||
$menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i];
|
||||
$menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i];
|
||||
$menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i];
|
||||
} elseif ($oMenu->Types[$i] == 'rootNode') {
|
||||
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]] = array(
|
||||
'label' => $oMenu->Labels[$i],
|
||||
'link' => $oMenu->Options[$i],
|
||||
'icon' => (isset($oMenu->Icons[$i]) && $oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'kcmdf.png'
|
||||
);
|
||||
} elseif ($menuInstance->Types[$i] == 'blockNestedTree') {
|
||||
$currentBlockID = $menuInstance->Id[$i];
|
||||
$menuCases[$currentBlockID]['blockTitle'] = $menuInstance->Labels[$i];
|
||||
$menuCases[$currentBlockID]['blockType'] = $menuInstance->Types[$i];
|
||||
$menuCases[$currentBlockID]['loaderurl'] = $menuInstance->Options[$i];
|
||||
} elseif ($menuInstance->Types[$i] == 'blockHeaderNoChild') {
|
||||
$currentBlockID = $menuInstance->Id[$i];
|
||||
$menuCases[$currentBlockID]['blockTitle'] = $menuInstance->Labels[$i];
|
||||
$menuCases[$currentBlockID]['blockType'] = $menuInstance->Types[$i];
|
||||
$menuCases[$currentBlockID]['link'] = $menuInstance->Options[$i];
|
||||
} elseif ($menuInstance->Types[$i] == 'rootNode') {
|
||||
$menuCases[$currentBlockID]['blockItems'][$menuInstance->Id[$i]] = [
|
||||
'label' => $menuInstance->Labels[$i],
|
||||
'link' => $menuInstance->Options[$i],
|
||||
'icon' => (isset($menuInstance->Icons[$i]) && $menuInstance->Icons[$i] != '') ? $menuInstance->Icons[$i] : 'kcmdf.png'
|
||||
];
|
||||
|
||||
$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;
|
||||
} else {
|
||||
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]] = array(
|
||||
'label' => $oMenu->Labels[$i],
|
||||
'link' => $oMenu->Options[$i],
|
||||
'icon' => (isset($oMenu->Icons[$i]) && $oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'kcmdf.png'
|
||||
);
|
||||
$menuCases[$currentBlockID]['blockItems'][$menuInstance->Id[$i]] = [
|
||||
'label' => $menuInstance->Labels[$i],
|
||||
'link' => $menuInstance->Options[$i],
|
||||
'icon' => (isset($menuInstance->Icons[$i]) && $menuInstance->Icons[$i] != '') ? $menuInstance->Icons[$i] : 'kcmdf.png'
|
||||
];
|
||||
|
||||
if (isset($aTypesID[$oMenu->Id[$i]])) {
|
||||
$menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]]['cases_count'] = $aCount[$aTypesID[$oMenu->Id[$i]]]['count'];
|
||||
if (isset($typesId[$menuInstance->Id[$i]])) {
|
||||
$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
|
||||
//by cleaning any content prior to this function with ob_clean
|
||||
// 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
|
||||
ob_clean();
|
||||
echo $xml->asXML();
|
||||
die;
|
||||
@@ -134,7 +134,7 @@ function getLoadTreeMenuData()
|
||||
$menuBlockNode->addAttribute('url', $menuBlock['link']);
|
||||
}
|
||||
|
||||
// adding "menu_block" childs nodes
|
||||
// Adding "menu_block" child nodes
|
||||
foreach ($menuBlock['blockItems'] as $id => $menu) {
|
||||
if (! empty($menu['childs'])) {
|
||||
$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
|
||||
//by cleaning any content prior to this function with ob_clean
|
||||
// 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
|
||||
ob_clean();
|
||||
echo $xml->asXML();
|
||||
die;
|
||||
|
||||
@@ -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("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";
|
||||
|
||||
G::RenderPage("publish", "extJs");
|
||||
|
||||
@@ -56,7 +56,7 @@ class Lists
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->mapList = array(
|
||||
$this->mapList = [
|
||||
'ListInbox' => 'CASES_INBOX',
|
||||
'ListDraft' => 'CASES_DRAFT',
|
||||
'ListCanceled' => 'CASES_CANCELLED',
|
||||
@@ -66,8 +66,7 @@ class Lists
|
||||
/*----------------------------------********---------------------------------*/
|
||||
'ListConsolidated' => 'CONSOLIDATED_CASES',
|
||||
/*----------------------------------********---------------------------------*/
|
||||
'ListSelfService' => 'CASES_SELFSERVICE'
|
||||
);
|
||||
];
|
||||
|
||||
$this->ListInbox = new \ListInbox();
|
||||
$this->ListDraft = new \ListInbox();
|
||||
@@ -77,9 +76,13 @@ class Lists
|
||||
$this->ListCompleted = new \ListCompleted();
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$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();
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -150,8 +153,11 @@ class Lists
|
||||
$listpeer = 'ListMyInboxPeer';
|
||||
break;
|
||||
case 'unassigned':
|
||||
// If the feature for highlight the home folders is disabled, initialize the variables for unassigned list
|
||||
if (!HIGHLIGHT_HOME_FOLDER_ENABLE) {
|
||||
$list = new \ListUnassigned();
|
||||
$listpeer = 'ListUnassignedPeer';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ Ext.onReady(function(){
|
||||
}
|
||||
e.stopEvent();
|
||||
updateCasesTree();
|
||||
highlightCasesTree();
|
||||
}
|
||||
else
|
||||
Ext.Msg.alert(_('ID_REFRESH_LABEL'),_('ID_REFRESH_MESSAGE'));
|
||||
@@ -132,6 +133,7 @@ Ext.onReady(function(){
|
||||
if (defaultOption.indexOf('open') > -1) {
|
||||
//if it is, then update cases trees
|
||||
updateCasesTree();
|
||||
highlightCasesTree();
|
||||
}
|
||||
if (_nodeId !== '') {
|
||||
treePanel1 = Ext.getCmp('tree-panel');
|
||||
@@ -142,6 +144,7 @@ Ext.onReady(function(){
|
||||
node.select();
|
||||
if (_nodeId === 'CASES_START_CASE') {
|
||||
updateCasesTree();
|
||||
highlightCasesTree();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +180,8 @@ Ext.onReady(function(){
|
||||
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({
|
||||
proxy: new Ext.data.HttpProxy({url: 'debug_vars'}),
|
||||
@@ -499,9 +503,15 @@ Ext.onReady(function(){
|
||||
|
||||
// Get the counters the first time
|
||||
updateCasesTree();
|
||||
highlightCasesTree();
|
||||
|
||||
// FORMATS.casesListRefreshTime is in seconds
|
||||
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) {
|
||||
@@ -530,8 +540,6 @@ function updateCasesView(viewList) {
|
||||
function updateCasesTree() {
|
||||
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({
|
||||
url: urlProxy + Math.random(),
|
||||
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() {
|
||||
if (flagRefresh) {
|
||||
updateCasesTree();
|
||||
|
||||
@@ -1081,11 +1081,12 @@ Ext.onReady(function(){
|
||||
if (data.status == true) {
|
||||
// The case was cancelled
|
||||
parent.notify('', _("ID_CASE_CANCELLED", stringReplace("\\: ", "", _APP_NUM)));
|
||||
parent.updateCasesTree();
|
||||
parent.highlightCasesTree();
|
||||
} else {
|
||||
// The case wasn't cancel
|
||||
parent.notify('', data.msg);
|
||||
}
|
||||
parent.updateCasesTree();
|
||||
} catch (e) {
|
||||
parent.notify('', _('ID_SOMETHING_WRONG'));
|
||||
}
|
||||
@@ -1353,6 +1354,7 @@ Ext.onReady(function(){
|
||||
try {
|
||||
parent.notify('', data.msg);
|
||||
parent.updateCasesTree();
|
||||
parent.highlightCasesTree();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
@@ -1553,6 +1555,7 @@ Ext.onReady(function(){
|
||||
try {
|
||||
parent.notify('PAUSE CASE', req.result.msg);
|
||||
parent.updateCasesTree();
|
||||
parent.highlightCasesTree();
|
||||
}catch (e) {
|
||||
}
|
||||
location.href = urlToRedirectAfterPause;
|
||||
@@ -1592,6 +1595,7 @@ Ext.onReady(function(){
|
||||
try {
|
||||
parent.PMExt.notify(_('ID_UNPAUSE_ACTION'), data.msg);
|
||||
parent.updateCasesTree();
|
||||
parent.highlightCasesTree();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
@@ -1646,6 +1650,7 @@ Ext.onReady(function(){
|
||||
try {
|
||||
parent.PMExt.notify(_('ID_DELETE_ACTION'), data.msg);
|
||||
parent.updateCasesTree();
|
||||
parent.highlightCasesTree();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
$filter = new InputFilter();
|
||||
if (isset($_POST['NextStep'])) {
|
||||
$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">
|
||||
Processmaker - Debugger (Break Point)
|
||||
@@ -12,4 +13,3 @@ if (isset($_POST['NextStep'])) {
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -336,6 +336,11 @@ define('LOGS_MAX_FILES', $config['logs_max_files']);
|
||||
define('LOGS_LOCATION', $config['logs_location']);
|
||||
define('LOGGING_LEVEL', $config['logging_level']);
|
||||
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.
|
||||
$_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];
|
||||
|
||||
Reference in New Issue
Block a user