Pman.Tab.AdminContactsGroupRight.bjs
[Pman.Admin] / Pman.Tab.AdminContactsGroupRight.bjs
index 7966cd0..b11b9cd 100644 (file)
                     "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        if (di != 'active') {\n            return;\n        }\n         \n        var rec = _this.grid.ds.getAt(rowIndex);\n        \n        rec.set('active', rec.data.active ? 0 : 1);\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        \n        if (i != 'accessmask') {\n            return;\n        }\n\n        var rec = _this.grid.ds.getAt(rowIndex);\n        Roo.log(di);\n        Roo.log(rec);\n        rec.set(i+'_'+k, rec.data[i+'_'+k] ? 0 : 1);\n        //rec.commit();\n         \n        \n}"
                     },
                     "*prop": "grid",
-                    "autoExpandColumn": "name",
                     "ddGroup": "groupDD",
                     "enableDrag": true,
                     "loadMask": true,
                                         }
                                     ]
                                 },
-                                {
-                                    "listeners": {
-                                        "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
-                                    },
-                                    "cls": "x-btn-icon",
-                                    "xtype": "Button",
-                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
-                                    "|xns": "Roo.Toolbar"
-                                },
-                                {
-                                    "listeners": {
-                                        "|click": "function (_self, e)\n{\n_this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\n}"
-                                    },
-                                    "cls": "x-btn-icon",
-                                    "xtype": "Button",
-                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
-                                    "|xns": "Roo.Toolbar"
-                                },
-                                {
-                                    "listeners": {
-                                        "toggle": "function (_self, pressed)\n{\n   _this.grid.footer.onClick('first');\n   this.setText(pressed ? \"Show Active\" : \"Show Removed\");\n   \n   \n}",
-                                        "render": "function (_self)\n{\n  _this.activeButton = _self;\n}"
-                                    },
-                                    "enableToggle": true,
-                                    "text": "Show Removed",
-                                    "xtype": "Button",
-                                    "|xns": "Roo.Toolbar"
-                                },
-                                {
-                                    "listeners": {
-                                        "toggle": "function (_self, pressed)\n{\n   _this.grid.footer.onClick('first');\n   this.setText(pressed ? \"Show Company\" : \"Show No Company\");\n   \n   \n}",
-                                        "render": "function (_self)\n{\n  _this.active_company_button = _self;\n}"
-                                    },
-                                    "enableToggle": true,
-                                    "text": "Show No Company",
-                                    "xtype": "Button",
-                                    "|xns": "Roo.Toolbar"
-                                },
                                 {
                                     "|xns": "Roo.Toolbar",
                                     "xtype": "Fill"
-                                },
-                                {
-                                    "listeners": {
-                                        "|click": "function()\n{\n    \n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
-                                    },
-                                    "cls": "x-btn-text-icon",
-                                    "text": "Add",
-                                    "xtype": "Button",
-                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                    "|xns": "Roo.Toolbar"
-                                },
-                                {
-                                    "listeners": {
-                                        "|click": "function()\n{\n    \n    Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
-                                    },
-                                    "cls": "x-btn-text-icon",
-                                    "text": "Bulk Add",
-                                    "xtype": "Button",
-                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                    "|xns": "Roo.Toolbar"
-                                },
-                                {
-                                    "listeners": {
-                                        "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n  \n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
-                                    },
-                                    "cls": "x-btn-text-icon",
-                                    "text": "Edit",
-                                    "xtype": "Button",
-                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
-                                    "|xns": "Roo.Toolbar"
-                                },
-                                {
-                                    "listeners": {
-                                        "|click": "function()\n{\n     Pman.genericDelete(_this, 'Person'); \n}\n        "
-                                    },
-                                    "cls": "x-btn-text-icon",
-                                    "text": "Delete",
-                                    "xtype": "Button",
-                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
-                                    "|xns": "Roo.Toolbar"
                                 }
                             ]
                         },
                         {
                             "*prop": "colModel[]",
                             "dataIndex": "accessmask",
-                            "header": "Type",
-                            "sortable": true,
+                            "header": "All",
+                            "sortable": false,
                             "width": 50,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v,x,r) {\n    if (r.data.office_id) {\n        return String.format('{0} - {1}', v, r.data.office_id_name); \n    } \n    return String.format('{0}', v); \n}",
+                            "|renderer": "function(v,x,r) {\n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "company_id_name",
-                            "header": "Company",
-                            "sortable": true,
+                            "dataIndex": "rightname",
+                            "header": "Module",
+                            "sortable": false,
                             "width": 150,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v,x,r) {\n    if (r.data.office_id) {\n        return String.format('{0} - {1}', v, r.data.office_id_name); \n    } \n    return String.format('{0}', v); \n}",
+                            "|renderer": "function(v,x,r) {\n    if(!v){\n        return;\n    }\n    return String.format('<span qtip=\"{1}\">{0}</span>', v.split('.').shift(), v);\n}",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "name",
-                            "header": "Name",
-                            "sortable": true,
-                            "width": 200,
+                            "dataIndex": "descript",
+                            "header": "Permission",
+                            "sortable": false,
+                            "width": 300,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|renderer": "function(v,x,r)\n{\n    if (r.json.descript && r.json.descript.length) {\n        return String.format('{0}',r.json.descript);\n    }\n    \n    return '???' + v;\n}",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "role",
-                            "header": "Role",
-                            "width": 100,
+                            "dataIndex": "accessmask_A",
+                            "header": "Add",
+                            "width": 75,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "phone",
-                            "header": "Phone",
-                            "width": 100,
+                            "dataIndex": "accessmask_E",
+                            "header": "Edit",
+                            "width": 75,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "fax",
-                            "header": "Fax",
-                            "width": 100,
+                            "dataIndex": "accessmask_D",
+                            "header": "Delete",
+                            "width": 75,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "email",
-                            "header": "Email",
-                            "sortable": true,
-                            "width": 200,
+                            "dataIndex": "accessmask_S",
+                            "header": "List/View",
+                            "width": 75,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v) {\n   return (v.length && v.indexOf('@') > 0 ) ? \n                    String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n }",
+                            "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
-                            "dataIndex": "active",
-                            "header": "Active",
+                            "dataIndex": "accessmask_P",
+                            "header": "Print/Export",
                             "width": 75,
                             "xtype": "ColumnModel",
                             "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",