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