]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Bandwidth limit window improvements
authorMarcin Haba <marcin.haba@bacula.pl>
Thu, 21 Nov 2019 06:19:26 +0000 (07:19 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 15:02:17 +0000 (16:02 +0100)
gui/baculum/protected/Web/Portlets/ClientBandwidthLimit.tpl
gui/baculum/protected/Web/Portlets/DirectiveTemplate.php
gui/baculum/protected/Web/Portlets/JobBandwidthLimit.tpl

index 493d848b6f62f0217edeea693f58d674c9623274..9056813f127a2e64cc66ba9a5b76d6758d073be5 100644 (file)
@@ -16,6 +16,7 @@
                                        Show="true"
                                        Label="<%[ Bandwidth limit ]%>"
                                        UnitType="decimal"
+                                       Attributes.onkeyup="var kc = (event.which || event.keyCode); if (kc == 13) oClientBandwidthLimit.set_bandwidth(); if (kc == 27) oClientBandwidthLimit.close_popup();"
                                />
                        </div>
                </div>
@@ -51,6 +52,7 @@ var oClientBandwidthLimit = {
        },
        open_popup: function() {
                document.getElementById(this.ids.popup).style.display = 'block';
+               document.getElementById('<%=$this->BandwidthLimit->Directive->ClientID%>').focus();
        },
        close_popup: function() {
                document.getElementById(this.ids.popup).style.display = 'none';
@@ -66,6 +68,9 @@ var oClientBandwidthLimit = {
                var val = Units.format_speed(value, null, false, true);
                bwlimit_val.value = val.value;
                bwlimit_unit.value = Units.get_short_unit_by_long('speed', val.format) || val.format;
+       },
+       set_bandwidth: function() {
+               $('#<%=$this->SetBandwidthLimit->ClientID%>').click();
        }
 };
 </script>
index c4ea961666825b6256ace066f061011f1719cf1c..b37e414f5c0583ba2f5794e1ad1902aabf91963f 100644 (file)
@@ -74,6 +74,13 @@ class DirectiveTemplate extends DirectiveControlTemplate implements IDirectiveFi
                }
        }
 
+       public function copyAttributes() {
+               $control = $this->findControl('Directive');
+               if ($control instanceof \Prado\Web\UI\TControl) {
+                       $control->getAttributes()->copyFrom($this->getAttributes());
+               }
+       }
+
        public function saveValue($sender, $param) {
                $command_param = $this->getCmdParam();
                if ($command_param === 'save' && method_exists($this, 'getValue')) {
@@ -87,6 +94,7 @@ class DirectiveTemplate extends DirectiveControlTemplate implements IDirectiveFi
                if (!$this->getIsDirectiveCreated()) {
                        $this->createDirective();
                        $this->setIsDirectiveCreated(true);
+                       $this->copyAttributes();
                }
 
                // show directives existing in config or all
index cc8440fbb6cca7320bf3de090dc6a55c8e773568..ca1d929bbc3d9a5dd79d460823aad4139f3165c8 100644 (file)
@@ -16,6 +16,7 @@
                                        Show="true"
                                        Label="<%[ Bandwidth limit ]%>"
                                        UnitType="decimal"
+                                       Attributes.onkeyup="var kc = (event.which || event.keyCode); if (kc == 13) oJobBandwidthLimit.set_bandwidth(); if (kc == 27) oJobBandwidthLimit.close_popup();"
                                />
                        </div>
                </div>
@@ -51,6 +52,7 @@ var oJobBandwidthLimit = {
        },
        open_popup: function() {
                document.getElementById(this.ids.popup).style.display = 'block';
+               document.getElementById('<%=$this->BandwidthLimit->Directive->ClientID%>').focus();
        },
        close_popup: function() {
                document.getElementById(this.ids.popup).style.display = 'none';
@@ -66,6 +68,9 @@ var oJobBandwidthLimit = {
                var val = Units.format_speed(value, null, false, true);
                bwlimit_val.value = val.value;
                bwlimit_unit.value = Units.get_short_unit_by_long('speed', val.format) || val.format;
+       },
+       set_bandwidth: function() {
+               $('#<%=$this->SetBandwidthLimit->ClientID%>').click();
        }
 };
 </script>