DataObjects/Core_person_signup.php
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.bjs
index 4882d83..71f6550 100644 (file)
@@ -6,6 +6,9 @@
     "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs",
     "items": [
         {
+            "listeners": {
+                "show": "function (_self)\n{\n    if(typeof(_this.data) != 'undefined'){\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
+            },
             "background": false,
             "closable": false,
             "collapsible": false,
@@ -44,7 +47,7 @@
                     "items": [
                         {
                             "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}"
+                                "|render": "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
                             },
                             "*prop": "grid",
                             "autoExpandColumn": "event_when",
@@ -54,7 +57,7 @@
                             "items": [
                                 {
                                     "listeners": {
-                                        "afterselectionchange": "function (_self)\n{\n    \n    if (!this.getSelected()) {\n        _this.viewPanel.setContent(\"Nothing Selected\");\n        return;\n    }\n    \n    _this.viewPanel.setContent(\"data\");\n}"
+                                        "afterselectionchange": "function (_self)\n{\n    var selected = this.getSelected();\n    \n    _this.source = '';\n    \n    if(!selected){\n       _this.viewPanel.setContent(\"Please select an saved version on the left\"); \n       return;\n    }\n    \n    _this.viewPanel.load( { url : baseURL + \"/Roo/Events\", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){\n        \n        var res = Roo.decode(oResponse.responseText);\n        \n        if(!bSuccess || !res.success){\n            _this.viewPanel.setContent(\"Load data failed?!\");\n        }\n        \n        if(typeof(res.data) === 'string'){\n            _this.viewPanel.setContent(res.data);\n            return;\n        }\n        \n        if(!_this.data.successFn){\n            Roo.MessageBox.alert('Error', 'Please setup the successFn');\n            return;\n        }\n        \n        _this.source = _this.data.successFn(res);\n\n        _this.viewPanel.setContent(_this.source);\n        \n    });\n}"
                                     },
                                     "*prop": "sm",
                                     "singleSelect": true,
                                 },
                                 {
                                     "listeners": {
-                                        "|beforeload": "function (_self, o)\n{\n    Roo.log(_this.data);\n    o.params = o.parmas || {};\n    o.params.action = 'AUTOSAVE';\n    \n}"
+                                        "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    if(typeof(_this.data) == 'undefined'){\n        this.removeAll();\n        return false;\n    }\n\n    var d = Roo.apply({}, _this.data);\n    delete d.successFn;\n\n    Roo.apply(o.params, d);\n    \n}",
+                                        "load": "function (_self, records, options)\n{\n    var sm = _this.grid.getSelectionModel();\n    if (!sm.getSelections().length) {\n        sm.selectFirstRow();\n        \n        sm.fireEvent('afterselectionchange', sm);\n    }\n}"
                                     },
                                     "*prop": "dataSource",
                                     "remoteSort": true,
                                     "xtype": "Store",
-                                    "|sortInfo": "{ field: 'event_when', direction: 'DESC'}",
+                                    "|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",
+                                            "xtype": "HttpProxy",
                                             "|url": "baseURL + '/Roo/Events.php'",
-                                            "listeners": {},
+                                            "|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': 'event_when',\n        'type': 'string'\n    }\n]",
                                             "|xns": "Roo.data"
                                         }
                                     ]
                                 },
                                 {
                                     "*prop": "footer",
-                                    "displayInfo": true,
-                                    "displayMsg": "{0} - {1} of {2}",
-                                    "emptyMsg": "Nothing found",
+                                    "displayInfo": false,
                                     "pageSize": 25,
                                     "xtype": "PagingToolbar",
                                     "|xns": "Roo"
                                     "header": "Date",
                                     "width": 100,
                                     "xtype": "ColumnModel",
-                                    "|renderer": "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
+                                    "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }",
                                     "|xns": "Roo.grid"
                                 }
                             ]
                     "listeners": {
                         "render": "function (_self)\n{\n    _this.viewPanel = _self;\n}"
                     },
+                    "autoScroll": true,
                     "background": false,
                     "fitContainer": true,
                     "fitToFrame": true,
                 },
                 {
                     "listeners": {
-                        "|click": "function() {\n    _this.dialog.hide();\n}"
+                        "|click": "function() {\n\n    _this.dialog.hide();\n    \n    if (_this.callback && _this.source != '') {\n        _this.callback.call(this, _this.source);\n    }\n}"
                     },
                     "*prop": "buttons[]",
                     "text": "OK",