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