Fix Bug 6189 for IE
This commit is contained in:
@@ -4,45 +4,46 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Keyboard Events
|
//Keyboard Events
|
||||||
new Ext.KeyMap(document, [
|
new Ext.KeyMap(document,
|
||||||
{
|
[
|
||||||
key: Ext.EventObject.F5,
|
{
|
||||||
fn: function(keycode, e) {
|
key: Ext.EventObject.F5,
|
||||||
if (! e.ctrlKey) {
|
fn: function(keycode, e) {
|
||||||
if (Ext.isIE) {
|
if (! e.ctrlKey) {
|
||||||
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
if (Ext.isIE) {
|
||||||
// thinking some other key was pressed (backspace in this case)
|
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
||||||
e.browserEvent.keyCode = 8;
|
// thinking some other key was pressed (backspace in this case)
|
||||||
}
|
e.browserEvent.keyCode = 8;
|
||||||
e.stopEvent();
|
}
|
||||||
document.location = document.location;
|
e.stopEvent();
|
||||||
}else{
|
document.location = document.location;
|
||||||
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
}else{
|
||||||
}
|
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,
|
}
|
||||||
{
|
,
|
||||||
key: Ext.EventObject.DELETE,
|
{
|
||||||
fn: function(k,e){
|
key: Ext.EventObject.DELETE,
|
||||||
iGrid = Ext.getCmp('infoGrid');
|
fn: function(k,e){
|
||||||
rowSelected = iGrid.getSelectionModel().getSelected();
|
iGrid = Ext.getCmp('infoGrid');
|
||||||
if (rowSelected){
|
rowSelected = iGrid.getSelectionModel().getSelected();
|
||||||
DeleteButtonAction();
|
if (rowSelected){
|
||||||
}
|
DeleteButtonAction();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
key: Ext.EventObject.F2,
|
{
|
||||||
fn: function(k,e){
|
key: Ext.EventObject.F2,
|
||||||
iGrid = Ext.getCmp('infoGrid');
|
fn: function(k,e){
|
||||||
rowSelected = iGrid.getSelectionModel().getSelected();
|
iGrid = Ext.getCmp('infoGrid');
|
||||||
if (rowSelected){
|
rowSelected = iGrid.getSelectionModel().getSelected();
|
||||||
EditGroupWindow();
|
if (rowSelected){
|
||||||
}
|
EditGroupWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
var store;
|
var store;
|
||||||
var cmodel;
|
var cmodel;
|
||||||
@@ -60,270 +61,269 @@ var contextMenu;
|
|||||||
var pageSize;
|
var pageSize;
|
||||||
|
|
||||||
Ext.onReady(function(){
|
Ext.onReady(function(){
|
||||||
Ext.QuickTips.init();
|
Ext.QuickTips.init();
|
||||||
|
|
||||||
pageSize = parseInt(CONFIG.pageSize);
|
|
||||||
|
|
||||||
newButton = new Ext.Action({
|
|
||||||
text: _('ID_NEW'),
|
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
|
||||||
handler: NewGroupWindow
|
|
||||||
});
|
|
||||||
|
|
||||||
editButton = new Ext.Action({
|
|
||||||
text: _('ID_EDIT'),
|
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
|
||||||
handler: EditGroupWindow,
|
|
||||||
disabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
deleteButton = new Ext.Action({
|
|
||||||
text: _('ID_DELETE'),
|
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
|
||||||
handler: DeleteButtonAction,
|
|
||||||
disabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
membersButton = new Ext.Action({
|
|
||||||
text: _('ID_USERS'),
|
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_user_add',
|
|
||||||
handler: MembersAction,
|
|
||||||
disabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
searchButton = new Ext.Action({
|
|
||||||
text: _('ID_SEARCH'),
|
|
||||||
handler: DoSearch
|
|
||||||
});
|
|
||||||
|
|
||||||
contextMenu = new Ext.menu.Menu({
|
|
||||||
items: [editButton, deleteButton,'-',membersButton]
|
|
||||||
});
|
|
||||||
|
|
||||||
searchText = new Ext.form.TextField ({
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
focus: function(f,e) {
|
|
||||||
var row = infoGrid.getSelectionModel().getSelected();
|
|
||||||
infoGrid.getSelectionModel().deselectRow(infoGrid.getStore().indexOf(row));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
clearTextButton = new Ext.Action({
|
|
||||||
text: 'X',
|
|
||||||
ctCls:'pm_search_x_button',
|
|
||||||
handler: GridByDefault
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
smodel = new Ext.grid.RowSelectionModel({
|
|
||||||
singleSelect: true,
|
|
||||||
listeners:{
|
|
||||||
rowselect: function(sm){
|
|
||||||
editButton.enable();
|
|
||||||
deleteButton.enable();
|
|
||||||
membersButton.enable();
|
|
||||||
},
|
|
||||||
rowdeselect: function(sm){
|
|
||||||
editButton.disable();
|
|
||||||
deleteButton.disable();
|
|
||||||
membersButton.disable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
comboStatusStore = new Ext.data.SimpleStore({
|
|
||||||
fields: ['id','value'],
|
|
||||||
data: [['1','ACTIVE'],['0','INACTIVE']]
|
|
||||||
});
|
|
||||||
|
|
||||||
newForm = new Ext.FormPanel({
|
|
||||||
url: 'groups_Ajax?action=saveNewGroup',
|
|
||||||
frame: true,
|
|
||||||
items:[
|
|
||||||
{xtype: 'textfield', fieldLabel: _('ID_GROUP_NAME'), name: 'name', width: 200, allowBlank: false},
|
|
||||||
{
|
|
||||||
xtype: 'combo',
|
|
||||||
fieldLabel: _('ID_STATUS'),
|
|
||||||
hiddenName: 'status',
|
|
||||||
typeAhead: true,
|
|
||||||
mode: 'local',
|
|
||||||
store: comboStatusStore,
|
|
||||||
displayField: 'value',
|
|
||||||
valueField:'value',
|
|
||||||
allowBlank: false,
|
|
||||||
triggerAction: 'all',
|
|
||||||
emptyText: _('ID_SELECT_STATUS'),
|
|
||||||
selectOnFocus:true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
buttons: [
|
|
||||||
{text: _('ID_SAVE'), handler: SaveNewGroupAction},
|
|
||||||
{text: _('ID_CANCEL'), handler: CloseWindow}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
editForm = new Ext.FormPanel({
|
|
||||||
url: 'groups_Ajax?action=saveEditGroup',
|
|
||||||
frame: true,
|
|
||||||
items:[
|
|
||||||
{xtype: 'textfield', name: 'grp_uid', hidden: true},
|
|
||||||
{xtype: 'textfield', fieldLabel: _('ID_GROUP_NAME'), name: 'name', width: 200, allowBlank: false},
|
|
||||||
{
|
|
||||||
xtype: 'combo',
|
|
||||||
fieldLabel: _('ID_STATUS'),
|
|
||||||
hiddenName: 'status',
|
|
||||||
typeAhead: true,
|
|
||||||
mode: 'local',
|
|
||||||
store: comboStatusStore,
|
|
||||||
displayField: 'value',
|
|
||||||
valueField:'value',
|
|
||||||
allowBlank: false,
|
|
||||||
triggerAction: 'all',
|
|
||||||
emptyText: _('ID_SELECT_STATUS'),
|
|
||||||
selectOnFocus:true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
buttons: [
|
|
||||||
{text: _('ID_SAVE'), handler: SaveEditGroupAction},
|
|
||||||
{text: _('ID_CANCEL'), handler: CloseWindow},
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
store = new Ext.data.GroupingStore( {
|
pageSize = parseInt(CONFIG.pageSize);
|
||||||
proxy : new Ext.data.HttpProxy({
|
|
||||||
url: 'groups_Ajax?action=groupsList'
|
newButton = new Ext.Action({
|
||||||
}),
|
text: _('ID_NEW'),
|
||||||
reader : new Ext.data.JsonReader( {
|
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||||
root: 'groups',
|
handler: NewGroupWindow
|
||||||
totalProperty: 'total_groups',
|
});
|
||||||
fields : [
|
|
||||||
{name : 'GRP_UID'},
|
editButton = new Ext.Action({
|
||||||
{name : 'GRP_STATUS'},
|
text: _('ID_EDIT'),
|
||||||
{name : 'CON_VALUE'},
|
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
||||||
{name : 'GRP_TASKS', type: 'int'},
|
handler: EditGroupWindow,
|
||||||
{name : 'GRP_USERS', type: 'int'}
|
disabled: true
|
||||||
]
|
});
|
||||||
})
|
|
||||||
});
|
deleteButton = new Ext.Action({
|
||||||
|
text: _('ID_DELETE'),
|
||||||
cmodel = new Ext.grid.ColumnModel({
|
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
||||||
defaults: {
|
handler: DeleteButtonAction,
|
||||||
width: 50,
|
disabled: true
|
||||||
sortable: true
|
});
|
||||||
},
|
|
||||||
columns: [
|
membersButton = new Ext.Action({
|
||||||
{id:'GRP_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
|
text: _('ID_USERS'),
|
||||||
{header: _('ID_GROUP_NAME'), dataIndex: 'CON_VALUE', width: 400, align:'left'},
|
iconCls: 'button_menu_ext ss_sprite ss_user_add',
|
||||||
{header: _('ID_STATUS'), dataIndex: 'GRP_STATUS', width: 130, align:'center', renderer: render_status},
|
handler: MembersAction,
|
||||||
{header: _('ID_USERS'), dataIndex: 'GRP_USERS', width: 100, align:'center'},
|
disabled: true
|
||||||
{header: _('ID_TASKS'), dataIndex: 'GRP_TASKS', width: 100, align:'center'}
|
});
|
||||||
|
|
||||||
|
searchButton = new Ext.Action({
|
||||||
|
text: _('ID_SEARCH'),
|
||||||
|
handler: DoSearch
|
||||||
|
});
|
||||||
|
|
||||||
|
contextMenu = new Ext.menu.Menu({
|
||||||
|
items: [editButton, deleteButton,'-',membersButton]
|
||||||
|
});
|
||||||
|
|
||||||
|
searchText = new Ext.form.TextField ({
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focus: function(f,e) {
|
||||||
|
var row = infoGrid.getSelectionModel().getSelected();
|
||||||
|
infoGrid.getSelectionModel().deselectRow(infoGrid.getStore().indexOf(row));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
clearTextButton = new Ext.Action({
|
||||||
|
text: 'X',
|
||||||
|
ctCls:'pm_search_x_button',
|
||||||
|
handler: GridByDefault
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
smodel = new Ext.grid.RowSelectionModel({
|
||||||
|
singleSelect: true,
|
||||||
|
listeners:{
|
||||||
|
rowselect: function(sm){
|
||||||
|
editButton.enable();
|
||||||
|
deleteButton.enable();
|
||||||
|
membersButton.enable();
|
||||||
|
},
|
||||||
|
rowdeselect: function(sm){
|
||||||
|
editButton.disable();
|
||||||
|
deleteButton.disable();
|
||||||
|
membersButton.disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
comboStatusStore = new Ext.data.SimpleStore({
|
||||||
|
fields: ['id','value'],
|
||||||
|
data: [['1','ACTIVE'],['0','INACTIVE']]
|
||||||
|
});
|
||||||
|
|
||||||
|
newForm = new Ext.FormPanel({
|
||||||
|
url: 'groups_Ajax?action=saveNewGroup',
|
||||||
|
frame: true,
|
||||||
|
items:[
|
||||||
|
{xtype: 'textfield', fieldLabel: _('ID_GROUP_NAME'), name: 'name', width: 200, allowBlank: false},
|
||||||
|
{
|
||||||
|
xtype: 'combo',
|
||||||
|
fieldLabel: _('ID_STATUS'),
|
||||||
|
hiddenName: 'status',
|
||||||
|
typeAhead: true,
|
||||||
|
mode: 'local',
|
||||||
|
store: comboStatusStore,
|
||||||
|
displayField: 'value',
|
||||||
|
valueField:'value',
|
||||||
|
allowBlank: false,
|
||||||
|
triggerAction: 'all',
|
||||||
|
emptyText: _('ID_SELECT_STATUS'),
|
||||||
|
selectOnFocus:true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
buttons: [
|
||||||
|
{text: _('ID_SAVE'), handler: SaveNewGroupAction},
|
||||||
|
{text: _('ID_CANCEL'), handler: CloseWindow}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
editForm = new Ext.FormPanel({
|
||||||
|
url: 'groups_Ajax?action=saveEditGroup',
|
||||||
|
frame: true,
|
||||||
|
items:[
|
||||||
|
{xtype: 'textfield', name: 'grp_uid', hidden: true},
|
||||||
|
{xtype: 'textfield', fieldLabel: _('ID_GROUP_NAME'), name: 'name', width: 200, allowBlank: false},
|
||||||
|
{
|
||||||
|
xtype: 'combo',
|
||||||
|
fieldLabel: _('ID_STATUS'),
|
||||||
|
hiddenName: 'status',
|
||||||
|
typeAhead: true,
|
||||||
|
mode: 'local',
|
||||||
|
store: comboStatusStore,
|
||||||
|
displayField: 'value',
|
||||||
|
valueField:'value',
|
||||||
|
allowBlank: false,
|
||||||
|
triggerAction: 'all',
|
||||||
|
emptyText: _('ID_SELECT_STATUS'),
|
||||||
|
selectOnFocus:true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
buttons: [
|
||||||
|
{text: _('ID_SAVE'), handler: SaveEditGroupAction},
|
||||||
|
{text: _('ID_CANCEL'), handler: CloseWindow}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
store = new Ext.data.GroupingStore( {
|
||||||
|
proxy : new Ext.data.HttpProxy({
|
||||||
|
url: 'groups_Ajax?action=groupsList'
|
||||||
|
}),
|
||||||
|
reader : new Ext.data.JsonReader( {
|
||||||
|
root: 'groups',
|
||||||
|
totalProperty: 'total_groups',
|
||||||
|
fields : [
|
||||||
|
{name : 'GRP_UID'},
|
||||||
|
{name : 'GRP_STATUS'},
|
||||||
|
{name : 'CON_VALUE'},
|
||||||
|
{name : 'GRP_TASKS', type: 'int'},
|
||||||
|
{name : 'GRP_USERS', type: 'int'}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
cmodel = new Ext.grid.ColumnModel({
|
||||||
|
defaults: {
|
||||||
|
width: 50,
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{id:'GRP_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
|
||||||
|
{header: _('ID_GROUP_NAME'), dataIndex: 'CON_VALUE', width: 400, align:'left'},
|
||||||
|
{header: _('ID_STATUS'), dataIndex: 'GRP_STATUS', width: 130, align:'center', renderer: render_status},
|
||||||
|
{header: _('ID_USERS'), dataIndex: 'GRP_USERS', width: 100, align:'center'},
|
||||||
|
{header: _('ID_TASKS'), dataIndex: 'GRP_TASKS', width: 100, align:'center'}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
storePageSize = new Ext.data.SimpleStore({
|
||||||
|
fields: ['size'],
|
||||||
|
data: [['20'],['30'],['40'],['50'],['100']],
|
||||||
|
autoLoad: true
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
comboPageSize.setValue(pageSize);
|
||||||
|
|
||||||
|
bbarpaging = new Ext.PagingToolbar({
|
||||||
|
pageSize: pageSize,
|
||||||
|
store: store,
|
||||||
|
displayInfo: true,
|
||||||
|
displayMsg: _('ID_GRID_PAGE_DISPLAYING_GROUPS_MESSAGE') + ' ',
|
||||||
|
emptyMsg: _('ID_GRID_PAGE_NO_GROUPS_MESSAGE'),
|
||||||
|
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
infoGrid = new Ext.grid.GridPanel({
|
||||||
|
region: 'center',
|
||||||
|
layout: 'fit',
|
||||||
|
id: 'infoGrid',
|
||||||
|
height:100,
|
||||||
|
autoWidth : true,
|
||||||
|
stateful : true,
|
||||||
|
stateId : 'grid',
|
||||||
|
enableColumnResize: true,
|
||||||
|
enableHdMenu: true,
|
||||||
|
frame:false,
|
||||||
|
columnLines: false,
|
||||||
|
viewConfig: {
|
||||||
|
forceFit:true
|
||||||
|
},
|
||||||
|
title : _('ID_GROUPS'),
|
||||||
|
store: store,
|
||||||
|
cm: cmodel,
|
||||||
|
sm: smodel,
|
||||||
|
tbar: [newButton, '-', editButton, deleteButton,'-',membersButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
|
||||||
|
bbar: bbarpaging,
|
||||||
|
listeners: {
|
||||||
|
rowdblclick: EditGroupWindow
|
||||||
|
},
|
||||||
|
view: new Ext.grid.GroupingView({
|
||||||
|
forceFit:true,
|
||||||
|
groupTextTpl: '{text}'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
infoGrid.on('rowcontextmenu',
|
||||||
|
function (grid, rowIndex, evt) {
|
||||||
|
var sm = grid.getSelectionModel();
|
||||||
|
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||||
|
},
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
|
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
||||||
|
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
||||||
|
infoGrid.store.load();
|
||||||
|
|
||||||
|
viewport = new Ext.Viewport({
|
||||||
|
layout: 'fit',
|
||||||
|
autoScroll: false,
|
||||||
|
items: [
|
||||||
|
infoGrid
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
storePageSize = new Ext.data.SimpleStore({
|
|
||||||
fields: ['size'],
|
|
||||||
data: [['20'],['30'],['40'],['50'],['100']],
|
|
||||||
autoLoad: true
|
|
||||||
});
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
comboPageSize.setValue(pageSize);
|
|
||||||
|
|
||||||
bbarpaging = new Ext.PagingToolbar({
|
|
||||||
pageSize: pageSize,
|
|
||||||
store: store,
|
|
||||||
displayInfo: true,
|
|
||||||
displayMsg: _('ID_GRID_PAGE_DISPLAYING_GROUPS_MESSAGE') + ' ',
|
|
||||||
emptyMsg: _('ID_GRID_PAGE_NO_GROUPS_MESSAGE'),
|
|
||||||
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
infoGrid = new Ext.grid.GridPanel({
|
|
||||||
region: 'center',
|
|
||||||
layout: 'fit',
|
|
||||||
id: 'infoGrid',
|
|
||||||
height:100,
|
|
||||||
autoWidth : true,
|
|
||||||
stateful : true,
|
|
||||||
stateId : 'grid',
|
|
||||||
enableColumnResize: true,
|
|
||||||
enableHdMenu: true,
|
|
||||||
frame:false,
|
|
||||||
//iconCls:'icon-grid',
|
|
||||||
columnLines: false,
|
|
||||||
viewConfig: {
|
|
||||||
forceFit:true
|
|
||||||
},
|
|
||||||
title : _('ID_GROUPS'),
|
|
||||||
store: store,
|
|
||||||
cm: cmodel,
|
|
||||||
sm: smodel,
|
|
||||||
tbar: [newButton, '-', editButton, deleteButton,'-',membersButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
|
|
||||||
bbar: bbarpaging,
|
|
||||||
listeners: {
|
|
||||||
rowdblclick: EditGroupWindow
|
|
||||||
},
|
|
||||||
view: new Ext.grid.GroupingView({
|
|
||||||
forceFit:true,
|
|
||||||
groupTextTpl: '{text}'
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
infoGrid.on('rowcontextmenu',
|
|
||||||
function (grid, rowIndex, evt) {
|
|
||||||
var sm = grid.getSelectionModel();
|
|
||||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
|
||||||
},
|
|
||||||
this
|
|
||||||
);
|
|
||||||
|
|
||||||
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
|
||||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
|
||||||
infoGrid.store.load();
|
|
||||||
|
|
||||||
viewport = new Ext.Viewport({
|
|
||||||
layout: 'fit',
|
|
||||||
autoScroll: false,
|
|
||||||
items: [
|
|
||||||
infoGrid
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Funtion Handles Context Menu Opening
|
//Funtion Handles Context Menu Opening
|
||||||
onMessageContextMenu = function (grid, rowIndex, e) {
|
onMessageContextMenu = function (grid, rowIndex, e) {
|
||||||
e.stopEvent();
|
e.stopEvent();
|
||||||
var coords = e.getXY();
|
var coords = e.getXY();
|
||||||
contextMenu.showAt([coords[0], coords[1]]);
|
contextMenu.showAt([coords[0], coords[1]]);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Do Nothing Function
|
//Do Nothing Function
|
||||||
@@ -331,183 +331,183 @@ DoNothing = function(){};
|
|||||||
|
|
||||||
//Open New Group Form
|
//Open New Group Form
|
||||||
NewGroupWindow = function(){
|
NewGroupWindow = function(){
|
||||||
w = new Ext.Window({
|
w = new Ext.Window({
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
width: 400,
|
width: 400,
|
||||||
title: _('ID_CREATE_GROUP_TITLE'),
|
title: _('ID_CREATE_GROUP_TITLE'),
|
||||||
closable: false,
|
closable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
items: [newForm]
|
items: [newForm]
|
||||||
});
|
});
|
||||||
w.show();
|
w.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Load Grid By Default
|
//Load Grid By Default
|
||||||
GridByDefault = function(){
|
GridByDefault = function(){
|
||||||
searchText.reset();
|
searchText.reset();
|
||||||
infoGrid.store.load();
|
infoGrid.store.load();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Do Search Function
|
//Do Search Function
|
||||||
DoSearch = function(){
|
DoSearch = function(){
|
||||||
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
||||||
};
|
};
|
||||||
|
|
||||||
//Close Popup Window
|
//Close Popup Window
|
||||||
CloseWindow = function(){
|
CloseWindow = function(){
|
||||||
w.hide();
|
w.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Check Group Name Availability
|
//Check Group Name Availability
|
||||||
CheckGroupName = function(grp_name, function_success, function_failure){
|
CheckGroupName = function(grp_name, function_success, function_failure){
|
||||||
viewport.getEl().mask(_('ID_PROCESSING'));
|
viewport.getEl().mask(_('ID_PROCESSING'));
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'groups_Ajax',
|
url: 'groups_Ajax',
|
||||||
params: {action: 'exitsGroupName', GRP_NAME: grp_name},
|
params: {action: 'exitsGroupName', GRP_NAME: grp_name},
|
||||||
success: function(resp, opt){
|
success: function(resp, opt){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
var checked = eval(resp.responseText);
|
var checked = eval(resp.responseText);
|
||||||
(!checked) ? function_success() : function_failure();
|
(!checked) ? function_success() : function_failure();
|
||||||
},
|
},
|
||||||
failure: function(r,o) {
|
failure: function(r,o) {
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
function_failure();
|
function_failure();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//Save Group Button
|
//Save Group Button
|
||||||
SaveNewGroupAction = function(){
|
SaveNewGroupAction = function(){
|
||||||
var group = newForm.getForm().findField('name').getValue();
|
var group = newForm.getForm().findField('name').getValue();
|
||||||
if (group != '') CheckGroupName(group, SaveNewGroup, DuplicateGroupName);
|
if (group != '') CheckGroupName(group, SaveNewGroup, DuplicateGroupName);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Show Duplicate Group Name Message
|
//Show Duplicate Group Name Message
|
||||||
DuplicateGroupName = function(){
|
DuplicateGroupName = function(){
|
||||||
PMExt.warning(_('ID_GROUPS'), _('ID_MSG_GROUP_NAME_EXISTS'));
|
PMExt.warning(_('ID_GROUPS'), _('ID_MSG_GROUP_NAME_EXISTS'));
|
||||||
};
|
};
|
||||||
|
|
||||||
//Save New Group
|
//Save New Group
|
||||||
SaveNewGroup = function(){
|
SaveNewGroup = function(){
|
||||||
newForm.getForm().submit({
|
newForm.getForm().submit({
|
||||||
success: function(f,a){
|
success: function(f,a){
|
||||||
w.hide(); //Hide popup widow
|
w.hide(); //Hide popup widow
|
||||||
newForm.getForm().reset(); //Set empty form to next use
|
newForm.getForm().reset(); //Set empty form to next use
|
||||||
searchText.reset();
|
searchText.reset();
|
||||||
infoGrid.store.load(); //Reload store grid
|
infoGrid.store.load(); //Reload store grid
|
||||||
PMExt.notify(_('ID_GROUPS'),_('ID_GROUPS_SUCCESS_NEW'));
|
PMExt.notify(_('ID_GROUPS'),_('ID_GROUPS_SUCCESS_NEW'));
|
||||||
//Ext.Msg.alert(_('ID_GROUPS,_('ID_GROUPS_SUCCESS_NEW);
|
//Ext.Msg.alert(_('ID_GROUPS,_('ID_GROUPS_SUCCESS_NEW);
|
||||||
},
|
},
|
||||||
failure: function(f,a){
|
failure: function(f,a){
|
||||||
switch(a.failureType){
|
switch(a.failureType){
|
||||||
case Ext.form.Action.CLIENT_INVALID:
|
case Ext.form.Action.CLIENT_INVALID:
|
||||||
//Ext.Msg.alert('New Role Form','Invalid Data');
|
//Ext.Msg.alert('New Role Form','Invalid Data');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//Open Edit Group Form
|
//Open Edit Group Form
|
||||||
EditGroupWindow = function(){
|
EditGroupWindow = function(){
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
editForm.getForm().findField('grp_uid').setValue(rowSelected.data.GRP_UID);
|
editForm.getForm().findField('grp_uid').setValue(rowSelected.data.GRP_UID);
|
||||||
editForm.getForm().findField('name').setValue(rowSelected.data.CON_VALUE);
|
editForm.getForm().findField('name').setValue(rowSelected.data.CON_VALUE);
|
||||||
editForm.getForm().findField('status').setValue(rowSelected.data.GRP_STATUS);
|
editForm.getForm().findField('status').setValue(rowSelected.data.GRP_STATUS);
|
||||||
w = new Ext.Window({
|
w = new Ext.Window({
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
width: 440,
|
width: 440,
|
||||||
title: _('ID_EDIT_GROUP_TITLE'),
|
title: _('ID_EDIT_GROUP_TITLE'),
|
||||||
closable: false,
|
closable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
items: [editForm]
|
items: [editForm]
|
||||||
});
|
});
|
||||||
w.show();
|
w.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Save Edit Group Button
|
//Save Edit Group Button
|
||||||
SaveEditGroupAction = function(){
|
SaveEditGroupAction = function(){
|
||||||
var group = editForm.getForm().findField('name').getValue();
|
var group = editForm.getForm().findField('name').getValue();
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
if (group != ''){
|
if (group != ''){
|
||||||
if (rowSelected.data.CON_VALUE.toUpperCase() == group.toUpperCase()){
|
if (rowSelected.data.CON_VALUE.toUpperCase() == group.toUpperCase()){
|
||||||
SaveEditGroup();
|
SaveEditGroup();
|
||||||
}else{
|
}else{
|
||||||
CheckGroupName(group, SaveEditGroup, DuplicateGroupName);
|
CheckGroupName(group, SaveEditGroup, DuplicateGroupName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Save Edit Group
|
//Save Edit Group
|
||||||
SaveEditGroup = function(){
|
SaveEditGroup = function(){
|
||||||
editForm.getForm().submit({
|
editForm.getForm().submit({
|
||||||
success: function(f,a){
|
success: function(f,a){
|
||||||
w.hide(); //Hide popup widow
|
w.hide(); //Hide popup widow
|
||||||
DoSearch(); //Reload store grid
|
DoSearch(); //Reload store grid
|
||||||
editButton.disable(); //Disable Edit Button
|
editButton.disable(); //Disable Edit Button
|
||||||
deleteButton.disable(); //Disable Delete Button
|
deleteButton.disable(); //Disable Delete Button
|
||||||
membersButton.disable(); //Disable Members Button
|
membersButton.disable(); //Disable Members Button
|
||||||
PMExt.notify(_('ID_GROUPS'),_('ID_GROUPS_SUCCESS_UPDATE'));
|
PMExt.notify(_('ID_GROUPS'),_('ID_GROUPS_SUCCESS_UPDATE'));
|
||||||
},
|
},
|
||||||
failure: function(f,a){
|
failure: function(f,a){
|
||||||
switch(a.failureType){
|
switch(a.failureType){
|
||||||
case Ext.form.Action.CLIENT_INVALID:
|
case Ext.form.Action.CLIENT_INVALID:
|
||||||
//Ext.Msg.alert('New Role Form','Invalid Data');
|
//Ext.Msg.alert('New Role Form','Invalid Data');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//Delete Button Action
|
//Delete Button Action
|
||||||
DeleteButtonAction = function(){
|
DeleteButtonAction = function(){
|
||||||
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_MSG_CONFIRM_DELETE_GROUP'),
|
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_MSG_CONFIRM_DELETE_GROUP'),
|
||||||
function(btn, text){
|
function(btn, text){
|
||||||
if (btn=="yes"){
|
if (btn=="yes"){
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
viewport.getEl().mask(_('ID_PROCESSING'));
|
viewport.getEl().mask(_('ID_PROCESSING'));
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'groups_Ajax',
|
url: 'groups_Ajax',
|
||||||
params: {action: 'deleteGroup', GRP_UID: rowSelected.data.GRP_UID},
|
params: {action: 'deleteGroup', GRP_UID: rowSelected.data.GRP_UID},
|
||||||
success: function(r,o){
|
success: function(r,o){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
DoSearch();
|
DoSearch();
|
||||||
editButton.disable(); //Disable Edit Button
|
editButton.disable(); //Disable Edit Button
|
||||||
deleteButton.disable(); //Disable Delete Button
|
deleteButton.disable(); //Disable Delete Button
|
||||||
membersButton.disable(); //Disable Members Button
|
membersButton.disable(); //Disable Members Button
|
||||||
PMExt.notify(_('ID_GROUPS'), _('ID_GROUPS_SUCCESS_DELETE'));
|
PMExt.notify(_('ID_GROUPS'), _('ID_GROUPS_SUCCESS_DELETE'));
|
||||||
},
|
},
|
||||||
failure: function(){
|
failure: function(){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Render Status
|
//Render Status
|
||||||
render_status = function(v){
|
render_status = function(v){
|
||||||
switch(v){
|
switch(v){
|
||||||
case 'ACTIVE': return '<font color="green">' + _('ID_ACTIVE') + '</font>'; break;
|
case 'ACTIVE': return '<font color="green">' + _('ID_ACTIVE') + '</font>'; break;
|
||||||
case 'INACTIVE': return '<font color="red">' + _('ID_INACTIVE') + '</font>';; break;
|
case 'INACTIVE': return '<font color="red">' + _('ID_INACTIVE') + '</font>'; break;
|
||||||
case 'VACATION': return '<font color="blue">' + _('ID_VACATION') + '</font>';; break;
|
case 'VACATION': return '<font color="blue">' + _('ID_VACATION') + '</font>'; break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Members Button Action
|
//Members Button Action
|
||||||
MembersAction = function(){
|
MembersAction = function(){
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
location.href = 'groupsMembers?GRP_UID=' + rowSelected.data.GRP_UID;
|
location.href = 'groupsMembers?GRP_UID=' + rowSelected.data.GRP_UID;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Update Page Size Configuration
|
//Update Page Size Configuration
|
||||||
UpdatePageConfig = function(pageSize){
|
UpdatePageConfig = function(pageSize){
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'groups_Ajax',
|
url: 'groups_Ajax',
|
||||||
params: {action:'updatePageSize', size: pageSize}
|
params: {action:'updatePageSize', size: pageSize}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user