From b0204da34f4332edd5db838860137d4e3b50a89a Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 13 Sep 2012 15:40:49 +0800 Subject: [PATCH] Pman.Tab.AdminContactsGroupRight.bjs Pman.Tab.AdminContactsGroupRight.js --- Pman.Tab.AdminContactsGroupRight.bjs | 76 ++---------------- Pman.Tab.AdminContactsGroupRight.js | 110 +++++++-------------------- 2 files changed, 31 insertions(+), 155 deletions(-) diff --git a/Pman.Tab.AdminContactsGroupRight.bjs b/Pman.Tab.AdminContactsGroupRight.bjs index 19b168a..a501f44 100644 --- a/Pman.Tab.AdminContactsGroupRight.bjs +++ b/Pman.Tab.AdminContactsGroupRight.bjs @@ -23,7 +23,7 @@ "listeners": { "|render": "function() \n{\n _this.grid = this; \n if (!_this.dialog) {\n _this.dialog = Pman.Dialog.PersonEdit;\n \n }\n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}", "|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n", - "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n\n var di = this.colModel.getDataIndex(columnIndex);\n var i = di.split('_').shift();\n var k = di.split('_').pop();\n if (i != 'accessmask') {\n return;\n }\n var rec = _this.grid.ds.getAt(rowIndex);\n if(k == 'AA'){\n var fm = rec.data.FullMask.split('');\n Roo.each(fm, function(e){\n rec.set(i+'_'+e, rec.data[i+'_'+k] ? 0 : 1);\n });\n } \n rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);\n \n //rec.commit();\n \n \n}" + "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n\n var di = this.colModel.getDataIndex(columnIndex);\n var i = di.split('_').shift();\n var k = di.split('_').pop();\n if (i != 'accessmask') {\n return;\n }\n var rec = _this.grid.ds.getAt(rowIndex);\n if(k == 'AA'){\n var fm = rec.data.FullMask.split('');\n Roo.each(fm, function(e){\n rec.set(i+'_'+e, rec.data[i+'_'+k] ? 0 : 1);\n });\n } \n rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);\n _this.dataUpdate[rec.data.id] = rec.data.accessmask;\n //rec.commit();\n \n \n}" }, "*prop": "grid", "ddGroup": "groupDD", @@ -83,79 +83,13 @@ "xtype": "Toolbar", "|xns": "Roo", "items": [ - { - "text": "Search", - "xtype": "TextItem", - "|xns": "Roo.Toolbar" - }, { "listeners": { - "render": "function (_self)\n{\n _this.searchBox = _self;\n}", - "show": "function (_self,e)\n{\n if (e.getCharCode() != 13) {\n return;\n }\n _this.grid.footer.onClick('first');\n}", - "specialkey": "function (_self, e)\n{\n if (e.getKey() == 13) {\n _this.grid.footer.onClick('first');\n }\n}" + "click": "function (_self, e)\n{\n \n new Pman.Request({\n url : baseURL + '/Roo/GroupRights.php',\n method :'POST',\n params : {\n id : record.data.id,\n active: record.data.active\n \n },\n success : function() {\n // do nothing\n \n _this.grid.ds.remove(record);\n \n },\n failure : function() \n {\n Roo.MessageBox.alert(\"Error\", \"saving failed\", function() {\n _this.grid.footer.onClick('first');\n });\n }\n });\n}" }, - "xtype": "TextField", - "|xns": "Roo.form" - }, - { - "listeners": { - "render": "function (_self)\n{\n _this.companyCombo = _self;\n}", - "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );\n}" - }, - "displayField": "name", - "editable": true, - "emptyText": "Select Company", - "forceSelection": true, - "hiddenName": "company_id", - "listWidth": 400, - "loadingText": "Searching...", - "minChars": 2, - "name": "company_name", - "pageSize": 20, - "qtip": "Select Companies", - "queryParam": "query[name]", - "selectOnFocus": true, - "tpl": "
{name}
", - "triggerAction": "all", - "typeAhead": true, - "valueField": "id", - "width": 150, - "xtype": "ComboBox", - "|xns": "Roo.form", - "items": [ - { - "listeners": { - "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n" - }, - "*prop": "store", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ direction : 'ASC', field: 'name' }", - "|xns": "Roo.data", - "items": [ - { - "*prop": "proxy", - "xtype": "HttpProxy", - "method": "GET", - "|xns": "Roo.data", - "|url": "baseURL + '/Roo/Companies.php'" - }, - { - "*prop": "reader", - "xtype": "JsonReader", - "|xns": "Roo.data", - "id": "id", - "root": "data", - "totalProperty": "total", - "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"code\",\"type\":\"string\"}]" - } - ] - } - ] - }, - { - "|xns": "Roo.Toolbar", - "xtype": "Fill" + "text": "Save", + "xtype": "Button", + "|xns": "Roo.Toolbar" } ] }, diff --git a/Pman.Tab.AdminContactsGroupRight.js b/Pman.Tab.AdminContactsGroupRight.js index 27b96b8..88afe31 100644 --- a/Pman.Tab.AdminContactsGroupRight.js +++ b/Pman.Tab.AdminContactsGroupRight.js @@ -72,7 +72,7 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({ }); } rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1); - + _this.dataUpdate[rec.data.id] = rec.data.accessmask; //rec.commit(); @@ -208,94 +208,36 @@ Pman.Tab.AdminContactsGroupRight = new Roo.XComponent({ xns: Roo, items : [ { - xtype: 'TextItem', + xtype: 'Button', xns: Roo.Toolbar, - text : "Search" - }, - { - xtype: 'TextField', - xns: Roo.form, - listeners : { - render : function (_self) - { - _this.searchBox = _self; - }, - show : function (_self,e) - { - if (e.getCharCode() != 13) { - return; - } - _this.grid.footer.onClick('first'); - }, - specialkey : function (_self, e) - { - if (e.getKey() == 13) { - _this.grid.footer.onClick('first'); - } - } - } - }, - { - xtype: 'ComboBox', - xns: Roo.form, listeners : { - render : function (_self) - { - _this.companyCombo = _self; - }, - select : function (combo, record, index) + click : function (_self, e) { - _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] ); + + new Pman.Request({ + url : baseURL + '/Roo/GroupRights.php', + method :'POST', + params : { + id : record.data.id, + active: record.data.active + + }, + success : function() { + // do nothing + + _this.grid.ds.remove(record); + + }, + failure : function() + { + Roo.MessageBox.alert("Error", "saving failed", function() { + _this.grid.footer.onClick('first'); + }); + } + }); } }, - displayField : 'name', - editable : true, - emptyText : "Select Company", - forceSelection : true, - hiddenName : 'company_id', - listWidth : 400, - loadingText : "Searching...", - minChars : 2, - name : 'company_name', - pageSize : 20, - qtip : "Select Companies", - queryParam : 'query[name]', - selectOnFocus : true, - tpl : '
{name}
', - triggerAction : 'all', - typeAhead : true, - valueField : 'id', - width : 150, - store : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o){ - o.params = o.params || {}; - // set more here - } - }, - remoteSort : true, - sortInfo : { direction : 'ASC', field: 'name' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/Companies.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}] - } - } - }, - { - xtype: 'Fill', - xns: Roo.Toolbar + text : "Save" } ] }, -- 2.39.2