From: Leandro Lucarella Date: Mon, 2 Jun 2003 04:26:36 +0000 (+0000) Subject: Added new Widget, Link: X-Git-Tag: svn_import~47 X-Git-Url: https://git.llucax.com/software/bife/bife-all.git/commitdiff_plain/090eddcda4bf543db3463012f7a552a744364cd5?ds=inline Added new Widget, Link: - Updated UML diagram. - Updated example to use Link widget in a smart way (removed photo.php). Even so, Link is not yet used in Album. - Fixed bugs. --- diff --git a/doc/bife.xmi b/doc/bife.xmi index cd94d32..f587167 100644 --- a/doc/bife.xmi +++ b/doc/bife.xmi @@ -5,11 +5,11 @@ umbrello uml modeller http://uml.sf.net 1.1 - + - + @@ -179,86 +179,101 @@ Returns an array of associative arrays with this keys: + + + + + + + + - - - - - - - - - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + - - + + - + @@ -296,6 +311,13 @@ Returns an array of associative arrays with this keys: + + + + + + + @@ -322,6 +344,10 @@ Returns an array of associative arrays with this keys: + + + + @@ -329,13 +355,6 @@ Returns an array of associative arrays with this keys: - - - - - - - diff --git a/examples/index.php b/examples/index.php index 4d7651a..dfff49c 100644 --- a/examples/index.php +++ b/examples/index.php @@ -35,12 +35,13 @@ require_once 'BIFE/Parser.php'; require_once 'BIFE/Copy.php'; require_once 'BIFE/Page.php'; require_once 'BIFE/Title.php'; +require_once 'BIFE/Link.php'; #require_once 'BIFE/Album.php'; #require_once 'BIFE.php'; -$file = 'simple.xbf'; +$file = isset($_REQUEST['BIFE']) ? $_REQUEST['BIFE'] : 'index.xbf'; -$template =& new HTML_Template_Sigma('templates'); +$template =& new HTML_Template_Sigma('templates', 'compiled_templates'); $template->setErrorHandling(PEAR_ERROR_PRINT); $parser =& new BIFE_Parser('BIFE_Copy'); diff --git a/examples/simple.xbf b/examples/index.xbf similarity index 100% rename from examples/simple.xbf rename to examples/index.xbf diff --git a/examples/templates/bife_album_item.html b/examples/templates/bife_album_item.html index 5d20d8c..5523de6 100644 --- a/examples/templates/bife_album_item.html +++ b/examples/templates/bife_album_item.html @@ -1,3 +1,4 @@ - {DESC} + {DESC} diff --git a/examples/templates/bife_link.html b/examples/templates/bife_link.html new file mode 100644 index 0000000..f8e2148 --- /dev/null +++ b/examples/templates/bife_link.html @@ -0,0 +1 @@ +{CONTENTS} diff --git a/src/BIFE/Album.php b/src/BIFE/Album.php index 977949c..1d9fa2b 100644 --- a/src/BIFE/Album.php +++ b/src/BIFE/Album.php @@ -282,4 +282,4 @@ Returns an array of associative arrays with this keys: } // -X2C Class :Album -?> +?> \ No newline at end of file diff --git a/src/BIFE/AlbumPhoto.php b/src/BIFE/AlbumPhoto.php index 7d7548d..6a34876 100644 --- a/src/BIFE/AlbumPhoto.php +++ b/src/BIFE/AlbumPhoto.php @@ -81,7 +81,7 @@ class BIFE_AlbumPhoto extends BIFE_Widget { */ function __construct($attrs) // ~X2C { - $this->file = @$attrs['FILE'] ? $attrs['FILE'] : @$_REQUEST['BIFE_AlbumPhoto_FILE']; + $this->file = @$attrs['FILE'] ? $attrs['FILE'] : @$_REQUEST['BIFE_ALBUMPHOTO_FILE']; $this->desc = @$attrs['DESC'] ? $attrs['DESC'] : basename($this->file); } // -X2C diff --git a/examples/photo.php b/src/BIFE/Link.php similarity index 51% rename from examples/photo.php rename to src/BIFE/Link.php index ca803c7..ab21616 100644 --- a/examples/photo.php +++ b/src/BIFE/Link.php @@ -1,4 +1,4 @@ - | // +--------------------------------------------------------------------+ // // $Id$ // -$tmp = ini_get('include_path'); -ini_set('include_path', "../src:$tmp"); -unset($tmp); +// +X2C includes +require_once 'BIFE/Generic.php'; +// ~X2C -require_once 'HTML/Template/Sigma.php'; -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.php'; +// +X2C Class 110 :Link +/** + * Link to another page. + * + * @access public + */ +class BIFE_Link extends BIFE_Generic { + // ~X2C -$file = 'photo.xbf'; + // +X2C Operation 111 + /** + * Constructor. + * + * @param array $attrs Attributes. + * + * @return void + * @access public + */ + function BIFE_Link($attrs) // ~X2C + { + $this->__construct($attrs); + } + // -X2C -$template =& new HTML_Template_Sigma('templates'); -$template->setErrorHandling(PEAR_ERROR_PRINT); + // +X2C Operation 112 + /** + * Constructor. + * + * @param array $attrs Attributes. + * + * @return void + * @access public + */ + function __construct($attrs) // ~X2C + { + if (isset($attrs['URL'])) { + $this->attrs['URL'] = $attrs['URL']; + unset($attrs['URL']); + } else { + $this->attrs['URL'] = ''; + } + if (isset($attrs['BIFE'])) { + $this->attrs['BIFE'] = $attrs['BIFE']; + $attrs['DATA-BIFE'] = $attrs['BIFE']; + unset($attrs['BIFE']); + } + $query = array(); + foreach($attrs as $name => $value) { + if (substr($name, 0, 5) === 'DATA-') { + if ($name = substr($name, 5)) { + $query[] = urlencode($name) . '=' . urlencode($value); + } + } + } + if ($query) { + $this->attrs['QUERY'] = '?' . join('&', $query); + } else { + $this->attrs['QUERY'] = ''; + } + } + // -X2C -$parser =& new BIFE_Parser('BIFE_Copy'); -$page =& $parser->parseFile($file); -$parser->__destruct(); -echo $page->render($template); +} // -X2C Class :Link ?>