]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Use extended framework buttons
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 29 Nov 2014 15:18:34 +0000 (16:18 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 29 Nov 2014 15:48:03 +0000 (16:48 +0100)
gui/baculum/index.php
gui/baculum/protected/Portlets/BActiveButton.php
gui/baculum/protected/Portlets/BActiveButton.tpl [deleted file]
gui/baculum/protected/Portlets/BButton.php
gui/baculum/protected/Portlets/BButton.tpl [deleted file]
gui/baculum/themes/Baculum-v1/style.css

index b97b1e0c6de039e02c7b3aff65b1fe91c6d5e069..5f05aaff2cc0fafb7bfa42477c07365742de8090 100644 (file)
@@ -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();
 ?>
index 13bb4970b56675dfbba229793abfceb0d2e45ae2..1c4b6ade7a9e40edf8c43240c041c7b56c129426 100644 (file)
  * 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 (file)
index 05884e6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<span class="bbutton">
-       <com:TActiveButton CssClass="button-left" OnCallback="save" Text="&nbsp;" ValidationGroup="<%=$this->validationGroup%>" CausesValidation="<%=$this->causesValidation%>" ClientSide.OnComplete="ConfigurationWindow<%=@$this->actionClass->getMaster()->ClientID%>.progress(false);<%=@$this->actionClass->getMaster()->ClientID%>reloadWindow();" /><com:TActiveButton ID="ApplyChanges" CssClass="button-center" OnCallback="save" Text="<%=$this->text%>" ValidationGroup="<%=$this->validationGroup%>" CausesValidation="<%=$this->causesValidation%>" ClientSide.OnComplete="ConfigurationWindow<%=@$this->actionClass->getMaster()->ClientID%>.progress(false);<%=@$this->actionClass->getMaster()->ClientID%>reloadWindow();" /><com:TActiveButton CssClass="button-right" OnCallback="save" Text="&nbsp;" ValidationGroup="<%=$this->validationGroup%>" CausesValidation="<%=$this->causesValidation%>" ClientSide.OnComplete="ConfigurationWindow<%=@$this->actionClass->getMaster()->ClientID%>.progress(false);<%=@$this->actionClass->getMaster()->ClientID%>reloadWindow();" />
-</span>
\ No newline at end of file
index 4f5e8ef66462fa166a9eac798736a2350df27581..f52fad45dcd0b9d29dcecec4bd8c4985dcfd6807 100644 (file)
  
 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 (file)
index df2c37d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<span class="bbutton" <%=$this->Visible === false ? 'style="display: none"' : ''%>>
-<com:TButton CssClass="button-left" Text="&nbsp;" CommandName="<%=$this->commandName%>" CausesValidation="<%=$this->causesValidation%>" Visible="<%=$this->Visible%>" /><com:TButton CssClass="button-center" Text="<%=$this->text%>" CommandName="<%=$this->commandName%>" CausesValidation="<%=$this->causesValidation%>" Visible="<%=$this->Visible%>" /><com:TButton CssClass="button-right"  Text="&nbsp;" CommandName="<%=$this->commandName%>" CausesValidation="<%=$this->causesValidation%>" Visible="<%=$this->Visible%>" />
-</span>
\ No newline at end of file
index 23052985a42dd683dd1052f40ccdc45e586348aa..bd134bb68b4380dc260c34a6f9039ac306623093 100644 (file)
@@ -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 {