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          "autoExpandColumn" : "remarks",
77          "xtype" : "Grid",
78          "loadMask" : true,
79          "$ xns" : "Roo.grid",
80          "* prop" : "grid",
81          "items" : [
82           {
83            "listeners" : {
84             "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}"
85            },
86            "xtype" : "RowSelectionModel",
87            "singleSelect" : true,
88            "$ xns" : "Roo.grid",
89            "* prop" : "sm"
90           },
91           {
92            "listeners" : {
93             "|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}"
94            },
95            "xtype" : "Store",
96            "remoteSort" : true,
97            "$ sortInfo" : "{ field: 'event_when', direction: 'DESC'}",
98            "$ xns" : "Roo.data",
99            "* prop" : "dataSource",
100            "items" : [
101             {
102              "id" : "id",
103              "root" : "data",
104              "xtype" : "JsonReader",
105              "$ xns" : "Roo.data",
106              "$ 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]",
107              "* prop" : "reader",
108              "totalProperty" : "total"
109             },
110             {
111              "$ url" : "baseURL + '/Roo/Events.php'",
112              "xtype" : "HttpProxy",
113              "method" : "GET",
114              "$ xns" : "Roo.data",
115              "* prop" : "proxy"
116             }
117            ]
118           },
119           {
120            "pageSize" : 25,
121            "xtype" : "PagingToolbar",
122            "emptyMsg" : "No Events found",
123            "$ xns" : "Roo",
124            "displayInfo" : true,
125            "displayMsg" : "Displaying Events  {0} - {1} of {2}",
126            "* prop" : "footer",
127            "items" : [
128             {
129              "listeners" : {
130               "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}"
131              },
132              "text" : "Download to Excel",
133              "xtype" : "Button",
134              "$ xns" : "Roo.Toolbar"
135             }
136            ]
137           },
138           {
139            "xtype" : "Toolbar",
140            "$ xns" : "Roo",
141            "* prop" : "toolbar",
142            "items" : [
143             {
144              "text" : "Show",
145              "xtype" : "TextItem",
146              "$ xns" : "Roo.Toolbar"
147             },
148             {
149              "listeners" : {
150               "|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}",
151               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
152              },
153              "listWidth" : 300,
154              "triggerAction" : "all",
155              "forceSelection" : true,
156              "selectOnFocus" : true,
157              "pageSize" : 20,
158              "displayField" : "value",
159              "emptyText" : "Select Person Table",
160              "minChars" : 2,
161              "valueField" : "value",
162              "xtype" : "ComboBox",
163              "allowBlank" : true,
164              "typeAhead" : true,
165              "Boolean alwaysQuery" : true,
166              "editable" : false,
167              "width" : 150,
168              "$ xns" : "Roo.form",
169              "name" : "person_table",
170              "qtip" : "Select Person Table",
171              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>",
172              "loadingText" : "Searching...",
173              "items" : [
174               {
175                "| 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})()",
176                "xtype" : "SimpleStore",
177                "$ fields" : "[ 'value' ]",
178                "$ xns" : "Roo.data",
179                "* prop" : "store",
180                "isLocal" : true
181               }
182              ]
183             },
184             {
185              "listeners" : {
186               "|render" : "function (_self)\n{\n  _this.personSel = _self;\n}",
187               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n  \n}"
188              },
189              "listWidth" : 600,
190              "triggerAction" : "all",
191              "fieldLabel" : "Person ",
192              "forceSelection" : true,
193              "selectOnFocus" : true,
194              "pageSize" : 20,
195              "displayField" : "name",
196              "emptyText" : "Select Person ",
197              "minChars" : 2,
198              "valueField" : "id",
199              "xtype" : "ComboBox",
200              "allowBlank" : true,
201              "typeAhead" : true,
202              "editable" : true,
203              "width" : 150,
204              "$ xns" : "Roo.form",
205              "name" : "person_id_name",
206              "qtip" : "Select Person ",
207              "queryParam" : "query[name]",
208              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) &lt;{email}&gt; </div>",
209              "loadingText" : "Searching...",
210              "items" : [
211               {
212                "listeners" : {
213                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.company_id = Pman.Login.authUser.company_id;\n}"
214                },
215                "xtype" : "Store",
216                "remoteSort" : true,
217                "$ sortInfo" : "{ field : 'name' , direction : 'ASC' }",
218                "$ xns" : "Roo.data",
219                "* prop" : "store",
220                "items" : [
221                 {
222                  "$ url" : "baseURL + '/Roo/Person.php'",
223                  "method" : "GET",
224                  "xtype" : "HttpProxy",
225                  "$ xns" : "Roo.data",
226                  "* prop" : "proxy"
227                 },
228                 {
229                  "id" : "id",
230                  "root" : "data",
231                  "xtype" : "JsonReader",
232                  "$ 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]",
233                  "$ xns" : "Roo.data",
234                  "* prop" : "reader",
235                  "totalProperty" : "total"
236                 }
237                ]
238               }
239              ]
240             },
241             {
242              "listeners" : {
243               "|render" : "function (_self)\n{\n  _this.actionSel = _self;\n}",
244               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
245              },
246              "listWidth" : 300,
247              "triggerAction" : "all",
248              "forceSelection" : true,
249              "selectOnFocus" : true,
250              "pageSize" : 20,
251              "displayField" : "action",
252              "emptyText" : "Select Action",
253              "minChars" : 2,
254              "valueField" : "action",
255              "xtype" : "ComboBox",
256              "allowBlank" : true,
257              "typeAhead" : true,
258              "editable" : true,
259              "width" : 150,
260              "$ xns" : "Roo.form",
261              "name" : "action",
262              "qtip" : "Select Action",
263              "queryParam" : "query[action]",
264              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>",
265              "loadingText" : "Searching...",
266              "items" : [
267               {
268                "listeners" : {
269                 "|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}"
270                },
271                "xtype" : "Store",
272                "remoteSort" : true,
273                "$ sortInfo" : "{ field : 'action' , direction : 'ASC' }",
274                "$ xns" : "Roo.data",
275                "* prop" : "store",
276                "items" : [
277                 {
278                  "$ url" : "baseURL + '/Roo/Events.php'",
279                  "method" : "GET",
280                  "xtype" : "HttpProxy",
281                  "$ xns" : "Roo.data",
282                  "* prop" : "proxy"
283                 },
284                 {
285                  "id" : "id",
286                  "root" : "data",
287                  "xtype" : "JsonReader",
288                  "$ 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]",
289                  "$ xns" : "Roo.data",
290                  "* prop" : "reader",
291                  "totalProperty" : "total"
292                 }
293                ]
294               }
295              ]
296             },
297             {
298              "listeners" : {
299               "|render" : "function (_self)\n{\n    _this.affectSel = _self;\n  \n    if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){\n        this.hide();\n    }\n}",
300               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
301              },
302              "listWidth" : 300,
303              "triggerAction" : "all",
304              "forceSelection" : true,
305              "selectOnFocus" : true,
306              "pageSize" : 20,
307              "displayField" : "on_table",
308              "emptyText" : "Select Affects",
309              "minChars" : 2,
310              "valueField" : "action",
311              "xtype" : "ComboBox",
312              "allowBlank" : true,
313              "typeAhead" : true,
314              "editable" : true,
315              "width" : 150,
316              "$ xns" : "Roo.form",
317              "name" : "on_table",
318              "qtip" : "Select Action",
319              "queryParam" : "query[on_table]",
320              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>",
321              "loadingText" : "Searching...",
322              "items" : [
323               {
324                "listeners" : {
325                 "|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}"
326                },
327                "xtype" : "Store",
328                "remoteSort" : true,
329                "$ sortInfo" : "{ field : 'on_table' , direction : 'ASC' }",
330                "$ xns" : "Roo.data",
331                "* prop" : "store",
332                "items" : [
333                 {
334                  "$ url" : "baseURL + '/Roo/Events.php'",
335                  "method" : "GET",
336                  "xtype" : "HttpProxy",
337                  "$ xns" : "Roo.data",
338                  "* prop" : "proxy"
339                 },
340                 {
341                  "id" : "id",
342                  "root" : "data",
343                  "xtype" : "JsonReader",
344                  "$ xns" : "Roo.data",
345                  "$ 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]",
346                  "* prop" : "reader",
347                  "totalProperty" : "total"
348                 }
349                ]
350               }
351              ]
352             },
353             {
354              "text" : "Date Range",
355              "xtype" : "TextItem",
356              "$ xns" : "Roo.Toolbar"
357             },
358             {
359              "listeners" : {
360               "render" : "function (_self)\n{\n  _this.dateFrom = _self;\n}",
361               "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
362              },
363              "format" : "Y-m-d",
364              "xtype" : "DateField",
365              "$ xns" : "Roo.form"
366             },
367             {
368              "listeners" : {
369               "render" : "function (_self)\n{\n  _this.dateTo = _self;\n}",
370               "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
371              },
372              "format" : "Y-m-d",
373              "xtype" : "DateField",
374              "$ xns" : "Roo.form"
375             }
376            ]
377           },
378           {
379            "xtype" : "ColumnModel",
380            "width" : 100,
381            "header" : "When",
382            "$ renderer" : "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
383            "$ xns" : "Roo.grid",
384            "* prop" : "colModel[]",
385            "dataIndex" : "event_when"
386           },
387           {
388            "xtype" : "ColumnModel",
389            "width" : 100,
390            "header" : "#id",
391            "$ xns" : "Roo.grid",
392            "* prop" : "colModel[]",
393            "dataIndex" : "id"
394           },
395           {
396            "xtype" : "ColumnModel",
397            "width" : 150,
398            "header" : "Person",
399            "$ 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}",
400            "$ xns" : "Roo.grid",
401            "* prop" : "colModel[]",
402            "dataIndex" : "person_id_name"
403           },
404           {
405            "xtype" : "ColumnModel",
406            "header" : "Action",
407            "width" : 100,
408            "$ renderer" : "function(v) { return String.format('{0}', v); }",
409            "$ xns" : "Roo.grid",
410            "* prop" : "colModel[]",
411            "dataIndex" : "action"
412           },
413           {
414            "xtype" : "ColumnModel",
415            "header" : "IP",
416            "width" : 100,
417            "$ renderer" : "function(v) { return String.format('{0}', v); }",
418            "$ xns" : "Roo.grid",
419            "* prop" : "colModel[]",
420            "dataIndex" : "ipaddr"
421           },
422           {
423            "xtype" : "ColumnModel",
424            "width" : 100,
425            "header" : "Affected",
426            "$ renderer" : "function(v, x, r) {                     \n            return v ? String.format('{0}({1})', v,  r.data.on_id)  : '';  \n   }",
427            "$ xns" : "Roo.grid",
428            "* prop" : "colModel[]",
429            "dataIndex" : "on_table"
430           },
431           {
432            "xtype" : "ColumnModel",
433            "width" : 300,
434            "header" : "Remarks",
435            "$ renderer" : "function(v) { return String.format('<span qtip=\"{1}\">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }",
436            "$ xns" : "Roo.grid",
437            "* prop" : "colModel[]",
438            "dataIndex" : "remarks"
439           }
440          ]
441         }
442        ]
443       }
444      ]
445     }
446    ]
447   }
448  ]
449 }