diff --git a/gulliver/system/class.httpProxyController.php b/gulliver/system/class.httpProxyController.php index a3f6f9757..a55c0b702 100755 --- a/gulliver/system/class.httpProxyController.php +++ b/gulliver/system/class.httpProxyController.php @@ -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; + } } diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php index 76f4a635e..b2de3757e 100644 --- a/workflow/engine/classes/model/AppNotes.php +++ b/workflow/engine/classes/model/AppNotes.php @@ -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(); diff --git a/workflow/engine/controllers/caseProxy.php b/workflow/engine/controllers/caseProxy.php new file mode 100644 index 000000000..155a7ef7b --- /dev/null +++ b/workflow/engine/controllers/caseProxy.php @@ -0,0 +1,100 @@ +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); + } + +} \ No newline at end of file diff --git a/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css b/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css index 4e1aef9fa..fef1bb783 100644 --- a/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css +++ b/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css @@ -914,4 +914,24 @@ antes funcionaba. width:50px; display:block; clear:none; -} \ No newline at end of file +} + +.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; } \ No newline at end of file diff --git a/workflow/engine/templates/cases/caseNotes.js b/workflow/engine/templates/cases/caseNotes.js index 40d3547ba..c0fff5008 100644 --- a/workflow/engine/templates/cases/caseNotes.js +++ b/workflow/engine/templates/cases/caseNotes.js @@ -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 }); } } -} \ No newline at end of file +} + diff --git a/workflow/public_html/images/notes.png b/workflow/public_html/images/notes.png new file mode 100644 index 000000000..c9a04817c Binary files /dev/null and b/workflow/public_html/images/notes.png differ