Pman.Tab.AdminLogEvents.bjs
[Pman.Admin] / Pman.Tab.AdminLogEvents.bjs
1 {
2  "name" : "Pman.Tab.AdminLogEvents",
3  "parent" : "Pman.Tab.AdminLogs",
4  "title" : "Admin - Logs - Events",
5  "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminLogEvents.bjs",
6  "permname" : "Admin.Logs",
7  "modOrder" : "001",
8  "strings" : {
9   "231bc72756b5e6de492aaaa1577f61b1" : "Remarks",
10   "2ea72778ebaacc973260c88837dd7a2f" : "Displaying Events  {0} - {1} of {2}",
11   "87f9f735a1d36793ceaecd4e47124b63" : "Events",
12   "1b7f7d24575cdbfadb83b9587fa1bf97" : "#id",
13   "a12a3079e14ced46e69ba52b8a90b21a" : "IP",
14   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
15   "01bd6a16732dfa2b760dc8566c58afae" : "Download to Excel",
16   "498f79c4c5bbde77f1bceb6c86fd0f6d" : "Show",
17   "037fd50b0e85bb65995ca7125d06c7cd" : "Select Person Table",
18   "fd7535ce3979bb8547e2c01689db0767" : "Select Person ",
19   "679308a758de538c5f39c4c6cdba6593" : "Select Affects",
20   "a8929eb5c1553d3f70497f862d25d0ce" : "Select Action",
21   "39b9e051f9fe75e65c7a330bb00499d4" : "Date Range",
22   "4e97aeeaa8b15ca1180fcd1f3ac478d1" : "When",
23   "40bed7cf9b3d4bb3a3d7a7e3eb18c5eb" : "Person",
24   "004bf6c9a40003140292e97330236c53" : "Action",
25   "90e4ac2e5a22e53df63b6b186d8727ba" : "No Events found",
26   "2c92a9a6a5dbf570825e62eabcdecd8d" : "Affected"
27  },
28  "items" : [
29   {
30    "region" : "center",
31    "title" : "Events",
32    "xtype" : "NestedLayoutPanel",
33    "$ xns" : "Roo",
34    "items" : [
35     {
36      "xtype" : "BorderLayout",
37      "$ xns" : "Roo",
38      "* prop" : "layout",
39      "items" : [
40       {
41        "xtype" : "LayoutRegion",
42        "$ xns" : "Roo",
43        "* prop" : "center"
44       },
45       {
46        "autoScroll" : true,
47        "xtype" : "LayoutRegion",
48        "$ xns" : "Roo",
49        "split" : true,
50        "height" : 150,
51        "* prop" : "south"
52       },
53       {
54        "listeners" : {
55         "render" : "function (_self)\n{\n  _this.viewPanel = _self;\n}"
56        },
57        "fitToFrame" : true,
58        "region" : "south",
59        "xtype" : "ContentPanel",
60        "$ xns" : "Roo"
61       },
62       {
63        "listeners" : {
64         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
65        },
66        "background" : false,
67        "region" : "center",
68        "fitToframe" : true,
69        "title" : "Events",
70        "xtype" : "GridPanel",
71        "fitContainer" : true,
72        "$ xns" : "Roo",
73        "tableName" : "Events",
74        "items" : [
75         {
76          "listeners" : {
77           "|render" : "function() { \n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
78          },
79          "autoExpandColumn" : "remarks",
80          "xtype" : "Grid",
81          "loadMask" : true,
82          "$ xns" : "Roo.grid",
83          "* prop" : "grid",
84          "items" : [
85           {
86            "listeners" : {
87             "afterselectionchange" : "function (_self)\n{\n    // load detail log in _this.viewPanel;\n    if (!this.getSelected()) {\n        this.viewPanel.setContent(\"Nothing Selected\");\n        return;\n    }\n    var id = this.getSelected().data.id;\n    _this.viewPanel.load( { url : baseURL + \"/Admin/EventView/\" + id + \".html\" });\n    \n}"
88            },
89            "xtype" : "RowSelectionModel",
90            "singleSelect" : true,
91            "$ xns" : "Roo.grid",
92            "* prop" : "sm"
93           },
94           {
95            "listeners" : {
96             "|beforeload" : "function (_self, o)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n   \n   \n   if (! _this.personSel) {\n    return false;\n    }\n    o.params = o.params || {};\n    o.params.person_id = _this.personSel.getValue();\n    o.params.person_table = _this.tableSel.getValue();\n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        o.params.action = act;\n    }\n    var tbl = _this.affectSel.getValue();\n    if (tbl.length) {\n        o.params.on_table = tbl;\n    }\n    act = _this.dateFrom.getValue();\n    if (act.format) {\n        o.params['query[from]'] = act.format('Y-m-d');\n    }\n    act = _this.dateTo.getValue();\n    if (act.format) {\n        o.params['query[to]'] = act.format('Y-m-d');\n    }\n \n    \n    /*\n    act = _this.groupedCombo.getValue();\n    o.params['query[grouped]'] = act;\n    if (o.params['query[grouped]'] == 'gr') {\n    \n        if (!tbl.length) {\n            Roo.MessageBox.alert(\"Error\", \"Select a table to group results on\");\n            return false;\n        }\n//        o.params['_columns']  = \n        o.params['_distinct'] = 'on_id';\n        \n        \n    }\n    \n    */\n\n    \n}"
97            },
98            "xtype" : "Store",
99            "remoteSort" : true,
100            "$ sortInfo" : "{ field: 'event_when', direction: 'DESC'}",
101            "$ xns" : "Roo.data",
102            "* prop" : "dataSource",
103            "items" : [
104             {
105              "id" : "id",
106              "root" : "data",
107              "xtype" : "JsonReader",
108              "$ xns" : "Roo.data",
109              "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]",
110              "* prop" : "reader",
111              "totalProperty" : "total"
112             },
113             {
114              "$ url" : "baseURL + '/Roo/Events.php'",
115              "xtype" : "HttpProxy",
116              "method" : "GET",
117              "$ xns" : "Roo.data",
118              "* prop" : "proxy"
119             }
120            ]
121           },
122           {
123            "pageSize" : 25,
124            "xtype" : "PagingToolbar",
125            "emptyMsg" : "No Events found",
126            "$ xns" : "Roo",
127            "displayInfo" : true,
128            "displayMsg" : "Displaying Events  {0} - {1} of {2}",
129            "* prop" : "footer",
130            "items" : [
131             {
132              "listeners" : {
133               "click" : "function (_self, e)\n{\n    \n    var params = {\n        'sort' : 'event_when',\n        'dir' : 'DESC',\n        'start' : 0,\n        'limit' : 900,\n        person_id : _this.personSel.getValue(), \n        'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', \n        'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_id_name', \n        'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', \n        'csvTitles[3]' : 'Record ID',   'csvCols[3]' : 'on_id'       ,\n        'csvTitles[4]' : 'Record Type',   'csvCols[4]' : 'on_table',\n        'csvTitles[5]' : 'Remarks',   'csvCols[5]' : 'remarks'        \n    }\n        \n    params.person_id = _this.personSel.getValue();\n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        params.action = act;\n    }\n    var tbl = _this.affectSel.getValue();\n    if (tbl.length) {\n        params.on_table = tbl;\n    }\n    act = _this.dateFrom.getValue();\n    if (act.format) {\n        params['query[from]'] = act.format('Y-m-d');\n    }\n    act = _this.dateTo.getValue();\n    if (act.format) {\n        params['query[to]'] = act.format('Y-m-d');\n    }\n    params.limit = 9999;\n    \n\n    new Pman.download({\n        url : baseURL + '/Roo/Events.php',\n        params : params ,\n        newWindow: true\n        \n    });\n}"
134              },
135              "text" : "Download to Excel",
136              "xtype" : "Button",
137              "$ xns" : "Roo.Toolbar"
138             }
139            ]
140           },
141           {
142            "xtype" : "Toolbar",
143            "$ xns" : "Roo",
144            "* prop" : "toolbar",
145            "items" : [
146             {
147              "text" : "Show",
148              "xtype" : "TextItem",
149              "$ xns" : "Roo.Toolbar"
150             },
151             {
152              "listeners" : {
153               "|render" : "function (_self)\n{\n    _this.tableSel = _self;\n  \n    if(\n        typeof(uiConfig) == 'undefined' || \n        typeof(uiConfig.events_person_table) == 'undefined' || \n        !uiConfig.events_person_table.length\n    ){\n        this.hide();\n    }\n  \n}",
154               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
155              },
156              "listWidth" : 300,
157              "triggerAction" : "all",
158              "forceSelection" : true,
159              "selectOnFocus" : true,
160              "pageSize" : 20,
161              "displayField" : "value",
162              "emptyText" : "Select Person Table",
163              "minChars" : 2,
164              "valueField" : "value",
165              "xtype" : "ComboBox",
166              "allowBlank" : true,
167              "typeAhead" : true,
168              "Boolean alwaysQuery" : true,
169              "editable" : false,
170              "width" : 150,
171              "$ xns" : "Roo.form",
172              "name" : "person_table",
173              "qtip" : "Select Person Table",
174              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>",
175              "loadingText" : "Searching...",
176              "items" : [
177               {
178                "| data" : "(function() { \n\n    if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){\n\n        return [];        \n    }\n\n    return uiConfig.events_person_table;\n    \n})()",
179                "xtype" : "SimpleStore",
180                "$ fields" : "[ 'value' ]",
181                "$ xns" : "Roo.data",
182                "* prop" : "store",
183                "isLocal" : true
184               }
185              ]
186             },
187             {
188              "listeners" : {
189               "|render" : "function (_self)\n{\n  _this.personSel = _self;\n}",
190               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n  \n}"
191              },
192              "listWidth" : 600,
193              "triggerAction" : "all",
194              "fieldLabel" : "Person ",
195              "forceSelection" : true,
196              "selectOnFocus" : true,
197              "pageSize" : 20,
198              "displayField" : "name",
199              "emptyText" : "Select Person ",
200              "minChars" : 2,
201              "valueField" : "id",
202              "xtype" : "ComboBox",
203              "allowBlank" : true,
204              "typeAhead" : true,
205              "editable" : true,
206              "width" : 150,
207              "$ xns" : "Roo.form",
208              "name" : "person_id_name",
209              "qtip" : "Select Person ",
210              "queryParam" : "query[name]",
211              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) &lt;{email}&gt; </div>",
212              "loadingText" : "Searching...",
213              "items" : [
214               {
215                "listeners" : {
216                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.company_id = Pman.Login.authUser.company_id;\n}"
217                },
218                "xtype" : "Store",
219                "remoteSort" : true,
220                "$ sortInfo" : "{ field : 'name' , direction : 'ASC' }",
221                "$ xns" : "Roo.data",
222                "* prop" : "store",
223                "items" : [
224                 {
225                  "$ url" : "baseURL + '/Roo/Person.php'",
226                  "method" : "GET",
227                  "xtype" : "HttpProxy",
228                  "$ xns" : "Roo.data",
229                  "* prop" : "proxy"
230                 },
231                 {
232                  "id" : "id",
233                  "root" : "data",
234                  "xtype" : "JsonReader",
235                  "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'phone',\n        'type': 'string'\n    },\n    {\n        'name': 'fax',\n        'type': 'string'\n    },\n    {\n        'name': 'email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'role',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'lang',\n        'type': 'string'\n    },\n    {\n        'name': 'no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'deleted_dt',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'office_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_tel',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_url',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_dispatch_port',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_province',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_country',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_type',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_client_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_team_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_file_location',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_open_date',\n        'type': 'date'\n    },\n    {\n        'name': 'project_id_open_by',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_close_date',\n        'type': 'date'\n    },\n    {\n        'name': 'project_id_countries',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_languages',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_agency_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_deleted_dt',\n        'type': 'date'\n    }\n]",
236                  "$ xns" : "Roo.data",
237                  "* prop" : "reader",
238                  "totalProperty" : "total"
239                 }
240                ]
241               }
242              ]
243             },
244             {
245              "listeners" : {
246               "|render" : "function (_self)\n{\n  _this.actionSel = _self;\n}",
247               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
248              },
249              "listWidth" : 300,
250              "triggerAction" : "all",
251              "forceSelection" : true,
252              "selectOnFocus" : true,
253              "pageSize" : 20,
254              "displayField" : "action",
255              "emptyText" : "Select Action",
256              "minChars" : 2,
257              "valueField" : "action",
258              "xtype" : "ComboBox",
259              "allowBlank" : true,
260              "typeAhead" : true,
261              "editable" : true,
262              "width" : 150,
263              "$ xns" : "Roo.form",
264              "name" : "action",
265              "qtip" : "Select Action",
266              "queryParam" : "query[action]",
267              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>",
268              "loadingText" : "Searching...",
269              "items" : [
270               {
271                "listeners" : {
272                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {\n        o.params.company_id = Pman.Login.authUser.company_id;\n    }\n    o.params._distinct = 'action';\n    o.params._columns ='action';\n}"
273                },
274                "xtype" : "Store",
275                "remoteSort" : true,
276                "$ sortInfo" : "{ field : 'action' , direction : 'ASC' }",
277                "$ xns" : "Roo.data",
278                "* prop" : "store",
279                "items" : [
280                 {
281                  "$ url" : "baseURL + '/Roo/Events.php'",
282                  "method" : "GET",
283                  "xtype" : "HttpProxy",
284                  "$ xns" : "Roo.data",
285                  "* prop" : "proxy"
286                 },
287                 {
288                  "id" : "id",
289                  "root" : "data",
290                  "xtype" : "JsonReader",
291                  "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]",
292                  "$ xns" : "Roo.data",
293                  "* prop" : "reader",
294                  "totalProperty" : "total"
295                 }
296                ]
297               }
298              ]
299             },
300             {
301              "listeners" : {
302               "|render" : "function (_self)\n{\n    _this.affectSel = _self;\n  \n    if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){\n        this.hide();\n    }\n}",
303               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
304              },
305              "listWidth" : 300,
306              "triggerAction" : "all",
307              "forceSelection" : true,
308              "selectOnFocus" : true,
309              "pageSize" : 20,
310              "displayField" : "on_table",
311              "emptyText" : "Select Affects",
312              "minChars" : 2,
313              "valueField" : "action",
314              "xtype" : "ComboBox",
315              "allowBlank" : true,
316              "typeAhead" : true,
317              "editable" : true,
318              "width" : 150,
319              "$ xns" : "Roo.form",
320              "name" : "on_table",
321              "qtip" : "Select Action",
322              "queryParam" : "query[on_table]",
323              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>",
324              "loadingText" : "Searching...",
325              "items" : [
326               {
327                "listeners" : {
328                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {\n        o.params.company_id = Pman.Login.authUser.company_id;\n    }\n    o.params._distinct = 'on_table';\n    o.params._columns ='on_table';\n}"
329                },
330                "xtype" : "Store",
331                "remoteSort" : true,
332                "$ sortInfo" : "{ field : 'on_table' , direction : 'ASC' }",
333                "$ xns" : "Roo.data",
334                "* prop" : "store",
335                "items" : [
336                 {
337                  "$ url" : "baseURL + '/Roo/Events.php'",
338                  "method" : "GET",
339                  "xtype" : "HttpProxy",
340                  "$ xns" : "Roo.data",
341                  "* prop" : "proxy"
342                 },
343                 {
344                  "id" : "id",
345                  "root" : "data",
346                  "xtype" : "JsonReader",
347                  "$ xns" : "Roo.data",
348                  "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]",
349                  "* prop" : "reader",
350                  "totalProperty" : "total"
351                 }
352                ]
353               }
354              ]
355             },
356             {
357              "text" : "Date Range",
358              "xtype" : "TextItem",
359              "$ xns" : "Roo.Toolbar"
360             },
361             {
362              "listeners" : {
363               "render" : "function (_self)\n{\n  _this.dateFrom = _self;\n}",
364               "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
365              },
366              "format" : "Y-m-d",
367              "xtype" : "DateField",
368              "$ xns" : "Roo.form"
369             },
370             {
371              "listeners" : {
372               "render" : "function (_self)\n{\n  _this.dateTo = _self;\n}",
373               "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
374              },
375              "format" : "Y-m-d",
376              "xtype" : "DateField",
377              "$ xns" : "Roo.form"
378             }
379            ]
380           },
381           {
382            "xtype" : "ColumnModel",
383            "width" : 100,
384            "header" : "When",
385            "$ renderer" : "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
386            "$ xns" : "Roo.grid",
387            "* prop" : "colModel[]",
388            "dataIndex" : "event_when"
389           },
390           {
391            "xtype" : "ColumnModel",
392            "width" : 100,
393            "header" : "#id",
394            "$ xns" : "Roo.grid",
395            "* prop" : "colModel[]",
396            "dataIndex" : "id"
397           },
398           {
399            "xtype" : "ColumnModel",
400            "width" : 150,
401            "header" : "Person",
402            "$ renderer" : "function(v,x,r) { \n    \n    var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;\n    var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;    \n    \n    //Roo.log([r, efield, nfield]);\n    \n    var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;\n    var name  = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;    \n    return String.format('{0} &lt;<a href=\"mailto:{1}\">{1}</a>&gt;', \n        name, email); \n\n\n}",
403            "$ xns" : "Roo.grid",
404            "* prop" : "colModel[]",
405            "dataIndex" : "person_id_name"
406           },
407           {
408            "xtype" : "ColumnModel",
409            "header" : "Action",
410            "width" : 100,
411            "$ renderer" : "function(v) { return String.format('{0}', v); }",
412            "$ xns" : "Roo.grid",
413            "* prop" : "colModel[]",
414            "dataIndex" : "action"
415           },
416           {
417            "xtype" : "ColumnModel",
418            "header" : "IP",
419            "width" : 100,
420            "$ renderer" : "function(v) { return String.format('{0}', v); }",
421            "$ xns" : "Roo.grid",
422            "* prop" : "colModel[]",
423            "dataIndex" : "ipaddr"
424           },
425           {
426            "xtype" : "ColumnModel",
427            "width" : 100,
428            "header" : "Affected",
429            "$ renderer" : "function(v, x, r) {                     \n            return v ? String.format('{0}({1})', v,  r.data.on_id)  : '';  \n   }",
430            "$ xns" : "Roo.grid",
431            "* prop" : "colModel[]",
432            "dataIndex" : "on_table"
433           },
434           {
435            "xtype" : "ColumnModel",
436            "width" : 300,
437            "header" : "Remarks",
438            "$ renderer" : "function(v) { return String.format('<span qtip=\"{1}\">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }",
439            "$ xns" : "Roo.grid",
440            "* prop" : "colModel[]",
441            "dataIndex" : "remarks"
442           }
443          ]
444         }
445        ]
446       }
447      ]
448     }
449    ]
450   }
451  ]
452 }