BUG 000 Case Notes improvements
This commit is contained in:
@@ -18,7 +18,7 @@ class HttpProxyController {
|
||||
*/
|
||||
private $__request__;
|
||||
|
||||
|
||||
private $sendResponse = true;
|
||||
/**
|
||||
* Magic setter method
|
||||
*
|
||||
@@ -99,7 +99,10 @@ class HttpProxyController {
|
||||
$result->exception->code = $e->getCode();
|
||||
$result->exception->trace = $e->getTraceAsString();
|
||||
}
|
||||
print G::json_encode($result);
|
||||
|
||||
if ($this->sendResponse) {
|
||||
print G::json_encode($result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,4 +118,14 @@ class HttpProxyController {
|
||||
} else
|
||||
$this->__request__ = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send response to client
|
||||
*
|
||||
* @param boolean $val
|
||||
*/
|
||||
public function setSendResponse($val)
|
||||
{
|
||||
$this->sendResponse = $val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,18 +67,6 @@ class AppNotes extends BaseAppNotes {
|
||||
|
||||
|
||||
function postNewNote($appUid, $usrUid, $noteContent, $notify=true, $noteAvalibility="PUBLIC", $noteRecipients="", $noteType="USER", $noteDate="now") {
|
||||
|
||||
if($noteRecipients==""){
|
||||
$noteRecipientsA=array();
|
||||
G::LoadClass('case');
|
||||
$oCase = new Cases ();
|
||||
|
||||
$p=$oCase->getUsersParticipatedInCase($appUid);
|
||||
foreach($p['array'] as $key => $userParticipated){
|
||||
$noteRecipientsA[]=$key;
|
||||
}
|
||||
$noteRecipients=implode(",",$noteRecipientsA);
|
||||
}
|
||||
|
||||
$this->setAppUid($appUid);
|
||||
$this->setUsrUid($usrUid);
|
||||
@@ -112,9 +100,18 @@ class AppNotes extends BaseAppNotes {
|
||||
$response['message'] = 'Saved...';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($notify){
|
||||
if ($notify) {
|
||||
if ($noteRecipients == "") {
|
||||
$noteRecipientsA = array();
|
||||
G::LoadClass('case');
|
||||
$oCase = new Cases ();
|
||||
|
||||
$p = $oCase->getUsersParticipatedInCase($appUid);
|
||||
foreach($p['array'] as $key => $userParticipated){
|
||||
$noteRecipientsA[]=$key;
|
||||
}
|
||||
$noteRecipients = implode(",", $noteRecipientsA);
|
||||
}
|
||||
|
||||
$this->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
|
||||
}
|
||||
@@ -122,7 +119,7 @@ class AppNotes extends BaseAppNotes {
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") {
|
||||
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") {
|
||||
try {
|
||||
require_once ('classes/model/Configuration.php');
|
||||
$oConfiguration = new Configuration();
|
||||
|
||||
100
workflow/engine/controllers/caseProxy.php
Normal file
100
workflow/engine/controllers/caseProxy.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -914,4 +914,24 @@ antes funcionaba.
|
||||
width:50px;
|
||||
display:block;
|
||||
clear:none;
|
||||
}
|
||||
}
|
||||
|
||||
.x-pm-startcase-btn {
|
||||
background-image:url(/images/notes.png) !important;
|
||||
color: #000 !important;
|
||||
padding-left: 2px !important;
|
||||
padding-right: 2px !important;
|
||||
padding-top: 30px !important;
|
||||
padding-bottom: 5px !important;
|
||||
font: 12px "Lucida Grande",Lucida,Verdana,sans-serif !important;
|
||||
}
|
||||
|
||||
.x-toolbar1 .x-btn-tl { background-position: 0 0; }
|
||||
.x-toolbar1 .x-btn-tr { background-position: -3px 0; }
|
||||
.x-toolbar1 .x-btn-tc { background-position: 0 -6px; }
|
||||
.x-toolbar1 .x-btn-ml { background-position: 0 -24px; }
|
||||
.x-toolbar1 .x-btn-mr { background-position: -3px -24px; }
|
||||
.x-toolbar1 .x-btn-mc { background-position: 0 -1096px; }
|
||||
.x-toolbar1 .x-btn-bl { background-position: 0 -3px; }
|
||||
.x-toolbar1 .x-btn-br { background-position: -3px -3px; }
|
||||
.x-toolbar1 .x-btn-bc { background-position: 0 -15px; }
|
||||
@@ -5,14 +5,13 @@ function closeCaseNotesWindow(){
|
||||
}
|
||||
|
||||
function openCaseNotesWindow(appUid,modalSw){
|
||||
|
||||
if(!appUid) appUid="";
|
||||
|
||||
var startRecord=0;
|
||||
var loadSize=10;
|
||||
|
||||
var storeNotes = new Ext.data.JsonStore({
|
||||
url : 'caseNotesAjax.php?action=getNotesList&appUid='+appUid,
|
||||
url : '../caseProxy/getNotesList?appUid='+appUid,
|
||||
root: 'notes',
|
||||
totalProperty: 'totalCount',
|
||||
fields: ['USR_USERNAME','NOTE_DATE','NOTE_CONTENT'],
|
||||
@@ -108,7 +107,6 @@ function openCaseNotesWindow(appUid,modalSw){
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
var caseNotesWindow;
|
||||
caseNotesWindow = new Ext.Window({
|
||||
title: _('ID_CASES_NOTES'), //Title of the Window
|
||||
@@ -117,7 +115,7 @@ caseNotesWindow = new Ext.Window({
|
||||
resizable: true, //Resize of the Window, if false - it cannot be resized
|
||||
closable: true, //Hide close button of the Window
|
||||
modal: modalSw, //When modal:true it make the window modal and mask everything behind it when displayed
|
||||
iconCls: 'ICON_CASES_NOTES',
|
||||
//iconCls: 'ICON_CASES_NOTES',
|
||||
autoCreate: true,
|
||||
height:400,
|
||||
shadow:true,
|
||||
@@ -144,11 +142,11 @@ caseNotesWindow = new Ext.Window({
|
||||
new Ext.ux.StatusBar({
|
||||
defaultText : _('ID_NOTES_READY'),
|
||||
id : 'notesStatusPanel',
|
||||
defaultIconCls: 'ICON_CASES_NOTES',
|
||||
//defaultIconCls: 'ICON_CASES_NOTES',
|
||||
|
||||
// values to set initially:
|
||||
text: _('ID_NOTES_READY'),
|
||||
iconCls: 'ready-icon',
|
||||
//iconCls: 'ready-icon',
|
||||
statusAlign: 'left',
|
||||
|
||||
// any standard Toolbar items:
|
||||
@@ -163,29 +161,34 @@ caseNotesWindow = new Ext.Window({
|
||||
name:'caseNoteText',
|
||||
hideLabel: true,
|
||||
blankText:_('ID_CASES_NOTES_POST'),
|
||||
//anchor:'95%',
|
||||
anchor: '100% -53',
|
||||
width:200,
|
||||
//autoWidth:true,
|
||||
grow:true,
|
||||
selectOnFocus:true,
|
||||
maxLenght:150,
|
||||
//preventMark:true,
|
||||
allowBlank:false
|
||||
//multiline:true
|
||||
},' ',{
|
||||
text:' '+_('ID_SUBMIT_NOTE'),
|
||||
iconCls: 'ICON_CASES_NOTES',
|
||||
handler:function() {
|
||||
allowBlank:true
|
||||
},
|
||||
' ',
|
||||
{
|
||||
cls: 'x-toolbar1',
|
||||
text: _('ID_SUBMIT_NOTE'),
|
||||
iconCls: 'x-pm-startcase-btn',
|
||||
scale: 'large',
|
||||
stype:'button',
|
||||
iconAlign: 'top',
|
||||
handler: function(){
|
||||
var noteText = Ext.getCmp('caseNoteText').getValue();
|
||||
if(noteText=="") return false;
|
||||
|
||||
if (noteText == "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
Ext.getCmp('caseNoteText').focus();
|
||||
Ext.getCmp('caseNoteText').reset();
|
||||
statusBarMessage( _('ID_CASES_NOTE_POSTING'), true);
|
||||
Ext.Ajax.request({
|
||||
url : 'caseNotesAjax' ,
|
||||
url : '../caseProxy/postNote' ,
|
||||
params : {
|
||||
action : 'postNote',
|
||||
appUid:appUid,
|
||||
noteText:noteText
|
||||
},
|
||||
@@ -205,7 +208,6 @@ caseNotesWindow = new Ext.Window({
|
||||
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}],
|
||||
listeners:{
|
||||
@@ -241,15 +243,16 @@ function statusBarMessage( msg, isLoading, success ) {
|
||||
if( success ) {
|
||||
statusBar.setStatus({
|
||||
text: '' + msg,
|
||||
iconCls: 'success',
|
||||
//iconCls: 'success',
|
||||
clear: true
|
||||
});
|
||||
} else {
|
||||
statusBar.setStatus({
|
||||
text: 'Error: ' + msg,
|
||||
iconCls: 'error',
|
||||
//iconCls: 'error',
|
||||
clear: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
workflow/public_html/images/notes.png
Normal file
BIN
workflow/public_html/images/notes.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Reference in New Issue
Block a user