/* * @author: Qennix * Jan 25th, 2011 */ //Keyboard Events new Ext.KeyMap(document, { key: Ext.EventObject.F5, fn: function(keycode, e) { if (! e.ctrlKey) { if (Ext.isIE) { // IE6 doesn't allow cancellation of the F5 key, so trick it into // thinking some other key was pressed (backspace in this case) e.browserEvent.keyCode = 8; } e.stopEvent(); document.location = document.location; }else{ Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5'); } } }); var storeP; var storeA; var cmodelP; var smodelA; var smodelP; var availableGrid; var assignedGrid; var GroupsPanel; var AuthenticationPanel; var northPanel; var tabsPanel; var viewport; var assignButton; var assignAllButton; var removeButton; var removeAllButton; var backButton; var discardChangesButton; var saveChangesButton; var sw_func_groups; //var sw_func_reassign; var sw_func_auth; var sw_form_changed; var sw_user_summary; Ext.onReady(function(){ sw_func_groups = false; //sw_func_reassign = false; sw_func_auth = false; sw_user_summary = false; editMembersButton = new Ext.Action({ text: _('ID_ASSIGN_GROUP'), iconCls: 'button_menu_ext ss_sprite ss_user_add', handler: EditMembersAction }); cancelEditMembersButton = new Ext.Action({ text: _('ID_CLOSE'), iconCls: 'button_menu_ext ss_sprite ss_cancel', handler: CancelEditMenbersAction }); backButton = new Ext.Action({ text: _('ID_BACK'), iconCls: 'button_menu_ext ss_sprite ss_arrow_redo', handler: BackToUsers }); saveChangesButton = new Ext.Action({ text: _('ID_SAVE_CHANGES'), //iconCls: 'button_menu_ext ss_sprite ss_arrow_redo', handler: SaveChangesAuthForm, disabled: true }); discardChangesButton = new Ext.Action({ text: _('ID_DISCARD_CHANGES'), //iconCls: 'button_menu_ext ss_sprite ss_arrow_redo', handler: LoadAuthForm, disabled: true }); storeP = new Ext.data.GroupingStore( { proxy : new Ext.data.HttpProxy({ url: 'users_Ajax?function=assignedGroups&uUID=' + USERS.USR_UID }), reader : new Ext.data.JsonReader( { root: 'groups', fields : [ {name : 'GRP_UID'}, {name : 'GRP_STATUS'}, {name : 'CON_VALUE'} ] }) }); storeA = new Ext.data.GroupingStore( { proxy : new Ext.data.HttpProxy({ url: 'users_Ajax?function=availableGroups&uUID=' + USERS.USR_UID }), reader : new Ext.data.JsonReader( { root: 'groups', fields : [ {name : 'GRP_UID'}, {name : 'GRP_STATUS'}, {name : 'CON_VALUE'} ] }) }); cmodelP = new Ext.grid.ColumnModel({ defaults: { width: 50, sortable: true }, columns: [ {id:'GRP_UID', dataIndex: 'GRP_UID', hidden:true, hideable:false}, {header: _('ID_GROUP'), dataIndex: 'CON_VALUE', width: 60, align:'left'} ] }); smodelA = new Ext.grid.RowSelectionModel({ selectSingle: false, listeners:{ selectionchange: function(sm){ switch(sm.getCount()){ case 0: Ext.getCmp('assignButton').disable(); break; default: Ext.getCmp('assignButton').enable(); break; } } } }); smodelP = new Ext.grid.RowSelectionModel({ selectSingle: false, listeners:{ selectionchange: function(sm){ switch(sm.getCount()){ case 0: Ext.getCmp('removeButton').disable(); break; default: Ext.getCmp('removeButton').enable(); break; } } } }); searchTextA = new Ext.form.TextField ({ id: 'searchTextA', ctCls:'pm_search_text_field', allowBlank: true, width: 110, emptyText: _('ID_ENTER_SEARCH_TERM'), listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { DoSearchA(); } } } }); clearTextButtonA = new Ext.Action({ text: 'X', ctCls:'pm_search_x_button', handler: GridByDefaultA }); searchTextP = new Ext.form.TextField ({ id: 'searchTextP', ctCls:'pm_search_text_field', allowBlank: true, width: 110, emptyText: _('ID_ENTER_SEARCH_TERM'), listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { DoSearchP(); } } } }); clearTextButtonP = new Ext.Action({ text: 'X', ctCls:'pm_search_x_button', handler: GridByDefaultP }); availableGrid = new Ext.grid.GridPanel({ layout : 'fit', title : _('ID_AVAILABLE_GROUPS'), region : 'center', ddGroup : 'assignedGridDDGroup', store : storeA, cm : cmodelP, sm : smodelA, enableDragDrop : true, stripeRows : true, autoExpandColumn: 'CON_VALUE', iconCls : 'icon-grid', id : 'availableGrid', height : 100, autoWidth : true, stateful : true, stateId : 'grid', enableColumnResize : true, enableHdMenu : true, frame : false, columnLines : false, viewConfig : {forceFit:true}, tbar: [cancelEditMembersButton,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA], //bbar: [{xtype: 'tbfill'}, cancelEditMembersButton], listeners: {rowdblclick: AssignGroupsAction}, hidden: true }); assignedGrid = new Ext.grid.GridPanel({ layout : 'fit', title : _('ID_ASSIGNED_GROUPS'), ddGroup : 'availableGridDDGroup', store : storeP, cm : cmodelP, sm : smodelP, enableDragDrop : true, stripeRows : true, autoExpandColumn: 'CON_VALUE', iconCls : 'icon-grid', id : 'assignedGrid', height : 100, autoWidth : true, stateful : true, stateId : 'grid', enableColumnResize : true, enableHdMenu : true, frame : false, columnLines : false, viewConfig : {forceFit:true}, tbar: [editMembersButton,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP], listeners: {rowdblclick: function(){ (availableGrid.hidden)? DoNothing() : RemoveGroupsAction(); }} }); buttonsPanel = new Ext.Panel({ width : 40, layout : { type:'vbox', padding:'0', pack:'center', align:'center' }, defaults:{margins:'0 0 35 0'}, items:[ {xtype:'button',text: '> ', handler: AssignGroupsAction, id: 'assignButton', disabled: true}, {xtype:'button',text: '<', handler: RemoveGroupsAction, id: 'removeButton', disabled: true}, {xtype:'button',text: '>>', handler: AssignAllGroupsAction, id: 'assignButtonAll', disabled: false}, {xtype:'button',text: '<<', handler: RemoveAllGroupsAction, id: 'removeButtonAll', disabled: false} ], hidden: true }); //GROUPS DRAG AND DROP PANEL GroupsPanel = new Ext.Panel({ title : _('ID_GROUPS'), autoWidth : true, layout : 'hbox', defaults : { flex : 1 }, //auto stretch layoutConfig : { align : 'stretch' }, items : [availableGrid,buttonsPanel, assignedGrid], viewConfig : {forceFit:true} }); comboAuthSourcesStore = new Ext.data.GroupingStore({ proxy : new Ext.data.HttpProxy({ url: 'users_Ajax?function=authSources' }), reader : new Ext.data.JsonReader( { root: 'sources', fields : [ {id: 'AUTH_SOURCE_UID'}, {name : 'AUTH_SOURCE_UID'}, {name : 'AUTH_SOURCE_NAME'}, {name : 'AUTH_SOURCE_PROVIDER'}, {name : 'AUTH_SOURCE_SHOW'} ] }), autoLoad: true }); //AUTHENTICATION FORM authForm = new Ext.FormPanel({ url: 'users_Ajax?function=updateAuthServices', frame: true, title: _('ID_AUTHENTICATION_FORM_TITLE'), labelWidth: 150, items:[ {xtype: 'textfield', name: 'usr_uid', hidden: true }, { xtype: 'combo', fieldLabel: _('ID_AUTHENTICATION_SOURCE'), hiddenName: 'auth_source', name: 'auth_source_uid', typeAhead: true, mode: 'local', store: comboAuthSourcesStore, displayField: 'AUTH_SOURCE_SHOW', valueField:'AUTH_SOURCE_UID', allowBlank: false, submitValue: true, width: 350, //hiddenValue: 'AUTH_SOURCE_UID', triggerAction: 'all', emptyText: _('ID_SELECT_AUTH_SOURCE'), selectOnFocus:true, listeners:{ select: function(c,r,i){ ReportChanges(); if (i==0){ authForm.getForm().findField('auth_dn').disable(); }else{ authForm.getForm().findField('auth_dn').enable(); } } } }, { xtype: 'textfield', fieldLabel: _('ID_AUTHENTICATION_DN'), name: 'auth_dn', width: 380, allowBlank: true, enableKeyEvents: true, listeners: {keyup: function(f,e){ ReportChanges(); }} } ], buttons: [discardChangesButton,saveChangesButton] }); //AUTHENTICATION EDITING PANEL AuthenticationPanel = new Ext.Panel({ title : _('ID_AUTHENTICATION'), autoWidth : true, layout : 'hbox', defaults : { flex : 1 }, //auto stretch layoutConfig : { align : 'stretch' }, items: [authForm], viewConfig : {forceFit:true}, hidden: true, hideLabel: true }); //SUMMARY VIEW FORM userFields = new Ext.form.FieldSet({ title: _('ID_USER_INFORMATION'), items: [ {xtype: 'label', fieldLabel: _('ID_FIRST_NAME'), id: 'fname', width: 250}, {xtype: 'label', fieldLabel: _('ID_LAST_NAME'), id: 'lname', width: 250}, {xtype: 'label', fieldLabel: _('ID_USER_NAME'), id: 'uname', width: 250}, {xtype: 'label', fieldLabel: _('ID_EMAIL'), id: 'email', width: 250}, {xtype: 'label', fieldLabel: _('ID_ADDRESS'), id: 'address', width: 250}, {xtype: 'label', fieldLabel: _('ID_ZIP_CODE'), id: 'zipcode', width: 250}, {xtype: 'label', fieldLabel: _('ID_COUNTRY'), id: 'country', width: 250}, {xtype: 'label', fieldLabel: _('ID_STATE_REGION'), id: 'state', width: 250}, {xtype: 'label', fieldLabel: _('ID_LOCATION'), id: 'location', width: 250}, {xtype: 'label', fieldLabel: _('ID_PHONE_NUMBER'), id: 'phone', width: 250}, {xtype: 'label', fieldLabel: _('ID_POSITION'), id: 'position', width: 250}, {xtype: 'label', fieldLabel: _('ID_DEPARTMENT'), id: 'department', width: 250}, {xtype: 'label', fieldLabel: _('ID_REPLACED_BY'), id: 'replaced', width: 250}, {xtype: 'label', fieldLabel: _('ID_EXPIRATION_DATE'), id: 'duedate', width: 250}, {xtype: 'label', fieldLabel: _('ID_STATUS'), id: 'status', width: 250}, {xtype: 'label', fieldLabel: _('ID_ROLE'), id: 'role', width: 250} ] }); caseFields = new Ext.form.FieldSet({ title: _('ID_CASES_SUMMARY'), labelWidth: 200, items: [ {xtype: 'label', fieldLabel: _('ID_INBOX'), id: 'inbox', width: 250}, {xtype: 'label', fieldLabel: _('ID_DRAFT'), id: 'draft', width: 250}, {xtype: 'label', fieldLabel: _('ID_TITLE_PARTICIPATED'), id: 'participated', width: 250}, {xtype: 'label', fieldLabel: _('ID_UNASSIGNED'), id: 'unassigned', width: 250}, {xtype: 'label', fieldLabel: _('ID_PAUSED'), id: 'pause', width: 250} ] }); userPhoto = new Ext.form.FieldSet({ title: _('ID_PHOTO'), items: [ {html: '