From: Leandro Lucarella Date: Fri, 23 May 2003 15:55:06 +0000 (+0000) Subject: - Added a Root class that manages 'use' attribute to make require_once calls. X-Git-Tag: svn_import~51 X-Git-Url: https://git.llucax.com/software/bife/bife-all.git/commitdiff_plain/afeefb526fa1db0797362edb2227739883a0b617?ds=sidebyside - Added a Root class that manages 'use' attribute to make require_once calls. - Now Page is a subclass of Root. - Fixed protected and private methods and attributes in UML diagram (and inline documentation) using xmi2code new option. - Removed include_once calls from the Parser. --- diff --git a/Doxyfile b/Doxyfile index 8206aa3..c1720c3 100644 --- a/Doxyfile +++ b/Doxyfile @@ -30,7 +30,7 @@ # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "BIFE - Build It FastEr" -PROJECT_NUMBER = 0.6 +PROJECT_NUMBER = 0.8 OUTPUT_DIRECTORY = doc/api OUTPUT_LANGUAGE = English EXTRACT_ALL = YES diff --git a/doc/ROADMAP b/doc/ROADMAP index c1e042c..c5d1395 100644 --- a/doc/ROADMAP +++ b/doc/ROADMAP @@ -1,18 +1,10 @@ $Id$ -Version 0.7 -=========== - - Parser: - - Implement the Fallback class. - - - Version 0.8 =========== General: - - Add a Root interface and derivate Page from Root. + - Add a Root interface and derivate Page from Root (done). - Make a Core Package with the core classes (Parser, Widget, Container, Root, Fallback). - Make a Basic (or Generic?) Package with simple implementations of all @@ -20,7 +12,8 @@ Version 0.8 - Make other more specific Packages (like Album) with other widgets. Parser: - - Remove include statement, replace it with Root 'use' attribute. + - Remove include statement, replace it with Root 'use' attribute + (done). diff --git a/doc/bife.xmi b/doc/bife.xmi index ece1275..789b2b3 100644 --- a/doc/bife.xmi +++ b/doc/bife.xmi @@ -9,7 +9,7 @@ - + @@ -34,13 +34,13 @@ - + - + @@ -49,6 +49,13 @@ + + + + + + + @@ -130,64 +137,80 @@ - - + + + + + + + + + + - - - - - - - - + + + + + + + + + - - + + - + - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + @@ -260,6 +283,13 @@ + + + + + + + diff --git a/examples/index.php b/examples/index.php index cd198be..4d7651a 100644 --- a/examples/index.php +++ b/examples/index.php @@ -35,7 +35,7 @@ require_once 'BIFE/Parser.php'; require_once 'BIFE/Copy.php'; require_once 'BIFE/Page.php'; require_once 'BIFE/Title.php'; -require_once 'BIFE/Album.php'; +#require_once 'BIFE/Album.php'; #require_once 'BIFE.php'; $file = 'simple.xbf'; diff --git a/examples/simple.xbf b/examples/simple.xbf index e3dcd89..61383a8 100644 --- a/examples/simple.xbf +++ b/examples/simple.xbf @@ -1,5 +1,5 @@ - + Datos!

Photo album

