2011-07-08 19:06:32 -04:00
|
|
|
var newButton;
|
|
|
|
|
var editButton;
|
|
|
|
|
var deleteButton;
|
|
|
|
|
var importButton;
|
|
|
|
|
var exportButton;
|
|
|
|
|
var dataButton;
|
|
|
|
|
|
|
|
|
|
var store;
|
|
|
|
|
var expander;
|
|
|
|
|
var cmodel;
|
|
|
|
|
var infoGrid;
|
|
|
|
|
var viewport;
|
|
|
|
|
var smodel;
|
|
|
|
|
|
|
|
|
|
var rowsSelected;
|
2011-07-12 12:02:57 -04:00
|
|
|
var importOption;
|
|
|
|
|
var externalOption;
|
2011-10-12 19:05:14 -04:00
|
|
|
var currentSelectedRow = -1;
|
2011-07-08 19:06:32 -04:00
|
|
|
|
|
|
|
|
Ext.onReady(function(){
|
|
|
|
|
///Keyboard Events
|
|
|
|
|
new Ext.KeyMap(document, {
|
|
|
|
|
key: Ext.EventObject.F5,
|
|
|
|
|
fn: function(keycode, e) {
|
|
|
|
|
if (! e.ctrlKey) {
|
|
|
|
|
if (Ext.isIE) {
|
|
|
|
|
e.browserEvent.keyCode = 8;
|
|
|
|
|
}
|
|
|
|
|
e.stopEvent();
|
|
|
|
|
document.location = document.location;
|
2012-04-12 17:46:54 -04:00
|
|
|
}
|
2011-07-08 19:06:32 -04:00
|
|
|
else{
|
|
|
|
|
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Ext.QuickTips.init();
|
|
|
|
|
|
|
|
|
|
pageSize = parseInt(CONFIG.pageSize);
|
|
|
|
|
|
2011-07-12 12:32:14 -04:00
|
|
|
var newMenuOptions = new Array();
|
|
|
|
|
if (PRO_UID == false) {
|
|
|
|
|
newMenuOptions.push({
|
2011-07-28 10:20:52 -04:00
|
|
|
text: _('ID_NEW_PMTABLE'),
|
2011-07-11 18:06:32 -04:00
|
|
|
handler: newPMTable
|
2011-07-12 12:32:14 -04:00
|
|
|
});
|
|
|
|
|
}
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-12 12:32:14 -04:00
|
|
|
newMenuOptions.push({
|
2011-07-22 17:08:57 -04:00
|
|
|
text: _('ID_NEW_REPORT_TABLE'),
|
2011-07-12 12:32:14 -04:00
|
|
|
handler: NewReportTable
|
|
|
|
|
});
|
2011-07-11 18:06:32 -04:00
|
|
|
|
|
|
|
|
if (PRO_UID !== false) {
|
|
|
|
|
newMenuOptions.push({
|
2011-07-22 17:08:57 -04:00
|
|
|
text: _('ID_NEW_REPORT_TABLE_OLD'),
|
2011-07-11 18:06:32 -04:00
|
|
|
handler: NewReportTableOld
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
newButton = new Ext.Action({
|
|
|
|
|
text: _('ID_NEW'),
|
2011-07-11 18:06:32 -04:00
|
|
|
icon: '/images/add-table.png',
|
|
|
|
|
menu: newMenuOptions
|
2011-07-08 19:06:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
editButton = new Ext.Action({
|
|
|
|
|
text: _('ID_EDIT'),
|
2011-07-11 18:06:32 -04:00
|
|
|
icon: '/images/edit-table.png',
|
2011-07-08 19:06:32 -04:00
|
|
|
handler: EditPMTable,
|
|
|
|
|
disabled: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
deleteButton = new Ext.Action({
|
|
|
|
|
text: _('ID_DELETE'),
|
2011-07-11 18:06:32 -04:00
|
|
|
icon: '/images/delete-table.png',
|
2011-07-08 19:06:32 -04:00
|
|
|
handler: DeletePMTable,
|
|
|
|
|
disabled: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
importButton = new Ext.Action({
|
|
|
|
|
text: _('ID_IMPORT'),
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
icon: '/images/import.gif',
|
|
|
|
|
handler: ImportPMTable
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exportButton = new Ext.Action({
|
|
|
|
|
text: _('ID_EXPORT'),
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
icon: '/images/export.png',
|
|
|
|
|
handler: ExportPMTable,
|
|
|
|
|
disabled: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dataButton = new Ext.Action({
|
|
|
|
|
text: ' ' + _('ID_DATA'),
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
icon: '/images/database-start.png',
|
|
|
|
|
handler: PMTableData,
|
|
|
|
|
disabled: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
searchButton = new Ext.Action({
|
|
|
|
|
text: _('ID_SEARCH'),
|
|
|
|
|
handler: DoSearch
|
|
|
|
|
});
|
|
|
|
|
|
2011-07-12 12:02:57 -04:00
|
|
|
var contextMenuItems = new Array();
|
2012-04-12 17:46:54 -04:00
|
|
|
contextMenuItems.push(editButton);
|
2011-07-12 12:02:57 -04:00
|
|
|
contextMenuItems.push(deleteButton);
|
|
|
|
|
contextMenuItems.push('-');
|
|
|
|
|
contextMenuItems.push(dataButton);
|
|
|
|
|
contextMenuItems.push(exportButton);
|
|
|
|
|
|
|
|
|
|
if (_PLUGIN_SIMPLEREPORTS !== false) {
|
|
|
|
|
externalOption = new Ext.Action({
|
|
|
|
|
text:'',
|
|
|
|
|
handler: function() {
|
|
|
|
|
updateTag('plugin@simplereport');
|
|
|
|
|
},
|
|
|
|
|
disabled: false
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
contextMenuItems.push(externalOption);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
contextMenu = new Ext.menu.Menu({
|
2011-07-12 12:02:57 -04:00
|
|
|
items: contextMenuItems
|
2011-07-08 19:06:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
searchText = new Ext.form.TextField ({
|
2011-09-15 11:30:27 -04:00
|
|
|
id: 'searchTxt',
|
|
|
|
|
ctCls:'pm_search_text_field',
|
|
|
|
|
allowBlank: true,
|
|
|
|
|
width: 150,
|
|
|
|
|
emptyText: _('ID_ENTER_SEARCH_TERM'),
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: function(f,e){
|
|
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
|
|
DoSearch();
|
2011-07-22 17:08:57 -04:00
|
|
|
}
|
2011-09-15 11:30:27 -04:00
|
|
|
},
|
|
|
|
|
focus: function(f,e) {
|
|
|
|
|
var row = infoGrid.getSelectionModel().getSelected();
|
|
|
|
|
infoGrid.getSelectionModel().deselectRow(infoGrid.getStore().indexOf(row));
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
2011-09-15 11:30:27 -04:00
|
|
|
}
|
2011-07-08 19:06:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
clearTextButton = new Ext.Action({
|
|
|
|
|
text: 'X',
|
|
|
|
|
ctCls:'pm_search_x_button',
|
|
|
|
|
handler: GridByDefault
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
storePageSize = new Ext.data.SimpleStore({
|
2011-07-12 12:02:57 -04:00
|
|
|
fields: ['size'],
|
|
|
|
|
data: [['20'],['30'],['40'],['50'],['100']],
|
|
|
|
|
autoLoad: true
|
|
|
|
|
});
|
2011-07-08 19:06:32 -04:00
|
|
|
|
2011-07-12 12:02:57 -04:00
|
|
|
comboPageSize = new Ext.form.ComboBox({
|
|
|
|
|
typeAhead : false,
|
|
|
|
|
mode : 'local',
|
|
|
|
|
triggerAction : 'all',
|
|
|
|
|
store: storePageSize,
|
|
|
|
|
valueField: 'size',
|
|
|
|
|
displayField: 'size',
|
|
|
|
|
width: 50,
|
|
|
|
|
editable: false,
|
|
|
|
|
listeners:{
|
|
|
|
|
select: function(c,d,i){
|
|
|
|
|
UpdatePageConfig(d.data['size']);
|
|
|
|
|
bbarpaging.pageSize = parseInt(d.data['size']);
|
|
|
|
|
bbarpaging.moveFirst();
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
2011-07-12 12:02:57 -04:00
|
|
|
}
|
|
|
|
|
});
|
2011-07-08 19:06:32 -04:00
|
|
|
|
2011-07-12 12:02:57 -04:00
|
|
|
comboPageSize.setValue(pageSize);
|
2011-07-08 19:06:32 -04:00
|
|
|
|
|
|
|
|
store = new Ext.data.GroupingStore( {
|
2011-09-15 11:30:27 -04:00
|
|
|
autoLoad: false,
|
2011-07-08 19:06:32 -04:00
|
|
|
proxy : new Ext.data.HttpProxy({
|
2011-07-11 18:06:32 -04:00
|
|
|
url: 'pmTablesProxy/getList' + (PRO_UID? '?pro_uid='+PRO_UID: '')
|
2011-07-08 19:06:32 -04:00
|
|
|
}),
|
|
|
|
|
reader : new Ext.data.JsonReader( {
|
|
|
|
|
root: 'rows',
|
|
|
|
|
totalProperty: 'count',
|
|
|
|
|
fields : [
|
|
|
|
|
{name : 'ADD_TAB_UID'},
|
|
|
|
|
{name : 'ADD_TAB_NAME'},
|
|
|
|
|
{name : 'ADD_TAB_DESCRIPTION'},
|
|
|
|
|
{name : 'PRO_TITLE'},
|
|
|
|
|
{name : 'TYPE'},
|
|
|
|
|
{name : 'ADD_TAB_TYPE'},
|
|
|
|
|
{name : 'ADD_TAB_TAG'},
|
|
|
|
|
{name : 'PRO_UID'},
|
2011-11-28 11:18:18 -04:00
|
|
|
{name : "DBS_UID"},
|
2011-10-11 17:13:13 -04:00
|
|
|
{name : 'NUM_ROWS'}
|
2011-07-08 19:06:32 -04:00
|
|
|
]
|
2011-10-12 19:05:14 -04:00
|
|
|
}),
|
|
|
|
|
listeners: {
|
|
|
|
|
load: function(a,b){
|
|
|
|
|
if (currentSelectedRow != '') {
|
|
|
|
|
Ext.getCmp('infoGrid').getSelectionModel().selectRow(currentSelectedRow);
|
|
|
|
|
Ext.getCmp('infoGrid').fireEvent('rowclick', Ext.getCmp('infoGrid'), currentSelectedRow)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-07-08 19:06:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
smodel = new Ext.grid.CheckboxSelectionModel({
|
|
|
|
|
listeners:{
|
|
|
|
|
selectionchange: function(sm){
|
2011-10-12 19:05:14 -04:00
|
|
|
if (sm.last !== false) {
|
2012-04-12 17:46:54 -04:00
|
|
|
var count_rows = sm.getCount();
|
2011-10-12 19:05:14 -04:00
|
|
|
//var isReport = sm.getSelected().get('PRO_UID') != '';
|
|
|
|
|
|
|
|
|
|
currentSelectedRow = sm.last;
|
|
|
|
|
switch(count_rows){
|
|
|
|
|
case 0:
|
|
|
|
|
editButton.disable();
|
|
|
|
|
deleteButton.disable();
|
|
|
|
|
exportButton.disable();
|
|
|
|
|
dataButton.disable();
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
editButton.enable();
|
|
|
|
|
deleteButton.enable();
|
|
|
|
|
exportButton.enable();
|
|
|
|
|
dataButton.enable();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
editButton.disable();
|
|
|
|
|
deleteButton.enable();
|
|
|
|
|
exportButton.enable();
|
|
|
|
|
dataButton.disable();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cmodelColumns = new Array();
|
2011-07-21 18:35:37 -04:00
|
|
|
cmodelColumns.push(new Ext.grid.CheckboxSelectionModel());
|
2011-07-08 19:06:32 -04:00
|
|
|
cmodelColumns.push({id:'ADD_TAB_UID', dataIndex: 'ADD_TAB_UID', hidden:true, hideable:false});
|
|
|
|
|
cmodelColumns.push({dataIndex: 'ADD_TAB_TAG', hidden:true, hideable:false});
|
|
|
|
|
cmodelColumns.push({header: _('ID_NAME'), dataIndex: 'ADD_TAB_NAME', width: 300, align:'left', renderer: function(v,p,r){
|
|
|
|
|
return r.get('TYPE') == 'CLASSIC'? v + ' <span style="font-size:9px; color:green">(old version)</font>' : v;
|
|
|
|
|
}});
|
|
|
|
|
cmodelColumns.push({header: _('ID_DESCRIPTION'), dataIndex: 'ADD_TAB_DESCRIPTION', width: 400, hidden:false, align:'left', renderer: function(v,p,r){
|
|
|
|
|
if (r.get('ADD_TAB_TAG')) {
|
|
|
|
|
tag = r.get('ADD_TAB_TAG').replace('plugin@', '');
|
|
|
|
|
tag = tag.charAt(0).toUpperCase() + tag.slice(1);
|
2011-07-12 12:02:57 -04:00
|
|
|
switch(tag.toLowerCase()){
|
2012-03-12 17:09:59 -04:00
|
|
|
case 'simplereport':
|
|
|
|
|
tag = _('ID_SIMPLE_REPORT');
|
|
|
|
|
break;
|
2011-07-12 12:02:57 -04:00
|
|
|
}
|
2012-04-12 17:46:54 -04:00
|
|
|
}
|
2011-07-08 19:06:32 -04:00
|
|
|
return r.get('ADD_TAB_TAG') ? '<span style="font-size:9px; color:green">'+tag+':</span> '+ v : v;
|
|
|
|
|
}});
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2012-03-12 17:09:59 -04:00
|
|
|
cmodelColumns.push({header: _('ID_TABLE_TYPE'), dataIndex: 'PRO_UID', width: 120, align:'left', renderer: function(v,p,r){
|
2011-07-12 12:02:57 -04:00
|
|
|
color = r.get('PRO_UID') ? 'blue' : 'green';
|
2011-07-22 17:08:57 -04:00
|
|
|
value = r.get('PRO_UID') ? _('ID_REPORT_TABLE') : _('ID_PMTABLE');
|
2011-07-08 19:06:32 -04:00
|
|
|
return '<span style="color:'+color+'">'+value+'</span> ';
|
|
|
|
|
}});
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-11-28 11:18:18 -04:00
|
|
|
cmodelColumns.push({dataIndex: "DBS_UID", hidden: true, hideable: false});
|
2011-07-08 19:06:32 -04:00
|
|
|
|
2011-10-11 17:13:13 -04:00
|
|
|
cmodelColumns.push({header: 'Records', dataIndex: 'NUM_ROWS', width: 90, align:'left'});
|
|
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
if (PRO_UID === false) {
|
|
|
|
|
cmodelColumns.push({header: _('ID_PROCESS'), dataIndex: 'PRO_TITLE', width: 180, align:'left'});
|
|
|
|
|
}
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
cmodelColumns.push({header: _('ID_TYPE'), dataIndex: 'ADD_TAB_TYPE', width: 400, hidden:true, align:'left'});
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
cmodel = new Ext.grid.ColumnModel({
|
|
|
|
|
defaults: {
|
|
|
|
|
width: 50,
|
|
|
|
|
sortable: true
|
|
|
|
|
},
|
|
|
|
|
columns: cmodelColumns
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
bbarpaging = new Ext.PagingToolbar({
|
|
|
|
|
pageSize: pageSize,
|
|
|
|
|
store: store,
|
|
|
|
|
displayInfo: true,
|
2012-05-04 16:22:50 -04:00
|
|
|
displayMsg: (PRO_UID? _('ID_GRID_PAGE_DISPLAYING_REPORTABLES_MESSAGE') : _('ID_GRID_PAGE_DISPLAYING_PMTABLES_MESSAGE')) + ' ',
|
2011-07-08 19:06:32 -04:00
|
|
|
emptyMsg: _('ID_GRID_PAGE_NO_PMTABLES_MESSAGE'),
|
|
|
|
|
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
infoGrid = new Ext.grid.GridPanel({
|
|
|
|
|
region: 'center',
|
|
|
|
|
layout: 'fit',
|
|
|
|
|
id: 'infoGrid',
|
|
|
|
|
height:100,
|
|
|
|
|
autoWidth : true,
|
2012-05-04 16:28:18 -04:00
|
|
|
title : (PRO_UID? _('ID_REPORT_TABLES') : _('ID_PMTABLE')),
|
2011-07-08 19:06:32 -04:00
|
|
|
stateful : true,
|
|
|
|
|
stateId : 'grid',
|
|
|
|
|
enableColumnResize: true,
|
|
|
|
|
enableHdMenu: true,
|
|
|
|
|
frame:false,
|
|
|
|
|
columnLines: false,
|
|
|
|
|
viewConfig: {
|
|
|
|
|
forceFit:true
|
|
|
|
|
},
|
|
|
|
|
store: store,
|
2011-09-15 11:30:27 -04:00
|
|
|
loadMask: true,
|
2011-07-08 19:06:32 -04:00
|
|
|
cm: cmodel,
|
|
|
|
|
sm: smodel,
|
2011-09-15 11:30:27 -04:00
|
|
|
tbar: [
|
2012-04-12 17:46:54 -04:00
|
|
|
newButton,
|
|
|
|
|
editButton,
|
|
|
|
|
deleteButton,'-',
|
|
|
|
|
dataButton,'-' ,
|
|
|
|
|
importButton,
|
2011-09-15 11:30:27 -04:00
|
|
|
exportButton,
|
|
|
|
|
'->',
|
|
|
|
|
searchText,
|
|
|
|
|
clearTextButton,
|
|
|
|
|
searchButton],
|
2011-07-08 19:06:32 -04:00
|
|
|
bbar: bbarpaging,
|
|
|
|
|
listeners: {
|
|
|
|
|
rowdblclick: EditPMTable,
|
|
|
|
|
render: function(){
|
2011-09-15 11:30:27 -04:00
|
|
|
this.loadMask = new Ext.LoadMask(this.body, {msg:'loading'});
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
view: new Ext.grid.GroupingView({
|
|
|
|
|
forceFit:true,
|
|
|
|
|
groupTextTpl: '{text}'
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
infoGrid.on('rowcontextmenu',
|
2011-09-15 11:30:27 -04:00
|
|
|
function (grid, rowIndex, evt) {
|
|
|
|
|
var sm = grid.getSelectionModel();
|
|
|
|
|
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
|
|
|
|
|
|
|
|
|
var rowsSelected = Ext.getCmp('infoGrid').getSelectionModel().getSelections();
|
|
|
|
|
tag = rowsSelected[0].get('ADD_TAB_TAG');
|
2012-04-12 17:46:54 -04:00
|
|
|
text = (tag) ? _('ID_CONVERT_NATIVE_REP_TABLE') : _('ID_CONVERT_SIMPLE_REPORT');
|
|
|
|
|
|
2011-09-15 11:30:27 -04:00
|
|
|
if (externalOption) {
|
|
|
|
|
externalOption.setText(text);
|
|
|
|
|
if (rowsSelected[0].get('PRO_UID')) {
|
|
|
|
|
externalOption.setDisabled(false);
|
|
|
|
|
} else {
|
|
|
|
|
externalOption.setDisabled(true);
|
2011-07-12 12:02:57 -04:00
|
|
|
}
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-11-28 11:18:18 -04:00
|
|
|
externalOption.setHidden((rowsSelected[0].get("TYPE") != "CLASSIC" && rowsSelected[0].get("DBS_UID") == "workflow")? false : true);
|
2011-09-15 11:30:27 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
this
|
2011-07-08 19:06:32 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
|
|
|
|
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
|
|
|
|
|
|
|
|
|
viewport = new Ext.Viewport({
|
|
|
|
|
layout: 'fit',
|
|
|
|
|
autoScroll: false,
|
2011-09-15 11:30:27 -04:00
|
|
|
items: [infoGrid]
|
2011-07-08 19:06:32 -04:00
|
|
|
});
|
2011-09-15 11:30:27 -04:00
|
|
|
|
|
|
|
|
infoGrid.store.load();
|
2011-07-08 19:06:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//Funtion Handles Context Menu Opening
|
|
|
|
|
onMessageContextMenu = function (grid, rowIndex, e) {
|
|
|
|
|
e.stopEvent();
|
|
|
|
|
var coords = e.getXY();
|
|
|
|
|
contextMenu.showAt([coords[0], coords[1]]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/////JS FUNCTIONS
|
|
|
|
|
|
|
|
|
|
//Capitalize String Function
|
|
|
|
|
capitalize = function(s){
|
|
|
|
|
s = s.toLowerCase();
|
|
|
|
|
return s.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Do Nothing Function
|
|
|
|
|
DoNothing = function(){};
|
|
|
|
|
|
|
|
|
|
//Load New PM Table Forms
|
|
|
|
|
NewReportTable = function(){
|
|
|
|
|
if(PRO_UID !== false)
|
|
|
|
|
location.href = 'pmTables/edit?PRO_UID='+PRO_UID+'&tableType=report';
|
|
|
|
|
else
|
|
|
|
|
location.href = 'pmTables/edit?tableType=report';
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-11 18:06:32 -04:00
|
|
|
NewReportTableOld = function(){
|
|
|
|
|
//location.href = 'reportTables/edit?PRO_UID='+PRO_UID+'&tableType=report';
|
|
|
|
|
//parent.reportTables2();
|
|
|
|
|
//parent.Pm.data.render.buildingBlocks.injector('reportTables2');
|
|
|
|
|
location.href = 'reportTables/reportTables_Edit?PRO_UID='+PRO_UID;
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
newPMTable = function(){
|
|
|
|
|
location.href = 'pmTables/edit?tableType=table';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
EditPMTable = function(){
|
|
|
|
|
var row = Ext.getCmp('infoGrid').getSelectionModel().getSelected();
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
if (row.data.TYPE != 'CLASSIC') {
|
2011-07-11 20:08:59 -04:00
|
|
|
tableType = row.data.PRO_UID ? 'report' : 'table';
|
2011-07-08 19:06:32 -04:00
|
|
|
proParam = PRO_UID !== false ? '&PRO_UID='+PRO_UID : '';
|
|
|
|
|
location.href = 'pmTables/edit?id='+row.data.ADD_TAB_UID+'&tableType=' + tableType + proParam;
|
|
|
|
|
}
|
|
|
|
|
else { //edit old report table
|
2011-07-11 18:06:32 -04:00
|
|
|
location.href = 'reportTables/reportTables_Edit?REP_TAB_UID='+row.data.ADD_TAB_UID
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Confirm PM Table Deletion Tasks
|
|
|
|
|
DeletePMTable = function() {
|
|
|
|
|
var rows = Ext.getCmp('infoGrid').getSelectionModel().getSelections();
|
|
|
|
|
var selections = new Array();
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
for(var i=0; i<rows.length; i++) {
|
|
|
|
|
selections[i] = {id: rows[i].get('ADD_TAB_UID'), type: rows[i].get('TYPE')};
|
|
|
|
|
}
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2012-03-12 17:09:59 -04:00
|
|
|
Ext.Msg.confirm( _('ID_CONFIRM'), _('ID_CONFIRM_DELETE_PM_TABLE'),
|
2011-07-08 19:06:32 -04:00
|
|
|
function(btn, text) {
|
|
|
|
|
if (btn == "yes") {
|
2011-10-12 10:09:53 -04:00
|
|
|
Ext.Msg.show({
|
|
|
|
|
title : '',
|
2012-03-12 17:09:59 -04:00
|
|
|
msg : _('ID_REMOVING_SELECTD_TABLES'),
|
2011-10-12 10:09:53 -04:00
|
|
|
wait:true,
|
|
|
|
|
waitConfig: {interval:500}
|
|
|
|
|
});
|
|
|
|
|
|
2011-07-08 19:06:32 -04:00
|
|
|
Ext.Ajax.request ({
|
|
|
|
|
url: 'pmTablesProxy/delete',
|
|
|
|
|
params: {
|
|
|
|
|
rows: Ext.util.JSON.encode(selections)
|
|
|
|
|
},
|
|
|
|
|
success: function(resp){
|
2011-10-12 10:09:53 -04:00
|
|
|
Ext.MessageBox.hide();
|
2011-07-08 19:06:32 -04:00
|
|
|
result = Ext.util.JSON.decode(resp.responseText);
|
2011-10-11 17:13:13 -04:00
|
|
|
Ext.getCmp('infoGrid').getStore().reload();
|
2011-07-08 19:06:32 -04:00
|
|
|
if (result.success) {
|
|
|
|
|
PMExt.notify(_("ID_DELETION_SUCCESSFULLY"), _("ID_ALL_RECORDS_DELETED_SUCESSFULLY"));
|
|
|
|
|
} else {
|
2011-10-11 17:13:13 -04:00
|
|
|
PMExt.error( _('ID_ERROR'), result.message.nl2br());
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
failure: function(obj, resp){
|
2011-10-12 10:09:53 -04:00
|
|
|
Ext.MessageBox.hide();
|
2011-10-11 17:13:13 -04:00
|
|
|
Ext.getCmp('infoGrid').getStore().reload();
|
|
|
|
|
Ext.Msg.alert( _('ID_ERROR'), resp.result.message);
|
2011-07-08 19:06:32 -04:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Load Import PM Table Form
|
|
|
|
|
ImportPMTable = function(){
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-12 12:02:57 -04:00
|
|
|
var w = new Ext.Window({
|
|
|
|
|
title: '',
|
|
|
|
|
width: 420,
|
|
|
|
|
height: 160,
|
|
|
|
|
modal: true,
|
|
|
|
|
autoScroll: false,
|
|
|
|
|
maximizable: false,
|
|
|
|
|
resizable: false,
|
|
|
|
|
items: [
|
|
|
|
|
new Ext.FormPanel({
|
|
|
|
|
/*renderTo: 'form-panel',*/
|
|
|
|
|
id:'uploader',
|
|
|
|
|
fileUpload: true,
|
|
|
|
|
width: 400,
|
|
|
|
|
frame: true,
|
2012-05-04 16:28:18 -04:00
|
|
|
title: (PRO_UID? _('ID_IMPORT_RT') : _('ID_IMPORT_PMT')),
|
2011-07-12 12:02:57 -04:00
|
|
|
autoHeight: false,
|
|
|
|
|
bodyStyle: 'padding: 10px 10px 0 10px;',
|
|
|
|
|
labelWidth: 50,
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '90%',
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
msgTarget: 'side'
|
|
|
|
|
},
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'fileuploadfield',
|
|
|
|
|
id: 'form-file',
|
2012-03-12 17:09:59 -04:00
|
|
|
emptyText: _('ID_SELECT_PM_FILE'),
|
2011-07-12 12:02:57 -04:00
|
|
|
fieldLabel: _('ID_FILE'),
|
|
|
|
|
name: 'form[FILENAME]',
|
|
|
|
|
buttonText: '',
|
|
|
|
|
buttonCfg: {
|
|
|
|
|
iconCls: 'upload-icon'
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'checkbox',
|
|
|
|
|
fieldLabel: '',
|
2012-03-12 17:09:59 -04:00
|
|
|
boxLabel: _('ID_OVERWRITE_EXIST'), // 'Overwrite if exists?',
|
2011-07-12 12:02:57 -04:00
|
|
|
name: 'form[OVERWRITE]'
|
2012-09-03 16:23:37 -04:00
|
|
|
}, {
|
|
|
|
|
xtype: "hidden",
|
|
|
|
|
name: "form[PRO_UID]",
|
|
|
|
|
value: (typeof PRO_UID == "string" && PRO_UID != "")? PRO_UID : ""
|
2011-07-12 12:02:57 -04:00
|
|
|
}],
|
|
|
|
|
buttons: [{
|
|
|
|
|
text: _('ID_UPLOAD'),
|
|
|
|
|
handler: function(){
|
|
|
|
|
var uploader = Ext.getCmp('uploader');
|
|
|
|
|
|
|
|
|
|
if(uploader.getForm().isValid()){
|
|
|
|
|
uploader.getForm().submit({
|
|
|
|
|
url: 'pmTablesProxy/import',
|
2012-03-12 17:09:59 -04:00
|
|
|
waitMsg: _('ID_UPLOADING_FILE'),
|
2011-07-12 12:02:57 -04:00
|
|
|
success: function(o, resp){
|
2011-09-15 12:29:08 -04:00
|
|
|
var result = Ext.util.JSON.decode(resp.response.responseText);
|
|
|
|
|
|
|
|
|
|
if (result.success) {
|
2012-03-12 17:09:59 -04:00
|
|
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
2011-09-15 12:29:08 -04:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
win = new Ext.Window({
|
|
|
|
|
applyTo:'hello-win',
|
|
|
|
|
layout:'fit',
|
|
|
|
|
width:500,
|
|
|
|
|
height:300,
|
|
|
|
|
closeAction:'hide',
|
|
|
|
|
plain: true,
|
2012-03-12 17:09:59 -04:00
|
|
|
html: '<h3>' + _('ID_IMPORTING_ERROR') + '</h3>' + result.message,
|
2011-09-15 12:29:08 -04:00
|
|
|
items: [],
|
|
|
|
|
|
|
|
|
|
buttons: [{
|
|
|
|
|
text: 'Close',
|
|
|
|
|
handler: function(){
|
|
|
|
|
win.hide();
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
win.show(this);
|
|
|
|
|
}
|
2011-09-15 11:30:27 -04:00
|
|
|
|
2011-07-12 12:02:57 -04:00
|
|
|
w.close();
|
|
|
|
|
infoGrid.store.reload();
|
|
|
|
|
},
|
|
|
|
|
failure: function(o, resp){
|
|
|
|
|
w.close();
|
2011-09-15 12:29:08 -04:00
|
|
|
infoGrid.store.reload();
|
|
|
|
|
|
|
|
|
|
var result = Ext.util.JSON.decode(resp.response.responseText);
|
|
|
|
|
if (result.errorType == 'warning') {
|
|
|
|
|
PMExt.warning(_('ID_WARNING'), result.message.replace(/\n/g,' <br>'));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
|
|
|
|
}
|
2011-07-12 12:02:57 -04:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}/*,{
|
|
|
|
|
text: 'Reset',
|
|
|
|
|
handler: function(){
|
|
|
|
|
uploader = Ext.getCmp('uploader');
|
|
|
|
|
uploader.getForm().reset();
|
|
|
|
|
}
|
|
|
|
|
}*/,{
|
|
|
|
|
text: TRANSLATIONS.ID_CANCEL,
|
|
|
|
|
handler: function(){
|
|
|
|
|
w.close();
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
})
|
2011-09-15 11:30:27 -04:00
|
|
|
]
|
2011-07-12 12:02:57 -04:00
|
|
|
});
|
|
|
|
|
w.show();
|
|
|
|
|
}
|
2011-07-08 19:06:32 -04:00
|
|
|
|
|
|
|
|
//Load Export PM Tables Form
|
|
|
|
|
ExportPMTable = function(){
|
2011-07-21 18:35:37 -04:00
|
|
|
var rows = Ext.getCmp('infoGrid').getSelectionModel().getSelections();
|
|
|
|
|
var toExportRows = new Array();
|
2012-04-12 17:46:54 -04:00
|
|
|
|
2011-07-21 18:35:37 -04:00
|
|
|
for(var i=0; i<rows.length; i++){
|
|
|
|
|
toExportRows.push([
|
|
|
|
|
rows[i].get('ADD_TAB_UID'),
|
2011-08-03 13:11:17 -04:00
|
|
|
rows[i].get('PRO_UID'),
|
2011-07-21 18:35:37 -04:00
|
|
|
rows[i].get('ADD_TAB_NAME'),
|
2011-07-22 17:08:57 -04:00
|
|
|
(rows[i].get('PRO_UID') ? _('ID_REPORT_TABLE'): _('ID_PMTABLE')),
|
2011-07-21 18:35:37 -04:00
|
|
|
true,
|
2012-04-12 17:46:54 -04:00
|
|
|
(rows[i].get('PRO_UID') ? false : true)
|
2011-07-21 18:35:37 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Export.targetGrid.store.loadData(toExportRows);
|
|
|
|
|
Export.window.show();
|
2011-07-08 19:06:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Load PM TAble Data
|
2011-10-11 17:13:13 -04:00
|
|
|
PMTableData = function()
|
|
|
|
|
{
|
2011-07-08 19:06:32 -04:00
|
|
|
var row = Ext.getCmp('infoGrid').getSelectionModel().getSelected();
|
2012-05-04 16:22:50 -04:00
|
|
|
var type = row.get('PRO_UID');
|
2012-07-30 16:28:08 -04:00
|
|
|
|
2011-10-11 17:13:13 -04:00
|
|
|
//location.href = 'pmTables/data?id='+row.get('ADD_TAB_UID');
|
|
|
|
|
if (row.get('TYPE') != '') {
|
|
|
|
|
PMExt.info(_('ID_INFO'), _('ID_DATA_LIST_NOT_AVAILABLE_FOR_OLDVER'));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
win = new Ext.Window({
|
2012-07-30 16:28:08 -04:00
|
|
|
layout: 'fit',
|
|
|
|
|
width: 700,
|
|
|
|
|
height: 400,
|
2012-05-04 16:22:50 -04:00
|
|
|
title: ((type != '')? _('ID_REPORT_TABLE') : _('ID_PMTABLE')) +': '+ row.get('ADD_TAB_NAME'),
|
2011-10-11 17:13:13 -04:00
|
|
|
modal: true,
|
|
|
|
|
maximizable: true,
|
|
|
|
|
constrain: true,
|
|
|
|
|
//closeAction:'hide',
|
|
|
|
|
plain: true,
|
|
|
|
|
items: [{
|
|
|
|
|
xtype:"iframepanel",
|
|
|
|
|
defaultSrc : 'pmTables/data?id='+row.get('ADD_TAB_UID')+'&type='+row.get('TYPE'),
|
|
|
|
|
loadMask:{msg: _('ID_LOADING')}
|
2011-10-12 10:09:53 -04:00
|
|
|
}],
|
|
|
|
|
listeners: {
|
|
|
|
|
close: function() {
|
|
|
|
|
store.reload();
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-10-11 17:13:13 -04:00
|
|
|
});
|
2012-07-30 16:28:08 -04:00
|
|
|
|
2011-10-11 17:13:13 -04:00
|
|
|
win.show();
|
2011-07-08 19:06:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Gets UIDs from a array of rows
|
|
|
|
|
RetrieveRowsID = function(rows){
|
|
|
|
|
var arrAux = new Array();
|
|
|
|
|
for(var c=0; c<rows.length; c++){
|
|
|
|
|
arrAux[c] = rows[c].get('ADD_TAB_UID');
|
|
|
|
|
}
|
|
|
|
|
return arrAux.join(',');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Update Page Size Configuration
|
|
|
|
|
UpdatePageConfig = function(pageSize){
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url: 'additionalTablesAjax',
|
|
|
|
|
params: {action:'updatePageSize', size: pageSize}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Do Search Function
|
|
|
|
|
DoSearch = function(){
|
|
|
|
|
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Load Grid By Default
|
|
|
|
|
GridByDefault = function(){
|
|
|
|
|
searchText.reset();
|
|
|
|
|
infoGrid.store.load();
|
2011-07-12 12:02:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function updateTag(value)
|
|
|
|
|
{
|
|
|
|
|
var rowsSelected = Ext.getCmp('infoGrid').getSelectionModel().getSelections();
|
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url: 'pmTablesProxy/updateTag',
|
|
|
|
|
params: {
|
|
|
|
|
ADD_TAB_UID: rowsSelected[0].get('ADD_TAB_UID'),
|
|
|
|
|
value: rowsSelected[0].get('ADD_TAB_TAG') ? '': value
|
|
|
|
|
},
|
|
|
|
|
success: function(resp){
|
|
|
|
|
Ext.getCmp('infoGrid').store.reload();
|
|
|
|
|
},
|
|
|
|
|
failure: function(obj, resp){
|
|
|
|
|
Ext.Msg.alert( _('ID_ERROR'), resp.result.msg);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-24 18:02:54 -04:00
|
|
|
function PopupCenter(pageURL, title,w,h) {
|
|
|
|
|
var left = (Ext.getBody().getViewSize().width/3);
|
|
|
|
|
var top = (Ext.getBody().getViewSize().height/3);
|
|
|
|
|
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
|
2012-04-12 17:46:54 -04:00
|
|
|
}
|