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