diff --git a/src/BIFE/Copy.php b/src/BIFE/Copy.php index 1d39031..c26fada 100644 --- a/src/BIFE/Copy.php +++ b/src/BIFE/Copy.php @@ -41,7 +41,7 @@ class BIFE_Copy extends BIFE_Fallback { * Widget name. * * @var string $name - * @access public + * @access protected */ var $name; @@ -49,7 +49,7 @@ class BIFE_Copy extends BIFE_Fallback { * Attributes. * * @var array $attrs - * @access public + * @access protected */ var $attrs; @@ -116,4 +116,4 @@ class BIFE_Copy extends BIFE_Fallback { } // -X2C Class :Copy -?> +?> \ No newline at end of file diff --git a/src/BIFE/Generic.php b/src/BIFE/Generic.php index 296a4c8..c98bc49 100644 --- a/src/BIFE/Generic.php +++ b/src/BIFE/Generic.php @@ -26,7 +26,6 @@ // $Id$ // - // +X2C includes require_once 'BIFE/Container.php'; // ~X2C @@ -43,7 +42,7 @@ class BIFE_Generic extends BIFE_Container { * Attribute list. * * @var array $attrs - * @access public + * @access protected */ var $attrs; @@ -82,7 +81,7 @@ class BIFE_Generic extends BIFE_Container { // +X2C Operation 11 /** - * Add contents to the widget. + * Add contents to the container. * * @param mixed &$contents Contents to add. * diff --git a/src/BIFE/Page.php b/src/BIFE/Page.php index 0d6455c..7f8fa30 100644 --- a/src/BIFE/Page.php +++ b/src/BIFE/Page.php @@ -27,7 +27,7 @@ // // +X2C includes -require_once 'BIFE/Generic.php'; +require_once 'BIFE/Root.php'; // ~X2C // +X2C Class 14 :Page @@ -36,7 +36,15 @@ require_once 'BIFE/Generic.php'; * * @access public */ -class BIFE_Page extends BIFE_Generic { +class BIFE_Page extends BIFE_Root { + /** + * Attributes. + * + * @var array $attrs + * @access protected + */ + var $attrs; + // ~X2C // +X2C Operation 15 @@ -66,6 +74,46 @@ class BIFE_Page extends BIFE_Generic { function __construct($attrs) // ~X2C { parent::__construct($attrs); + $this->attrs = $attrs; + } + // -X2C + + // +X2C Operation 93 + /** + * Adds contents to the container. + * + * @param mixed &$contents Contents to add. + * + * @return void + * @access public + */ + function addContents(&$contents) // ~X2C + { + if (is_string($contents)) { + $contents = trim($contents); + } + if ($contents) { + parent::addContents($contents); + } + } + // -X2C + + // +X2C Operation 90 + /** + * Returns the rendered widget as a string. + * + * @param HTML_Template_Sigma &$template Template to use to render the widget. + * + * @return string + * @access public + */ + function render(&$template) // ~X2C + { + $contents = parent::render($template); + $template->loadTemplateFile('bife_page.html'); + $template->setVariable($this->attrs); + $template->setVariable('CONTENTS', $contents); + return $template->get(); } // -X2C diff --git a/src/BIFE/Parser.php b/src/BIFE/Parser.php index bf96326..66be149 100644 --- a/src/BIFE/Parser.php +++ b/src/BIFE/Parser.php @@ -128,9 +128,6 @@ class BIFE_Parser { function startElement($parser, $name, $attrs) // ~X2C { $class = "BIFE_$name"; - if (!class_exists($class)) { - @include_once 'BIFE/' . ucfirst(strtolower($name)) . '.php'; - } if (class_exists($class)) { $obj =& new $class($attrs); if (!is_a($obj, 'bife_widget')) { diff --git a/src/BIFE/Root.php b/src/BIFE/Root.php new file mode 100644 index 0000000..66f9cbc --- /dev/null +++ b/src/BIFE/Root.php @@ -0,0 +1,80 @@ + | +// +--------------------------------------------------------------------+ +// +// $Id$ +// + +// +X2C includes +require_once 'BIFE/Container.php'; +// ~X2C + +// +X2C Class 85 :Root +/** + * Root container class. + * + * @access public + */ +class BIFE_Root extends BIFE_Container { + // ~X2C + + // +X2C Operation 87 + /** + * Constructor. + * + * @param string $attrs Attributes. + * + * @return void + * @access public + */ + function BIFE_Root($attrs) // ~X2C + { + $this->__construct($attrs); + } + // -X2C + + // +X2C Operation 88 + /** + * Constructor. + * + * @param string $attrs Attributes. + * + * @return void + * @access public + */ + function __construct($attrs) // ~X2C + { + if (@$attrs['USE']) { + foreach (split(':', $attrs['USE']) as $require) { + require_once "BIFE/$require.php"; + } + unset($attrs['USE']); + } + parent::__construct($attrs); + } + // -X2C + +} // -X2C Class :Root + +?> \ No newline at end of file diff --git a/xmi2code.config b/xmi2code.config index 688b61e..684f541 100644 --- a/xmi2code.config +++ b/xmi2code.config @@ -43,4 +43,5 @@