From f6a58a269ddbe96afb7d0b4a82929c5ae902493e Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sat, 29 Nov 2014 16:18:34 +0100 Subject: [PATCH] baculum: Use extended framework buttons --- gui/baculum/index.php | 3 + .../protected/Portlets/BActiveButton.php | 65 +++++++++++++------ .../protected/Portlets/BActiveButton.tpl | 3 - gui/baculum/protected/Portlets/BButton.php | 31 ++------- gui/baculum/protected/Portlets/BButton.tpl | 3 - gui/baculum/themes/Baculum-v1/style.css | 57 +++++++--------- 6 files changed, 77 insertions(+), 85 deletions(-) delete mode 100644 gui/baculum/protected/Portlets/BActiveButton.tpl delete mode 100644 gui/baculum/protected/Portlets/BButton.tpl diff --git a/gui/baculum/index.php b/gui/baculum/index.php index b97b1e0c6d..5f05aaff2c 100644 --- a/gui/baculum/index.php +++ b/gui/baculum/index.php @@ -28,6 +28,9 @@ define('APPLICATION_DIRECTORY', __DIR__); require_once('./protected/Pages/Requirements.php'); new Requirements(__DIR__); require_once('./framework/prado.php'); + $application=new TApplication; +Prado::using('Application.Portlets.BButton'); +Prado::using('Application.Portlets.BActiveButton'); $application->run(); ?> diff --git a/gui/baculum/protected/Portlets/BActiveButton.php b/gui/baculum/protected/Portlets/BActiveButton.php index 13bb4970b5..1c4b6ade7a 100644 --- a/gui/baculum/protected/Portlets/BActiveButton.php +++ b/gui/baculum/protected/Portlets/BActiveButton.php @@ -17,41 +17,66 @@ * Bacula® is a registered trademark of Kern Sibbald. */ -Prado::using('System.Web.UI.ActiveControls.TActiveButton'); -Prado::using('Application.Portlets.Portlets'); +Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter'); -class BActiveButton extends Portlets{ +class BActiveButton extends TButton implements ICallbackEventHandler, IActiveControl +{ + public function __construct() + { + parent::__construct(); + $this->setAdapter(new TActiveControlAdapter($this)); + } - public $actionClass, $text, $validationGroup; - public $causesValidation = true; + public function getActiveControl() + { + return $this->getAdapter()->getBaseActiveControl(); + } - public function onInit($param) { - parent::onInit($param); + public function getClientSide() + { + return $this->getAdapter()->getBaseActiveControl()->getClientSide(); } - public function setActionClass($param) { - $this->actionClass = $param; + public function raiseCallbackEvent($param) + { + $this->raisePostBackEvent($param); + $this->onCallback($param); + } + + public function onCallback($param) + { + $this->raiseEvent('OnCallback', $this, $param); } - public function save($sender, $param) { - $this->actionClass->save($sender, $param); + public function setText($value) + { + parent::setText($value); + if($this->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getCallbackClient()->setAttribute($this, 'value', $value); } - public function setCommandName($param) { - $this->commandName = $param; + protected function renderClientControlScript($writer) + { + $this->CssClass = "bbutton"; } - public function setText($param) { - $this->text = $param; + protected function addAttributesToRender($writer) + { + parent::addAttributesToRender($writer); + $writer->addAttribute('id',$this->getClientID()); + $this->getActiveControl()->registerCallbackClientScript( + $this->getClientClassName(), $this->getPostBackOptions()); } - public function setCausesValidation($param) { - $this->causesValidation = $param; + protected function getClientClassName() + { + return 'Prado.WebUI.TActiveButton'; } - public function setValidationGroup($param) { - $this->validationGroup = $param; + public function setActionClass($param) { } + + } -?> \ No newline at end of file +?> diff --git a/gui/baculum/protected/Portlets/BActiveButton.tpl b/gui/baculum/protected/Portlets/BActiveButton.tpl deleted file mode 100644 index 05884e68a2..0000000000 --- a/gui/baculum/protected/Portlets/BActiveButton.tpl +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/gui/baculum/protected/Portlets/BButton.php b/gui/baculum/protected/Portlets/BButton.php index 4f5e8ef664..f52fad45dc 100644 --- a/gui/baculum/protected/Portlets/BButton.php +++ b/gui/baculum/protected/Portlets/BButton.php @@ -19,34 +19,11 @@ Prado::using('Application.Portlets.Portlets'); -class BButton extends Portlets{ +class BButton extends TButton { - public $commandName, $text; - public $causesValidation = true; - public $Visible = true; - - public function onInit($param) { - parent::onInit($param); - } - - public function setCommandName($param) { - $this->commandName = $param; - } - - public function setText($param) { - $this->text = $param; - } - - public function setCausesValidation($param) { - $this->causesValidation = $param; - } - - public function setVisible($param) { - $this->Visible = $param; - } - - public function getVisible($checkParents = true) { - return $this->Visible; + protected function renderClientControlScript($writer) + { + $this->CssClass = "bbutton"; } } diff --git a/gui/baculum/protected/Portlets/BButton.tpl b/gui/baculum/protected/Portlets/BButton.tpl deleted file mode 100644 index df2c37ddc3..0000000000 --- a/gui/baculum/protected/Portlets/BButton.tpl +++ /dev/null @@ -1,3 +0,0 @@ -Visible === false ? 'style="display: none"' : ''%>> - - \ No newline at end of file diff --git a/gui/baculum/themes/Baculum-v1/style.css b/gui/baculum/themes/Baculum-v1/style.css index 23052985a4..bd134bb68b 100644 --- a/gui/baculum/themes/Baculum-v1/style.css +++ b/gui/baculum/themes/Baculum-v1/style.css @@ -26,7 +26,8 @@ input[type=text], input[type=password], select, textarea { } input[type=checkbox] { - margin: 6px; + height: 16px; + width: 16px; } input.textbox, select.textbox { @@ -335,46 +336,27 @@ div.slide-window-progress { color: #96c600 !important; } -.bbutton input.button-left, .bbutton input.button-center, .bbutton input.button-right { +input.bbutton { font-size: 12px; - height: 25px; color: black; + height: 25px; cursor: pointer; padding: 0; - margin: 0; + margin: 0 8px; border: 0; -} - -.bbutton input.button-left, .bbutton input.button-right { - width: 2px; -} - -.bbutton input.button-left { - background: transparent url('button-left.png') no-repeat left 0; -} - -.bbutton input.button-center { - padding: 0 7px; + padding: 0 9px; min-width: 65px; + border: 0; + border-radius: 3px; background: transparent url('button-center.png') repeat-x left 0; } -.bbutton input.button-right { - background: transparent url('button-right.png') no-repeat left 0; -} - -.bbutton:hover input.button-left { - background: transparent url('button-left.png') no-repeat left -25px; -} - -.bbutton:hover input.button-center { +input.bbutton:hover { + border: 1px solid red; + padding: 0 8px; background: transparent url('button-center.png') repeat-x left -25px; } -.bbutton:hover input.button-right { - background: transparent url('button-right.png') no-repeat left -25px; -} - div.slide-window-container { width: 400px; height: 200px; @@ -420,6 +402,7 @@ tr.slide-window-element-alternating { tr.slide-window-element td, tr.slide-window-element-alternating td { font-style: italic; + word-break: break-all; } tr.slide-window-element:hover, tr.slide-window-element-alternating:hover { float: none; @@ -518,7 +501,7 @@ div.slide-window-sort { right: 14px; } -div.slide-window-toolbar { +div.slide-window-toolbar, div.slide-window-actions { height: 90px; width: 240px; z-index: 25; @@ -551,6 +534,16 @@ div.slide-window-toolbar table select,div.slide-window-toolbar table input { div.slide-window-toolbar table input[type="text"] { width: 123px; } +div.slide-window-actions { + width: 220px; + height: 110px; +} + +div.slide-window-actions table { + width: 100%; + font-size: 12px; + padding: 10px; +} div.configuration-window-content { padding: 10px 12px;; @@ -763,8 +756,8 @@ legend { } img { - vertical-align: middle; - border: none; + vertical-align: middle; + border: none; } div.small { -- 2.39.5