From: Marcin Haba Date: Thu, 21 Nov 2019 06:19:26 +0000 (+0100) Subject: baculum: Bandwidth limit window improvements X-Git-Tag: Release-9.6.0~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=243079acaa964595651f1c841831b65b9e8f1829;p=thirdparty%2Fbacula.git baculum: Bandwidth limit window improvements --- diff --git a/gui/baculum/protected/Web/Portlets/ClientBandwidthLimit.tpl b/gui/baculum/protected/Web/Portlets/ClientBandwidthLimit.tpl index 493d848b6..9056813f1 100644 --- a/gui/baculum/protected/Web/Portlets/ClientBandwidthLimit.tpl +++ b/gui/baculum/protected/Web/Portlets/ClientBandwidthLimit.tpl @@ -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();" /> @@ -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(); } }; diff --git a/gui/baculum/protected/Web/Portlets/DirectiveTemplate.php b/gui/baculum/protected/Web/Portlets/DirectiveTemplate.php index c4ea96166..b37e414f5 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveTemplate.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveTemplate.php @@ -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 diff --git a/gui/baculum/protected/Web/Portlets/JobBandwidthLimit.tpl b/gui/baculum/protected/Web/Portlets/JobBandwidthLimit.tpl index cc8440fbb..ca1d929bb 100644 --- a/gui/baculum/protected/Web/Portlets/JobBandwidthLimit.tpl +++ b/gui/baculum/protected/Web/Portlets/JobBandwidthLimit.tpl @@ -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();" /> @@ -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(); } };