[dev] [patch] Add Horde_UI_Widget class
Jason M. Felice
jfelice at cronosys.com
Wed Nov 26 15:27:52 PST 2003
This patch adds Horde_UI_Widget:: and makes it a base class of Horde_UI_Tabs::.
It will also be the base class for Horde_UI_Table::, which I'm working on.
The base class basically just tracks the widget's variable name and the list
of variables to preserve. (The Horde_UI_Table:: stuff is getting kinda big,
so I want to break it up.)
Patch Summary:
A framework/UI/UI/Widget.php
M framework/UI/package.xml
M framework/UI/UI/Tabs.php
-------------- next part --------------
epm diff framework/UI/UI/Widget.php
--- framework/UI/UI/Widget.php 1969-12-31 19:00:00.000000000 -0500
+++ framework/UI/UI/Widget.php 2003-11-26 18:21:32.000000000 -0500
@@ -0,0 +1,66 @@
+<?php
+/**
+ * The Horde_UI_Widget:: class provides base functionality for other Horde
+ * UI elements.
+ *
+ * $Horde: $
+ *
+ * Copyright 2003 Jason M. Felice <jfelice at cronosys.com>
+ *
+ * See the enclosed file LICENSE for license information (LGPL).
+ *
+ * @version $Revision: 1.6 $
+ * @since Horde_UI 0.0.1
+ * @package Horde_UI
+ */
+class Horde_UI_Widget {
+
+ /**
+ * Any variables that should be preserved in all of the tab links.
+ * @var array $_preserve
+ */
+ var $_preserve = array();
+
+ /**
+ * The name of the variable that varies based on which tab is
+ * clicked.
+ * @var string $_varname
+ */
+ var $_varname;
+
+ /**
+ * Construct a new tab interface.
+ *
+ * @access public
+ *
+ * @param string $varname The name of the variable which will track this
+ * UI widget's state.
+ */
+ function Horde_UI_Widget($varname)
+ {
+ $this->_varname = $varname;
+ }
+
+ /**
+ * Instruct Horde_UI_Table:: to preserve a variable.
+ *
+ * @access public
+ *
+ * @param string $var The name of the variable to preserve.
+ * @param mixed $value The value of the variable to preserve.
+ */
+ function preserve($var, $value)
+ {
+ $this->_preserve[] = array('var' => $var, 'value' => $value);
+ }
+
+ /**
+ * Render the widget.
+ *
+ * @abstract
+ *
+ * @param optional mixed $data The widget's state data.
+ */
+ function render($data) {}
+
+}
epm diff framework/UI/package.xml
--- framework/UI/package.xml 2003-11-26 18:21:32.000000000 -0500
+++ framework/UI/package.xml 2003-11-26 18:22:18.000000000 -0500
@@ -34,10 +34,12 @@
<filelist>
<dir role="php" baseinstalldir="/Horde" name="UI">
<file name="Tabs.php" />
+ <file name="Widget.php" />
</dir>
</filelist>
<provides type="class" name="Horde_UI_Tabs" />
+ <provides type="class" name="Horde_UI_Widget" />
</release>
epm diff framework/UI/UI/Tabs.php
--- framework/UI/UI/Tabs.php 2003-11-26 18:21:32.000000000 -0500
+++ framework/UI/UI/Tabs.php 2003-11-26 18:21:32.000000000 -0500
@@ -1,4 +1,7 @@
<?php
+
+require_once 'Horde/UI/Widget.php';
+
/**
* The Horde_UI_Tabs:: class manages and renders a tab-like interface.
*
@@ -13,7 +16,7 @@
* @since Horde_UI 0.0.1
* @package Horde_UI
*/
-class Horde_UI_Tabs {
+class Horde_UI_Tabs extends Horde_UI_Widget {
/**
* The array of tabs.
@@ -22,19 +25,6 @@
var $_tabs = array();
/**
- * Any variables that should be preserved in all of the tab links.
- * @var array $_preserve
- */
- var $_preserve = array();
-
- /**
- * The name of the variable that varies based on which tab is
- * clicked.
- * @var string $_varname
- */
- var $_varname;
-
- /**
* Construct a new tab interface.
*
* @access public
@@ -44,7 +34,7 @@
*/
function Horde_UI_Tabs($varname = 'tabname')
{
- $this->_varname = $varname;
+ parent::Horde_UI_Widget($varname);
}
/**
@@ -62,19 +52,6 @@
}
/**
- * Instruct Horde_UI_Tab:: to preserve a variable.
- *
- * @access public
- *
- * @param string $var The name of the variable to preserve.
- * @param mixed $value The value of the variable to preserve.
- */
- function preserve($var, $value)
- {
- $this->_preserve[] = array('var' => $var, 'value' => $value);
- }
-
- /**
* Retreive the title of the tab with the specified name.
*
* @access public
More information about the dev
mailing list