sync
[Pman.Admin] / Pman.Tab.AdminContacts.bjs
1 {
2  "name" : "Pman.Tab.AdminContacts",
3  "parent" : "Pman.Tab.AdminContactsManager",
4  "title" : "Pman.Tab.AdminContacts",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminContacts.bjs",
6  "permname" : "Core.Person",
7  "modOrder" : "001",
8  "strings" : {
9   "99b344c8ae43e3e7213862b8f35c4e51" : "Select Company",
10   "1c76cbfe21c6f44c1d1e59d54f3e4420" : "Company",
11   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
12   "8444e81d652b084d70c71cd7d19ac0cf" : "Displaying Person{0} - {1} of {2}",
13   "13348442cc6a27032d2b4aa28b75a5d3" : "Search",
14   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
15   "9e727fdd3aec8274f46685441900280d" : "Project",
16   "7dce122004969d56ae2e0245cb754d35" : "Edit",
17   "4110db87ce3ac86d603d03d691616b1e" : "Drag person to add or remove from group",
18   "b47a519aebda8fdb4b59bdae6eb2bff0" : "Show No Company",
19   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
20   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
21   "9675747b5ab12d05f18518761e68a533" : "Select Companies",
22   "40bed7cf9b3d4bb3a3d7a7e3eb18c5eb" : "Person",
23   "f1174ecbbc232f948717979daf04cf08" : "No Person found",
24   "ec3249f16ee5880d4c1acb752e5c925f" : "Switch to Selected User",
25   "a93806efd0cc7a149f0f03e2b9a0f862" : "Bulk Add",
26   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
27   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
28   "49ee3087348e8d44e1feda1917443987" : "Name",
29   "bbbabdbe1b262f75d99d62880b953be1" : "Role",
30   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
31   "d4d25ad0a12e8d30e9d8d35230f6d1d3" : "Show Removed",
32   "9810aa2b9f44401be4bf73188ef2b67d" : "Fax"
33  },
34  "named_strings" : {
35   "company_name_emptyText" : "99b344c8ae43e3e7213862b8f35c4e51",
36   "company_name_qtip" : "9675747b5ab12d05f18518761e68a533",
37   "company_name_loadingText" : "1243daf593fa297e07ab03bf06d925af"
38  },
39  "items" : [
40   {
41    "listeners" : {
42     "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
43    },
44    "bool background" : false,
45    "autoScroll" : true,
46    "fitToframe" : true,
47    "region" : "center",
48    "title" : "Person",
49    "xtype" : "GridPanel",
50    "fitContainer" : true,
51    "$ xns" : "Roo",
52    "tableName" : "Person",
53    "items" : [
54     {
55      "listeners" : {
56       "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) {\n        return;\n    }\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
57       "|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}",
58       "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}"
59      },
60      "autoExpandColumn" : "name",
61      "xtype" : "Grid",
62      "ddGroup" : "groupDD",
63      "enableDrag" : true,
64      "loadMask" : true,
65      "$ xns" : "Roo.grid",
66      "* prop" : "grid",
67      "items" : [
68       {
69        "listeners" : {
70         "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    // only used to change active status.\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Person.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}",
71         "beforeload" : "function (_self, o)\n{\n    if(!_this.active_company_button.pressed){\n        o.params['!company_id_comptype'] = 'OWNER';\n    }\n    \n    o.params['query[search]'] = _this.searchBox.getValue();\n    \n    if (!_this.activeButton) {return; false;}\n    \n    if (_this.companyCombo &&   _this.companyCombo.getValue()) {\n        o.params.company_id =   _this.companyCombo.getValue();\n    }\n    \n    \n    o.params.active = _this.activeButton.pressed ? 0 : 1;\n    \n    if(_this.active_company_button.pressed){\n        o.params.company_id = 0;\n    }\n    \n    var c = Pman.Tab.AdminContactsManager.layout.getRegion('west').getActivePanel();\n    \n    if (!c) { \n        return false;\n    }\n    \n    var tms = c.grid.getSelectionModel().getSelected();\n    \n    if (!tms) {\n        return false;\n    }\n    \n    if(c.tableName == 'Groups'){\n        o.params['query[in_group]'] = tms.data.id;\n        o.params['query[type]'] = 2; // group type..\n    }else{\n        o.params['query[in_country]'] = (tms.data.country*1 == -1) ? '' : tms.data.country;\n        o.params['query[in_group]'] = 0;\n        o.params['query[type]'] = 2;\n    }\n    /*\n    if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {\n        \n        \n        \n    }\n    \n    if(Pman.Tab.AdminCountries && Pman.Tab.AdminCountries.grid){\n        var tms = Pman.Tab.AdminCountries.grid.getSelectionModel().getSelected();\n        \n        if (!tms) {\n            return false;\n        }\n        \n    }\n    */\n    //o.params['query[name]'] = _this.searchBox.getValue();\n  \n}"
72        },
73        "xtype" : "Store",
74        "remoteSort" : true,
75        "$ sortInfo" : "{ field : 'name', direction: 'ASC' }",
76        "$ xns" : "Roo.data",
77        "* prop" : "dataSource",
78        "items" : [
79         {
80          "$ url" : "baseURL + '/Roo/core_person'",
81          "xtype" : "HttpProxy",
82          "method" : "GET",
83          "$ xns" : "Roo.data",
84          "* prop" : "proxy"
85         },
86         {
87          "id" : "id",
88          "root" : "data",
89          "xtype" : "JsonReader",
90          "$ xns" : "Roo.data",
91          "* prop" : "reader",
92          "totalProperty" : "total"
93         }
94        ]
95       },
96       {
97        "pageSize" : 25,
98        "xtype" : "PagingToolbar",
99        "emptyMsg" : "No Person found",
100        "$ xns" : "Roo",
101        "displayInfo" : true,
102        "displayMsg" : "Displaying Person{0} - {1} of {2}",
103        "* prop" : "footer",
104        "items" : [
105         {
106          "text" : "Drag person to add or remove from group",
107          "xtype" : "TextItem",
108          "$ xns" : "Roo.Toolbar"
109         }
110        ]
111       },
112       {
113        "xtype" : "Toolbar",
114        "$ xns" : "Roo",
115        "* prop" : "toolbar",
116        "items" : [
117         {
118          "text" : "Search",
119          "xtype" : "TextItem",
120          "$ xns" : "Roo.Toolbar"
121         },
122         {
123          "listeners" : {
124           "specialkey" : "function (_self, e)\n{\n  if (e.getKey() == 13) {\n    _this.grid.footer.onClick('first');\n  }\n}",
125           "show" : "function (_self,e)\n{\n    if (e.getCharCode() != 13) {\n        return;\n    }\n    _this.grid.footer.onClick('first');\n}",
126           "render" : "function (_self)\n{\n    _this.searchBox = _self;\n}"
127          },
128          "xtype" : "TextField",
129          "$ xns" : "Roo.form"
130         },
131         {
132          "listeners" : {
133           "render" : "function (_self)\n{\n  _this.companyCombo = _self;\n}",
134           "select" : "function (combo, record, index)\n{\n   _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );\n}"
135          },
136          "listWidth" : 400,
137          "triggerAction" : "all",
138          "forceSelection" : true,
139          "selectOnFocus" : true,
140          "pageSize" : 20,
141          "emptyText" : "Select Company",
142          "displayField" : "name",
143          "hiddenName" : "company_id",
144          "minChars" : 2,
145          "valueField" : "id",
146          "xtype" : "ComboBox",
147          "typeAhead" : true,
148          "editable" : true,
149          "width" : 150,
150          "$ xns" : "Roo.form",
151          "name" : "company_name",
152          "qtip" : "Select Companies",
153          "queryParam" : "query[name]",
154          "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
155          "loadingText" : "Searching...",
156          "items" : [
157           {
158            "listeners" : {
159             "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
160            },
161            "xtype" : "Store",
162            "remoteSort" : true,
163            "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
164            "$ xns" : "Roo.data",
165            "* prop" : "store",
166            "items" : [
167             {
168              "$ url" : "baseURL + '/Roo/core_company'",
169              "xtype" : "HttpProxy",
170              "method" : "GET",
171              "$ xns" : "Roo.data",
172              "* prop" : "proxy"
173             },
174             {
175              "id" : "id",
176              "root" : "data",
177              "xtype" : "JsonReader",
178              "$ xns" : "Roo.data",
179              "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"code\",\"type\":\"string\"}]",
180              "* prop" : "reader",
181              "totalProperty" : "total"
182             }
183            ]
184           }
185          ]
186         },
187         {
188          "listeners" : {
189           "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
190          },
191          "xtype" : "Button",
192          "cls" : "x-btn-icon",
193          "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
194          "$ xns" : "Roo.Toolbar"
195         },
196         {
197          "listeners" : {
198           "|click" : "function (_self, e)\n{\n_this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\n}"
199          },
200          "xtype" : "Button",
201          "cls" : "x-btn-icon",
202          "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
203          "$ xns" : "Roo.Toolbar"
204         },
205         {
206          "listeners" : {
207           "toggle" : "function (_self, pressed)\n{\n   _this.grid.footer.onClick('first');\n   this.setText(pressed ? \"Show Active\" : \"Show Removed\");\n   \n   \n}",
208           "render" : "function (_self)\n{\n  _this.activeButton = _self;\n}"
209          },
210          "text" : "Show Removed",
211          "enableToggle" : true,
212          "xtype" : "Button",
213          "$ xns" : "Roo.Toolbar"
214         },
215         {
216          "listeners" : {
217           "toggle" : "function (_self, pressed)\n{\n   _this.grid.footer.onClick('first');\n   this.setText(pressed ? \"Show Company\" : \"Show No Company\");\n   \n   \n}",
218           "render" : "function (_self)\n{\n  _this.active_company_button = _self;\n}"
219          },
220          "text" : "Show No Company",
221          "enableToggle" : true,
222          "xtype" : "Button",
223          "$ xns" : "Roo.Toolbar"
224         },
225         {
226          "listeners" : {
227           "click" : "function (_self, e)\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if(s.length != 1){\n        Roo.MessageBox.alert(\"Error\", \"Select a Person\");\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Login.php',\n        method : 'GET',\n        params : {\n            'switch' : s[0].data.id\n        },\n        success : function (){\n            document.location = baseURL + '?ts=' + Math.random();\n        },\n        failure : function (d){\n            Roo.log(d);\n            Roo.MessageBox.alert(\"Error\", d);\n        }\n    });\n}"
228          },
229          "text" : "Switch to Selected User",
230          "xtype" : "Button",
231          "$ xns" : "Roo.Toolbar"
232         },
233         {
234          "xtype" : "Fill",
235          "$ xns" : "Roo.Toolbar"
236         },
237         {
238          "listeners" : {
239           "|click" : "function()\n{\n    \n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
240          },
241          "text" : "Add",
242          "xtype" : "Button",
243          "cls" : "x-btn-text-icon",
244          "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
245          "$ xns" : "Roo.Toolbar"
246         },
247         {
248          "listeners" : {
249           "|click" : "function()\n{\n    \n    Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
250          },
251          "text" : "Bulk Add",
252          "xtype" : "Button",
253          "cls" : "x-btn-text-icon",
254          "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
255          "$ xns" : "Roo.Toolbar"
256         },
257         {
258          "listeners" : {
259           "|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"
260          },
261          "text" : "Edit",
262          "xtype" : "Button",
263          "cls" : "x-btn-text-icon",
264          "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
265          "$ xns" : "Roo.Toolbar"
266         },
267         {
268          "listeners" : {
269           "|click" : "function()\n{\n     Pman.genericDelete(_this, 'Person'); \n}\n        "
270          },
271          "text" : "Delete",
272          "xtype" : "Button",
273          "cls" : "x-btn-text-icon",
274          "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
275          "$ xns" : "Roo.Toolbar"
276         }
277        ]
278       },
279       {
280        "hidden" : true,
281        "xtype" : "ColumnModel",
282        "sortable" : true,
283        "header" : "Project",
284        "width" : 75,
285        "$ renderer" : "function(v,x,r) { \n      return String.format('<span qtip=\"{0}\">{1}</span>', \n                    r.data.project_id_name,\n                    v);\n }",
286        "$ xns" : "Roo.grid",
287        "* prop" : "colModel[]",
288        "dataIndex" : "project_id_code"
289       },
290       {
291        "xtype" : "ColumnModel",
292        "sortable" : true,
293        "header" : "Type",
294        "width" : 50,
295        "$ 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}",
296        "$ xns" : "Roo.grid",
297        "* prop" : "colModel[]",
298        "dataIndex" : "company_id_comptype"
299       },
300       {
301        "xtype" : "ColumnModel",
302        "sortable" : true,
303        "header" : "Company",
304        "width" : 150,
305        "$ 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}",
306        "$ xns" : "Roo.grid",
307        "* prop" : "colModel[]",
308        "dataIndex" : "company_id_name"
309       },
310       {
311        "xtype" : "ColumnModel",
312        "sortable" : true,
313        "header" : "Name",
314        "width" : 200,
315        "$ renderer" : "function(v) { return String.format('{0}', v); }",
316        "$ xns" : "Roo.grid",
317        "* prop" : "colModel[]",
318        "dataIndex" : "name"
319       },
320       {
321        "xtype" : "ColumnModel",
322        "width" : 100,
323        "header" : "Role",
324        "$ renderer" : "function(v) { return String.format('{0}', v); }",
325        "$ xns" : "Roo.grid",
326        "* prop" : "colModel[]",
327        "dataIndex" : "role"
328       },
329       {
330        "xtype" : "ColumnModel",
331        "width" : 100,
332        "header" : "Phone",
333        "$ renderer" : "function(v) { return String.format('{0}', v); }",
334        "$ xns" : "Roo.grid",
335        "* prop" : "colModel[]",
336        "dataIndex" : "phone"
337       },
338       {
339        "xtype" : "ColumnModel",
340        "header" : "Fax",
341        "width" : 100,
342        "$ renderer" : "function(v) { return String.format('{0}', v); }",
343        "$ xns" : "Roo.grid",
344        "* prop" : "colModel[]",
345        "Boolean hidden" : true,
346        "dataIndex" : "fax"
347       },
348       {
349        "xtype" : "ColumnModel",
350        "sortable" : true,
351        "header" : "Email",
352        "width" : 200,
353        "$ renderer" : "function(v) {\n   return (v.length && v.indexOf('@') > 0 ) ? \n                    String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n }",
354        "$ xns" : "Roo.grid",
355        "* prop" : "colModel[]",
356        "dataIndex" : "email"
357       },
358       {
359        "xtype" : "ColumnModel",
360        "width" : 75,
361        "header" : "Active",
362        "$ 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 }",
363        "$ xns" : "Roo.grid",
364        "* prop" : "colModel[]",
365        "dataIndex" : "active"
366       }
367      ]
368     }
369    ]
370   }
371  ]
372 }