]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Do not refresh window lists if toolbar is open or elements are checked
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 20:51:04 +0000 (21:51 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 20:51:04 +0000 (21:51 +0100)
gui/baculum/protected/JavaScript/slide-window.js
gui/baculum/protected/Portlets/ClientConfiguration.tpl
gui/baculum/protected/Portlets/JobConfiguration.tpl
gui/baculum/protected/Portlets/JobRunConfiguration.tpl
gui/baculum/protected/Portlets/PoolConfiguration.tpl
gui/baculum/protected/Portlets/VolumeConfiguration.tpl

index d0d329c02ddcc630ed75b950aee8d26820c646e1..cbb7c63c8fe860733751a7292645b9f4ca8f70e8 100644 (file)
@@ -405,11 +405,10 @@ var SlideWindowClass = Class.create({
                return $(this.windowId + this.elements.toolbarSuffix).visible();
        },
        setActions: function() {
-               var table = $(this.window).down('table');
-               var checkboxes = table.select('input[name="actions_checkbox"]');
+               var checkboxes = this.getCheckboxes();
                checkboxes.each(function(el) {
                        el.observe('change', function() {
-                               var is_checked = this.is_any_checked(checkboxes);
+                               var is_checked = this.isAnyChecked(checkboxes);
                                if(is_checked === true && !this.areActionsOpen()) {
                                        this.showActions();
                                } else if (is_checked === false && this.areActionsOpen()) {
@@ -418,7 +417,7 @@ var SlideWindowClass = Class.create({
                        }.bind(this));
                 }.bind(this));
        },
-       is_any_checked: function(checkboxes) {
+       isAnyChecked: function(checkboxes) {
                var is_checked = false;
                checkboxes.each(function(ch) {
                        if(ch.checked == true) {
@@ -429,10 +428,19 @@ var SlideWindowClass = Class.create({
                return is_checked;
        },
 
+       getCheckboxes: function() {
+               var checkboxes = $(this.gridEl).select('input[name="actions_checkbox"]');
+               return checkboxes;
+       },
+
+       areCheckboxesChecked: function() {
+               var checkboxes = this.getCheckboxes();
+               return this.isAnyChecked(checkboxes);
+       },
+
        markAllChecked: function(check) {
                this.checked = [];
-               var table = $(this.window).down('table');
-               var checkboxes = table.select('input[name="actions_checkbox"]');
+               var checkboxes = this.getCheckboxes();
                var containerId;
                if(checkboxes.length > 0) {
                        checkboxes.each(function(ch, index) {
index 9e480b55fe1ebfd9073480a060236a00d7db0727..fd13e844790f42866ce9b66ebc6979974df9c962 100644 (file)
                        <com:TCallback ID="ReloadClients" OnCallback="Page.ClientWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('ClientWindow').setLoadRequest();" />
                        <script type="text/javascript">
                                var client_callback_func = function() {
+                                       /* If Client list window is not open or if actually toolbar is used
+                                        * then Client window refresh does not take place.
+                                        */
+                                       var obj = SlideWindow.getObj('ClientWindow');
+                                       if (obj.isWindowOpen() === false || obj.isToolbarOpen() === true) {
+                                               return;
+                                       }
                                        var mainForm = Prado.Validation.getForm();
                                        var callback = <%=$this->ReloadClients->ActiveControl->Javascript%>;
                                        if (Prado.Validation.managers[mainForm].getValidatorsWithError('ClientGroup').length == 0) {
index 7aae452fc54d58e19ac16c37c90d0091e835dd04..b9acf8404e3143f68a9e77a894855e4015d13b74 100644 (file)
                                var job_callback_func = function() {
                                        /*
                                         * Check if Job list window is open and if any checkbox from actions is not checked.
+                                        * Also check if toolbar is open.
                                         * If yes, then is possible to refresh Job list window.
                                         */
-                                       if(SlideWindow.getObj('JobWindow').isWindowOpen() === true && SlideWindow.getObj('JobWindow').areActionsOpen() === false) {
-                                               var mainForm = Prado.Validation.getForm();
-                                               var callback = <%=$this->ReloadJobs->ActiveControl->Javascript%>;
-                                               if (Prado.Validation.managers[mainForm].getValidatorsWithError('JobGroup').length == 0) {
-                                                       SlideWindow.getObj('JobWindow').markAllChecked(false);
-                                                       callback.dispatch();
-                                               }
+                                       var obj = SlideWindow.getObj('JobWindow');
+                                       if (obj.isWindowOpen() === false || obj.areCheckboxesChecked() === true || obj.isToolbarOpen() === true) {
+                                               return;
+                                       }
+                                       var mainForm = Prado.Validation.getForm();
+                                       var callback = <%=$this->ReloadJobs->ActiveControl->Javascript%>;
+                                       if (Prado.Validation.managers[mainForm].getValidatorsWithError('JobGroup').length == 0) {
+                                               obj.markAllChecked(false);
+                                               callback.dispatch();
                                        }
                                }
                        </script>
index 1fecd5e396a9d058796384217084619c63726ea5..01c86e3e41808b6ab8f817d4fbfa78ff7f4940c3 100644 (file)
                        <com:TCallback ID="ReloadRunJobs" OnCallback="Page.JobRunWindow.prepareData" ClientSide.OnComplete="RunSlideWindow.getObj('JobRunWindow').setLoadRequest();" />
                        <script type="text/javascript">
                                var jobrun_callback_func = function() {
+                                       /* If Job Run list window is not open or if actually toolbar is used
+                                        * then Job Run window refresh does not take place.
+                                        */
+                                       var obj = SlideWindow.getObj('JobRunWindow');
+                                       if (obj.isWindowOpen() === false || obj.isToolbarOpen() === true) {
+                                               return;
+                                       }
                                        var mainForm = Prado.Validation.getForm();
                                        var callback = <%=$this->ReloadRunJobs->ActiveControl->Javascript%>;
                                        if (Prado.Validation.managers[mainForm].getValidatorsWithError('JobRunGroup').length == 0) {
index b531c6303b52d7dd0b8f78f6e2c5477770da3aab..3011466a57ade70e85eaea425d65bfa1db58049f 100644 (file)
                <com:TCallback ID="ReloadPools" OnCallback="Page.PoolWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('PoolWindow').setLoadRequest();" />
                <script type="text/javascript">
                        var pool_callback_func = function() {
+                               /* If Pool list window is not open or if actually toolbar is used
+                                * then Pool window refresh does not take place.
+                                */
+                               var obj = SlideWindow.getObj('PoolWindow');
+                               if (obj.isWindowOpen() === false || obj.isToolbarOpen() === true) {
+                                       return;
+                               }
                                var mainForm = Prado.Validation.getForm();
                                var callback = <%=$this->ReloadPools->ActiveControl->Javascript%>;
                                if (Prado.Validation.managers[mainForm].getValidatorsWithError('PoolGroup').length == 0) {
index 9b97d40a0355fc60ce4671f45e33177563cfaefe..584f80e00ca683a966dcaad0ad6e2a1e02982b6a 100644 (file)
                <com:TCallback ID="ReloadVolumes" OnCallback="Page.VolumeWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('VolumeWindow').setLoadRequest();" />
                <script type="text/javascript">
                        var volume_callback_func = function() {
+                               /*
+                                * Check if Volume list window is open and if any checkbox from actions is not checked.
+                                * Also check if toolbar is open.
+                                * If yes, then is possible to refresh Volume list window.
+                                */
+                               var obj = SlideWindow.getObj('VolumeWindow');
+                               if (obj.isWindowOpen() === false || obj.areCheckboxesChecked() === true || obj.isToolbarOpen() === true) {
+                                       return;
+                               }
                                var mainForm = Prado.Validation.getForm();
                                var callback = <%=$this->ReloadVolumes->ActiveControl->Javascript%>;
                                if (Prado.Validation.managers[mainForm].getValidatorsWithError('VolumeGroup').length == 0) {
-                                       SlideWindow.getObj('VolumeWindow').markAllChecked(false);
+                                       obj.markAllChecked(false);
                                        callback.dispatch();
                                }
                        }