Pman.Tab.AdminCompanies.bjs
[Pman.Admin] / Pman.Tab.AdminLogEvents.bjs
1 {
2  "name" : "Pman.Tab.AdminLogEvents",
3  "parent" : "Pman.Tab.AdminLogs",
4  "title" : "Admin - Logs - Events",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminLogEvents.bjs",
6  "permname" : "Admin.Logs",
7  "modOrder" : "001",
8  "strings" : {
9   "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   "90e4ac2e5a22e53df63b6b186d8727ba" : "No Events found",
28   "2c92a9a6a5dbf570825e62eabcdecd8d" : "Affected"
29  },
30  "items" : [
31   {
32    "region" : "center",
33    "title" : "Events",
34    "xtype" : "NestedLayoutPanel",
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              "xtype" : "HttpProxy",
118              "method" : "GET",
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]' : '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}"
144              },
145              "text" : "Download to Excel (with extra descriptions)",
146              "xtype" : "Button",
147              "$ xns" : "Roo.Toolbar"
148             }
149            ]
150           },
151           {
152            "xtype" : "Toolbar",
153            "$ xns" : "Roo",
154            "* prop" : "toolbar",
155            "items" : [
156             {
157              "text" : "Show",
158              "xtype" : "TextItem",
159              "$ xns" : "Roo.Toolbar"
160             },
161             {
162              "listeners" : {
163               "|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}",
164               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
165              },
166              "listWidth" : 300,
167              "triggerAction" : "all",
168              "forceSelection" : true,
169              "selectOnFocus" : true,
170              "pageSize" : 20,
171              "displayField" : "value",
172              "emptyText" : "Select Person Table",
173              "minChars" : 2,
174              "valueField" : "value",
175              "xtype" : "ComboBox",
176              "allowBlank" : true,
177              "typeAhead" : true,
178              "Boolean alwaysQuery" : true,
179              "editable" : false,
180              "width" : 150,
181              "$ xns" : "Roo.form",
182              "name" : "person_table",
183              "qtip" : "Select Person Table",
184              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>",
185              "loadingText" : "Searching...",
186              "items" : [
187               {
188                "| 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})()",
189                "xtype" : "SimpleStore",
190                "$ fields" : "[ 'value' ]",
191                "$ xns" : "Roo.data",
192                "* prop" : "store",
193                "isLocal" : true
194               }
195              ]
196             },
197             {
198              "listeners" : {
199               "|render" : "function (_self)\n{\n  _this.personSel = _self;\n}",
200               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n  \n}"
201              },
202              "listWidth" : 600,
203              "triggerAction" : "all",
204              "fieldLabel" : "Person ",
205              "forceSelection" : true,
206              "selectOnFocus" : true,
207              "pageSize" : 20,
208              "displayField" : "name",
209              "emptyText" : "Select Person ",
210              "minChars" : 2,
211              "valueField" : "id",
212              "xtype" : "ComboBox",
213              "allowBlank" : true,
214              "typeAhead" : true,
215              "editable" : true,
216              "width" : 150,
217              "$ xns" : "Roo.form",
218              "name" : "person_id_name",
219              "qtip" : "Select Person ",
220              "queryParam" : "query[name]",
221              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) &lt;{email}&gt; </div>",
222              "loadingText" : "Searching...",
223              "items" : [
224               {
225                "listeners" : {
226                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.company_id = Pman.Login.authUser.company_id;\n}"
227                },
228                "xtype" : "Store",
229                "remoteSort" : true,
230                "$ sortInfo" : "{ field : 'name' , direction : 'ASC' }",
231                "$ xns" : "Roo.data",
232                "* prop" : "store",
233                "items" : [
234                 {
235                  "$ url" : "baseURL + '/Roo/Person.php'",
236                  "method" : "GET",
237                  "xtype" : "HttpProxy",
238                  "$ xns" : "Roo.data",
239                  "* prop" : "proxy"
240                 },
241                 {
242                  "id" : "id",
243                  "root" : "data",
244                  "xtype" : "JsonReader",
245                  "$ 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]",
246                  "$ xns" : "Roo.data",
247                  "* prop" : "reader",
248                  "totalProperty" : "total"
249                 }
250                ]
251               }
252              ]
253             },
254             {
255              "listeners" : {
256               "|render" : "function (_self)\n{\n  _this.actionSel = _self;\n}",
257               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
258              },
259              "listWidth" : 300,
260              "triggerAction" : "all",
261              "forceSelection" : true,
262              "selectOnFocus" : true,
263              "pageSize" : 20,
264              "displayField" : "action",
265              "emptyText" : "Select Action",
266              "minChars" : 2,
267              "valueField" : "action",
268              "xtype" : "ComboBox",
269              "allowBlank" : true,
270              "typeAhead" : true,
271              "editable" : true,
272              "width" : 150,
273              "$ xns" : "Roo.form",
274              "name" : "action",
275              "qtip" : "Select Action",
276              "queryParam" : "query[action]",
277              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>",
278              "loadingText" : "Searching...",
279              "items" : [
280               {
281                "listeners" : {
282                 "|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}"
283                },
284                "xtype" : "Store",
285                "remoteSort" : true,
286                "$ sortInfo" : "{ field : 'action' , direction : 'ASC' }",
287                "$ xns" : "Roo.data",
288                "* prop" : "store",
289                "items" : [
290                 {
291                  "$ url" : "baseURL + '/Roo/Events.php'",
292                  "method" : "GET",
293                  "xtype" : "HttpProxy",
294                  "$ xns" : "Roo.data",
295                  "* prop" : "proxy"
296                 },
297                 {
298                  "id" : "id",
299                  "root" : "data",
300                  "xtype" : "JsonReader",
301                  "$ 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]",
302                  "$ xns" : "Roo.data",
303                  "* prop" : "reader",
304                  "totalProperty" : "total"
305                 }
306                ]
307               }
308              ]
309             },
310             {
311              "listeners" : {
312               "|render" : "function (_self)\n{\n    _this.affectSel = _self;\n  \n    if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){\n        this.hide();\n    }\n}",
313               "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
314              },
315              "listWidth" : 300,
316              "triggerAction" : "all",
317              "forceSelection" : true,
318              "selectOnFocus" : true,
319              "pageSize" : 20,
320              "displayField" : "on_table",
321              "emptyText" : "Select Affects",
322              "minChars" : 2,
323              "valueField" : "action",
324              "xtype" : "ComboBox",
325              "allowBlank" : true,
326              "typeAhead" : true,
327              "editable" : true,
328              "width" : 150,
329              "$ xns" : "Roo.form",
330              "name" : "on_table",
331              "qtip" : "Select Action",
332              "queryParam" : "query[on_table]",
333              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>",
334              "loadingText" : "Searching...",
335              "items" : [
336               {
337                "listeners" : {
338                 "|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}"
339                },
340                "xtype" : "Store",
341                "remoteSort" : true,
342                "$ sortInfo" : "{ field : 'on_table' , direction : 'ASC' }",
343                "$ xns" : "Roo.data",
344                "* prop" : "store",
345                "items" : [
346                 {
347                  "$ url" : "baseURL + '/Roo/Events.php'",
348                  "method" : "GET",
349                  "xtype" : "HttpProxy",
350                  "$ xns" : "Roo.data",
351                  "* prop" : "proxy"
352                 },
353                 {
354                  "id" : "id",
355                  "root" : "data",
356                  "xtype" : "JsonReader",
357                  "$ xns" : "Roo.data",
358                  "$ 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]",
359                  "* prop" : "reader",
360                  "totalProperty" : "total"
361                 }
362                ]
363               }
364              ]
365             },
366             {
367              "text" : "Date Range",
368              "xtype" : "TextItem",
369              "$ xns" : "Roo.Toolbar"
370             },
371             {
372              "listeners" : {
373               "render" : "function (_self)\n{\n  _this.dateFrom = _self;\n}",
374               "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
375              },
376              "format" : "Y-m-d",
377              "xtype" : "DateField",
378              "$ xns" : "Roo.form"
379             },
380             {
381              "listeners" : {
382               "render" : "function (_self)\n{\n  _this.dateTo = _self;\n}",
383               "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
384              },
385              "format" : "Y-m-d",
386              "xtype" : "DateField",
387              "$ xns" : "Roo.form"
388             }
389            ]
390           },
391           {
392            "xtype" : "ColumnModel",
393            "width" : 100,
394            "header" : "When",
395            "$ renderer" : "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
396            "$ xns" : "Roo.grid",
397            "* prop" : "colModel[]",
398            "dataIndex" : "event_when"
399           },
400           {
401            "xtype" : "ColumnModel",
402            "width" : 100,
403            "header" : "#id",
404            "$ xns" : "Roo.grid",
405            "* prop" : "colModel[]",
406            "dataIndex" : "id"
407           },
408           {
409            "xtype" : "ColumnModel",
410            "width" : 150,
411            "header" : "Person",
412            "$ 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}",
413            "$ xns" : "Roo.grid",
414            "* prop" : "colModel[]",
415            "dataIndex" : "person_id_name"
416           },
417           {
418            "xtype" : "ColumnModel",
419            "header" : "Action",
420            "width" : 100,
421            "$ renderer" : "function(v) { return String.format('{0}', v); }",
422            "$ xns" : "Roo.grid",
423            "* prop" : "colModel[]",
424            "dataIndex" : "action"
425           },
426           {
427            "xtype" : "ColumnModel",
428            "header" : "IP",
429            "width" : 100,
430            "$ renderer" : "function(v) { return String.format('{0}', v); }",
431            "$ xns" : "Roo.grid",
432            "* prop" : "colModel[]",
433            "dataIndex" : "ipaddr"
434           },
435           {
436            "xtype" : "ColumnModel",
437            "width" : 100,
438            "header" : "Affected",
439            "$ renderer" : "function(v, x, r) {                     \n            return v ? String.format('{0}({1})', v,  r.data.on_id)  : '';  \n   }",
440            "$ xns" : "Roo.grid",
441            "* prop" : "colModel[]",
442            "dataIndex" : "on_table"
443           },
444           {
445            "xtype" : "ColumnModel",
446            "width" : 300,
447            "header" : "Remarks",
448            "$ renderer" : "function(v) { return String.format('<span qtip=\"{1}\">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }",
449            "$ xns" : "Roo.grid",
450            "* prop" : "colModel[]",
451            "dataIndex" : "remarks"
452           }
453          ]
454         }
455        ]
456       }
457      ]
458     }
459    ]
460   }
461  ]
462 }