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                         "dragover": "function (_self, dd, targetId, e)\n{\n    var t = Roo.lib.Event.getTarget(e); \n    var ri = _this.grid.view.findRowIndex(t);\n    var rid  = false;\n    if (ri !== false) {\n        rid = _this.grid.getDataSource().getAt(ri).data;\n    }\n    \n    var s = _this.grid.getSelectionModel().getSelections();\n    \n    var isFromGroup = s.length ? s[0].data.id > 0 : false;\n    \n    var isToGroup = rid && rid.id > 0;\n    \n    if (isFromGroup && isToGroup) {\n        return this.dropNotAllowed; \n    }\n    if (!isFromGroup && !isToGroup) {\n        return this.dropNotAllowed; \n    }\n    if (isFromGroup && !isToGroup) {\n        return 'x-dd-drop-ok-sub'; \n    } \n    //if (!isFromGroup && isToGroup) {\n        return 'x-dd-drop-ok-add'; \n    //}\n}"
26                     },
27                     "*prop": "grid",
28                     "autoExpandColumn": "name",
29                     "ddGroup": "groupDD",
30                     "enableDrop": true,
31                     "loadMask": true,
32                     "xtype": "Grid",
33                     "|xns": "Roo.grid",
34                     "items": [
35                         {
36                             "listeners": {
37                                 "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.type =2;\n}",
38                                 "load": "function (_self, records, options)\n{\n    var sm = _this.grid.getSelectionModel();\n        if (!sm.getSelections().length) {\n            sm.selectFirstRow();\n        }\n        Pman.Tab.AdminContacts.grid.footer.onClick('first');\n}"
39                             },
40                             "*prop": "dataSource",
41                             "remoteSort": true,
42                             "xtype": "Store",
43                             "|sortInfo": "{ field : 'name', direction: 'ASC' }",
44                             "|xns": "Roo.data",
45                             "items": [
46                                 {
47                                     "*prop": "proxy",
48                                     "xtype": "HttpProxy",
49                                     "method": "GET",
50                                     "|url": "baseURL + '/Roo/Groups.php'",
51                                     "|xns": "Roo.data"
52                                 },
53                                 {
54                                     "|xns": "Roo.data",
55                                     "xtype": "JsonReader",
56                                     "totalProperty": "total",
57                                     "root": "data",
58                                     "*prop": "reader",
59                                     "id": "id",
60                                     "|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]"
61                                 }
62                             ]
63                         },
64                         {
65                             "*prop": "toolbar",
66                             "xtype": "Toolbar",
67                             "|xns": "Roo",
68                             "items": [
69                                 {
70                                     "text": "Manage Groups",
71                                     "xtype": "Button",
72                                     "|xns": "Roo.Toolbar",
73                                     "items": [
74                                         {
75                                             "|xns": "Roo.menu",
76                                             "xtype": "Menu",
77                                             "*prop": "menu",
78                                             "items": [
79                                                 {
80                                                     "listeners": {
81                                                         "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n         _this.grid.ds.load({});\n   }); \n}\n"
82                                                     },
83                                                     "cls": "x-btn-text-icon",
84                                                     "text": "Add",
85                                                     "xtype": "Item",
86                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
87                                                     "|xns": "Roo.menu"
88                                                 },
89                                                 {
90                                                     "listeners": {
91                                                         "|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"
92                                                     },
93                                                     "cls": "x-btn-text-icon",
94                                                     "text": "Edit",
95                                                     "xtype": "Item",
96                                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
97                                                     "|xns": "Roo.menu"
98                                                 },
99                                                 {
100                                                     "listeners": {
101                                                         "|click": "function()\n{\n     Pman.genericDelete(_this, 'Groups'); \n}\n        "
102                                                     },
103                                                     "cls": "x-btn-text-icon",
104                                                     "text": "Delete",
105                                                     "xtype": "Item",
106                                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
107                                                     "|xns": "Roo.menu"
108                                                 },
109                                                 {
110                                                     "|xns": "Roo.menu",
111                                                     "xtype": "Separator"
112                                                 },
113                                                 {
114                                                     "listeners": {
115                                                         "click": "function (_self, e)\n{\n  _this.grid.ds.load({});\n}"
116                                                     },
117                                                     "text": "Reload",
118                                                     "xtype": "Item",
119                                                     "|xns": "Roo.menu"
120                                                 }
121                                             ]
122                                         }
123                                     ]
124                                 }
125                             ]
126                         },
127                         {
128                             "*prop": "colModel[]",
129                             "dataIndex": "name",
130                             "header": "Name",
131                             "width": 200,
132                             "xtype": "ColumnModel",
133                             "|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}",
134                             "|xns": "Roo.grid"
135                         },
136                         {
137                             "listeners": {
138                                 "afterselectionchange": "function (_self)\n{\n    Pman.Tab.AdminContacts.footer.onClick('first');\n}"
139                             },
140                             "*prop": "sm",
141                             "singleSelect": true,
142                             "xtype": "RowSelectionModel",
143                             "|xns": "Roo.grid"
144                         }
145                     ]
146                 }
147             ]
148         }
149     ],
150     "permname": "",
151     "modOrder": "001"
152 }