PMCORE-3432

This commit is contained in:
Henry Jordan
2021-10-20 16:39:21 +00:00
parent a4bb3a43a9
commit c284e840d5

View File

@@ -8,48 +8,47 @@ var toolTipChkSendMail;
var caseNotesForm; var caseNotesForm;
var uploadItemsSize = 5; var uploadItemsSize = 5;
function closeCaseNotesWindow(){ function closeCaseNotesWindow() {
if(Ext.get("caseNotesWindowPanel")){ if (Ext.get("caseNotesWindowPanel")) {
Ext.get("caseNotesWindowPanel").destroy(); Ext.get("caseNotesWindowPanel").destroy();
} }
} }
function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskUid) function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskUid) {
{
Ext.MessageBox.show({ Ext.MessageBox.show({
msg: _('ID_CASE_NOTES_LOADING'), msg: _('ID_CASE_NOTES_LOADING'),
progressText: _('ID_SAVING'), progressText: _('ID_SAVING'),
width:300, width: 300,
wait:true, wait: true,
waitConfig: {interval:200}, waitConfig: { interval: 200 },
animEl: 'mb7' animEl: 'mb7'
}); });
Ext.QuickTips.init(); Ext.QuickTips.init();
appUid = !appUid1 ? "": appUid1; appUid = !appUid1 ? "" : appUid1;
delIndex = (!delIndex)? 0: delIndex; delIndex = (!delIndex) ? 0 : delIndex;
proUid = !proUid ? "": proUid; proUid = !proUid ? "" : proUid;
taskUid = !taskUid ? "": taskUid; taskUid = !taskUid ? "" : taskUid;
var startRecord=0; var startRecord = 0;
var loadSize=10; var loadSize = 10;
startRecord=startRecord+loadSize; startRecord = startRecord + loadSize;
storeNotes = new Ext.data.JsonStore({ storeNotes = new Ext.data.JsonStore({
url: "../appProxy/getNotesList?appUid=" + appUid + "&delIndex=" + delIndex + "&pro=" + proUid + "&tas=" + taskUid, url: "../appProxy/getNotesList?appUid=" + appUid + "&delIndex=" + delIndex + "&pro=" + proUid + "&tas=" + taskUid,
root: 'notes', root: 'notes',
totalProperty: 'totalCount', totalProperty: 'totalCount',
fields: ['USR_USERNAME','USR_FIRSTNAME','USR_LASTNAME','USR_FULL_NAME','NOTE_DATE','NOTE_CONTENT', 'USR_UID','USR_EMAIL', 'attachments', 'user'], fields: ['USR_USERNAME', 'USR_FIRSTNAME', 'USR_LASTNAME', 'USR_FULL_NAME', 'NOTE_DATE', 'NOTE_CONTENT', 'USR_UID', 'USR_EMAIL', 'attachments', 'user'],
baseParams:{ baseParams: {
start:0, start: 0,
limit:startRecord+loadSize limit: startRecord + loadSize
}, },
listeners:{ listeners: {
load:function(response){ load: function (response) {
Ext.MessageBox.hide(); Ext.MessageBox.hide();
if ( typeof(storeNotes.reader.jsonData.noPerms != 'undefined') && if (typeof (storeNotes.reader.jsonData.noPerms != 'undefined') &&
(storeNotes.reader.jsonData.noPerms == '1') ) { (storeNotes.reader.jsonData.noPerms == '1')) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('ID_WARNING'), title: _('ID_WARNING'),
msg: _('ID_CASES_NOTES_NO_PERMISSIONS'), msg: _('ID_CASES_NOTES_NO_PERMISSIONS'),
@@ -61,11 +60,11 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
} }
caseNotesWindow.setTitle(_('ID_CASES_NOTES') + ' (' + storeNotes.data.items.length + ')'); caseNotesWindow.setTitle(_('ID_CASES_NOTES') + ' (' + storeNotes.data.items.length + ')');
title = !appTitle ? storeNotes.reader.jsonData.appTitle : appTitle ; title = !appTitle ? storeNotes.reader.jsonData.appTitle : appTitle;
if(storeNotes.getCount()<storeNotes.getTotalCount()){ if (storeNotes.getCount() < storeNotes.getTotalCount()) {
Ext.getCmp('CASES_MORE_BUTTON').show(); Ext.getCmp('CASES_MORE_BUTTON').show();
}else{ } else {
Ext.getCmp('CASES_MORE_BUTTON').hide(); Ext.getCmp('CASES_MORE_BUTTON').hide();
} }
@@ -73,7 +72,7 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
newNoteAreaActive = false; newNoteAreaActive = false;
newNoteHandler(); newNoteHandler();
}, },
exception: function(dp, type, action, options, response, arg) { exception: function (dp, type, action, options, response, arg) {
responseObject = Ext.util.JSON.decode(response.responseText); responseObject = Ext.util.JSON.decode(response.responseText);
if (responseObject.lostSession) { if (responseObject.lostSession) {
Ext.Msg.show({ Ext.Msg.show({
@@ -82,14 +81,12 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
animEl: 'elId', animEl: 'elId',
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
fn : function(btn) { fn: function (btn) {
try try {
{
prnt = parent.parent; prnt = parent.parent;
top.location = top.location; top.location = top.location;
} }
catch (err) catch (err) {
{
parent.location = parent.location; parent.location = parent.location;
} }
} }
@@ -101,26 +98,26 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
storeNotes.load(); storeNotes.load();
var panelNotes = new Ext.Panel({ var panelNotes = new Ext.Panel({
id:'notesPanel', id: 'notesPanel',
frame:true, frame: true,
autoWidth:true, autoWidth: true,
autoHeight:true, autoHeight: true,
collapsible:false, collapsible: false,
items:[ items: [
new Ext.DataView({ new Ext.DataView({
store: storeNotes, store: storeNotes,
loadingtext:_('ID_CASE_NOTES_LOADING'), loadingtext: _('ID_CASE_NOTES_LOADING'),
emptyText: _('ID_CASE_NOTES_EMPTY'), emptyText: _('ID_CASE_NOTES_EMPTY'),
cls: 'x-cnotes-view', cls: 'x-cnotes-view',
tpl: '<tpl for=".">' + tpl: '<tpl for=".">' +
'<div class="x-cnotes-source"><table><tbody>' + '<div class="x-cnotes-source"><table><tbody>' +
'<tr>' + '<tr>' +
'<td class="x-cnotes-label"><img border="0" src="../users/users_ViewPhotoGrid?pUID={USR_UID}" width="40" height="40"/></td>' + '<td class="x-cnotes-label"><img border="0" src="../users/users_ViewPhotoGrid?pUID={USR_UID}" width="40" height="40"/></td>' +
'<td class="x-cnotes-name">'+ '<td class="x-cnotes-name">' +
'<p class="user-from">{user}</p>'+ '<p class="user-from">{user}</p>' +
'<div style="width: 370px; overflow-x:auto; height: 80px;" class="x-editable x-message"><p>{NOTE_CONTENT}</p>'+ '<div style="width: 370px; overflow-x:auto; height: 80px;" class="x-editable x-message"><p>{NOTE_CONTENT}</p>' +
'<ul class="nav_list"><li>{files}</li></ul></div>' + '<ul class="nav_list"><li>{files}</li></ul></div>' +
'<p class="x-editable"><small>'+_('ID_POSTED_AT')+'<i> {NOTE_DATE}</i></small></p>'+ '<p class="x-editable"><small>' + _('ID_POSTED_AT') + '<i> {NOTE_DATE}</i></small></p>' +
'</td>' + '</td>' +
'</tr>' + '</tr>' +
'</tbody></table></div>' + '</tbody></table></div>' +
@@ -130,13 +127,13 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
selectedClass: 'x-cnotes-selected', selectedClass: 'x-cnotes-selected',
singleSelect: false, singleSelect: false,
prepareData: function(data){ prepareData: function (data) {
var i; var i;
data.user = _FNF(data.USR_EMAIL, data.USR_FIRSTNAME, data.USR_LASTNAME); data.user = _FNF(data.USR_EMAIL, data.USR_FIRSTNAME, data.USR_LASTNAME);
//the 'NOTE_CONTENT' is used directly in an HTML template, so reserved characters //the 'NOTE_CONTENT' is used directly in an HTML template, so reserved characters
//must be converted to HTML entities. //must be converted to HTML entities.
data.NOTE_CONTENT = Ext.util.Format.htmlEncode(data.NOTE_CONTENT); data.NOTE_CONTENT = Ext.util.Format.htmlEncode(data.NOTE_CONTENT);
data.NOTE_CONTENT = data.NOTE_CONTENT.replace(/\n/g,' <br/>'); data.NOTE_CONTENT = data.NOTE_CONTENT.replace(/\n/g, ' <br/>');
data.files = ""; data.files = "";
for (i = 0; i < data.attachments.length; i += 1) { for (i = 0; i < data.attachments.length; i += 1) {
data.files += "<a href='" + data.attachments[i].LINK + "' title='" + data.attachments[i].APP_DOC_FILENAME + "'>" + data.attachments[i].APP_DOC_FILENAME + "</a>"; data.files += "<a href='" + data.attachments[i].LINK + "' title='" + data.attachments[i].APP_DOC_FILENAME + "'>" + data.attachments[i].APP_DOC_FILENAME + "</a>";
@@ -146,31 +143,31 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
listeners: { listeners: {
selectionchange: { selectionchange: {
fn: function(dv,nodes){ fn: function (dv, nodes) {
var l = nodes.length; var l = nodes.length;
var s = l != 1 ? 's' : ''; var s = l != 1 ? 's' : '';
//panelNotes.setTitle('Process ('+l+' item'+s+' selected)'); //panelNotes.setTitle('Process ('+l+' item'+s+' selected)');
} }
}, },
click: { click: {
fn: function(dv,nodes,a){ fn: function (dv, nodes, a) {
} }
} }
} }
}),{ }), {
xtype:'button', xtype: 'button',
id:'CASES_MORE_BUTTON', id: 'CASES_MORE_BUTTON',
iconCls: '.x-pm-notes-btn', iconCls: '.x-pm-notes-btn',
hidden:true, hidden: true,
text:_('ID_CASE_NOTES_MORE'), text: _('ID_CASE_NOTES_MORE'),
align:'center', align: 'center',
handler:function() { handler: function () {
startRecord=startRecord+loadSize; startRecord = startRecord + loadSize;
limitRecord=startRecord+loadSize; limitRecord = startRecord + loadSize;
storeNotes.load({ storeNotes.load({
params:{ params: {
start:0, start: 0,
limit:startRecord+loadSize limit: startRecord + loadSize
} }
}); });
} }
@@ -181,7 +178,7 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
* Factory to create upload files field dinamically * Factory to create upload files field dinamically
* @return {Object} * @return {Object}
*/ */
function uploadFileFactory () { function uploadFileFactory() {
return { return {
xtype: 'fileuploadfield', xtype: 'fileuploadfield',
emptyText: '', emptyText: '',
@@ -189,7 +186,7 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
buttonText: _('ID_SELECT_FILE'), buttonText: _('ID_SELECT_FILE'),
name: 'filesToUpload[]', name: 'filesToUpload[]',
allowBlank: true, allowBlank: true,
width : '70%', width: '70%',
validator: function (filePath) { validator: function (filePath) {
var flag = false; var flag = false;
if (caseNotesWindow.isVisible() === false || filePath === "") { if (caseNotesWindow.isVisible() === false || filePath === "") {
@@ -218,23 +215,23 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
items: items:
[ [
{ {
text : _('ID_NEW_NOTE'), text: _('ID_NEW_NOTE'),
xtype : 'textarea', xtype: 'textarea',
id : 'caseNoteText', id: 'caseNoteText',
name : 'caseNoteText', name: 'caseNoteText',
width : '98%', width: '98%',
height : 100, height: 100,
hideLabel: true, hideLabel: true,
maxLengthText : 1500, maxLengthText: 1500,
allowBlank :false, allowBlank: false,
selectOnFocus :true, selectOnFocus: true,
enableKeyEvents: true, enableKeyEvents: true,
listeners : { listeners: {
scope : this, scope: this,
keyup : updateTextCtr, keyup: updateTextCtr,
keydown: updateTextCtr, keydown: updateTextCtr,
'change': function(field, newVal, oldVal) { 'change': function (field, newVal, oldVal) {
var textAreaValue = newVal.replace(/^\s+/,'').replace(/\s+$/,''); var textAreaValue = newVal.replace(/^\s+/, '').replace(/\s+$/, '');
field.setValue(textAreaValue.trim()); field.setValue(textAreaValue.trim());
Ext.getCmp('caseNoteText').focus(false, 200); Ext.getCmp('caseNoteText').focus(false, 200);
} }
@@ -276,29 +273,29 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
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:450, height: 450,
shadow:true, shadow: true,
minWidth:380, minWidth: 380,
minHeight:200, minHeight: 200,
proxyDrag: true, proxyDrag: true,
constrain: true, constrain: true,
keys: { keys: {
key: 27, key: 27,
fn : function(){ fn: function () {
caseNotesWindow.hide(); caseNotesWindow.hide();
} }
}, },
autoScroll:true, autoScroll: true,
items:[panelNotes], items: [panelNotes],
tools:[ tools: [
{ {
id:'refresh', id: 'refresh',
handler:function() { handler: function () {
storeNotes.load(); storeNotes.load();
} }
} }
], ],
tbar:[caseNotesForm], tbar: [caseNotesForm],
rowtbar: [ rowtbar: [
[ [
{ {
@@ -331,10 +328,10 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
} }
] ]
], ],
bbar:[ bbar: [
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',
text: _('ID_NOTES_READY'), // values to set initially: text: _('ID_NOTES_READY'), // values to set initially:
//iconCls: 'ready-icon', //iconCls: 'ready-icon',
@@ -343,19 +340,19 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU
}) })
], ],
listeners: { listeners: {
show:function() { show: function () {
if (typeof(parent.setFlag) != 'undefined') { if (typeof (parent.setFlag) != 'undefined') {
parent.setFlag(false); parent.setFlag(false);
} }
this.loadMask = new Ext.LoadMask(this.body, { this.loadMask = new Ext.LoadMask(this.body, {
msg:_('ID_LOADING') msg: _('ID_LOADING')
}); });
caseNotesForm.add(uploadFileFactory()); caseNotesForm.add(uploadFileFactory());
caseNotesForm.doLayout(); caseNotesForm.doLayout();
caseNotesWindow.doLayout(); caseNotesWindow.doLayout();
}, },
close:function(){ close: function () {
if (typeof(parent.setFlag) != 'undefined') { if (typeof (parent.setFlag) != 'undefined') {
parent.setFlag(true); parent.setFlag(true);
} }
if (Ext.get("caseNotes")) { if (Ext.get("caseNotes")) {
@@ -383,22 +380,21 @@ function updateTextCtr(body, event) {
maxLength = 1500; maxLength = 1500;
if (text.length > maxLength) { if (text.length > maxLength) {
Ext.getCmp('caseNoteText').setValue(Ext.getCmp('caseNoteText').getValue().substr(0,1500)); Ext.getCmp('caseNoteText').setValue(Ext.getCmp('caseNoteText').getValue().substr(0, 1500));
} }
else { else {
document.getElementById('countChar').innerHTML = maxLength - text.length; document.getElementById('countChar').innerHTML = maxLength - text.length;
} }
} }
function newNoteHandler() function newNoteHandler() {
{
var i; var i;
newNoteAreaActive = newNoteAreaActive ? false : true; newNoteAreaActive = newNoteAreaActive ? false : true;
if (newNoteAreaActive) { if (newNoteAreaActive) {
Ext.getCmp('addCancelBtn').setText(''); Ext.getCmp('addCancelBtn').setText('');
Ext.getCmp('addCancelBtn').setTooltip({ Ext.getCmp('addCancelBtn').setTooltip({
title: _('ID_CASES_NOTES_ADD'), title: _('ID_CASES_NOTES_ADD'),
text: _('ID_CASE') +': '+ title text: _('ID_CASE') + ': ' + title
}); });
Ext.getCmp('addCancelBtn').setIcon('/images/comment_add.gif'); Ext.getCmp('addCancelBtn').setIcon('/images/comment_add.gif');
@@ -413,7 +409,7 @@ function newNoteHandler()
toolTipChkSendMail.initTarget("chkSendMail"); toolTipChkSendMail.initTarget("chkSendMail");
Ext.getCmp('addCancelBtn').setText(''); Ext.getCmp('addCancelBtn').setText('');
Ext.getCmp('addCancelBtn').setTooltip({title: _('ID_CASES_NOTES_CANCEL')}); Ext.getCmp('addCancelBtn').setTooltip({ title: _('ID_CASES_NOTES_CANCEL') });
Ext.getCmp('addCancelBtn').setIcon('/images/cancel.png'); Ext.getCmp('addCancelBtn').setIcon('/images/cancel.png');
caseNotesWindow.getTopToolbar().show(); caseNotesWindow.getTopToolbar().show();
@@ -437,7 +433,7 @@ function newNoteHandler()
caseNotesWindow.doLayout(); caseNotesWindow.doLayout();
} }
function sendNote(){ function sendNote() {
var noteText = Ext.getCmp('caseNoteText').getValue(); var noteText = Ext.getCmp('caseNoteText').getValue();
if (noteText == "") { if (noteText == "") {
return false; return false;
@@ -448,7 +444,7 @@ function sendNote(){
Ext.getCmp('caseNoteText').setDisabled(true); Ext.getCmp('caseNoteText').setDisabled(true);
Ext.getCmp('sendBtn').setDisabled(true); Ext.getCmp('sendBtn').setDisabled(true);
Ext.getCmp('addCancelBtn').setDisabled(true); Ext.getCmp('addCancelBtn').setDisabled(true);
statusBarMessage( _('ID_CASES_NOTE_POSTING'), true); statusBarMessage(_('ID_CASES_NOTE_POSTING'), true);
caseNotesForm.getForm().submit({ caseNotesForm.getForm().submit({
clientValidation: true, clientValidation: true,
@@ -458,34 +454,34 @@ function sendNote(){
noteText: noteText, noteText: noteText,
swSendMail: (Ext.getCmp("chkSendMail").checked === true) ? 1 : 0 swSendMail: (Ext.getCmp("chkSendMail").checked === true) ? 1 : 0
}, },
success: function ( result, request ) { success: function (result, request) {
var data = Ext.util.JSON.decode(request.response.responseText); var data = Ext.util.JSON.decode(request.response.responseText);
if(data.success=="success"){ if (data.success == "success") {
Ext.getCmp('caseNoteText').setDisabled(false); Ext.getCmp('caseNoteText').setDisabled(false);
Ext.getCmp('sendBtn').setDisabled(false); Ext.getCmp('sendBtn').setDisabled(false);
Ext.getCmp('addCancelBtn').setDisabled(false); Ext.getCmp('addCancelBtn').setDisabled(false);
if (data.message != '') { if (data.message != '') {
Ext.Msg.show({ Ext.Msg.show({
title : _('ID_CASES_NOTE_POST_ERROR'), title: _('ID_CASES_NOTE_POST_ERROR'),
msg : data.message, msg: data.message,
icon : Ext.MessageBox.WARNING, icon: Ext.MessageBox.WARNING,
buttons : Ext.Msg.OK, buttons: Ext.Msg.OK,
fn : function(btn) { fn: function (btn) {
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true); statusBarMessage(_('ID_CASES_NOTE_POST_SUCCESS'), false, true);
storeNotes.load(); storeNotes.load();
} }
}); });
} else { } else {
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true); statusBarMessage(_('ID_CASES_NOTE_POST_SUCCESS'), false, true);
storeNotes.load(); storeNotes.load();
} }
} else if (data.lostSession) { } else if (data.lostSession) {
Ext.Msg.show({ Ext.Msg.show({
title : _('ID_CASES_NOTE_POST_ERROR'), title: _('ID_CASES_NOTE_POST_ERROR'),
msg : data.message, msg: data.message,
icon : Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
buttons : Ext.Msg.OK, buttons: Ext.Msg.OK,
fn : function(btn) { fn: function (btn) {
try { try {
prnt = parent.parent; prnt = parent.parent;
top.location = top.location; top.location = top.location;
@@ -498,29 +494,29 @@ function sendNote(){
Ext.getCmp('caseNoteText').setDisabled(false); Ext.getCmp('caseNoteText').setDisabled(false);
Ext.getCmp('sendBtn').setDisabled(false); Ext.getCmp('sendBtn').setDisabled(false);
Ext.getCmp('addCancelBtn').setDisabled(false); Ext.getCmp('addCancelBtn').setDisabled(false);
statusBarMessage( _('ID_CASES_NOTE_POST_ERROR'), false,false); statusBarMessage(_('ID_CASES_NOTE_POST_ERROR'), false, false);
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_ERROR'), data.message); Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_ERROR'), data.message);
} }
}, },
failure: function ( result, request) { failure: function (result, request) {
statusBarMessage( _('ID_CASES_NOTE_POST_FAILED'), false,false); statusBarMessage(_('ID_CASES_NOTE_POST_FAILED'), false, false);
Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText); Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText);
} }
}); });
} }
function statusBarMessage( msg, isLoading, success ) { function statusBarMessage(msg, isLoading, success) {
var statusBar = Ext.getCmp('notesStatusPanel'); var statusBar = Ext.getCmp('notesStatusPanel');
if( !statusBar ) return; if (!statusBar) return;
if( isLoading ) { if (isLoading) {
statusBar.showBusy(msg); statusBar.showBusy(msg);
} }
else { else {
//statusBar.setStatus("Done."); //statusBar.setStatus("Done.");
statusBar.clearStatus(); statusBar.clearStatus();
if( success ) { if (success) {
statusBar.setStatus({ statusBar.setStatus({
text: '' + msg, text: '' + msg,
iconCls: 'x-status-valid', iconCls: 'x-status-valid',
@@ -543,23 +539,102 @@ function statusBarMessage( msg, isLoading, success ) {
/* Case Notes - End */ /* Case Notes - End */
/* Case Summary - Start */ /* Case Summary - Start */
var openSummaryWindow = function(appUid, delIndex, action) var createInfoPanel = function (url, params, columnsSize, root, title) {
{ var labelColumnWidth = 170;
var valueColumnWidth = 350;
params = params || {};
if (typeof columnsSize !== 'undefined') {
labelColumnWidth = columnsSize[0] || labelColumnWidth;
valueColumnWidth = columnsSize[1] || valueColumnWidth;
}
return new Ext.grid.GridPanel({
store: new Ext.data.GroupingStore({
autoLoad: true,
proxy: new Ext.data.HttpProxy({
url: url,
method: 'POST'
}),
baseParams: params,
reader: new Ext.data.JsonReader({
root: function (o) {
var out = [], title, obj = o["caseProperties"], obj2, index, i;
title = o["caseProperties"][0];
label = title["label"];
for (index = 1; index < obj.length; index = index + 1) {
obj[index].section = label;
out.push(obj[index]);
}
if (o["taskProperties"].length > 0) {
title = o["taskProperties"][0];
label = title["label"];
obj2 = o["taskProperties"];
for (index = 1; index < obj2.length; index = index + 1) {
for (i = 0; i < obj2[index].length; i = i + 1) {
obj2[index][i].section = label;
obj2[index][i].id = obj2[index][i].id + index;
out.push(obj2[index][i]);
}
}
}
return out;
},
fields: [{
name: 'label'
}, {
name: 'value'
}, {
name: 'section'
}]
}),
groupField: 'section'
}),
columns: [{
width: labelColumnWidth,
dataIndex: "label",
renderer: function (v) {
return "<b><font class='selectText' color=\"#465070\">" + v + "</font></b>";
},
align: "right"
}, {
width: valueColumnWidth,
dataIndex: "value",
renderer: function (v) {
return "<b class='selectText'>" + v + "</b>";
}
}, {
hidden: true,
dataIndex: "section"
}],
autoHeight: true,
columnLines: true,
trackMouseOver: false,
disableSelection: true,
view: new Ext.grid.GroupingView({
forceFit: true,
headersDisabled: true,
groupTextTpl: '{group}'
}),
loadMask: true
});
};
var openSummaryWindow = function (appUid, delIndex, action) {
if (summaryWindowOpened) { if (summaryWindowOpened) {
return; return;
} }
summaryWindowOpened = true; summaryWindowOpened = true;
Ext.Ajax.request({ Ext.Ajax.request({
url : '../appProxy/requestOpenSummary', url: '../appProxy/requestOpenSummary',
params : { params: {
appUid : appUid, appUid: appUid,
delIndex: delIndex, delIndex: delIndex,
action: action action: action
}, },
success: function (result, request) { success: function (result, request) {
var response = Ext.util.JSON.decode(result.responseText); var response = Ext.util.JSON.decode(result.responseText);
if (response.success) { if (response.success) {
var sumaryInfPanel = PMExt.createInfoPanel('../appProxy/getSummary', {appUid: appUid, delIndex: delIndex, action: action}); var sumaryInfPanel = createInfoPanel('../appProxy/getSummary', { appUid: appUid, delIndex: delIndex, action: action }, [], "caseProperties", _("ID_CASE_PROPERTIES"));
sumaryInfPanel.setTitle(_('ID_GENERATE_INFO')); sumaryInfPanel.setTitle(_('ID_GENERATE_INFO'));
var summaryWindow = new Ext.Window({ var summaryWindow = new Ext.Window({
@@ -570,11 +645,11 @@ var openSummaryWindow = function(appUid, delIndex, action)
resizable: true, resizable: true,
closable: true, closable: true,
modal: true, modal: true,
autoScroll:true, autoScroll: true,
constrain: true, constrain: true,
keys: { keys: {
key: 27, key: 27,
fn: function() { fn: function () {
summaryWindow.close(); summaryWindow.close();
} }
}/*, }/*,
@@ -588,25 +663,25 @@ var openSummaryWindow = function(appUid, delIndex, action)
var tabs = new Array(); var tabs = new Array();
var isMovil = { var isMovil = {
Android: function() { Android: function () {
return navigator.userAgent.match(/Android/i); return navigator.userAgent.match(/Android/i);
}, },
BlackBerry: function() { BlackBerry: function () {
return navigator.userAgent.match(/BlackBerry/i); return navigator.userAgent.match(/BlackBerry/i);
}, },
iOS: function() { iOS: function () {
return navigator.userAgent.match(/iPhone|iPad|iPod/i); return navigator.userAgent.match(/iPhone|iPad|iPod/i);
}, },
Opera: function() { Opera: function () {
return navigator.userAgent.match(/Opera Mini/i); return navigator.userAgent.match(/Opera Mini/i);
}, },
Windows: function() { Windows: function () {
return navigator.userAgent.match(/IEMobile/i); return navigator.userAgent.match(/IEMobile/i);
}, },
other: function() { other: function () {
return navigator.userAgent.match(/Mobile/i); return navigator.userAgent.match(/Mobile/i);
}, },
any: function() { any: function () {
return isMovil.Android() || isMovil.BlackBerry() || isMovil.iOS() || isMovil.Opera() || isMovil.Windows() || isMovil.other(); return isMovil.Android() || isMovil.BlackBerry() || isMovil.iOS() || isMovil.Opera() || isMovil.Windows() || isMovil.other();
} }
}; };
@@ -616,8 +691,8 @@ var openSummaryWindow = function(appUid, delIndex, action)
if (isMovil.any()) { if (isMovil.any()) {
var src = '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid; var src = '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid;
var windowOpen = function() { var windowOpen = function () {
window.open(src,'_blank'); window.open(src, '_blank');
}; };
var openDynaform = new Ext.Action({ var openDynaform = new Ext.Action({
@@ -627,40 +702,40 @@ var openSummaryWindow = function(appUid, delIndex, action)
}); });
var fieldsAS = new Ext.form.FieldSet({ var fieldsAS = new Ext.form.FieldSet({
bodyStyle:'align:center', bodyStyle: 'align:center',
items: [ items: [
{ {
xtype:'button', xtype: 'button',
id: 'buttonOpenDynaform', id: 'buttonOpenDynaform',
name: 'buttonOpenDynaform', name: 'buttonOpenDynaform',
hidden: true, hidden: true,
text: _('ID_OPEN_DYNAFORM_TAB'), text: _('ID_OPEN_DYNAFORM_TAB'),
handler:function() { handler: function () {
window.open(src,'_blank'); window.open(src, '_blank');
} }
}, },
{ {
html:'<iframe src="'+ src +'" width="100%" height="350" frameBorder="0"></iframe>' html: '<iframe src="' + src + '" width="100%" height="350" frameBorder="0"></iframe>'
} }
] ]
}); });
var panel = new Ext.FormPanel({ var panel = new Ext.FormPanel({
labelAlign:'center', labelAlign: 'center',
autoScroll: true, autoScroll: true,
fileUpload: true, fileUpload: true,
width:'100%', width: '100%',
height: '50px', height: '50px',
bodyStyle:'padding:10px', bodyStyle: 'padding:10px',
waitMsgTarget : true, waitMsgTarget: true,
frame: true, frame: true,
defaults: { defaults: {
anchor: '100%', anchor: '100%',
allowBlank: false, allowBlank: false,
resizable: true, resizable: true,
msgTarget: 'side', msgTarget: 'side',
align:'center' align: 'center'
}, },
items:[ items: [
fieldsAS fieldsAS
] ]
}); });
@@ -670,31 +745,37 @@ var openSummaryWindow = function(appUid, delIndex, action)
items: [panel] items: [panel]
}); });
} else { } else {
tabs.push({title: _('ID_MORE_INFORMATION'), bodyCfg: { tabs.push({
title: _('ID_MORE_INFORMATION'), bodyCfg: {
tag: 'iframe', tag: 'iframe',
id: 'summaryIFrame', id: 'summaryIFrame',
src: '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid, src: '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid,
style: {border: '0px none', height: '300px', overflow: 'auto'}, style: { border: '0px none', height: '300px', overflow: 'auto' },
onload: '' onload: ''
}}); }
});
} }
} }
tabs.push({title: _('ID_UPLOADED_DOCUMENTS'), bodyCfg: { tabs.push({
title: _('ID_UPLOADED_DOCUMENTS'), bodyCfg: {
tag: 'iframe', tag: 'iframe',
id: 'summaryIFrame', id: 'summaryIFrame',
src: '../cases/ajaxListener?action=uploadedDocumentsSummary', src: '../cases/ajaxListener?action=uploadedDocumentsSummary',
style: {border: '0px none', height: '300px'}, style: { border: '0px none', height: '300px' },
onload: '' onload: ''
}}); }
});
tabs.push({title: _('ID_GENERATED_DOCUMENTS'), bodyCfg: { tabs.push({
title: _('ID_GENERATED_DOCUMENTS'), bodyCfg: {
tag: 'iframe', tag: 'iframe',
id: 'summaryIFrame', id: 'summaryIFrame',
src: '../cases/ajaxListener?action=generatedDocumentsSummary', src: '../cases/ajaxListener?action=generatedDocumentsSummary',
style: {border: '0px none',height: '450px'}, style: { border: '0px none', height: '450px' },
onload: '' onload: ''
}}); }
});
var summaryTabs = new Ext.TabPanel({ var summaryTabs = new Ext.TabPanel({
activeTab: 0, activeTab: 0,
items: tabs items: tabs
@@ -704,18 +785,16 @@ var openSummaryWindow = function(appUid, delIndex, action)
summaryWindow.show(); summaryWindow.show();
} else if (response.lostSession) { } else if (response.lostSession) {
Ext.Msg.show({ Ext.Msg.show({
title : "ERROR", title: "ERROR",
msg : response.message, msg: response.message,
icon : Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
buttons : Ext.Msg.OK, buttons: Ext.Msg.OK,
fn : function(btn) { fn: function (btn) {
try try {
{
prnt = parent.parent; prnt = parent.parent;
top.location = top.location; top.location = top.location;
} }
catch (err) catch (err) {
{
parent.location = parent.location; parent.location = parent.location;
} }
} }
@@ -737,27 +816,27 @@ var openSummaryWindow = function(appUid, delIndex, action)
Ext.Panel.prototype.originalonRender = Ext.Panel.prototype.onRender; Ext.Panel.prototype.originalonRender = Ext.Panel.prototype.onRender;
// override onRender method // override onRender method
Ext.Panel.prototype.onRender = function(ct, position) { Ext.Panel.prototype.onRender = function (ct, position) {
this.originalonRender(ct, position); this.originalonRender(ct, position);
// use the custom rowtbar argument to add it to this TopToolbar // use the custom rowtbar argument to add it to this TopToolbar
if(this.tbar && this.rowtbar){ if (this.tbar && this.rowtbar) {
var rowtbar = this.rowtbar; var rowtbar = this.rowtbar;
if(!Ext.isArray(rowtbar)) if (!Ext.isArray(rowtbar))
return; return;
for(var i = 0; i < rowtbar.length; i ++) { for (var i = 0; i < rowtbar.length; i++) {
new Ext.Toolbar(rowtbar[i]).render(this.tbar); new Ext.Toolbar(rowtbar[i]).render(this.tbar);
} }
} }
// use the custom rowbbar argument to add it to this BottomToolbar // use the custom rowbbar argument to add it to this BottomToolbar
if(this.bbar && this.rowbbar) { if (this.bbar && this.rowbbar) {
var rowbbar = this.rowbbar; var rowbbar = this.rowbbar;
if(!Ext.isArray(rowbbar)) if (!Ext.isArray(rowbbar))
return; return;
for(var i = 0; i < rowbbar.length; i ++) { for (var i = 0; i < rowbbar.length; i++) {
new Ext.Toolbar(rowbbar[i]).render(this.bbar); new Ext.Toolbar(rowbbar[i]).render(this.bbar);
} }
} }