BUG 000 Case Notes improvements
This commit is contained in:
@@ -18,7 +18,7 @@ class HttpProxyController {
|
|||||||
*/
|
*/
|
||||||
private $__request__;
|
private $__request__;
|
||||||
|
|
||||||
|
private $sendResponse = true;
|
||||||
/**
|
/**
|
||||||
* Magic setter method
|
* Magic setter method
|
||||||
*
|
*
|
||||||
@@ -99,7 +99,10 @@ class HttpProxyController {
|
|||||||
$result->exception->code = $e->getCode();
|
$result->exception->code = $e->getCode();
|
||||||
$result->exception->trace = $e->getTraceAsString();
|
$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
|
} else
|
||||||
$this->__request__ = $data;
|
$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") {
|
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->setAppUid($appUid);
|
||||||
$this->setUsrUid($usrUid);
|
$this->setUsrUid($usrUid);
|
||||||
@@ -112,9 +100,18 @@ class AppNotes extends BaseAppNotes {
|
|||||||
$response['message'] = 'Saved...';
|
$response['message'] = 'Saved...';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($notify) {
|
||||||
|
if ($noteRecipients == "") {
|
||||||
if($notify){
|
$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);
|
$this->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
|
||||||
}
|
}
|
||||||
@@ -122,7 +119,7 @@ class AppNotes extends BaseAppNotes {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") {
|
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") {
|
||||||
try {
|
try {
|
||||||
require_once ('classes/model/Configuration.php');
|
require_once ('classes/model/Configuration.php');
|
||||||
$oConfiguration = new Configuration();
|
$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;
|
width:50px;
|
||||||
display:block;
|
display:block;
|
||||||
clear:none;
|
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){
|
function openCaseNotesWindow(appUid,modalSw){
|
||||||
|
|
||||||
if(!appUid) appUid="";
|
if(!appUid) appUid="";
|
||||||
|
|
||||||
var startRecord=0;
|
var startRecord=0;
|
||||||
var loadSize=10;
|
var loadSize=10;
|
||||||
|
|
||||||
var storeNotes = new Ext.data.JsonStore({
|
var storeNotes = new Ext.data.JsonStore({
|
||||||
url : 'caseNotesAjax.php?action=getNotesList&appUid='+appUid,
|
url : '../caseProxy/getNotesList?appUid='+appUid,
|
||||||
root: 'notes',
|
root: 'notes',
|
||||||
totalProperty: 'totalCount',
|
totalProperty: 'totalCount',
|
||||||
fields: ['USR_USERNAME','NOTE_DATE','NOTE_CONTENT'],
|
fields: ['USR_USERNAME','NOTE_DATE','NOTE_CONTENT'],
|
||||||
@@ -108,7 +107,6 @@ function openCaseNotesWindow(appUid,modalSw){
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var caseNotesWindow;
|
var caseNotesWindow;
|
||||||
caseNotesWindow = new Ext.Window({
|
caseNotesWindow = new Ext.Window({
|
||||||
title: _('ID_CASES_NOTES'), //Title of the 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
|
resizable: true, //Resize of the Window, if false - it cannot be resized
|
||||||
closable: true, //Hide close button of the Window
|
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
|
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,
|
autoCreate: true,
|
||||||
height:400,
|
height:400,
|
||||||
shadow:true,
|
shadow:true,
|
||||||
@@ -144,11 +142,11 @@ caseNotesWindow = new Ext.Window({
|
|||||||
new Ext.ux.StatusBar({
|
new Ext.ux.StatusBar({
|
||||||
defaultText : _('ID_NOTES_READY'),
|
defaultText : _('ID_NOTES_READY'),
|
||||||
id : 'notesStatusPanel',
|
id : 'notesStatusPanel',
|
||||||
defaultIconCls: 'ICON_CASES_NOTES',
|
//defaultIconCls: 'ICON_CASES_NOTES',
|
||||||
|
|
||||||
// values to set initially:
|
// values to set initially:
|
||||||
text: _('ID_NOTES_READY'),
|
text: _('ID_NOTES_READY'),
|
||||||
iconCls: 'ready-icon',
|
//iconCls: 'ready-icon',
|
||||||
statusAlign: 'left',
|
statusAlign: 'left',
|
||||||
|
|
||||||
// any standard Toolbar items:
|
// any standard Toolbar items:
|
||||||
@@ -163,29 +161,34 @@ caseNotesWindow = new Ext.Window({
|
|||||||
name:'caseNoteText',
|
name:'caseNoteText',
|
||||||
hideLabel: true,
|
hideLabel: true,
|
||||||
blankText:_('ID_CASES_NOTES_POST'),
|
blankText:_('ID_CASES_NOTES_POST'),
|
||||||
//anchor:'95%',
|
|
||||||
anchor: '100% -53',
|
anchor: '100% -53',
|
||||||
width:200,
|
width:200,
|
||||||
//autoWidth:true,
|
|
||||||
grow:true,
|
grow:true,
|
||||||
selectOnFocus:true,
|
selectOnFocus:true,
|
||||||
maxLenght:150,
|
maxLenght:150,
|
||||||
//preventMark:true,
|
allowBlank:true
|
||||||
allowBlank:false
|
},
|
||||||
//multiline:true
|
' ',
|
||||||
},' ',{
|
{
|
||||||
text:' '+_('ID_SUBMIT_NOTE'),
|
cls: 'x-toolbar1',
|
||||||
iconCls: 'ICON_CASES_NOTES',
|
text: _('ID_SUBMIT_NOTE'),
|
||||||
handler:function() {
|
iconCls: 'x-pm-startcase-btn',
|
||||||
|
scale: 'large',
|
||||||
|
stype:'button',
|
||||||
|
iconAlign: 'top',
|
||||||
|
handler: function(){
|
||||||
var noteText = Ext.getCmp('caseNoteText').getValue();
|
var noteText = Ext.getCmp('caseNoteText').getValue();
|
||||||
if(noteText=="") return false;
|
|
||||||
|
if (noteText == "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Ext.getCmp('caseNoteText').focus();
|
Ext.getCmp('caseNoteText').focus();
|
||||||
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 : 'caseNotesAjax' ,
|
url : '../caseProxy/postNote' ,
|
||||||
params : {
|
params : {
|
||||||
action : 'postNote',
|
|
||||||
appUid:appUid,
|
appUid:appUid,
|
||||||
noteText:noteText
|
noteText:noteText
|
||||||
},
|
},
|
||||||
@@ -205,7 +208,6 @@ caseNotesWindow = new Ext.Window({
|
|||||||
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText);
|
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
listeners:{
|
listeners:{
|
||||||
@@ -241,15 +243,16 @@ function statusBarMessage( msg, isLoading, success ) {
|
|||||||
if( success ) {
|
if( success ) {
|
||||||
statusBar.setStatus({
|
statusBar.setStatus({
|
||||||
text: '' + msg,
|
text: '' + msg,
|
||||||
iconCls: 'success',
|
//iconCls: 'success',
|
||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
statusBar.setStatus({
|
statusBar.setStatus({
|
||||||
text: 'Error: ' + msg,
|
text: 'Error: ' + msg,
|
||||||
iconCls: 'error',
|
//iconCls: 'error',
|
||||||
clear: true
|
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