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