diff --git a/workflow/engine/templates/cases/caseMessageHistory.js b/workflow/engine/templates/cases/caseMessageHistory.js index 2bc4df634..e79cb5a1f 100644 --- a/workflow/engine/templates/cases/caseMessageHistory.js +++ b/workflow/engine/templates/cases/caseMessageHistory.js @@ -2,14 +2,12 @@ * @author: Douglas Medrano * May 03, 2011 */ - //var windowMessage; - windowMessage = new Object(); + var windowMessage = new Object(); function onResizeIframe(idIframe){ window.parent.tabIframeWidthFix2(idIframe); } function windowPreviewMessage(rowSelected) { - windowMessage = new Ext.Window({ title: '', width: 600, @@ -138,12 +136,13 @@ - function ajaxPostRequest(url, callback_function, id){ - var d = new Date(); - var time = d.getTime(); + function ajaxPostRequest (url, callback_function, id) { + var d = new Date(), + time = d.getTime(), + return_xml=false, + http_request = false; + url= url + '&nocachetime='+time; - var return_xml=false; - var http_request = false; if (window.XMLHttpRequest){ // Mozilla, Safari,... http_request = new XMLHttpRequest(); @@ -169,21 +168,19 @@ return false; } - http_request.onreadystatechange = function(){ - if (http_request.readyState == 4){ - if (http_request.status == 200){ - if (return_xml){ - eval(callback_function + '(http_request.responseXML)'); + http_request.onreadystatechange = function () { + if (http_request.readyState === 4) { + if (http_request.status === 200) { + if (return_xml) { + eval(callback_function + '(http_request.responseXML)'); + } else { + eval(callback_function + '(http_request.responseText, \'' + id + '\')'); } - else{ - eval(callback_function + '(http_request.responseText, \''+id+'\')'); - } - } - else{ - alert('Error found on request:(Code: ' + http_request.status + ')'); + } else { + alert('Error found on request:(Code: ' + http_request.status + ')'); } } - } + }; http_request.open('GET', url, true); http_request.send(null); } @@ -302,82 +299,77 @@ var ActionTabFrameGlobal = ''; } //!!historyGridList|changeLog - function caseMessageHistory_RSP(response,id){ +function caseMessageHistory_RSP (response, id) { messageHistoryGridListMask.hide(); - if(response==""){ - - Ext.Msg.show({ - title:'', - msg: _('ID_MAIL_SENT_SUCCESSFULLY'), - buttons: Ext.Msg.INFO, - fn: function(){}, - animEl: 'elId', - icon: Ext.MessageBox.INFO, - buttons: Ext.MessageBox.OK - }); - - Ext.destroy(Ext.getCmp('processesGrid')); - - messageHistoryGridList(); + if (response === "") { + Ext.Msg.show({ + title: '', + msg: _('ID_MAIL_SENT_SUCCESSFULLY'), + buttons: Ext.Msg.INFO, + animEl: 'elId', + icon: Ext.MessageBox.INFO, + buttons: Ext.MessageBox.OK + }); + Ext.destroy(Ext.getCmp('processesGrid')); + store.destroy(); + messageHistoryGridList(); } - else{ - alert(response); + else { + alert(response); } - } +} + function messageHistoryGridList () { + var expander, + startDateRender, + escapeHtml, + actionRenderingTranslation, + processesGrid, + viewport; - function messageHistoryGridList(){ store = new Ext.data.GroupingStore({ - remoteSort: true, - proxy : new Ext.data.HttpProxy - ( - { - url: 'caseMessageHistory_Ajax.php?actionAjax=messageHistoryGridList_JXP' - } - ), + remoteSort: true, + proxy: new Ext.data.HttpProxy({ + url: 'caseMessageHistory_Ajax.php?actionAjax=messageHistoryGridList_JXP' + }), + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data', + fields: [ + {name: 'ID_MESSAGE'}, + {name: 'APP_MSG_TYPE'}, + {name: 'APP_MSG_DATE'}, + {name: 'APP_MSG_SUBJECT'}, + {name: 'APP_MSG_FROM'}, + {name: 'APP_MSG_TO'}, + {name: 'APP_MSG_STATUS'}, + {name: 'APP_MSG_BODY'}, + {name: 'MSGS_HISTORY'} - reader : new Ext.data.JsonReader - ( - { - totalProperty: 'totalCount', - root: 'data', - fields : - [ - {name : 'ID_MESSAGE'}, - {name : 'APP_MSG_TYPE'}, - {name : 'APP_MSG_DATE'}, - {name : 'APP_MSG_SUBJECT'}, - {name : 'APP_MSG_FROM'}, - {name : 'APP_MSG_TO'}, - {name : 'APP_MSG_STATUS'}, - {name : 'APP_MSG_BODY'}, - {name : 'MSGS_HISTORY'} - - ] - } - ) + ] + }) }); - var expander = new Ext.ux.grid.RowExpander({ + expander = new Ext.ux.grid.RowExpander({ tpl : new Ext.Template( '
'+TRANSLATIONS.ID_PRO_DESCRIPTION+': {PRO_DESCRIPTION}