Pman.Tab.AdminContactsGroup.bjs
[Pman.Admin] / Pman.Tab.AdminContactsGroup.bjs
1 {
2     "id": "roo-file-171",
3     "name": "Pman.Tab.AdminContactsGroup",
4     "parent": "Pman.Tab.AdminContactsManager",
5     "title": "Pman.Tab.AdminContactsGroup",
6     "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminContactsGroup.bjs",
7     "items": [
8         {
9             "|xns": "Roo",
10             "xtype": "GridPanel",
11             "title": "Groups",
12             "fitToframe": true,
13             "fitContainer": true,
14             "tableName": "Groups",
15             "background": true,
16             "region": "center",
17             "listeners": {
18                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
19             },
20             "items": [
21                 {
22                     "listeners": {
23                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
24                         "|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"
25                     },
26                     "*prop": "grid",
27                     "autoExpandColumn": "name",
28                     "ddGroup": "groupDD",
29                     "enableDrop": true,
30                     "loadMask": true,
31                     "xtype": "Grid",
32                     "|xns": "Roo.grid",
33                     "items": [
34                         {
35                             "listeners": {
36                                 "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.type =2;\n}",
37                                 "load": "function (_self, records, options)\n{\n    var sm = _this.grid.getSelectionModel();\n        if (!sm.getSelections().length) {\n            sm.selectFirstRow();\n        }\n        Pman.Tab.AdminContactsPerson.grid.footer.onClick('first');\n}"
38                             },
39                             "*prop": "dataSource",
40                             "remoteSort": true,
41                             "xtype": "Store",
42                             "|sortInfo": "{ field : 'name', direction: 'ASC' }",
43                             "|xns": "Roo.data",
44                             "items": [
45                                 {
46                                     "*prop": "proxy",
47                                     "xtype": "HttpProxy",
48                                     "method": "GET",
49                                     "|url": "baseURL + '/Roo/Groups.php'",
50                                     "|xns": "Roo.data"
51                                 },
52                                 {
53                                     "|xns": "Roo.data",
54                                     "xtype": "JsonReader",
55                                     "totalProperty": "total",
56                                     "root": "data",
57                                     "*prop": "reader",
58                                     "id": "id",
59                                     "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'type',\n        'type': 'int'\n    },\n    {\n        'name': 'leader',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_name',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_email',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_role',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_active',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_project_id',\n        'type': 'int'\n    }\n]"
60                                 }
61                             ]
62                         },
63                         {
64                             "*prop": "toolbar",
65                             "xtype": "Toolbar",
66                             "|xns": "Roo",
67                             "items": [
68                                 {
69                                     "text": "Manage Groups",
70                                     "xtype": "Button",
71                                     "|xns": "Roo.Toolbar",
72                                     "items": [
73                                         {
74                                             "|xns": "Roo.menu",
75                                             "xtype": "Menu",
76                                             "*prop": "menu",
77                                             "items": [
78                                                 {
79                                                     "listeners": {
80                                                         "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n         _this.grid.ds.load({});\n   }); \n}\n"
81                                                     },
82                                                     "cls": "x-btn-text-icon",
83                                                     "text": "Add",
84                                                     "xtype": "Item",
85                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
86                                                     "|xns": "Roo.menu"
87                                                 },
88                                                 {
89                                                     "listeners": {
90                                                         "|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    if (!_this.dialog) return;\n    _this.dialog.show(s[0].data, function() {\n         _this.grid.ds.load({});\n    }); \n    \n}\n"
91                                                     },
92                                                     "cls": "x-btn-text-icon",
93                                                     "text": "Edit",
94                                                     "xtype": "Item",
95                                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
96                                                     "|xns": "Roo.menu"
97                                                 },
98                                                 {
99                                                     "listeners": {
100                                                         "|click": "function()\n{\n     Pman.genericDelete(_this, 'Groups'); \n}\n        "
101                                                     },
102                                                     "cls": "x-btn-text-icon",
103                                                     "text": "Delete",
104                                                     "xtype": "Item",
105                                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
106                                                     "|xns": "Roo.menu"
107                                                 },
108                                                 {
109                                                     "|xns": "Roo.menu",
110                                                     "xtype": "Separator"
111                                                 },
112                                                 {
113                                                     "listeners": {
114                                                         "click": "function (_self, e)\n{\n  _this.grid.ds.load({});\n}"
115                                                     },
116                                                     "text": "Reload",
117                                                     "xtype": "Item",
118                                                     "|xns": "Roo.menu"
119                                                 }
120                                             ]
121                                         }
122                                     ]
123                                 }
124                             ]
125                         },
126                         {
127                             "*prop": "colModel[]",
128                             "dataIndex": "name",
129                             "header": "Name",
130                             "width": 200,
131                             "xtype": "ColumnModel",
132                             "|renderer": "function(v,x,r) { \n    if (r.data.id == -1) {\n        return '<b>' + \"Not in a Group\" + '</b>';\n    }\n    if ((r.data.id == 0) && (_this.type == 0)) {\n        return '<b>' + \"All Staff (Default Permissions)\" + '</b>';\n    }\n    if ((r.data.id == 0) && (_this.type == 2)) {\n        return '<b>' + \"Everybody\" + '</b>';\n    }\n    if (r.data.id == 0) {\n        return '<b>' + \"All Staff\" + '</b>';\n    }\n    if (v == 'Administrators') {\n        return '<b>' + \"Adminstrators\" + '</b>';\n    }\n    if (r.data.leader) {\n        return v + ' (' + r.data.leader_name + ')';\n    }\n    \n    return v;\n}",
133                             "|xns": "Roo.grid"
134                         },
135                         {
136                             "*prop": "sm",
137                             "singleSelect": true,
138                             "xtype": "RowSelectionModel",
139                             "|xns": "Roo.grid"
140                         }
141                     ]
142                 }
143             ]
144         }
145     ],
146     "permname": "",
147     "modOrder": "001"
148 }