R-1055
Case counters are not working on Single Sign On Server HOR-1055 Case counters are not working on Single Sign On Server HOR-1055 Case counters are not working on Single Sign On Server
This commit is contained in:
@@ -12,6 +12,11 @@ switch ($action) {
|
|||||||
case 'getProcess':
|
case 'getProcess':
|
||||||
getProcess();
|
getProcess();
|
||||||
break;
|
break;
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
|
case 'getAllCountersEnterprise':
|
||||||
|
getAllCountersEnterprise();
|
||||||
|
break;
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
default: //this is the starting call
|
default: //this is the starting call
|
||||||
getLoadTreeMenuData();
|
getLoadTreeMenuData();
|
||||||
break;
|
break;
|
||||||
@@ -271,6 +276,20 @@ function getProcess ()
|
|||||||
echo G::json_encode( $response );
|
echo G::json_encode( $response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
|
function getAllCountersEnterprise()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$userUid = (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
||||||
|
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||||
|
$response = $lists->getCounters($userUid);
|
||||||
|
echo G::json_encode($response);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new Exception($e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
function getAllCounters ()
|
function getAllCounters ()
|
||||||
{
|
{
|
||||||
$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
||||||
|
|||||||
@@ -124,53 +124,19 @@ if ($oServerConf->isRtl( SYS_LANG )) {
|
|||||||
|
|
||||||
$urlProxy = 'casesMenuLoader?action=getAllCounters&r=';
|
$urlProxy = 'casesMenuLoader?action=getAllCounters&r=';
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/system/counters-lists?r=';
|
$urlProxy = 'casesMenuLoader?action=getAllCountersEnterprise&r=';
|
||||||
$clientId = 'x-pm-local-client';
|
|
||||||
$client = getClientCredentials($clientId);
|
|
||||||
$authCode = getAuthorizationCode($client);
|
|
||||||
$debug = false; //System::isDebugMode();
|
|
||||||
|
|
||||||
$loader = Maveriks\Util\ClassLoader::getInstance();
|
|
||||||
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
|
|
||||||
|
|
||||||
$request = array(
|
|
||||||
'grant_type' => 'authorization_code',
|
|
||||||
'code' => $authCode
|
|
||||||
);
|
|
||||||
$server = array(
|
|
||||||
'REQUEST_METHOD' => 'POST'
|
|
||||||
);
|
|
||||||
$headers = array(
|
|
||||||
"PHP_AUTH_USER" => $client['CLIENT_ID'],
|
|
||||||
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
|
|
||||||
"Content-Type" => "multipart/form-data;",
|
|
||||||
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
|
|
||||||
);
|
|
||||||
|
|
||||||
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
|
|
||||||
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
|
||||||
$response = $oauthServer->postToken($request, true);
|
|
||||||
|
|
||||||
$clientToken = $response->getParameters();
|
|
||||||
$clientToken["client_id"] = $client['CLIENT_ID'];
|
|
||||||
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
|
$oHeadPublisher->assign('regionTreePanel', $regionTreePanel);
|
||||||
$oHeadPublisher->assign( 'regionTreePanel', $regionTreePanel );
|
$oHeadPublisher->assign('regionDebug', $regionDebug);
|
||||||
$oHeadPublisher->assign( 'regionDebug', $regionDebug );
|
$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions
|
||||||
$oHeadPublisher->assign( "defaultOption", $defaultOption ); //User menu permissions
|
$oHeadPublisher->assign('urlProxy', $urlProxy); //sending the urlProxy to make
|
||||||
$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());
|
||||||
$oHeadPublisher->assign( 'credentials', $clientToken );
|
|
||||||
/*----------------------------------********---------------------------------*/
|
|
||||||
$oHeadPublisher->assign( "_nodeId", isset( $confDefaultOption ) ? $confDefaultOption : "PM_USERS" ); //User menu permissions
|
|
||||||
$oHeadPublisher->assign( "FORMATS", $conf->getFormats() );
|
|
||||||
|
|
||||||
$_SESSION["current_ux"] = "NORMAL";
|
$_SESSION["current_ux"] = "NORMAL";
|
||||||
|
|
||||||
G::RenderPage( "publish", "extJs" );
|
G::RenderPage("publish", "extJs");
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
function getClientCredentials($clientId)
|
function getClientCredentials($clientId)
|
||||||
|
|||||||
@@ -566,51 +566,42 @@ function updateCasesView(viewList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateCasesTree() {
|
function updateCasesTree() {
|
||||||
//treeMenuItems.root.reload();
|
|
||||||
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');
|
itemsTypes = Array('CASES_INBOX', 'CASES_DRAFT', 'CASES_CANCELLED', 'CASES_SENT', 'CASES_PAUSED', 'CASES_COMPLETED', 'CASES_SELFSERVICE');
|
||||||
if(currentSelectedTreeMenuItem){
|
if (currentSelectedTreeMenuItem) {
|
||||||
ReloadTreeMenuItemDetail({item:currentSelectedTreeMenuItem});
|
ReloadTreeMenuItemDetail({item: currentSelectedTreeMenuItem});
|
||||||
}
|
}
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: urlProxy + Math.random(),
|
url: urlProxy + Math.random(),
|
||||||
/*----------------------------------********---------------------------------*/
|
success: function (response) {
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': 'Bearer ' + credentials.access_token
|
|
||||||
},
|
|
||||||
method: 'GET',
|
|
||||||
/*----------------------------------********---------------------------------*/
|
|
||||||
success: function(response){
|
|
||||||
result = Ext.util.JSON.decode(response.responseText);
|
result = Ext.util.JSON.decode(response.responseText);
|
||||||
|
|
||||||
for(i=0; i<result.length; i++){
|
for (i = 0; i < result.length; i++) {
|
||||||
if( document.getElementById('NOTIFIER_'+result[i].item ) ){
|
if (document.getElementById('NOTIFIER_' + result[i].item)) {
|
||||||
oldValue = document.getElementById('NOTIFIER_'+result[i].item).innerHTML;
|
oldValue = document.getElementById('NOTIFIER_' + result[i].item).innerHTML;
|
||||||
oldValue = oldValue.replace('<b>', '');
|
oldValue = oldValue.replace('<b>', '');
|
||||||
oldValue = oldValue.replace('</b>', '');
|
oldValue = oldValue.replace('</b>', '');
|
||||||
|
|
||||||
newValue = result[i].count;
|
newValue = result[i].count;
|
||||||
|
|
||||||
if( oldValue != newValue && oldValue != 0 ){
|
if (oldValue != newValue && oldValue != 0) {
|
||||||
document.getElementById('NOTIFIER_'+result[i].item).innerHTML = '<b>' + result[i].count + '</b>';
|
document.getElementById('NOTIFIER_' + result[i].item).innerHTML = '<b>' + result[i].count + '</b>';
|
||||||
//NOTIFIER_FLAG = true;
|
//NOTIFIER_FLAG = true;
|
||||||
} else {
|
} else {
|
||||||
//if(NOTIFIER_FLAG === false){
|
//if(NOTIFIER_FLAG === false){
|
||||||
document.getElementById('NOTIFIER_'+result[i].item).innerHTML = result[i].count;
|
document.getElementById('NOTIFIER_' + result[i].item).innerHTML = result[i].count;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else continue;
|
else continue;
|
||||||
}
|
}
|
||||||
document.getElementById('refreshNotifiers').src = '/images/refresh.gif';
|
document.getElementById('refreshNotifiers').src = '/images/refresh.gif';
|
||||||
|
|
||||||
},
|
},
|
||||||
failure: function(){},
|
failure: function () {
|
||||||
|
},
|
||||||
params: {'updateCasesTree': true}
|
params: {'updateCasesTree': true}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setFlag = function (val) {
|
setFlag = function (val) {
|
||||||
|
|||||||
Reference in New Issue
Block a user