Pman.Tab.CmsBlog.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 12 Jul 2017 01:31:52 +0000 (09:31 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 12 Jul 2017 01:31:52 +0000 (09:31 +0800)
Pman.Tab.CmsBlog.js

Pman.Tab.CmsBlog.bjs
Pman.Tab.CmsBlog.js

index 7a46954..38061f4 100644 (file)
             },
             {
              "listeners" : {
-              "|click" : "function()\n{\n    var ds = false;\n    if(_this.grid.selModel.getSelections().length != 1){\n        Roo.MessageBox.alert(\"Error\", \"Select page to delete\");\n        return;\n    }\n    var  sel = _this.grid.selModel.getSelected();\n    if(sel.data.is_system_page){\n        Roo.MessageBox.alert(\"Error\", \"System pages can not be deleted.\");\n        return;\n    }\n    \n    \n    Roo.MessageBox.confirm(\"Confirm\", \n        \"Are you sure you want to delete this, - to un-delete, select 'Show Deleted' at bottom, and press this button again\", \n        function(res) {\n            if (res != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                method : 'POST',\n                url : baseURL + '/Roo/cms_page',\n                params : {\n                    _delete : sel.data.id\n                },\n                success : function() { \n                    _this.grid.footer.onClick('refresh');\n                }\n            });\n            \n                \n        }\n    );\n    \n    */\n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/cms_page',\n        params : {\n            id : sel.data.id,\n            is_deleted : 1 * (!sel.data.is_deleted)\n        },\n        success : function() { \n            _this.grid.footer.onClick('refresh');\n        }\n    });\n    \n}\n",
+              "|click" : "function()\n{\n    var ds = false;\n    if(_this.grid.selModel.getSelections().length != 1){\n        Roo.MessageBox.alert(\"Error\", \"Select page to delete\");\n        return;\n    }\n    var  sel = _this.grid.selModel.getSelected();\n    if(sel.data.is_system_page){\n        Roo.MessageBox.alert(\"Error\", \"System pages can not be deleted.\");\n        return;\n    }\n    \n    if (!sel.data.is_deleted) {\n        Roo.MessageBox.confirm(\"Confirm\", \n            \"Are you sure you want to delete this, - to un-delete, select 'Show Deleted' at bottom, and press this button again\", \n            function(res) {\n                if (res != 'yes') {\n                    return;\n                }\n                new Pman.Request({\n                    method : 'POST',\n                    mask : \"Deleting\"\n                    url : baseURL + '/Roo/cms_page',\n                    params : {\n                        id : sel.data.id,\n                        is_deleted : 1 * (!sel.data.is_deleted)\n                    },\n                    success : function() { \n                        _this.grid.footer.onClick('refresh');\n                    }\n                });\n                \n                    \n            }\n        );\n        return;\n    }\n  \n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/cms_page',\n        mask: 'Un-deleting',\n        params : {\n            id : sel.data.id,\n            is_deleted : 0\n        },\n        success : function() { \n            _this.grid.footer.onClick('refresh');\n        }\n    });\n    \n}\n",
               "render" : "function (_self)\n{\n    _this.deleteBtn = this;\n}"
              },
              "text" : "Delete",
index 1fcb914..d8a10c4 100644 (file)
@@ -513,36 +513,40 @@ Pman.Tab.CmsBlog = new Roo.XComponent({
                     return;
                 }
                 
-                
-                Roo.MessageBox.confirm("Confirm", 
-                    "Are you sure you want to delete this, - to un-delete, select 'Show Deleted' at bottom, and press this button again", 
-                    function(res) {
-                        if (res != 'yes') {
-                            return;
-                        }
-                        new Pman.Request({
-                            method : 'POST',
-                            url : baseURL + '/Roo/cms_page',
-                            params : {
-                                _delete : sel.data.id
-                            },
-                            success : function() { 
-                                _this.grid.footer.onClick('refresh');
+                if (!sel.data.is_deleted) {
+                    Roo.MessageBox.confirm("Confirm", 
+                        "Are you sure you want to delete this, - to un-delete, select 'Show Deleted' at bottom, and press this button again", 
+                        function(res) {
+                            if (res != 'yes') {
+                                return;
                             }
-                        });
-                        
+                            new Pman.Request({
+                                method : 'POST',
+                                mask : "Deleting"
+                                url : baseURL + '/Roo/cms_page',
+                                params : {
+                                    id : sel.data.id,
+                                    is_deleted : 1 * (!sel.data.is_deleted)
+                                },
+                                success : function() { 
+                                    _this.grid.footer.onClick('refresh');
+                                }
+                            });
                             
-                    }
-                );
-                
-                */
+                                
+                        }
+                    );
+                    return;
+                }
+              
                 
                 new Pman.Request({
                     method : 'POST',
                     url : baseURL + '/Roo/cms_page',
+                    mask: 'Un-deleting',
                     params : {
                         id : sel.data.id,
-                        is_deleted : 1 * (!sel.data.is_deleted)
+                        is_deleted : 0
                     },
                     success : function() { 
                         _this.grid.footer.onClick('refresh');