Hi,

Please find attached patch to fix RM2760 and RM2867



-- 
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/misc/file_manager/static/js/file_manager.js b/web/pgadmin/misc/file_manager/static/js/file_manager.js
index a88ed67..fefa1b0 100644
--- a/web/pgadmin/misc/file_manager/static/js/file_manager.js
+++ b/web/pgadmin/misc/file_manager/static/js/file_manager.js
@@ -159,6 +159,7 @@ define('misc.file_manager', [
                 $(innerbody).find('*').off();
                 innerbody.remove();
                 removeTransId(trans_id);
+                pgAdmin.Browser.Events.trigger('pgadmin-storage:cancel_btn:storage_dialog');
               }
             },
             build: function() {
@@ -285,6 +286,7 @@ define('misc.file_manager', [
                 $(innerbody).find('*').off();
                 innerbody.remove();
                 removeTransId(trans_id);
+                pgAdmin.Browser.Events.trigger('pgadmin-storage:cancel_btn:select_file');
               }
             },
             build: function() {
@@ -409,6 +411,7 @@ define('misc.file_manager', [
                 $(innerbody).find('*').off();
                 innerbody.remove();
                 removeTransId(trans_id);
+                pgAdmin.Browser.Events.trigger('pgadmin-storage:cancel_btn:select_folder');
               }
             },
             build: function() {
@@ -632,6 +635,7 @@ define('misc.file_manager', [
                 $(innerbody).find('*').off();
                 innerbody.remove();
                 removeTransId(trans_id);
+                pgAdmin.Browser.Events.trigger('pgadmin-storage:cancel_btn:create_file');
               }
             },
             build: function() {
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index acde87b..7d446fe 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -2163,9 +2163,6 @@
     },
     initialize: function(){
       Backform.InputControl.prototype.initialize.apply(this, arguments);
-
-      // Listen click events of Storage Manager dialog buttons
-      pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:'+this.field.get('dialog_type'), this.storage_dlg_hander, this);
     },
     template: _.template([
       '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
@@ -2199,15 +2196,30 @@
 
       pgAdmin.FileManager.init();
       pgAdmin.FileManager.show_dialog(params);
+      // Listen click events of Storage Manager dialog buttons
+      this.listen_file_dlg_events();
     },
     storage_dlg_hander: function(value) {
       var field = _.defaults(this.field.toJSON(), this.defaults),
           attrArr = this.field.get("name").split('.'),
           name = attrArr.shift();
 
+      this.remove_file_dlg_event_listeners();
+
       // Set selected value into the model
       this.model.set(name, decodeURI(value));
     },
+    storage_close_dlg_hander: function() {
+      this.remove_file_dlg_event_listeners();
+    },
+    listen_file_dlg_events: function() {
+      pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:'+this.field.get('dialog_type'), this.storage_dlg_hander, this);
+      pgAdmin.Browser.Events.on('pgadmin-storage:cancel_btn:'+this.field.get('dialog_type'), this.storage_close_dlg_hander, this);
+    },
+    remove_file_dlg_event_listeners: function() {
+      pgAdmin.Browser.Events.off('pgadmin-storage:finish_btn:'+this.field.get('dialog_type'), this.storage_dlg_hander, this);
+      pgAdmin.Browser.Events.off('pgadmin-storage:cancel_btn:'+this.field.get('dialog_type'), this.storage_close_dlg_hander, this);
+    },
     clearInvalid: function() {
       Backform.InputControl.prototype.clearInvalid.apply(this, arguments);
       this.$el.removeClass("pgadmin-file-has-error");

Reply via email to