Pman.Dialog.Image.bjs
[Pman.Core] / Pman.Dialog.Image.js
index 0beb6a1..deaf650 100644 (file)
@@ -57,11 +57,17 @@ Pman.Dialog.Image = {
                if (!dlg.haveProgress) {
                     Roo.MessageBox.progress("Uploading", "Uploading");
                 }
+                
+                if (dlg.haveProgress == 2) {
+                    // it's been closed elsewhere..
+                    return;
+                }
                 if (dlg.uploadComplete) {
                     Roo.MessageBox.hide();
                     return;
                 }
-                dlg.haveProgress = true;
+                
+                dlg.haveProgress = 1;
             
                 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
                 Pman.request({
@@ -72,6 +78,12 @@ Pman.Dialog.Image = {
                     method: 'GET',
                     success : function(data){
                         //console.log(data);
+                        
+                        if (dlg.haveProgress == 2) {
+                            // it's been closed elsewhere..
+                            return;
+                        }
+                        
                         if (dlg.uploadComplete) {
                             Roo.MessageBox.hide();
                             return;
@@ -105,6 +117,8 @@ Pman.Dialog.Image = {
                                 actioncomplete : function(_self,act)
                                 {
                                     _this.dialog.uploadComplete = true;
+                                    _this.dialog.haveProgress = 2; 
+                                    Roo.MessageBox.hide(); // force hiding
                                     _this.dialog.el.unmask();
                                      
                                     if (act.type == 'setdata') { 
@@ -146,17 +160,18 @@ Pman.Dialog.Image = {
                                     // error msg???
                                     
                                     if (act.type == 'submit') {
-                                        Roo.log(act);
+                                        //Roo.log(act);
                                         try {
-                                            Ext.MessageBox.alert("Error", act.result.errorMsg);
+                                            Roo.MessageBox.alert("Error", act.result.errorMsg);
                                         } catch(e) {
-                                            Ext.MessageBox.alert("Error", "Saving failed = fix errors and try again");        
+                                          //  Roo.log(e);
+                                            Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");        
                                         }
                                         return;
                                     }
                                     
                                     // what about load failing..
-                                    Ext.MessageBox.alert("Error", "Error loading details"); 
+                                    Roo.MessageBox.alert("Error", "Error loading details"); 
                                 }
                             },
                             fileUpload : true,
@@ -241,7 +256,7 @@ Pman.Dialog.Image = {
                                     ts : Math.random()
                                 } 
                             });
-                            _this.dialog.haveProgress = false,
+                            _this.dialog.haveProgress = 0; // set to show..
                             _this.dialog.uploadProgress.defer(1000, _this.dialog);
                         
                         }