BUG 0000 Movig old notes proxy controller to appProxy.php
This commit is contained in:
@@ -8,6 +8,97 @@
|
|||||||
|
|
||||||
class AppProxy extends HttpProxyController
|
class AppProxy extends HttpProxyController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Get Notes List
|
||||||
|
* @param int $httpData->start
|
||||||
|
* @param int $httpData->limit
|
||||||
|
* @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION'])
|
||||||
|
* @return array containg the case notes
|
||||||
|
*/
|
||||||
|
function getNotesList($httpData)
|
||||||
|
{
|
||||||
|
require_once ( "classes/model/AppNotes.php" );
|
||||||
|
$appUid = null;
|
||||||
|
|
||||||
|
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
|
||||||
|
$appUid = $httpData->appUid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isset($_SESSION['APPLICATION'])) {
|
||||||
|
$appUid = $_SESSION['APPLICATION'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($appUid)) {
|
||||||
|
throw new Exception('Can\'t resolve the Apllication ID for this request.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
|
||||||
|
$appNotes = new AppNotes();
|
||||||
|
$response = $appNotes->getNotesList($appUid, $usrUid, $httpData->start, $httpData->limit);
|
||||||
|
|
||||||
|
return $response['array'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* post Note Action
|
||||||
|
* @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
|
||||||
|
* @return array containg the case notes
|
||||||
|
*/
|
||||||
|
function postNote($httpData)
|
||||||
|
{
|
||||||
|
//extract(getExtJSParams());
|
||||||
|
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
|
||||||
|
$appUid = $httpData->appUid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$appUid = $_SESSION['APPLICATION'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($appUid)) {
|
||||||
|
throw new Exception('Can\'t resolve the Apllication ID for this request.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : "";
|
||||||
|
require_once ( "classes/model/AppNotes.php" );
|
||||||
|
|
||||||
|
$appNotes = new AppNotes();
|
||||||
|
$noteContent = addslashes($httpData->noteText);
|
||||||
|
|
||||||
|
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
|
||||||
|
|
||||||
|
// Disabling the controller response because we handle a special behavior
|
||||||
|
$this->setSendResponse(false);
|
||||||
|
|
||||||
|
//send the response to client
|
||||||
|
@ini_set('implicit_flush', 1);
|
||||||
|
ob_start();
|
||||||
|
echo G::json_encode($result);
|
||||||
|
@ob_flush();
|
||||||
|
@flush();
|
||||||
|
@ob_end_flush();
|
||||||
|
ob_implicit_flush(1);
|
||||||
|
|
||||||
|
//send notification in background
|
||||||
|
$noteRecipientsList = array();
|
||||||
|
G::LoadClass('case');
|
||||||
|
$oCase = new Cases();
|
||||||
|
|
||||||
|
$p = $oCase->getUsersParticipatedInCase($appUid);
|
||||||
|
foreach($p['array'] as $key => $userParticipated){
|
||||||
|
$noteRecipientsList[] = $key;
|
||||||
|
}
|
||||||
|
$noteRecipients = implode(",", $noteRecipientsList);
|
||||||
|
|
||||||
|
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* request to open the case summary
|
||||||
|
* @param string $httpData->appUid
|
||||||
|
* @param string $httpData->delIndex
|
||||||
|
* @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid
|
||||||
|
*/
|
||||||
function requestOpenSummary($httpData)
|
function requestOpenSummary($httpData)
|
||||||
{
|
{
|
||||||
global $RBAC;
|
global $RBAC;
|
||||||
@@ -42,6 +133,12 @@ class AppProxy extends HttpProxyController
|
|||||||
$_SESSION['_processData'] = $processData;
|
$_SESSION['_processData'] = $processData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the case summary data
|
||||||
|
* @param string $httpData->appUid
|
||||||
|
* @param string $httpData->delIndex
|
||||||
|
* @return array containg the case summary data
|
||||||
|
*/
|
||||||
function getSummary($httpData)
|
function getSummary($httpData)
|
||||||
{
|
{
|
||||||
$labels = array();
|
$labels = array();
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Case HttpProxyController
|
|
||||||
*/
|
|
||||||
class caseProxy extends HttpProxyController
|
|
||||||
{
|
|
||||||
|
|
||||||
function sendJsonResultGeneric($response, $callback)
|
|
||||||
{
|
|
||||||
header("Content-Type: application/json");
|
|
||||||
$finalResponse = json_encode($response);
|
|
||||||
if ($callback != '') {
|
|
||||||
print $callback . "($finalResponse);";
|
|
||||||
} else {
|
|
||||||
print $finalResponse;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Notes List
|
|
||||||
* @param int $httpData->start
|
|
||||||
* @param int $httpData->limit
|
|
||||||
* @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION'])
|
|
||||||
* @return array containg the case notes
|
|
||||||
*/
|
|
||||||
function getNotesList($httpData)
|
|
||||||
{
|
|
||||||
require_once ( "classes/model/AppNotes.php" );
|
|
||||||
$appUid = null;
|
|
||||||
|
|
||||||
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
|
|
||||||
$appUid = $httpData->appUid;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (isset($_SESSION['APPLICATION'])) {
|
|
||||||
$appUid = $_SESSION['APPLICATION'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($appUid)) {
|
|
||||||
throw new Exception('Can\'t resolve the Apllication ID for this request.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
|
|
||||||
$appNotes = new AppNotes();
|
|
||||||
$response = $appNotes->getNotesList($appUid, $usrUid, $httpData->start, $httpData->limit);
|
|
||||||
|
|
||||||
return $response['array'];
|
|
||||||
}
|
|
||||||
|
|
||||||
function postNote($httpData)
|
|
||||||
{
|
|
||||||
//extract(getExtJSParams());
|
|
||||||
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
|
|
||||||
$appUid = $httpData->appUid;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$appUid = $_SESSION['APPLICATION'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($appUid)) {
|
|
||||||
throw new Exception('Can\'t resolve the Apllication ID for this request.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : "";
|
|
||||||
require_once ( "classes/model/AppNotes.php" );
|
|
||||||
|
|
||||||
$appNotes = new AppNotes();
|
|
||||||
$noteContent = addslashes($httpData->noteText);
|
|
||||||
|
|
||||||
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
|
|
||||||
|
|
||||||
// Disabling the controller response because we handle a special behavior
|
|
||||||
$this->setSendResponse(false);
|
|
||||||
|
|
||||||
//send the response to client
|
|
||||||
@ini_set('implicit_flush', 1);
|
|
||||||
ob_start();
|
|
||||||
echo G::json_encode($result);
|
|
||||||
@ob_flush();
|
|
||||||
@flush();
|
|
||||||
@ob_end_flush();
|
|
||||||
ob_implicit_flush(1);
|
|
||||||
|
|
||||||
//send notification in background
|
|
||||||
$noteRecipientsList = array();
|
|
||||||
G::LoadClass('case');
|
|
||||||
$oCase = new Cases();
|
|
||||||
|
|
||||||
$p = $oCase->getUsersParticipatedInCase($appUid);
|
|
||||||
foreach($p['array'] as $key => $userParticipated){
|
|
||||||
$noteRecipientsList[] = $key;
|
|
||||||
}
|
|
||||||
$noteRecipients = implode(",", $noteRecipientsList);
|
|
||||||
|
|
||||||
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ function openCaseNotesWindow(appUid,modalSw){
|
|||||||
var loadSize=10;
|
var loadSize=10;
|
||||||
|
|
||||||
var storeNotes = new Ext.data.JsonStore({
|
var storeNotes = new Ext.data.JsonStore({
|
||||||
url : '../caseProxy/getNotesList?appUid='+appUid,
|
url : '../appProxy/getNotesList?appUid='+appUid,
|
||||||
root: 'notes',
|
root: 'notes',
|
||||||
totalProperty: 'totalCount',
|
totalProperty: 'totalCount',
|
||||||
fields: ['USR_USERNAME','USR_FIRSTNAME','USR_LASTNAME','USR_FULL_NAME','NOTE_DATE','NOTE_CONTENT'],
|
fields: ['USR_USERNAME','USR_FIRSTNAME','USR_LASTNAME','USR_FULL_NAME','NOTE_DATE','NOTE_CONTENT'],
|
||||||
@@ -219,7 +219,7 @@ caseNotesWindow = new Ext.Window({
|
|||||||
Ext.getCmp('caseNoteText').reset();
|
Ext.getCmp('caseNoteText').reset();
|
||||||
statusBarMessage( _('ID_CASES_NOTE_POSTING'), true);
|
statusBarMessage( _('ID_CASES_NOTE_POSTING'), true);
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url : '../caseProxy/postNote' ,
|
url : '../appProxy/postNote' ,
|
||||||
params : {
|
params : {
|
||||||
appUid:appUid,
|
appUid:appUid,
|
||||||
noteText:noteText
|
noteText:noteText
|
||||||
|
|||||||
Reference in New Issue
Block a user