Pman.Tab.AdminLogEvents.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 28 Sep 2011 05:43:45 +0000 (13:43 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 28 Sep 2011 05:43:45 +0000 (13:43 +0800)
Pman.Tab.AdminLogEvents.bjs
Pman.Tab.AdminLogEvents.js
Pman.Tab.AdminLogEvents.js
Pman.Tab.AdminLogEvents.bjs
Pman.Tab.AdminLogEvents.bjs
Pman.Tab.AdminLogEvents.js
Pman.Tab.AdminLogEvents.js

Pman.Tab.AdminLogEvents.bjs
Pman.Tab.AdminLogEvents.js

index 4d127c5..a3d8610 100644 (file)
 {
-    "id": "roo-file-51",
+    "id": "roo-file-52",
     "name": "Pman.Tab.AdminLogEvents",
     "parent": "Pman.Tab.AdminLogs",
     "title": "Admin - Logs - Events",
     "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminLogEvents.bjs",
     "items": [
         {
-            "listeners": {
-                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
-            },
-            "background": true,
-            "fitContainer": true,
-            "fitToframe": true,
             "region": "center",
-            "tableName": "Events",
             "title": "Events",
-            "xtype": "GridPanel",
+            "xtype": "NestedLayoutPanel",
             "|xns": "Roo",
             "items": [
                 {
-                    "*prop": "grid",
-                    "xtype": "Grid",
-                    "autoExpandColumn": "remarks",
-                    "loadMask": true,
-                    "listeners": {
-                        "|render": "function() { \n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
-                    },
-                    "|xns": "Roo.grid",
+                    "|xns": "Roo",
+                    "xtype": "BorderLayout",
+                    "*prop": "layout",
                     "items": [
                         {
-                            "listeners": {
-                                "|beforeload": "function (_self, o)\n{\n   if (! _this.personSel) {\n    return;\n    }\n    o.params = o.params || {};\n    o.params.person_id = _this.personSel.getValue();\n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        o.params.action = act;\n    }\n     act = _this.affectSel.getValue();\n    if (act.length) {\n        o.params.on_table = act;\n    }\n    \n}"
-                            },
-                            "*prop": "dataSource",
-                            "remoteSort": true,
-                            "xtype": "Store",
-                            "|reader": "Pman.Readers.Events",
-                            "|sortInfo": "{ field: 'event_when', direction: 'DESC'}",
-                            "|xns": "Roo.data",
-                            "items": [
-                                {
-                                    "|xns": "Roo.data",
-                                    "xtype": "JsonReader",
-                                    "totalProperty": "total",
-                                    "root": "data",
-                                    "*prop": "reader",
-                                    "id": "id",
-                                    "|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]"
-                                },
-                                {
-                                    "*prop": "proxy",
-                                    "xtype": "HttpProxy",
-                                    "method": "GET",
-                                    "|url": "baseURL + '/Roo/Events.php'",
-                                    "listeners": {},
-                                    "|xns": "Roo.data"
-                                }
-                            ]
+                            "*prop": "south",
+                            "height": 150,
+                            "xtype": "LayoutRegion",
+                            "|xns": "Roo"
+                        },
+                        {
+                            "|xns": "Roo",
+                            "xtype": "LayoutRegion",
+                            "*prop": "center"
                         },
                         {
-                            "*prop": "footer",
-                            "xtype": "PagingToolbar",
-                            "pageSize": 25,
-                            "displayInfo": true,
-                            "displayMsg": "Displaying Events  {0} - {1} of {2}",
-                            "emptyMsg": "No Events found",
+                            "region": "south",
+                            "xtype": "ContentPanel",
                             "|xns": "Roo"
                         },
                         {
-                            "*prop": "toolbar",
-                            "xtype": "Toolbar",
-                            "listeners": {},
+                            "listeners": {
+                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            },
+                            "background": true,
+                            "fitContainer": true,
+                            "fitToframe": true,
+                            "region": "center",
+                            "tableName": "Events",
+                            "title": "Events",
+                            "xtype": "GridPanel",
                             "|xns": "Roo",
                             "items": [
                                 {
-                                    "xtype": "TextItem",
-                                    "|xns": "Roo.Toolbar",
-                                    "text": "Show",
-                                    "listeners": {}
-                                },
-                                {
+                                    "*prop": "grid",
+                                    "xtype": "Grid",
+                                    "autoExpandColumn": "remarks",
+                                    "loadMask": true,
                                     "listeners": {
-                                        "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n  \n}",
-                                        "|render": "function (_self)\n{\n  _this.personSel = _self;\n}"
+                                        "|render": "function() { \n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
                                     },
-                                    "allowBlank": true,
-                                    "displayField": "name",
-                                    "editable": true,
-                                    "emptyText": "Select Person ",
-                                    "fieldLabel": "Person ",
-                                    "forceSelection": true,
-                                    "listWidth": 400,
-                                    "loadingText": "Searching...",
-                                    "minChars": 2,
-                                    "name": "person_id_name",
-                                    "pageSize": 20,
-                                    "qtip": "Select Person ",
-                                    "queryParam": "query[name]",
-                                    "selectOnFocus": true,
-                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> &lt;{email}&gt; </div>",
-                                    "triggerAction": "all",
-                                    "typeAhead": true,
-                                    "valueField": "id",
-                                    "width": 150,
-                                    "xtype": "ComboBox",
-                                    "|xns": "Roo.form",
+                                    "|xns": "Roo.grid",
                                     "items": [
                                         {
                                             "listeners": {
-                                                "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    o.company_id = Pman.Login.authUser.company_id;\n}"
+                                                "|beforeload": "function (_self, o)\n{\n   if (! _this.personSel) {\n    return;\n    }\n    o.params = o.params || {};\n    o.params.person_id = _this.personSel.getValue();\n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        o.params.action = act;\n    }\n     act = _this.affectSel.getValue();\n    if (act.length) {\n        o.params.on_table = act;\n    }\n    \n}"
                                             },
-                                            "*prop": "store",
-                                            "|sortInfo": "{ field : 'name' , direction : 'ASC' }",
+                                            "*prop": "dataSource",
+                                            "remoteSort": true,
                                             "xtype": "Store",
+                                            "|reader": "Pman.Readers.Events",
+                                            "|sortInfo": "{ field: 'event_when', direction: 'DESC'}",
                                             "|xns": "Roo.data",
                                             "items": [
+                                                {
+                                                    "|xns": "Roo.data",
+                                                    "xtype": "JsonReader",
+                                                    "totalProperty": "total",
+                                                    "root": "data",
+                                                    "*prop": "reader",
+                                                    "id": "id",
+                                                    "|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]"
+                                                },
                                                 {
                                                     "*prop": "proxy",
                                                     "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Person.php'",
                                                     "method": "GET",
-                                                    "|xns": "Roo.data"
-                                                },
-                                                {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|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]",
+                                                    "|url": "baseURL + '/Roo/Events.php'",
+                                                    "listeners": {},
                                                     "|xns": "Roo.data"
                                                 }
                                             ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "listeners": {
-                                        "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}",
-                                        "|render": "function (_self)\n{\n  _this.actionSel = _self;\n}"
-                                    },
-                                    "allowBlank": true,
-                                    "displayField": "action",
-                                    "editable": false,
-                                    "emptyText": "Select Action",
-                                    "forceSelection": true,
-                                    "listWidth": 300,
-                                    "loadingText": "Searching...",
-                                    "minChars": 2,
-                                    "name": "action",
-                                    "pageSize": 20,
-                                    "qtip": "Select Action",
-                                    "queryParam": "query[action]",
-                                    "selectOnFocus": true,
-                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>",
-                                    "triggerAction": "all",
-                                    "typeAhead": true,
-                                    "valueField": "action",
-                                    "width": 150,
-                                    "xtype": "ComboBox",
-                                    "|xns": "Roo.form",
-                                    "items": [
+                                        },
                                         {
-                                            "listeners": {
-                                                "|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}"
-                                            },
-                                            "*prop": "store",
-                                            "|sortInfo": "{ field : 'action' , direction : 'ASC' }",
-                                            "xtype": "Store",
-                                            "|xns": "Roo.data",
+                                            "*prop": "footer",
+                                            "xtype": "PagingToolbar",
+                                            "pageSize": 25,
+                                            "displayInfo": true,
+                                            "displayMsg": "Displaying Events  {0} - {1} of {2}",
+                                            "emptyMsg": "No Events found",
+                                            "|xns": "Roo",
                                             "items": [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Events.php'",
-                                                    "|xns": "Roo.data"
-                                                },
-                                                {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "|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]"
+                                                    "listeners": {
+                                                        "click": "function (_self, e)\n{\n \n    var params = {\n        'sort' : 'event_when',\n        'dir' : 'DESC',\n        'start' : 0,\n        'limit' : 400,\n        person_id : _this.personSel.getValue(), \n        'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', \n        'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_name', \n        'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', \n        'csvTitles[3]' : 'Remarks',   'csvCols[3]' : 'remarks'\n        \n    }\n        \n    \n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        params.action = act;\n    }\n    \n\n    new Pman.download({\n        url : baseURL + '/Roo/Events.php',\n        params : params,\n        newWindow: true\n        \n    });\n}"
+                                                    },
+                                                    "text": "Download",
+                                                    "xtype": "Button",
+                                                    "|xns": "Roo.Toolbar"
                                                 }
                                             ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "listeners": {
-                                        "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}",
-                                        "|render": "function (_self)\n{\n  _this.affectSel = _self;\n}"
-                                    },
-                                    "allowBlank": true,
-                                    "displayField": "on_table",
-                                    "editable": false,
-                                    "emptyText": "Select Affects",
-                                    "forceSelection": true,
-                                    "listWidth": 300,
-                                    "loadingText": "Searching...",
-                                    "minChars": 2,
-                                    "name": "on_table",
-                                    "pageSize": 20,
-                                    "qtip": "Select Action",
-                                    "queryParam": "query[on_table]",
-                                    "selectOnFocus": true,
-                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>",
-                                    "triggerAction": "all",
-                                    "typeAhead": true,
-                                    "valueField": "action",
-                                    "width": 150,
-                                    "xtype": "ComboBox",
-                                    "|xns": "Roo.form",
-                                    "items": [
+                                        },
                                         {
-                                            "listeners": {
-                                                "|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}"
-                                            },
-                                            "*prop": "store",
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'on_table' , direction : 'ASC' }",
-                                            "|xns": "Roo.data",
+                                            "*prop": "toolbar",
+                                            "xtype": "Toolbar",
+                                            "listeners": {},
+                                            "|xns": "Roo",
                                             "items": [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Events.php'",
-                                                    "|xns": "Roo.data"
+                                                    "xtype": "TextItem",
+                                                    "|xns": "Roo.Toolbar",
+                                                    "text": "Show",
+                                                    "listeners": {}
                                                 },
                                                 {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "|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]"
+                                                    "listeners": {
+                                                        "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n  \n}",
+                                                        "|render": "function (_self)\n{\n  _this.personSel = _self;\n}"
+                                                    },
+                                                    "allowBlank": true,
+                                                    "displayField": "name",
+                                                    "editable": true,
+                                                    "emptyText": "Select Person ",
+                                                    "fieldLabel": "Person ",
+                                                    "forceSelection": true,
+                                                    "listWidth": 400,
+                                                    "loadingText": "Searching...",
+                                                    "minChars": 2,
+                                                    "name": "person_id_name",
+                                                    "pageSize": 20,
+                                                    "qtip": "Select Person ",
+                                                    "queryParam": "query[name]",
+                                                    "selectOnFocus": true,
+                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> &lt;{email}&gt; </div>",
+                                                    "triggerAction": "all",
+                                                    "typeAhead": true,
+                                                    "valueField": "id",
+                                                    "width": 150,
+                                                    "xtype": "ComboBox",
+                                                    "|xns": "Roo.form",
+                                                    "items": [
+                                                        {
+                                                            "listeners": {
+                                                                "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    o.company_id = Pman.Login.authUser.company_id;\n}"
+                                                            },
+                                                            "*prop": "store",
+                                                            "|sortInfo": "{ field : 'name' , direction : 'ASC' }",
+                                                            "xtype": "Store",
+                                                            "|xns": "Roo.data",
+                                                            "items": [
+                                                                {
+                                                                    "*prop": "proxy",
+                                                                    "xtype": "HttpProxy",
+                                                                    "|url": "baseURL + '/Roo/Person.php'",
+                                                                    "method": "GET",
+                                                                    "|xns": "Roo.data"
+                                                                },
+                                                                {
+                                                                    "*prop": "reader",
+                                                                    "id": "id",
+                                                                    "root": "data",
+                                                                    "totalProperty": "total",
+                                                                    "xtype": "JsonReader",
+                                                                    "|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]",
+                                                                    "|xns": "Roo.data"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}",
+                                                        "|render": "function (_self)\n{\n  _this.actionSel = _self;\n}"
+                                                    },
+                                                    "allowBlank": true,
+                                                    "displayField": "action",
+                                                    "editable": false,
+                                                    "emptyText": "Select Action",
+                                                    "forceSelection": true,
+                                                    "listWidth": 300,
+                                                    "loadingText": "Searching...",
+                                                    "minChars": 2,
+                                                    "name": "action",
+                                                    "pageSize": 20,
+                                                    "qtip": "Select Action",
+                                                    "queryParam": "query[action]",
+                                                    "selectOnFocus": true,
+                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>",
+                                                    "triggerAction": "all",
+                                                    "typeAhead": true,
+                                                    "valueField": "action",
+                                                    "width": 150,
+                                                    "xtype": "ComboBox",
+                                                    "|xns": "Roo.form",
+                                                    "items": [
+                                                        {
+                                                            "listeners": {
+                                                                "|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}"
+                                                            },
+                                                            "*prop": "store",
+                                                            "|sortInfo": "{ field : 'action' , direction : 'ASC' }",
+                                                            "xtype": "Store",
+                                                            "|xns": "Roo.data",
+                                                            "items": [
+                                                                {
+                                                                    "*prop": "proxy",
+                                                                    "method": "GET",
+                                                                    "xtype": "HttpProxy",
+                                                                    "|url": "baseURL + '/Roo/Events.php'",
+                                                                    "|xns": "Roo.data"
+                                                                },
+                                                                {
+                                                                    "|xns": "Roo.data",
+                                                                    "xtype": "JsonReader",
+                                                                    "totalProperty": "total",
+                                                                    "root": "data",
+                                                                    "*prop": "reader",
+                                                                    "id": "id",
+                                                                    "|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]"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "|select": "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}",
+                                                        "|render": "function (_self)\n{\n  _this.affectSel = _self;\n}"
+                                                    },
+                                                    "allowBlank": true,
+                                                    "displayField": "on_table",
+                                                    "editable": false,
+                                                    "emptyText": "Select Affects",
+                                                    "forceSelection": true,
+                                                    "listWidth": 300,
+                                                    "loadingText": "Searching...",
+                                                    "minChars": 2,
+                                                    "name": "on_table",
+                                                    "pageSize": 20,
+                                                    "qtip": "Select Action",
+                                                    "queryParam": "query[on_table]",
+                                                    "selectOnFocus": true,
+                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>",
+                                                    "triggerAction": "all",
+                                                    "typeAhead": true,
+                                                    "valueField": "action",
+                                                    "width": 150,
+                                                    "xtype": "ComboBox",
+                                                    "|xns": "Roo.form",
+                                                    "items": [
+                                                        {
+                                                            "listeners": {
+                                                                "|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}"
+                                                            },
+                                                            "*prop": "store",
+                                                            "xtype": "Store",
+                                                            "|sortInfo": "{ field : 'on_table' , direction : 'ASC' }",
+                                                            "|xns": "Roo.data",
+                                                            "items": [
+                                                                {
+                                                                    "*prop": "proxy",
+                                                                    "method": "GET",
+                                                                    "xtype": "HttpProxy",
+                                                                    "|url": "baseURL + '/Roo/Events.php'",
+                                                                    "|xns": "Roo.data"
+                                                                },
+                                                                {
+                                                                    "|xns": "Roo.data",
+                                                                    "xtype": "JsonReader",
+                                                                    "totalProperty": "total",
+                                                                    "root": "data",
+                                                                    "*prop": "reader",
+                                                                    "id": "id",
+                                                                    "|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]"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
                                                 }
                                             ]
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "When",
+                                            "width": 100,
+                                            "dataIndex": "event_when",
+                                            "|renderer": "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
+                                            "listeners": {},
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "*prop": "colModel[]",
+                                            "dataIndex": "id",
+                                            "header": "#id",
+                                            "width": 100,
+                                            "xtype": "ColumnModel",
+                                            "|xns": "Roo.grid",
+                                            "listeners": {}
+                                        },
+                                        {
+                                            "*prop": "colModel[]",
+                                            "dataIndex": "person_name",
+                                            "header": "Staff",
+                                            "width": 150,
+                                            "xtype": "ColumnModel",
+                                            "|renderer": "function(v,x,r) { \n    return String.format('{0} &lt;<a href=\"mailto:{1}\">{1}</a>&gt;', v, r.data.person_id_email); \n}",
+                                            "|xns": "Roo.grid"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Action",
+                                            "width": 100,
+                                            "dataIndex": "action",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "IP",
+                                            "width": 100,
+                                            "dataIndex": "ipaddr",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "listeners": {},
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Affected",
+                                            "width": 100,
+                                            "dataIndex": "on_id",
+                                            "|renderer": "function(v, x, r) {                             return v ? String.format('{0}({1})', r.data.on_table, v)  : '';                         }",
+                                            "listeners": {},
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "*prop": "colModel[]",
+                                            "dataIndex": "remarks",
+                                            "header": "Remarks",
+                                            "width": 300,
+                                            "xtype": "ColumnModel",
+                                            "|renderer": "function(v) { return String.format('<span qtip=\"{1}\">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }",
+                                            "|xns": "Roo.grid"
                                         }
                                     ]
-                                },
-                                {
-                                    "listeners": {
-                                        "click": "function (_self, e)\n{\n \n    var params = {\n        'sort' : 'event_when',\n        'dir' : 'DESC',\n        'start' : 0,\n        'limit' : 400,\n        person_id : _this.personSel.getValue(), \n        'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', \n        'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_name', \n        'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', \n        'csvTitles[3]' : 'Remarks',   'csvCols[3]' : 'remarks'\n        \n    }\n        \n    \n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        params.action = act;\n    }\n    \n\n    new Pman.download({\n        url : baseURL + '/Roo/Events.php',\n        params : params,\n        newWindow: true\n        \n    });\n}"
-                                    },
-                                    "text": "Download",
-                                    "xtype": "Button",
-                                    "|xns": "Roo.Toolbar"
                                 }
                             ]
-                        },
-                        {
-                            "xtype": "ColumnModel",
-                            "header": "When",
-                            "width": 100,
-                            "dataIndex": "event_when",
-                            "|renderer": "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
-                            "listeners": {},
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
-                        },
-                        {
-                            "*prop": "colModel[]",
-                            "dataIndex": "id",
-                            "header": "#id",
-                            "width": 100,
-                            "xtype": "ColumnModel",
-                            "|xns": "Roo.grid",
-                            "listeners": {}
-                        },
-                        {
-                            "*prop": "colModel[]",
-                            "dataIndex": "person_name",
-                            "header": "Staff",
-                            "width": 150,
-                            "xtype": "ColumnModel",
-                            "|renderer": "function(v,x,r) { \n    return String.format('{0} &lt;<a href=\"mailto:{1}\">{1}</a>&gt;', v, r.data.person_id_email); \n}",
-                            "|xns": "Roo.grid"
-                        },
-                        {
-                            "xtype": "ColumnModel",
-                            "header": "Action",
-                            "width": 100,
-                            "dataIndex": "action",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
-                        },
-                        {
-                            "xtype": "ColumnModel",
-                            "header": "IP",
-                            "width": 100,
-                            "dataIndex": "ipaddr",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                            "listeners": {},
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
-                        },
-                        {
-                            "xtype": "ColumnModel",
-                            "header": "Affected",
-                            "width": 100,
-                            "dataIndex": "on_id",
-                            "|renderer": "function(v, x, r) {                             return v ? String.format('{0}({1})', r.data.on_table, v)  : '';                         }",
-                            "listeners": {},
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
-                        },
-                        {
-                            "*prop": "colModel[]",
-                            "dataIndex": "remarks",
-                            "header": "Remarks",
-                            "width": 300,
-                            "xtype": "ColumnModel",
-                            "|renderer": "function(v) { return String.format('<span qtip=\"{1}\">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }",
-                            "|xns": "Roo.grid"
                         }
                     ]
                 }
index ae235ac..0967346 100644 (file)
@@ -31,650 +31,75 @@ Pman.Tab.AdminLogEvents = new Roo.util.Observable({
         this.parentLayout = parentLayout;
 
         this.panel = parentLayout.addxtype({
-            xtype: 'GridPanel',
+            xtype: 'NestedLayoutPanel',
             xns: Roo,
-            listeners : {
-                activate : function() {
-                    _this.panel = this;
-                    if (_this.grid) {
-                        _this.grid.footer.onClick('first');
-                    }
-                }
-            },
-            background : true,
-            fitContainer : true,
-            fitToframe : true,
-            region : 'center',
-            tableName : 'Events',
-            title : "Events",
-            grid : {
-                xtype: 'Grid',
-                xns: Roo.grid,
-                autoExpandColumn : 'remarks',
-                loadMask : true,
-                listeners : {
-                    render : function() { 
-                        _this.grid = this; 
-                        //_this.dialog = Pman.Dialog.FILL_IN
-                        if (_this.panel.active) {
-                           this.footer.onClick('first');
-                        }
-                    }
-                },
-                dataSource : {
-                    xtype: 'Store',
-                    xns: Roo.data,
-                    listeners : {
-                        beforeload : function (_self, o)
-                        {
-                           if (! _this.personSel) {
-                            return;
-                            }
-                            o.params = o.params || {};
-                            o.params.person_id = _this.personSel.getValue();
-                            var act = _this.actionSel.getValue();
-                            if (act.length) {
-                                o.params.action = act;
-                            }
-                             act = _this.affectSel.getValue();
-                            if (act.length) {
-                                o.params.on_table = act;
-                            }
-                            
-                        }
-                    },
-                    remoteSort : true,
-                    reader : Pman.Readers.Events,
-                    sortInfo : { field: 'event_when', direction: 'DESC'},
-                    reader : {
-                        xtype: 'JsonReader',
-                        xns: Roo.data,
-                        totalProperty : 'total',
-                        root : 'data',
-                        id : 'id',
-                        fields : [
-                            {
-                                'name': 'id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_name',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'event_when',
-                                'type': 'date',
-                                'dateFormat': 'Y-m-d'
-                            },
-                            {
-                                'name': 'action',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'ipaddr',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'on_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'on_table',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'remarks',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_office_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_name',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_phone',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_fax',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_email',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_company_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_role',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_active',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_remarks',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_passwd',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_owner_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_lang',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_no_reset_sent',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_action_type',
-                                'type': 'string'
-                            },
-                            {
-                                'name': 'person_id_project_id',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_deleted_by',
-                                'type': 'int'
-                            },
-                            {
-                                'name': 'person_id_deleted_dt',
-                                'type': 'date'
-                            }
-                        ]
-                    },
-                    proxy : {
-                        xtype: 'HttpProxy',
-                        xns: Roo.data,
-                        method : 'GET',
-                        url : baseURL + '/Roo/Events.php'
-                    }
-                },
-                footer : {
-                    xtype: 'PagingToolbar',
-                    xns: Roo,
-                    pageSize : 25,
-                    displayInfo : true,
-                    displayMsg : "Displaying Events  {0} - {1} of {2}",
-                    emptyMsg : "No Events found"
-                },
-                toolbar : {
-                    xtype: 'Toolbar',
-                    xns: Roo,
-                    items : [
-                        {
-                            xtype: 'TextItem',
-                            xns: Roo.Toolbar,
-                            text : "Show"
-                        },
-                        {
-                            xtype: 'ComboBox',
-                            xns: Roo.form,
-                            listeners : {
-                                select : function (combo, record, index)
-                                {
-                                  _this.grid.footer.onClick('first');
-                                  
-                                },
-                                render : function (_self)
-                                {
-                                  _this.personSel = _self;
-                                }
-                            },
-                            allowBlank : true,
-                            displayField : 'name',
-                            editable : true,
-                            emptyText : "Select Person ",
-                            fieldLabel : 'Person ',
-                            forceSelection : true,
-                            listWidth : 400,
-                            loadingText : "Searching...",
-                            minChars : 2,
-                            name : 'person_id_name',
-                            pageSize : 20,
-                            qtip : "Select Person ",
-                            queryParam : 'query[name]',
-                            selectOnFocus : true,
-                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> &lt;{email}&gt; </div>',
-                            triggerAction : 'all',
-                            typeAhead : true,
-                            valueField : 'id',
-                            width : 150,
-                            store : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o)
-                                    {
-                                        o.params = o.params || {};
-                                        o.company_id = Pman.Login.authUser.company_id;
-                                    }
-                                },
-                                sortInfo : { field : 'name' , direction : 'ASC' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    url : baseURL + '/Roo/Person.php',
-                                    method : 'GET'
-                                },
-                                reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    id : 'id',
-                                    root : 'data',
-                                    totalProperty : 'total',
-                                    fields : [
-                                        {
-                                            'name': 'id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'lang',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'no_reset_sent',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'action_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'deleted_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'deleted_dt',
-                                            'type': 'date',
-                                            'dateFormat': 'Y-m-d'
-                                        },
-                                        {
-                                            'name': 'office_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'office_id_company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'office_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'office_id_address',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'office_id_phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'office_id_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'office_id_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'office_id_role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_code',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_address',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_tel',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_isOwner',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_logo_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_background_color',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_comptype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_url',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_main_office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_created_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_created_dt',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'company_id_updated_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'company_id_updated_dt',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'company_id_passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_dispatch_port',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_province',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'company_id_country',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_code',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_client_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_team_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_file_location',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_open_date',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'project_id_open_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'project_id_close_date',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'project_id_countries',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_languages',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'project_id_agency_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_lang',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_no_reset_sent',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_action_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'owner_id_project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_deleted_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'owner_id_deleted_dt',
-                                            'type': 'date'
-                                        }
-                                    ]
+            region : 'center',
+            title : "Events",
+            layout : {
+                xtype: 'BorderLayout',
+                xns: Roo,
+                items : [
+                    {
+                        xtype: 'ContentPanel',
+                        xns: Roo,
+                        region : 'south'
+                    },
+                    {
+                        xtype: 'GridPanel',
+                        xns: Roo,
+                        listeners : {
+                            activate : function() {
+                                _this.panel = this;
+                                if (_this.grid) {
+                                    _this.grid.footer.onClick('first');
                                 }
                             }
                         },
-                        {
-                            xtype: 'ComboBox',
-                            xns: Roo.form,
+                        background : true,
+                        fitContainer : true,
+                        fitToframe : true,
+                        region : 'center',
+                        tableName : 'Events',
+                        title : "Events",
+                        grid : {
+                            xtype: 'Grid',
+                            xns: Roo.grid,
+                            autoExpandColumn : 'remarks',
+                            loadMask : true,
                             listeners : {
-                                select : function (combo, record, index)
-                                {
-                                  _this.grid.footer.onClick('first');
-                                },
-                                render : function (_self)
-                                {
-                                  _this.actionSel = _self;
+                                render : function() { 
+                                    _this.grid = this; 
+                                    //_this.dialog = Pman.Dialog.FILL_IN
+                                    if (_this.panel.active) {
+                                       this.footer.onClick('first');
+                                    }
                                 }
                             },
-                            allowBlank : true,
-                            displayField : 'action',
-                            editable : false,
-                            emptyText : "Select Action",
-                            forceSelection : true,
-                            listWidth : 300,
-                            loadingText : "Searching...",
-                            minChars : 2,
-                            name : 'action',
-                            pageSize : 20,
-                            qtip : "Select Action",
-                            queryParam : 'query[action]',
-                            selectOnFocus : true,
-                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{action}</b> </div>',
-                            triggerAction : 'all',
-                            typeAhead : true,
-                            valueField : 'action',
-                            width : 150,
-                            store : {
+                            dataSource : {
                                 xtype: 'Store',
                                 xns: Roo.data,
                                 listeners : {
                                     beforeload : function (_self, o)
                                     {
+                                       if (! _this.personSel) {
+                                        return;
+                                        }
                                         o.params = o.params || {};
-                                        // staff can see all logs, other companies can only see their own.
-                                        if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
-                                            o.params.company_id = Pman.Login.authUser.company_id;
+                                        o.params.person_id = _this.personSel.getValue();
+                                        var act = _this.actionSel.getValue();
+                                        if (act.length) {
+                                            o.params.action = act;
                                         }
-                                        o.params._distinct = 'action';
-                                        o.params._columns ='action';
+                                         act = _this.affectSel.getValue();
+                                        if (act.length) {
+                                            o.params.on_table = act;
+                                        }
+                                        
                                     }
                                 },
-                                sortInfo : { field : 'action' , direction : 'ASC' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    method : 'GET',
-                                    url : baseURL + '/Roo/Events.php'
-                                },
+                                remoteSort : true,
+                                reader : Pman.Readers.Events,
+                                sortInfo : { field: 'event_when', direction: 'DESC'},
                                 reader : {
                                     xtype: 'JsonReader',
                                     xns: Roo.data,
@@ -792,280 +217,883 @@ Pman.Tab.AdminLogEvents = new Roo.util.Observable({
                                             'type': 'date'
                                         }
                                     ]
-                                }
-                            }
-                        },
-                        {
-                            xtype: 'ComboBox',
-                            xns: Roo.form,
-                            listeners : {
-                                select : function (combo, record, index)
-                                {
-                                  _this.grid.footer.onClick('first');
                                 },
-                                render : function (_self)
-                                {
-                                  _this.affectSel = _self;
+                                proxy : {
+                                    xtype: 'HttpProxy',
+                                    xns: Roo.data,
+                                    method : 'GET',
+                                    url : baseURL + '/Roo/Events.php'
                                 }
                             },
-                            allowBlank : true,
-                            displayField : 'on_table',
-                            editable : false,
-                            emptyText : "Select Affects",
-                            forceSelection : true,
-                            listWidth : 300,
-                            loadingText : "Searching...",
-                            minChars : 2,
-                            name : 'on_table',
-                            pageSize : 20,
-                            qtip : "Select Action",
-                            queryParam : 'query[on_table]',
-                            selectOnFocus : true,
-                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{on_table}</b> </div>',
-                            triggerAction : 'all',
-                            typeAhead : true,
-                            valueField : 'action',
-                            width : 150,
-                            store : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o)
+                            footer : {
+                                xtype: 'PagingToolbar',
+                                xns: Roo,
+                                pageSize : 25,
+                                displayInfo : true,
+                                displayMsg : "Displaying Events  {0} - {1} of {2}",
+                                emptyMsg : "No Events found",
+                                items : [
                                     {
-                                        o.params = o.params || {};
-                                        // staff can see all logs, other companies can only see their own.
-                                        if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
-                                            o.params.company_id = Pman.Login.authUser.company_id;
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        listeners : {
+                                            click : function (_self, e)
+                                            {
+                                             
+                                                var params = {
+                                                    'sort' : 'event_when',
+                                                    'dir' : 'DESC',
+                                                    'start' : 0,
+                                                    'limit' : 400,
+                                                    person_id : _this.personSel.getValue(), 
+                                                    'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', 
+                                                    'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_name', 
+                                                    'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', 
+                                                    'csvTitles[3]' : 'Remarks',   'csvCols[3]' : 'remarks'
+                                                    
+                                                }
+                                                    
+                                                
+                                                var act = _this.actionSel.getValue();
+                                                if (act.length) {
+                                                    params.action = act;
+                                                }
+                                                
+                                            
+                                                new Pman.download({
+                                                    url : baseURL + '/Roo/Events.php',
+                                                    params : params,
+                                                    newWindow: true
+                                                    
+                                                });
+                                            }
+                                        },
+                                        text : "Download"
+                                    }
+                                ]
+                            },
+                            toolbar : {
+                                xtype: 'Toolbar',
+                                xns: Roo,
+                                items : [
+                                    {
+                                        xtype: 'TextItem',
+                                        xns: Roo.Toolbar,
+                                        text : "Show"
+                                    },
+                                    {
+                                        xtype: 'ComboBox',
+                                        xns: Roo.form,
+                                        listeners : {
+                                            select : function (combo, record, index)
+                                            {
+                                              _this.grid.footer.onClick('first');
+                                              
+                                            },
+                                            render : function (_self)
+                                            {
+                                              _this.personSel = _self;
+                                            }
+                                        },
+                                        allowBlank : true,
+                                        displayField : 'name',
+                                        editable : true,
+                                        emptyText : "Select Person ",
+                                        fieldLabel : 'Person ',
+                                        forceSelection : true,
+                                        listWidth : 400,
+                                        loadingText : "Searching...",
+                                        minChars : 2,
+                                        name : 'person_id_name',
+                                        pageSize : 20,
+                                        qtip : "Select Person ",
+                                        queryParam : 'query[name]',
+                                        selectOnFocus : true,
+                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> &lt;{email}&gt; </div>',
+                                        triggerAction : 'all',
+                                        typeAhead : true,
+                                        valueField : 'id',
+                                        width : 150,
+                                        store : {
+                                            xtype: 'Store',
+                                            xns: Roo.data,
+                                            listeners : {
+                                                beforeload : function (_self, o)
+                                                {
+                                                    o.params = o.params || {};
+                                                    o.company_id = Pman.Login.authUser.company_id;
+                                                }
+                                            },
+                                            sortInfo : { field : 'name' , direction : 'ASC' },
+                                            proxy : {
+                                                xtype: 'HttpProxy',
+                                                xns: Roo.data,
+                                                url : baseURL + '/Roo/Person.php',
+                                                method : 'GET'
+                                            },
+                                            reader : {
+                                                xtype: 'JsonReader',
+                                                xns: Roo.data,
+                                                id : 'id',
+                                                root : 'data',
+                                                totalProperty : 'total',
+                                                fields : [
+                                                    {
+                                                        'name': 'id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'office_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'phone',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'fax',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'email',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'role',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'active',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'passwd',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'lang',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'no_reset_sent',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'action_type',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'deleted_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'deleted_dt',
+                                                        'type': 'date',
+                                                        'dateFormat': 'Y-m-d'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_company_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_address',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_phone',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_fax',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_email',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'office_id_role',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_code',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_owner_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_address',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_tel',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_fax',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_email',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_isOwner',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_logo_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_background_color',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_comptype',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_url',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_main_office_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_created_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_created_dt',
+                                                        'type': 'date'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_updated_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_updated_dt',
+                                                        'type': 'date'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_passwd',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_dispatch_port',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_province',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'company_id_country',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_owner_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_code',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_active',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_type',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_client_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_team_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_file_location',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_open_date',
+                                                        'type': 'date'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_open_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_close_date',
+                                                        'type': 'date'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_countries',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_languages',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'project_id_agency_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_office_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_phone',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_fax',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_email',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_company_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_role',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_active',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_passwd',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_owner_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_lang',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_no_reset_sent',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_action_type',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_project_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_deleted_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'owner_id_deleted_dt',
+                                                        'type': 'date'
+                                                    }
+                                                ]
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'ComboBox',
+                                        xns: Roo.form,
+                                        listeners : {
+                                            select : function (combo, record, index)
+                                            {
+                                              _this.grid.footer.onClick('first');
+                                            },
+                                            render : function (_self)
+                                            {
+                                              _this.actionSel = _self;
+                                            }
+                                        },
+                                        allowBlank : true,
+                                        displayField : 'action',
+                                        editable : false,
+                                        emptyText : "Select Action",
+                                        forceSelection : true,
+                                        listWidth : 300,
+                                        loadingText : "Searching...",
+                                        minChars : 2,
+                                        name : 'action',
+                                        pageSize : 20,
+                                        qtip : "Select Action",
+                                        queryParam : 'query[action]',
+                                        selectOnFocus : true,
+                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{action}</b> </div>',
+                                        triggerAction : 'all',
+                                        typeAhead : true,
+                                        valueField : 'action',
+                                        width : 150,
+                                        store : {
+                                            xtype: 'Store',
+                                            xns: Roo.data,
+                                            listeners : {
+                                                beforeload : function (_self, o)
+                                                {
+                                                    o.params = o.params || {};
+                                                    // staff can see all logs, other companies can only see their own.
+                                                    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
+                                                        o.params.company_id = Pman.Login.authUser.company_id;
+                                                    }
+                                                    o.params._distinct = 'action';
+                                                    o.params._columns ='action';
+                                                }
+                                            },
+                                            sortInfo : { field : 'action' , direction : 'ASC' },
+                                            proxy : {
+                                                xtype: 'HttpProxy',
+                                                xns: Roo.data,
+                                                method : 'GET',
+                                                url : baseURL + '/Roo/Events.php'
+                                            },
+                                            reader : {
+                                                xtype: 'JsonReader',
+                                                xns: Roo.data,
+                                                totalProperty : 'total',
+                                                root : 'data',
+                                                id : 'id',
+                                                fields : [
+                                                    {
+                                                        'name': 'id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'event_when',
+                                                        'type': 'date',
+                                                        'dateFormat': 'Y-m-d'
+                                                    },
+                                                    {
+                                                        'name': 'action',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'ipaddr',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'on_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'on_table',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_office_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_phone',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_fax',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_email',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_company_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_role',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_active',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_passwd',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_owner_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_lang',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_no_reset_sent',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_action_type',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_project_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_deleted_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_deleted_dt',
+                                                        'type': 'date'
+                                                    }
+                                                ]
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'ComboBox',
+                                        xns: Roo.form,
+                                        listeners : {
+                                            select : function (combo, record, index)
+                                            {
+                                              _this.grid.footer.onClick('first');
+                                            },
+                                            render : function (_self)
+                                            {
+                                              _this.affectSel = _self;
+                                            }
+                                        },
+                                        allowBlank : true,
+                                        displayField : 'on_table',
+                                        editable : false,
+                                        emptyText : "Select Affects",
+                                        forceSelection : true,
+                                        listWidth : 300,
+                                        loadingText : "Searching...",
+                                        minChars : 2,
+                                        name : 'on_table',
+                                        pageSize : 20,
+                                        qtip : "Select Action",
+                                        queryParam : 'query[on_table]',
+                                        selectOnFocus : true,
+                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{on_table}</b> </div>',
+                                        triggerAction : 'all',
+                                        typeAhead : true,
+                                        valueField : 'action',
+                                        width : 150,
+                                        store : {
+                                            xtype: 'Store',
+                                            xns: Roo.data,
+                                            listeners : {
+                                                beforeload : function (_self, o)
+                                                {
+                                                    o.params = o.params || {};
+                                                    // staff can see all logs, other companies can only see their own.
+                                                    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
+                                                        o.params.company_id = Pman.Login.authUser.company_id;
+                                                    }
+                                                    o.params._distinct = 'on_table';
+                                                    o.params._columns ='on_table';
+                                                }
+                                            },
+                                            sortInfo : { field : 'on_table' , direction : 'ASC' },
+                                            proxy : {
+                                                xtype: 'HttpProxy',
+                                                xns: Roo.data,
+                                                method : 'GET',
+                                                url : baseURL + '/Roo/Events.php'
+                                            },
+                                            reader : {
+                                                xtype: 'JsonReader',
+                                                xns: Roo.data,
+                                                totalProperty : 'total',
+                                                root : 'data',
+                                                id : 'id',
+                                                fields : [
+                                                    {
+                                                        'name': 'id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'event_when',
+                                                        'type': 'date',
+                                                        'dateFormat': 'Y-m-d'
+                                                    },
+                                                    {
+                                                        'name': 'action',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'ipaddr',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'on_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'on_table',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_office_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_name',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_phone',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_fax',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_email',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_company_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_role',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_active',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_remarks',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_passwd',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_owner_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_lang',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_no_reset_sent',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_action_type',
+                                                        'type': 'string'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_project_id',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_deleted_by',
+                                                        'type': 'int'
+                                                    },
+                                                    {
+                                                        'name': 'person_id_deleted_dt',
+                                                        'type': 'date'
+                                                    }
+                                                ]
+                                            }
                                         }
-                                        o.params._distinct = 'on_table';
-                                        o.params._columns ='on_table';
                                     }
+                                ]
+                            },
+                            colModel : [
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'When',
+                                    width : 100,
+                                    dataIndex : 'event_when',
+                                    renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }
                                 },
-                                sortInfo : { field : 'on_table' , direction : 'ASC' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    method : 'GET',
-                                    url : baseURL + '/Roo/Events.php'
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    dataIndex : 'id',
+                                    header : '#id',
+                                    width : 100
                                 },
-                                reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    totalProperty : 'total',
-                                    root : 'data',
-                                    id : 'id',
-                                    fields : [
-                                        {
-                                            'name': 'id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'event_when',
-                                            'type': 'date',
-                                            'dateFormat': 'Y-m-d'
-                                        },
-                                        {
-                                            'name': 'action',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'ipaddr',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'on_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'on_table',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_lang',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_no_reset_sent',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_action_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'person_id_project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_deleted_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'person_id_deleted_dt',
-                                            'type': 'date'
-                                        }
-                                    ]
-                                }
-                            }
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function (_self, e)
                                 {
-                                 
-                                    var params = {
-                                        'sort' : 'event_when',
-                                        'dir' : 'DESC',
-                                        'start' : 0,
-                                        'limit' : 400,
-                                        person_id : _this.personSel.getValue(), 
-                                        'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', 
-                                        'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_name', 
-                                        'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', 
-                                        'csvTitles[3]' : 'Remarks',   'csvCols[3]' : 'remarks'
-                                        
-                                    }
-                                        
-                                    
-                                    var act = _this.actionSel.getValue();
-                                    if (act.length) {
-                                        params.action = act;
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    dataIndex : 'person_name',
+                                    header : 'Staff',
+                                    width : 150,
+                                    renderer : function(v,x,r) { 
+                                        return String.format('{0} &lt;<a href="mailto:{1}">{1}</a>&gt;', v, r.data.person_id_email); 
                                     }
-                                    
-                                
-                                    new Pman.download({
-                                        url : baseURL + '/Roo/Events.php',
-                                        params : params,
-                                        newWindow: true
-                                        
-                                    });
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Action',
+                                    width : 100,
+                                    dataIndex : 'action',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'IP',
+                                    width : 100,
+                                    dataIndex : 'ipaddr',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Affected',
+                                    width : 100,
+                                    dataIndex : 'on_id',
+                                    renderer : function(v, x, r) {                             return v ? String.format('{0}({1})', r.data.on_table, v)  : '';                         }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    dataIndex : 'remarks',
+                                    header : 'Remarks',
+                                    width : 300,
+                                    renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }
                                 }
-                            },
-                            text : "Download"
-                        }
-                    ]
-                },
-                colModel : [
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        header : 'When',
-                        width : 100,
-                        dataIndex : 'event_when',
-                        renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'id',
-                        header : '#id',
-                        width : 100
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'person_name',
-                        header : 'Staff',
-                        width : 150,
-                        renderer : function(v,x,r) { 
-                            return String.format('{0} &lt;<a href="mailto:{1}">{1}</a>&gt;', v, r.data.person_id_email); 
+                            ]
                         }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        header : 'Action',
-                        width : 100,
-                        dataIndex : 'action',
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        header : 'IP',
-                        width : 100,
-                        dataIndex : 'ipaddr',
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        header : 'Affected',
-                        width : 100,
-                        dataIndex : 'on_id',
-                        renderer : function(v, x, r) {                             return v ? String.format('{0}({1})', r.data.on_table, v)  : '';                         }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'remarks',
-                        header : 'Remarks',
-                        width : 300,
-                        renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }
                     }
-                ]
+                ],
+                south : {
+                    xtype: 'LayoutRegion',
+                    xns: Roo,
+                    height : 150
+                },
+                center : {
+                    xtype: 'LayoutRegion',
+                    xns: Roo
+                }
             }
         });
         this.layout = this.panel.layout;