Pman.Tab.AdminLogDrill.bjs
authorAlan Knowles <alan@akbkhome.com>
Tue, 17 Jan 2012 06:56:45 +0000 (14:56 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 17 Jan 2012 06:56:45 +0000 (14:56 +0800)
Pman.Tab.AdminLogDrill.bjs
Pman.Tab.AdminLogDrill.js
Pman.Tab.AdminLogDrill.js

Pman.Tab.AdminLogDrill.bjs
Pman.Tab.AdminLogDrill.js

index bb23aa3..a64c1de 100644 (file)
                                     ]
                                 }
                             ]
+                        },
+                        {
+                            "|xns": "Roo",
+                            "xtype": "GridPanel",
+                            "title": "Events",
+                            "fitToframe": true,
+                            "fitContainer": true,
+                            "tableName": "Events",
+                            "background": true,
+                            "region": "center",
+                            "listeners": {
+                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            },
+                            "items": [
+                                {
+                                    "*prop": "grid",
+                                    "xtype": "Grid",
+                                    "autoExpandColumn": "person_name",
+                                    "loadMask": true,
+                                    "listeners": {
+                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                                    },
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "*prop": "dataSource",
+                                            "xtype": "Store",
+                                            "remoteSort": true,
+                                            "|sortInfo": "{ field : 'person_name', direction: 'ASC' }",
+                                            "|xns": "Roo.data",
+                                            "items": [
+                                                {
+                                                    "*prop": "proxy",
+                                                    "xtype": "HttpProxy",
+                                                    "method": "GET",
+                                                    "|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]"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "*prop": "footer",
+                                            "xtype": "PagingToolbar",
+                                            "pageSize": 25,
+                                            "displayInfo": true,
+                                            "displayMsg": "Displaying Events{0} - {1} of {2}",
+                                            "emptyMsg": "No Events found",
+                                            "|xns": "Roo"
+                                        },
+                                        {
+                                            "*prop": "toolbar",
+                                            "xtype": "Toolbar",
+                                            "|xns": "Roo",
+                                            "items": [
+                                                {
+                                                    "text": "Add",
+                                                    "xtype": "Button",
+                                                    "cls": "x-btn-text-icon",
+                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                    "listeners": {
+                                                        "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                                    },
+                                                    "|xns": "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "text": "Edit",
+                                                    "xtype": "Button",
+                                                    "cls": "x-btn-text-icon",
+                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                    "listeners": {
+                                                        "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (!_this.dialog) return;\n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
+                                                    },
+                                                    "|xns": "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "text": "Delete",
+                                                    "cls": "x-btn-text-icon",
+                                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                                    "xtype": "Button",
+                                                    "listeners": {
+                                                        "|click": "function()\n{\n     Pman.genericDelete(_this, 'Events'); \n}\n        "
+                                                    },
+                                                    "|xns": "Roo.Toolbar"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Id",
+                                            "width": 75,
+                                            "dataIndex": "id",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Person name",
+                                            "width": 200,
+                                            "dataIndex": "person_name",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Event when",
+                                            "width": 75,
+                                            "dataIndex": "event_when",
+                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Action",
+                                            "width": 200,
+                                            "dataIndex": "action",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Ipaddr",
+                                            "width": 200,
+                                            "dataIndex": "ipaddr",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "On",
+                                            "width": 75,
+                                            "dataIndex": "on_id",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "On table",
+                                            "width": 200,
+                                            "dataIndex": "on_table",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Person",
+                                            "width": 75,
+                                            "dataIndex": "person_id",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Remarks",
+                                            "width": 200,
+                                            "dataIndex": "remarks",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        }
+                                    ]
+                                }
+                            ]
                         }
                     ]
                 }
index ae1ba48..1cb7e7a 100644 (file)
@@ -887,6 +887,316 @@ Pman.Tab.AdminLogDrill = new Roo.util.Observable({
                                 }
                             ]
                         }
+                    },
+                    {
+                        xtype: 'GridPanel',
+                        xns: Roo,
+                        title : "Events",
+                        fitToframe : true,
+                        fitContainer : true,
+                        tableName : 'Events',
+                        background : true,
+                        region : 'center',
+                        listeners : {
+                            activate : function() {
+                                _this.panel = this;
+                                if (_this.grid) {
+                                    _this.grid.footer.onClick('first');
+                                }
+                            }
+                        },
+                        grid : {
+                            xtype: 'Grid',
+                            xns: Roo.grid,
+                            autoExpandColumn : 'person_name',
+                            loadMask : true,
+                            listeners : {
+                                render : function() 
+                                {
+                                    _this.grid = this; 
+                                    //_this.dialog = Pman.Dialog.FILL_IN
+                                    if (_this.panel.active) {
+                                       this.footer.onClick('first');
+                                    }
+                                },
+                                rowdblclick : function (_self, rowIndex, e)
+                                {
+                                    if (!_this.dialog) return;
+                                    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
+                                        _this.grid.footer.onClick('first');
+                                    }); 
+                                }
+                            },
+                            dataSource : {
+                                xtype: 'Store',
+                                xns: Roo.data,
+                                remoteSort : true,
+                                sortInfo : { field : 'person_name', 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'
+                                        }
+                                    ]
+                                }
+                            },
+                            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: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Add",
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                if (!_this.dialog) return;
+                                                _this.dialog.show( { id : 0 } , function() {
+                                                    _this.grid.footer.onClick('first');
+                                               }); 
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Edit",
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                var s = _this.grid.getSelectionModel().getSelections();
+                                                if (!s.length || (s.length > 1))  {
+                                                    Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                                                    return;
+                                                }
+                                                if (!_this.dialog) return;
+                                                _this.dialog.show(s[0].data, function() {
+                                                    _this.grid.footer.onClick('first');
+                                                }); 
+                                                
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Delete",
+                                        cls : 'x-btn-text-icon',
+                                        icon : rootURL + '/Pman/templates/images/trash.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                 Pman.genericDelete(_this, 'Events'); 
+                                            }
+                                        }
+                                    }
+                                ]
+                            },
+                            colModel : [
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Id',
+                                    width : 75,
+                                    dataIndex : 'id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Person name',
+                                    width : 200,
+                                    dataIndex : 'person_name',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Event when',
+                                    width : 75,
+                                    dataIndex : 'event_when',
+                                    renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Action',
+                                    width : 200,
+                                    dataIndex : 'action',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Ipaddr',
+                                    width : 200,
+                                    dataIndex : 'ipaddr',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'On',
+                                    width : 75,
+                                    dataIndex : 'on_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'On table',
+                                    width : 200,
+                                    dataIndex : 'on_table',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Person',
+                                    width : 75,
+                                    dataIndex : 'person_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Remarks',
+                                    width : 200,
+                                    dataIndex : 'remarks',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                }
+                            ]
+                        }
                     }
                 ],
                 west : {