Se adicion cambio endPoint de listado por llamada Ajax
This commit is contained in:
@@ -11,71 +11,40 @@ if ($action == 'selfservice') {
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$urlProxy = '/api/1.0/' . SYS_SYS . '/lists/';
|
||||
$urlProxy = 'proxyNewCasesList';
|
||||
switch ($action) {
|
||||
case 'todo':
|
||||
case 'draft':
|
||||
$urlProxy .= 'inbox';
|
||||
$urlProxy .= '?list=inbox';
|
||||
break;
|
||||
case 'sent':
|
||||
$urlProxy .= 'participated';
|
||||
$urlProxy .= '?list=participated';
|
||||
break;
|
||||
case 'search':
|
||||
case 'participated-history':
|
||||
$urlProxy = 'proxyCasesList';
|
||||
break;
|
||||
case 'paused':
|
||||
$urlProxy .= 'paused';
|
||||
$urlProxy .= '?list=paused';
|
||||
break;
|
||||
case 'cancel':
|
||||
case 'canceled':
|
||||
$urlProxy .= 'canceled';
|
||||
$urlProxy .= '?list=canceled';
|
||||
break;
|
||||
case 'completed':
|
||||
$urlProxy .= 'completed';
|
||||
$urlProxy .= '?list=completed';
|
||||
break;
|
||||
case 'myinbox':
|
||||
case 'my-inbox':
|
||||
$urlProxy .= 'my-inbox';
|
||||
$urlProxy .= '?list=myInbox';
|
||||
break;
|
||||
case 'unassigned':
|
||||
$urlProxy = 'proxyCasesList';
|
||||
$action = 'unassigned';
|
||||
break;
|
||||
}
|
||||
|
||||
$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'];
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
|
||||
|
||||
G::LoadClass("BasePeer");
|
||||
G::LoadClass("configuration");
|
||||
//require_once ("classes/model/Fields.php");
|
||||
@@ -195,9 +164,6 @@ $oHeadPublisher->assign( 'reassignColumns', $reassignColumns ); //sending the co
|
||||
$oHeadPublisher->assign( 'action', $action ); //sending the action to make
|
||||
$oHeadPublisher->assign( 'urlProxy', $urlProxy ); //sending the urlProxy to make
|
||||
$oHeadPublisher->assign( 'caseListBuilder', $caseListBuilder ); //sending the caseListBuilder
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oHeadPublisher->assign( 'credentials', $clientToken ); //sending the SYS_SYS to make
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oHeadPublisher->assign( 'PMDateFormat', $dateFormat ); //sending the fields to get from proxy
|
||||
$oHeadPublisher->assign( 'statusValues', $status ); //Sending the listing of status
|
||||
$oHeadPublisher->assign( 'processValues', $processes ); //Sending the listing of processes
|
||||
|
||||
156
workflow/engine/methods/cases/proxyNewCasesList.php
Normal file
156
workflow/engine/methods/cases/proxyNewCasesList.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$_GET = $filter->xssFilterHard($_GET);
|
||||
$_REQUEST = $filter->xssFilterHard($_REQUEST);
|
||||
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
|
||||
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$responseObject = new stdclass();
|
||||
$responseObject->error = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
$responseObject->success = true;
|
||||
$responseObject->lostSession = true;
|
||||
print G::json_encode( $responseObject );
|
||||
die();
|
||||
}
|
||||
|
||||
try {
|
||||
$userUid = $_SESSION['USER_LOGGED'];
|
||||
$filters["paged"] = isset( $_REQUEST["paged"] ) ? $_REQUEST["paged"] : true;
|
||||
$filters['count'] = isset( $_REQUEST['count'] ) ? $_REQUEST['count'] : true;
|
||||
$filters["category"] = isset( $_REQUEST["category"] ) ? $_REQUEST["category"] : "";
|
||||
$filters["process"] = isset( $_REQUEST["process"] ) ? $_REQUEST["process"] : "";
|
||||
$filters["search"] = isset( $_REQUEST["search"] ) ? $_REQUEST["search"] : "";
|
||||
$filters["filter"] = isset( $_REQUEST["filter"] ) ? $_REQUEST["filter"] : "";
|
||||
$filters["dateFrom"] = (!empty( $_REQUEST["dateFrom"] )) ? substr( $_REQUEST["dateFrom"], 0, 10 ) : "";
|
||||
$filters["dateTo"] = (!empty( $_REQUEST["dateTo"] )) ? substr( $_REQUEST["dateTo"], 0, 10 ) : "";
|
||||
|
||||
$filters["start"] = isset( $_REQUEST["start"] ) ? $_REQUEST["start"] : "0";
|
||||
$filters["limit"] = isset( $_REQUEST["limit"] ) ? $_REQUEST["limit"] : "25";
|
||||
$filters["sort"] = isset( $_REQUEST["sort"] ) ? $_REQUEST["sort"] : "";
|
||||
$filters["dir"] = isset( $_REQUEST["dir"] ) ? $_REQUEST["dir"] : "DESC";
|
||||
|
||||
$filters["action"] = isset( $_REQUEST["action"] ) ? $_REQUEST["action"] : "";
|
||||
$listName = isset( $_REQUEST["list"] ) ? $_REQUEST["list"] : "inbox";
|
||||
|
||||
// Select list
|
||||
switch ($listName) {
|
||||
case 'inbox':
|
||||
$list = new ListInbox();
|
||||
$listpeer = 'ListInboxPeer';
|
||||
break;
|
||||
case 'participated_history':
|
||||
$list = new ListParticipatedHistory();
|
||||
$listpeer = 'ListParticipatedHistoryPeer';
|
||||
break;
|
||||
case 'participated':
|
||||
case 'participated_last':
|
||||
$list = new ListParticipatedLast();
|
||||
$listpeer = 'ListParticipatedLastPeer';
|
||||
break;
|
||||
case 'completed':
|
||||
$list = new ListCompleted();
|
||||
$listpeer = 'ListCompletedPeer';
|
||||
break;
|
||||
case 'paused':
|
||||
$list = new ListPaused();
|
||||
$listpeer = 'ListPausedPeer';
|
||||
break;
|
||||
case 'canceled':
|
||||
$list = new ListCanceled();
|
||||
$listpeer = 'ListCanceledPeer';
|
||||
break;
|
||||
case 'my_inbox':
|
||||
$list = new ListMyInbox();
|
||||
$listpeer = 'ListMyInboxPeer';
|
||||
break;
|
||||
case 'unassigned':
|
||||
$list = new ListUnassigned();
|
||||
$listpeer = 'ListUnassignedPeer';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Validate filters
|
||||
$filters["start"] = (int)$filters["start"];
|
||||
$filters["start"] = abs($filters["start"]);
|
||||
if ($filters["start"] != 0) {
|
||||
$filters["start"]+1;
|
||||
}
|
||||
|
||||
$filters["limit"] = (int)$filters["limit"];
|
||||
$filters["limit"] = abs($filters["limit"]);
|
||||
if ($filters["limit"] == 0) {
|
||||
G::LoadClass("configuration");
|
||||
$conf = new Configurations();
|
||||
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
if (isset($generalConfCasesList['casesListRowNumber'])) {
|
||||
$filters["limit"] = (int)$generalConfCasesList['casesListRowNumber'];
|
||||
} else {
|
||||
$filters["limit"] = 25;
|
||||
}
|
||||
} else {
|
||||
$filters["limit"] = (int)$filters["limit"];
|
||||
}
|
||||
|
||||
$filters["sort"] = G::toUpper($filters["sort"]);
|
||||
$columnsList = $listpeer::getFieldNames(BasePeer::TYPE_FIELDNAME);
|
||||
if (!(in_array($filters["sort"], $columnsList))) {
|
||||
$filters["sort"] = '';
|
||||
}
|
||||
|
||||
$filters["dir"] = G::toUpper($filters["dir"]);
|
||||
if (!($filters["dir"] == 'DESC' || $filters["dir"] == 'ASC')) {
|
||||
$filters["dir"] = 'DESC';
|
||||
}
|
||||
|
||||
$result = $list->loadList($userUid, $filters);
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$value) {
|
||||
if (isset($value['DEL_PREVIOUS_USR_UID'])) {
|
||||
$value['PREVIOUS_USR_UID'] = $value['DEL_PREVIOUS_USR_UID'];
|
||||
$value['PREVIOUS_USR_USERNAME'] = $value['DEL_PREVIOUS_USR_USERNAME'];
|
||||
$value['PREVIOUS_USR_FIRSTNAME'] = $value['DEL_PREVIOUS_USR_FIRSTNAME'];
|
||||
$value['PREVIOUS_USR_LASTNAME'] = $value['DEL_PREVIOUS_USR_LASTNAME'];
|
||||
}
|
||||
if (isset($value['DEL_DUE_DATE'])) {
|
||||
$value['DEL_TASK_DUE_DATE'] = $value['DEL_DUE_DATE'];
|
||||
}
|
||||
if (isset($value['APP_PAUSED_DATE'])) {
|
||||
$value['APP_UPDATE_DATE'] = $value['APP_PAUSED_DATE'];
|
||||
}
|
||||
if (isset($value['DEL_CURRENT_USR_USERNAME'])) {
|
||||
$value['USR_USERNAME'] = $value['DEL_CURRENT_USR_USERNAME'];
|
||||
$value['USR_FIRSTNAME'] = $value['DEL_CURRENT_USR_FIRSTNAME'];
|
||||
$value['USR_LASTNAME'] = $value['DEL_CURRENT_USR_LASTNAME'];
|
||||
$value['APP_UPDATE_DATE'] = $value['DEL_DELEGATE_DATE'];
|
||||
}
|
||||
if (isset($value['APP_STATUS'])) {
|
||||
$value['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$value['APP_STATUS']}" );
|
||||
}
|
||||
|
||||
//$value = array_change_key_case($value, CASE_LOWER);
|
||||
}
|
||||
}
|
||||
|
||||
$filtersData = array();
|
||||
$filtersData['start'] = $filters["start"];
|
||||
$filtersData['limit'] = $filters["limit"];
|
||||
$filtersData['sort'] = G::toLower($filters["sort"]);
|
||||
$filtersData['dir'] = G::toLower($filters["dir"]);
|
||||
$filtersData['cat_uid'] = $filters["category"];
|
||||
$filtersData['pro_uid'] = $filters["process"];
|
||||
$filtersData['search'] = $filters["search"];
|
||||
$filtersData['date_from'] = $filters["dateFrom"];
|
||||
$filtersData['date_to'] = $filters["dateTo"];
|
||||
$response['filters'] = $filtersData;
|
||||
$response['data'] = $result;
|
||||
$filtersData['action'] = $filters["action"];
|
||||
$response['totalCount'] = $list->countTotal($userUid, $filtersData);
|
||||
|
||||
echo G::json_encode($response);
|
||||
} catch (Exception $e) {
|
||||
$msg = array("error" => $e->getMessage());
|
||||
echo G::json_encode($msg);
|
||||
}
|
||||
|
||||
@@ -734,7 +734,6 @@ Ext.onReady ( function() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Create HttpProxy instance, all CRUD requests will be directed to single proxy url.
|
||||
if (caseListBuilder) {
|
||||
var proxyCasesList = new Ext.data.HttpProxy({
|
||||
@@ -747,13 +746,6 @@ Ext.onReady ( function() {
|
||||
api: {
|
||||
read : urlProxy
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
,method: 'GET'
|
||||
,headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + credentials.access_token
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,20 @@ leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress'
|
||||
}
|
||||
});
|
||||
|
||||
leimnud.event.add(document.getElementById('form[USER_ENV]'), 'keypress', function(event) {
|
||||
var key;
|
||||
if(window.event)
|
||||
key = window.event.keyCode; //IE
|
||||
else
|
||||
key = event.which; //firefox
|
||||
if(key == 13) {
|
||||
document.getElementById('form[BSUBMIT]').click();
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
|
||||
createCookie("pm_sys_sys", "{\"sys_sys\": \"" + getField("USER_ENV").value + "\"}", 365);
|
||||
|
||||
|
||||
@@ -48,6 +48,20 @@ leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress'
|
||||
}
|
||||
});
|
||||
|
||||
leimnud.event.add(document.getElementById('form[USER_ENV]'), 'keypress', function(event) {
|
||||
var key;
|
||||
if(window.event)
|
||||
key = window.event.keyCode; //IE
|
||||
else
|
||||
key = event.which; //firefox
|
||||
if(key == 13) {
|
||||
document.getElementById('form[BSUBMIT]').click();
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
|
||||
createCookie("pm_sys_sys", "{\"sys_sys\": \"" + getField("USER_ENV").value + "\"}", 365);
|
||||
|
||||
|
||||
@@ -894,6 +894,7 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
|
||||
$noLoginFiles[] = 'appFolderAjax';
|
||||
$noLoginFiles[] = 'steps_Ajax';
|
||||
$noLoginFiles[] = 'proxyCasesList';
|
||||
$noLoginFiles[] = 'proxyNewCasesList';
|
||||
$noLoginFiles[] = 'casesStartPage_Ajax';
|
||||
$noLoginFiles[] = 'appProxy';
|
||||
$noLoginFiles[] = 'cases_Ajax';
|
||||
|
||||
Reference in New Issue
Block a user