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':
|
||||
getProcess();
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'getAllCountersEnterprise':
|
||||
getAllCountersEnterprise();
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
default: //this is the starting call
|
||||
getLoadTreeMenuData();
|
||||
break;
|
||||
@@ -271,6 +276,20 @@ function getProcess ()
|
||||
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 ()
|
||||
{
|
||||
$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 = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/system/counters-lists?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'];
|
||||
$urlProxy = 'casesMenuLoader?action=getAllCountersEnterprise&r=';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
|
||||
$oHeadPublisher->assign( 'regionTreePanel', $regionTreePanel );
|
||||
$oHeadPublisher->assign( 'regionDebug', $regionDebug );
|
||||
$oHeadPublisher->assign( "defaultOption", $defaultOption ); //User menu permissions
|
||||
$oHeadPublisher->assign( 'urlProxy', $urlProxy ); //sending the urlProxy to make
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oHeadPublisher->assign( 'credentials', $clientToken );
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oHeadPublisher->assign( "_nodeId", isset( $confDefaultOption ) ? $confDefaultOption : "PM_USERS" ); //User menu permissions
|
||||
$oHeadPublisher->assign( "FORMATS", $conf->getFormats() );
|
||||
$oHeadPublisher->assign('regionTreePanel', $regionTreePanel);
|
||||
$oHeadPublisher->assign('regionDebug', $regionDebug);
|
||||
$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions
|
||||
$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());
|
||||
|
||||
$_SESSION["current_ux"] = "NORMAL";
|
||||
|
||||
G::RenderPage( "publish", "extJs" );
|
||||
|
||||
G::RenderPage("publish", "extJs");
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
function getClientCredentials($clientId)
|
||||
|
||||
@@ -566,51 +566,42 @@ function updateCasesView(viewList) {
|
||||
}
|
||||
|
||||
function updateCasesTree() {
|
||||
//treeMenuItems.root.reload();
|
||||
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');
|
||||
if(currentSelectedTreeMenuItem){
|
||||
ReloadTreeMenuItemDetail({item:currentSelectedTreeMenuItem});
|
||||
itemsTypes = Array('CASES_INBOX', 'CASES_DRAFT', 'CASES_CANCELLED', 'CASES_SENT', 'CASES_PAUSED', 'CASES_COMPLETED', 'CASES_SELFSERVICE');
|
||||
if (currentSelectedTreeMenuItem) {
|
||||
ReloadTreeMenuItemDetail({item: currentSelectedTreeMenuItem});
|
||||
}
|
||||
Ext.Ajax.request({
|
||||
url: urlProxy + Math.random(),
|
||||
/*----------------------------------********---------------------------------*/
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + credentials.access_token
|
||||
},
|
||||
method: 'GET',
|
||||
/*----------------------------------********---------------------------------*/
|
||||
success: function(response){
|
||||
success: function (response) {
|
||||
result = Ext.util.JSON.decode(response.responseText);
|
||||
|
||||
for(i=0; i<result.length; i++){
|
||||
if( document.getElementById('NOTIFIER_'+result[i].item ) ){
|
||||
oldValue = document.getElementById('NOTIFIER_'+result[i].item).innerHTML;
|
||||
for (i = 0; i < result.length; i++) {
|
||||
if (document.getElementById('NOTIFIER_' + result[i].item)) {
|
||||
oldValue = document.getElementById('NOTIFIER_' + result[i].item).innerHTML;
|
||||
oldValue = oldValue.replace('<b>', '');
|
||||
oldValue = oldValue.replace('</b>', '');
|
||||
|
||||
newValue = result[i].count;
|
||||
|
||||
if( oldValue != newValue && oldValue != 0 ){
|
||||
document.getElementById('NOTIFIER_'+result[i].item).innerHTML = '<b>' + result[i].count + '</b>';
|
||||
if (oldValue != newValue && oldValue != 0) {
|
||||
document.getElementById('NOTIFIER_' + result[i].item).innerHTML = '<b>' + result[i].count + '</b>';
|
||||
//NOTIFIER_FLAG = true;
|
||||
} else {
|
||||
//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;
|
||||
}
|
||||
document.getElementById('refreshNotifiers').src = '/images/refresh.gif';
|
||||
|
||||
},
|
||||
failure: function(){},
|
||||
failure: function () {
|
||||
},
|
||||
params: {'updateCasesTree': true}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
setFlag = function (val) {
|
||||
|
||||
Reference in New Issue
Block a user