Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.js
index 0257c62..261b141 100644 (file)
@@ -94,13 +94,27 @@ Pman.Dialog.CoreAutoSavePreview = {
                                     
                                     _this.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){
                                         
+                                        _this.source = '';
+                                        
                                         var res = Roo.decode(oResponse.responseText);
                                         
                                         if(!bSuccess || !res.success){
                                             _this.viewPanel.setContent("Load data failed?!");
                                         }
+                                        
+                                        if(typeof(res.data) === 'string'){
+                                            _this.viewPanel.setContent(res.data);
+                                            return;
+                                        }
+                                        
+                                        if(!_this.data.successFn){
+                                            Roo.MessageBox.alert('Error', 'Please setup the successFn');
+                                            return;
+                                        }
+                                        
+                                        _this.source = _this.data.successFn(res);
                                 
-                                        _this.data.successFn();
+                                        _this.viewPanel.setContent(_this.source);
                                         
                                     });
                                 }
@@ -119,8 +133,12 @@ Pman.Dialog.CoreAutoSavePreview = {
                                         this.removeAll();
                                         return false;
                                     }
-                                    Roo.log(_this.data);
-                                    o.params.action = 'AUTOSAVE';
+                                
+                                    var d = Roo.apply(_this.data);
+                                    delete d.successFn;
+                                    
+                                    Roo.apply(o.params, d);
+                                    
                                 }
                             },
                             remoteSort : true,