]> git.llucax.com Git - software/bife/bife-all.git/commitdiff
Core and Basic modules are now much more like they should. Huge code clean:
authorLeandro Lucarella <llucax@gmail.com>
Sun, 29 Jun 2003 07:42:29 +0000 (07:42 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Sun, 29 Jun 2003 07:42:29 +0000 (07:42 +0000)
- Merged Copy and Generic class into a new Fallback implementation: Translate.
  It searchs for a template and if it doesn't find it, it copy the output like
  Copy.
- Removed Title and Page (now are created by Translate fallback since they are
  too simple).
- Removed a lot of unused constructors.
- Cleaned up Link constructor (now it uses getURL()) and inherits directly
  from Container.

HIT Changes:
- Added searching for templates in include_path capabilities (much slower).
- Added optional group parameter to parse() method.
- Added exists() method to check if a template exists.
- Fixed paramters of getBuffer() and popBuffer().
- Renamed setGroup() as pushGroup() and unsetGroup() as popGroup().

Other updates:
- Updated ROADMAP.
- Updated UML diagrams.
- Updated example.
- Bugfixes.

18 files changed:
core/BIFE/Container.php
core/BIFE/Fallback.php
core/BIFE/Widget.php
core/HTML/Template/HIT.php
core/bife.xmi
doc/ROADMAP
examples/index.php
modules/album/BIFE/Album/Pager.php
modules/album/BIFE/Album/Photo.php
modules/album/BIFE/Album/Thumbs.php
modules/album/album.xmi
modules/basic/BIFE/Generic.php [deleted file]
modules/basic/BIFE/Link.php
modules/basic/BIFE/Page.php [deleted file]
modules/basic/BIFE/Title.php [deleted file]
modules/basic/BIFE/Translate.php [moved from modules/basic/BIFE/Copy.php with 61% similarity]
modules/basic/basic.xmi
modules/menu/menu.xmi

index a1540b8f2a9a63e7827d5d5635f81ffe5a9b74d1..2ddc24d12975076e671987ea72da8291affcce8d 100644 (file)
@@ -39,44 +39,15 @@ require_once 'BIFE/Widget.php';
  */
 class BIFE_Container extends BIFE_Widget {
     /**
+     * Widget contents.
+     *
      * @var    array $contents
      * @access public
      */
-    var $contents;
+    var $contents = array();
 
     // ~X2C
 
-    // +X2C Operation 48
-    /**
-     * Constructor.
-     *
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function BIFE_Container($attrs) // ~X2C
-    {
-        $this->__construct($attrs);
-    }
-    // -X2C
-
-    // +X2C Operation 50
-    /**
-     * Constructor.
-     *
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function __construct($attrs) // ~X2C
-    {
-        parent::__construct($attrs);
-        $this->contents = array();
-    }
-    // -X2C
-
     // +X2C Operation 6
     /**
      * Adds contents to the container.
@@ -105,7 +76,7 @@ class BIFE_Container extends BIFE_Widget {
      * @return string
      * @access public
      */
-    function render(&$template) // ~X2C
+    function renderContents(&$template) // ~X2C
     {
         $c = count($this->contents);
         $o = '';
@@ -120,6 +91,7 @@ class BIFE_Container extends BIFE_Widget {
     }
     // -X2C
 
+
 } // -X2C Class :Container
 
 ?>
\ No newline at end of file
index e3098252b869e9c3a7527892b24f781151e941bf..04a11b1c5553f2c8966e1c921011ae1ad57af3e3 100644 (file)
@@ -39,10 +39,12 @@ require_once 'BIFE/Container.php';
  */
 class BIFE_Fallback extends BIFE_Container {
     /**
+     * Name of the widget.
+     *
      * @var    string $name
      * @access private
      */
-    var $name;
+    var $name = '';
 
     // ~X2C
 
@@ -75,7 +77,7 @@ class BIFE_Fallback extends BIFE_Container {
     function __construct($name, $attrs) // ~X2C
     {
         parent::__construct($attrs);
-        $this->name = $name;
+        $this->name = strtolower(strtr($name, ':', '_'));
     }
     // -X2C
 
index c000452a7e0cb3bdc4349f0cf66956e9700f39be..5e0ab11b9a00189841263bd475d8c4b220a6b193 100644 (file)
@@ -87,7 +87,7 @@ class BIFE_Widget {
     function render(&$template) // ~X2C
     {
         trigger_error('Method not implemented '.get_class($this).
-            '::addContents().', E_USER_ERROR);
+            '::render().', E_USER_ERROR);
     }
     // -X2C
 
index 025707adf4e4e43015a5a66ccb76b813be23686e..2b635c98de25727591a45f1ef7bd7720fd2cc4fa 100644 (file)
@@ -41,6 +41,14 @@ class HTML_Template_HIT {
      */
     var $root = '.';
 
+    /**
+     * If it's true, it looks for template files in PHP's include_path.
+     *
+     * @var    bool $useIncludePath
+     * @access public
+     */
+    var $useIncludePath = false;
+
     /**
      * Group of templates to use (a subdirectory in root).
      *
@@ -70,14 +78,15 @@ class HTML_Template_HIT {
      * Constructor.
      *
      * @param  string $root Root directory where template files are.
+     * @param  bool $useIncludePath If it's true, it looks for template files in PHP's include_path.
      * @param  string $group Group of templates to use (a subdirectory in root).
      *
      * @return void
      * @access public
      */
-    function HTML_Template_HIT($root = '.', $group = '') // ~X2C
+    function HTML_Template_HIT($root = '.', $useIncludePath = false, $group = '') // ~X2C
     {
-        $this->__construct($root, $group);
+        $this->__construct($root, $useIncludePath, $group);
     }
     // -X2C
 
@@ -86,15 +95,17 @@ class HTML_Template_HIT {
      * Constructor.
      *
      * @param  int $root Root directory where template files are.
-     * @param  int $group Group of templates to use (a subdirectory in root).
+     * @param  false $useIncludePath If it's true, it looks for template files in PHP's include_path.
+     * @param  string $group Group of templates to use (a subdirectory in root).
      *
      * @return void
      * @access public
      */
-    function __construct($root = '.', $group = '') // ~X2C
+    function __construct($root = '.', $useIncludePath = false, $group = '') // ~X2C
     {
         $this->root = $root;
-        $this->setGroup($group);
+        $this->useIncludePath = $useIncludePath;
+        $this->pushGroup($group);
     }
     // -X2C
 
@@ -106,13 +117,14 @@ If $vars is an array, the {[keys]} are replaced with [values] ($val is ignored).
      * @param  string $name Name of template to parse.
      * @param  mixed $vars Variables to replace in the template.
      * @param  string $val If $vars is a string, the value to replace for $vars.
+     * @param  mixed $group Group to use to parse this template. Null to use the current group.
      *
      * @return string
      * @access public
      */
-    function parse($name, $vars = '', $val = '') // ~X2C
+    function parse($name, $vars = '', $val = '', $group = null) // ~X2C
     {
-        $group = end($this->group);
+        $group = is_null($group) ? end($this->group) : $group;
         if ($group) {
             $file = "{$this->root}/$group/$name.tpl.html";
         } else {
@@ -120,11 +132,8 @@ If $vars is an array, the {[keys]} are replaced with [values] ($val is ignored).
         }
         if (!isset($this->cache[$file])) {
             // FIXME - replace join(file()) with file_get_contents().
-            $this->cache[$file] = join('', file($file));
+            $this->cache[$file] = join('', file($file, $this->useIncludePath));
         }
-        //if (!is_readable($file)) {
-        //    trigger_error("Can't read '$file'.");
-        //}
         if ($vars) {
             if (is_string($vars)) {
                 $vars = array($vars => $val);
@@ -163,12 +172,12 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
      * Gets a parsed buffer.
      *
      * @param  string $name Name of the parsed template to get.
-     * @param  bool $flush Flush buffer.
      *
      * @return string
      * @access public
+     * @static
      */
-    function getBuffer($name, $flush = true) // ~X2C
+    function getBuffer($name) // ~X2C
     {
         return @$this->buffer["{$this->group}/$name"];
     }
@@ -178,12 +187,12 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
     /**
      * Gets a parsed buffer and removes it.
      *
-     * @param  int $name Name of the buffer to flush.
+     * @param  string $name Name of the buffer to flush.
      *
      * @return void
      * @access public
      */
-    function popBuffer($name = '') // ~X2C
+    function popBuffer($name) // ~X2C
     {
         $return = @$this->buffer["{$this->group}/$name"];
         unset($this->buffer["{$this->group}/$name"]);
@@ -200,13 +209,9 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
      * @return void
      * @access public
      */
-    function setGroup($group = '') // ~X2C
+    function pushGroup($group = '') // ~X2C
     {
-        if ($group) {
-            $this->group[] = $group;
-        } else {
-            $this->group[] = '';
-        }
+        $this->group[] = $group;
     }
     // -X2C
 
@@ -214,12 +219,44 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
     /**
      * Removes the group from the groups stack and returns to the previous used group.
      *
-     * @return void
+     * @return string
+     * @access public
+     */
+    function popGroup() // ~X2C
+    {
+        return array_pop($this->group);
+    }
+    // -X2C
+
+    // +X2C Operation 159
+    /**
+     * True if the template $name exists in $group (or the current group).
+     *
+     * @param  string $name Name of the template.
+     * @param  mixed $group Template's group. If it's null it uses the current group.
+     *
+     * @return bool
      * @access public
      */
-    function unsetGroup() // ~X2C
+    function exists($name, $group = null) // ~X2C
     {
-        array_pop($this->group);
+        $group = is_null($group) ? end($this->group) : $group;
+        if ($group) {
+            $file = "{$this->root}/$group/$name.tpl.html";
+        } else {
+            $file = "{$this->root}/$name.tpl.html";
+        }
+        if (!$this->useIncludePath) {
+            return is_readable($file);
+        } else {
+            $include_path = array_unique(preg_split('/[:;]/', ini_get('include_path')));
+            foreach ($include_path as $path) {
+                if (is_readable("$path/$file")) {
+                    return true;
+                }
+            }
+            return false;
+        }
     }
     // -X2C
 
index 7dc04890401f9d858a50a6232aee12702e684540..bdd5163ffbbddab8382965743d10f63949379576 100644 (file)
@@ -9,7 +9,7 @@
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="2" documentation="Parse XML data getting widgets." uniqueid="156" />
+  <docsettings viewid="2" documentation="Parse XML data getting widgets." uniqueid="159" />
   <umlobjects>
    <UML:Class stereotype="" package="BIFE" xmi.id="3" abstract="1" documentation="Base widget class." name="Widget" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="126" type="void" abstract="0" documentation="Constructor." name="BIFE_Widget" static="0" scope="200" >
     <UML:Attribute stereotype="" package="" xmi.id="125" value="array()" type="array" abstract="0" documentation="Attribute list." name="attrs" static="0" scope="202" />
    </UML:Class>
    <UML:Class stereotype="" package="BIFE" xmi.id="5" abstract="1" documentation="Base container widget class." name="Container" static="0" scope="200" >
-    <UML:Operation stereotype="" package="" xmi.id="48" type="void" abstract="0" documentation="Constructor." name="BIFE_Container" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="50" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="6" type="void" abstract="0" documentation="Adds contents to the container." name="addContents" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;mixed" abstract="0" documentation="Contents to add to the container." name="contents" static="0" scope="200" />
     </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="59" type="string" abstract="0" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
+    <UML:Operation stereotype="" package="" xmi.id="59" type="string" abstract="0" documentation="Renders the widget using a template returning a string with the results." name="renderContents" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_HIT" abstract="0" documentation="Template object to render the widget." name="template" static="0" scope="200" />
     </UML:Operation>
-    <UML:Attribute stereotype="" package="" xmi.id="47" value="" type="array" abstract="0" documentation="" name="contents" static="0" scope="200" />
+    <UML:Attribute stereotype="" package="" xmi.id="47" value="array()" type="array" abstract="0" documentation="Widget contents." name="contents" static="0" scope="200" />
    </UML:Class>
    <UML:Class stereotype="" package="BIFE" xmi.id="25" abstract="0" documentation="This is the XML Parser." name="Parser" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="30" type="void" abstract="0" documentation="Constructor." name="BIFE_Parser" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Name of the widget." name="name" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
     </UML:Operation>
-    <UML:Attribute stereotype="" package="" xmi.id="129" value="" type="string" abstract="0" documentation="" name="name" static="0" scope="201" />
+    <UML:Attribute stereotype="" package="" xmi.id="129" value="''" type="string" abstract="0" documentation="Name of the widget." name="name" static="0" scope="201" />
    </UML:Class>
    <UML:Class stereotype="" package="HTML/Template" xmi.id="130" abstract="0" documentation="Hooks vs. IT (HIT) is a simple template implementation, based on hooks and IT template systems." name="HIT" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="136" type="void" abstract="0" documentation="Constructor." name="HTML_Template_HIT" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="'.'" type="string" abstract="0" documentation="Root directory where template files are." name="root" static="0" scope="200" />
-     <UML:Parameter stereotype="" package="" xmi.id="2" value="''" type="string" abstract="0" documentation="Group of templates to use (a subdirectory in root)." name="group" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="3" value="false" type="bool" abstract="0" documentation="If it's true, it looks for template files in PHP's include_path." name="useIncludePath" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="4" value="''" type="string" abstract="0" documentation="Group of templates to use (a subdirectory in root)." name="group" static="0" scope="200" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="137" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="'.'" type="int" abstract="0" documentation="Root directory where template files are." name="root" static="0" scope="200" />
-     <UML:Parameter stereotype="" package="" xmi.id="2" value="''" type="int" abstract="0" documentation="Group of templates to use (a subdirectory in root)." name="group" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="3" value="false" type="false" abstract="0" documentation="If it's true, it looks for template files in PHP's include_path." name="useIncludePath" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="4" value="''" type="string" abstract="0" documentation="Group of templates to use (a subdirectory in root)." name="group" static="0" scope="200" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="138" type="string" abstract="0" documentation="Parse a template returning the results.
 
@@ -104,6 +100,7 @@ If $vars is an array, the {[keys]} are replaced with [values] ($val is ignored).
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Name of template to parse." name="name" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="''" type="mixed" abstract="0" documentation="Variables to replace in the template." name="vars" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="3" value="''" type="string" abstract="0" documentation="If $vars is a string, the value to replace for $vars." name="val" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="4" value="null" type="mixed" abstract="0" documentation="Group to use to parse this template. Null to use the current group." name="group" static="0" scope="200" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="144" type="void" abstract="0" documentation="Parse a template buffering the results.
 
@@ -112,18 +109,22 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
      <UML:Parameter stereotype="" package="" xmi.id="2" value="''" type="mixed" abstract="0" documentation="Variables to replace in the template." name="vars" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="3" value="''" type="string" abstract="0" documentation="If $vars is a string, the value to replace for $vars." name="val" static="0" scope="200" />
     </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="145" type="string" abstract="0" documentation="Gets a parsed buffer." name="getBuffer" static="0" scope="200" >
+    <UML:Operation stereotype="" package="" xmi.id="145" type="string" abstract="0" documentation="Gets a parsed buffer." name="getBuffer" static="1" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Name of the parsed template to get." name="name" static="0" scope="200" />
-     <UML:Parameter stereotype="" package="" xmi.id="2" value="true" type="bool" abstract="0" documentation="Flush buffer." name="flush" static="0" scope="200" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="146" type="void" abstract="0" documentation="Gets a parsed buffer and removes it." name="popBuffer" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="''" type="int" abstract="0" documentation="Name of the buffer to flush." name="name" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Name of the buffer to flush." name="name" static="0" scope="200" />
     </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="139" type="void" abstract="0" documentation="Sets the group to use and add it to the groups stack." name="setGroup" static="0" scope="200" >
+    <UML:Operation stereotype="" package="" xmi.id="139" type="void" abstract="0" documentation="Sets the group to use and add it to the groups stack." name="pushGroup" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="''" type="string" abstract="0" documentation="Group to use." name="group" static="0" scope="200" />
     </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="140" type="void" abstract="0" documentation="Removes the group from the groups stack and returns to the previous used group." name="unsetGroup" static="0" scope="200" />
+    <UML:Operation stereotype="" package="" xmi.id="140" type="string" abstract="0" documentation="Removes the group from the groups stack and returns to the previous used group." name="popGroup" static="0" scope="200" />
+    <UML:Operation stereotype="" package="" xmi.id="159" type="bool" abstract="0" documentation="True if the template $name exists in $group (or the current group)." name="exists" static="0" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Name of the template." name="name" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="2" value="null" type="mixed" abstract="0" documentation="Template's group. If it's null it uses the current group." name="group" static="0" scope="200" />
+    </UML:Operation>
     <UML:Attribute stereotype="" package="" xmi.id="133" value="'.'" type="string" abstract="0" documentation="Root directory where template files are." name="root" static="0" scope="200" />
+    <UML:Attribute stereotype="" package="" xmi.id="158" value="false" type="bool" abstract="0" documentation="If it's true, it looks for template files in PHP's include_path." name="useIncludePath" static="0" scope="200" />
     <UML:Attribute stereotype="" package="" xmi.id="134" value="''" type="string" abstract="0" documentation="Group of templates to use (a subdirectory in root)." name="group" static="0" scope="202" />
     <UML:Attribute stereotype="" package="" xmi.id="135" value="array()" type="array" abstract="0" documentation="Templates cache." name="cache" static="0" scope="202" />
     <UML:Attribute stereotype="" package="" xmi.id="147" value="array()" type="array" abstract="0" documentation="" name="buffer" static="0" scope="202" />
@@ -133,29 +134,29 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
    <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="0" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="2" documentation="" type="402" showops="1" showpackage="1" name="Core Classes" localid="30000" showstereotype="0" showscope="1" font="Helvetica,9,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
     <widgets>
      <UML:ConceptWidget usesdiagramfillcolour="0" width="148" showattsigs="601" usesdiagramusefillcolour="0" x="80" linecolour="#ff0000" y="20" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="75" usefillcolor="1" showattributes="1" xmi.id="3" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="127" showattsigs="601" usesdiagramusefillcolour="0" x="91" linecolour="#ff0000" y="150" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="90" usefillcolor="1" showattributes="1" xmi.id="5" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="118" showattsigs="601" usesdiagramusefillcolour="0" x="95" linecolour="#ff0000" y="295" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="60" usefillcolor="1" showattributes="1" xmi.id="61" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="173" showattsigs="601" usesdiagramusefillcolour="0" x="68" linecolour="#ff0000" y="140" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="60" usefillcolor="1" showattributes="1" xmi.id="5" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="123" showattsigs="601" usesdiagramusefillcolour="0" x="93" linecolour="#ff0000" y="241" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="60" usefillcolor="1" showattributes="1" xmi.id="61" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="171" showattsigs="601" usesdiagramusefillcolour="0" x="301" linecolour="#ff0000" y="20" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="240" usefillcolor="1" showattributes="1" xmi.id="25" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
     </widgets>
     <messages/>
     <associations>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="3" widgetaid="5" documentation="" type="500" >
       <linepath>
-       <startpoint startx="154" starty="150" />
+       <startpoint startx="154" starty="140" />
        <endpoint endx="154" endy="95" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="5" widgetaid="61" documentation="" type="500" >
       <linepath>
-       <startpoint startx="154" starty="295" />
-       <endpoint endx="154" endy="240" />
+       <startpoint startx="154" starty="241" />
+       <endpoint endx="154" endy="200" />
       </linepath>
      </UML:AssocWidget>
     </associations>
    </diagram>
    <diagram snapgrid="1" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="0" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="132" documentation="" type="402" showops="1" showpackage="1" name="HIT Classes" localid="30000" showstereotype="0" showscope="1" font="Helvetica,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" >
     <widgets>
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="161" showattsigs="601" usesdiagramusefillcolour="0" x="50" linecolour="#ff0000" y="40" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="195" usefillcolor="1" showattributes="1" xmi.id="130" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,50,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="195" showattsigs="601" usesdiagramusefillcolour="0" x="50" linecolour="#ff0000" y="40" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="225" usefillcolor="1" showattributes="1" xmi.id="130" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,50,0,0,0,0,0" />
     </widgets>
     <messages/>
     <associations/>
@@ -166,11 +167,9 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
     <listitem open="1" type="801" id="-1" label="Logical View" >
      <listitem open="1" type="803" id="-1" label="BIFE" >
       <listitem open="0" type="813" id="5" label="Container" >
-       <listitem open="0" type="815" id="48" label="BIFE_Container" />
-       <listitem open="0" type="815" id="50" label="__construct" />
        <listitem open="0" type="815" id="6" label="addContents" />
        <listitem open="0" type="814" id="47" label="contents" />
-       <listitem open="0" type="815" id="59" label="render" />
+       <listitem open="0" type="815" id="59" label="renderContents" />
       </listitem>
       <listitem open="0" type="807" id="2" label="Core Classes" />
       <listitem open="0" type="813" id="61" label="Fallback" >
@@ -208,14 +207,16 @@ Parse a template appending the results to an internal buffer. If $vars is an arr
        <listitem open="0" type="815" id="137" label="__construct" />
        <listitem open="0" type="814" id="147" label="buffer" />
        <listitem open="0" type="814" id="135" label="cache" />
+       <listitem open="0" type="815" id="159" label="exists" />
        <listitem open="0" type="815" id="145" label="getBuffer" />
        <listitem open="0" type="814" id="134" label="group" />
        <listitem open="0" type="815" id="138" label="parse" />
        <listitem open="0" type="815" id="144" label="parseBuffered" />
        <listitem open="0" type="815" id="146" label="popBuffer" />
+       <listitem open="0" type="815" id="140" label="popGroup" />
+       <listitem open="0" type="815" id="139" label="pushGroup" />
        <listitem open="0" type="814" id="133" label="root" />
-       <listitem open="0" type="815" id="139" label="setGroup" />
-       <listitem open="0" type="815" id="140" label="unsetGroup" />
+       <listitem open="0" type="814" id="158" label="useIncludePath" />
       </listitem>
       <listitem open="1" type="807" id="132" label="HIT Classes" />
      </listitem>
index dd911a39b5295e47f1f840cca542f853716a4b5c..22255c29a34f5eda64eaed64fab439b02be01e4f 100644 (file)
@@ -4,8 +4,8 @@ Version 0.10
 ============
 
     - Add XML file caching. [done!]
-    - Remove Root widget, is has no sense with the new autoincludin method.
-      [done!]
+    - Remove Root widget, is has no sense with the new autoincluding
+      method. [done!]
     - Make the proyect modular. [done as a first draft]
     - Make a Core module with the core classes (Parser, Widget, Container,
       Fallback). [almost done]
@@ -15,7 +15,7 @@ Version 0.10
       [almost done]
     - Fix bugs: all classes should done the dynamic work in the render()
       method or using __sleep() and __wakeup() because of the new cache
-      capabilities.
+      capabilities. [started]
 
 
 Version 0.11
index f7abe2b739d6994d18cb44294108f299e5531dcb..fdb958003d9963df6b66be6416c298394e4e4256 100644 (file)
@@ -40,14 +40,14 @@ umask('002');
 
 require_once 'HTML/Template/HIT.php';
 require_once 'BIFE/Parser.php';
-require_once 'BIFE/Copy.php';
+require_once 'BIFE/Translate.php';
 require_once 'BIFE/Link.php';
 
 $file = isset($_REQUEST['BIFE']) ? $_REQUEST['BIFE'] : 'index.xbf';
 
 $template =& new HTML_Template_HIT('templates');
 
-$parser =& new BIFE_Parser('BIFE_Copy');
+$parser =& new BIFE_Parser('BIFE_Translate');
 $page =& $parser->parseFile($file);
 $parser->__destruct();
 echo $page->render($template);
index 577ce969404d458fcd3d174070de6359c5420e91..7a37116f07579eb7e30cde3038bcce81eb19f7a0 100644 (file)
@@ -26,8 +26,6 @@
 // $Id$
 //
 
-
-
 // +X2C includes
 require_once 'BIFE/Widget.php';
 // ~X2C
@@ -87,4 +85,5 @@ class BIFE_Album_Pager extends BIFE_Widget {
     // -X2C
 
 } // -X2C Class :Pager
+
 ?>
\ No newline at end of file
index 15682553e37d5ab9999a974f8aada76fb7181e7e..c99ef29e5c243bda9a9a3c570779e3453f169fac 100644 (file)
@@ -39,38 +39,6 @@ require_once 'BIFE/Widget.php';
 class BIFE_Album_Photo extends BIFE_Widget {
     // ~X2C
 
-    // +X2C Operation 106
-    /**
-     * Constructor.
-     *
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function BIFE_Album_Photo($attrs) // ~X2C
-    {
-        $this->__construct($attrs);
-    }
-    // -X2C
-
-    // +X2C Operation 107
-    /**
-     * Constructor.
-     *
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function __construct($attrs) // ~X2C
-    {
-        $new_attrs['FILE'] = @$attrs['FILE'] ? $attrs['FILE'] : @$_REQUEST['BIFE_ALBUM_FILE'];
-        $new_attrs['DESC'] = @$attrs['DESC'] ? $attrs['DESC'] : basename($new_attrs['FILE']);
-        parent::__construct($new_attrs);
-    }
-    // -X2C
-
     // +X2C Operation 108
     /**
      * Renders the widget using a template returning a string with the results.
@@ -82,9 +50,9 @@ class BIFE_Album_Photo extends BIFE_Widget {
      */
     function render(&$template) // ~X2C
     {
-        $template->setGroup('album');
-        $out = $template->parse('photo', $this->attrs);
-        $template->unsetGroup();
+        $attrs['FILE'] = @$this->attrs['FILE'] ? $this->attrs['FILE'] : @$_REQUEST['BIFE_ALBUM_FILE'];
+        $attrs['DESC'] = @$this->attrs['DESC'] ? $this->attrs['DESC'] : basename($attrs['FILE']);
+        $out = $template->parse('photo', $attrs, '', 'album');
         return $out;
     }
     // -X2C
index 7c5ddeca284f4283e440dc3aa96c97d0f7a52ad5..4deaae84c0464b57f15c093c2cc8225c5e915e72 100644 (file)
@@ -98,7 +98,7 @@ class BIFE_Album_Thumbs extends BIFE_Widget {
      */
     function render(&$template) // ~X2C
     {
-        $template->setGroup('album');
+        $template->pushGroup('album');
         $list = $this->getList();
         $tot  = count($list);
         $rows = ceil($tot / $this->attrs['COLUMNS']);
@@ -122,13 +122,13 @@ class BIFE_Album_Thumbs extends BIFE_Widget {
                 }
                 $template->parseBuffered('cell', 'CONTENTS', $cell);
             }
-            $template->parseBuffered('row', 'CONTENTS', $template->popBuffer('cell'));
+            $template->parseBuffered('row', 'CONTENTS',
+                $template->popBuffer('cell'));
         }
-        $out = $template->parse(
-            'body',
-            array('DESC' => $this->getDescription(), 'CONTENTS' => $template->popBuffer('row'))
-        );
-        $template->unsetGroup();
+        $out = $template->parse('body', array(
+            'DESC'     => $this->getDescription(),
+            'CONTENTS' => $template->popBuffer('row')));
+        $template->popGroup();
         return $out;
     }
     // -X2C
index 455bba5a41894709db3238a461d0a6af3ac5e441..c23cb927067c31f9e8e75a9fb0f10720f88b7018 100644 (file)
@@ -45,18 +45,10 @@ Returns an array of associative arrays with this keys:
     </UML:Operation>
    </UML:Class>
    <UML:Class stereotype="" package="BIFE/Album" xmi.id="103" abstract="0" documentation="Photo widget." name="Photo" static="0" scope="200" >
-    <UML:Operation stereotype="" package="" xmi.id="106" type="void" abstract="0" documentation="Constructor." name="BIFE_Album_Photo" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="107" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="108" type="string" abstract="0" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_HIT" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
     </UML:Operation>
    </UML:Class>
-   <UML:Class stereotype="" package="HTML/Template" xmi.id="130" abstract="0" documentation="Hooks vs. IT (HIT) is a simple template implementation, based on hooks and IT template systems.
-x2c:extern" name="HIT" static="0" scope="200" />
    <UML:Class stereotype="" package="BIFE/Album" xmi.id="151" abstract="0" documentation="Album pager to an easier navigation when viewing photos." name="Pager" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="153" type="void" abstract="0" documentation="Constructor." name="BIFE_Album_Pager" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
@@ -74,7 +66,7 @@ x2c:extern" name="HIT" static="0" scope="200" />
     <widgets>
      <UML:ConceptWidget usesdiagramfillcolour="0" width="90" showattsigs="600" usesdiagramusefillcolour="0" x="222" linecolour="#ff0000" y="23" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="25" usefillcolor="1" showattributes="0" xmi.id="3" showoperations="0" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="161" showattsigs="601" usesdiagramusefillcolour="0" x="22" linecolour="#ff0000" y="175" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="142" usefillcolor="1" showattributes="1" xmi.id="20" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="149" showattsigs="601" usesdiagramusefillcolour="0" x="193" linecolour="#ff0000" y="175" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="67" usefillcolor="1" showattributes="1" xmi.id="103" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="126" showattsigs="601" usesdiagramusefillcolour="0" x="204" linecolour="#ff0000" y="175" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="37" usefillcolor="1" showattributes="1" xmi.id="103" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="148" showattsigs="601" usesdiagramusefillcolour="0" x="352" linecolour="#ff0000" y="175" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="67" usefillcolor="1" showattributes="1" xmi.id="151" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
     </widgets>
     <messages/>
@@ -111,8 +103,6 @@ x2c:extern" name="HIT" static="0" scope="200" />
        <listitem open="0" type="815" id="155" label="render" />
       </listitem>
       <listitem open="0" type="813" id="103" label="Photo" >
-       <listitem open="0" type="815" id="106" label="BIFE_Album_Photo" />
-       <listitem open="0" type="815" id="107" label="__construct" />
        <listitem open="0" type="815" id="108" label="render" />
       </listitem>
       <listitem open="0" type="813" id="20" label="Thumbs" >
@@ -129,9 +119,6 @@ x2c:extern" name="HIT" static="0" scope="200" />
      <listitem open="1" type="803" id="-1" label="BIFE" >
       <listitem open="0" type="813" id="3" label="Widget" />
      </listitem>
-     <listitem open="1" type="803" id="-1" label="HIT" >
-      <listitem open="0" type="813" id="130" label="HIT" />
-     </listitem>
     </listitem>
     <listitem open="1" type="802" id="-1" label="Use Case View" />
    </listitem>
diff --git a/modules/basic/BIFE/Generic.php b/modules/basic/BIFE/Generic.php
deleted file mode 100644 (file)
index bbda5bd..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +--------------------------------------------------------------------+
-// |                       BIFE - Buil It FastEr                        |
-// +--------------------------------------------------------------------+
-// | This file is part of BIFE.                                         |
-// |                                                                    |
-// | BIFE is free software; you can redistribute it and/or modify it    |
-// | under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation; either version 2 of the License, or  |
-// | (at your option) any later version.                                |
-// |                                                                    |
-// | BIFE is distributed in the hope that it will be useful, but        |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of         |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   |
-// | General Public License for more details.                           |
-// |                                                                    |
-// | You should have received a copy of the GNU General Public License  |
-// | along with Hooks; if not, write to the Free Software Foundation,   |
-// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
-// +--------------------------------------------------------------------+
-// | Created: Wed May 17 18:16:54 ART 2003                              |
-// | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
-// +--------------------------------------------------------------------+
-//
-// $Id$
-//
-
-// +X2C includes
-require_once 'BIFE/Container.php';
-// ~X2C
-
-// +X2C Class 7 :Generic
-/**
- * This is a generic and simple BIFE_Container implementation.
- *
- * @access public
- * @abstract
- */
-class BIFE_Generic extends BIFE_Container {
-    // ~X2C
-
-    // +X2C Operation 10
-    /**
-     * Constructor.
-     *
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function BIFE_Generic($attrs) // ~X2C
-    {
-        $this->__construct($attrs);
-    }
-    // -X2C
-
-    // +X2C Operation 51
-    /**
-     * Constructor.
-     *
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function __construct($attrs) // ~X2C
-    {
-        parent::__construct($attrs);
-    }
-    // -X2C
-
-    // +X2C Operation 11
-    /**
-     * Add 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 12
-    /**
-     * Renders the widget.
-     *
-     * @param  HTML_Template_HIT &$template Template to use to render the widget.
-     *
-     * @return string
-     * @access public
-     */
-    function render(&$template) // ~X2C
-    {
-        $this->attrs['CONTENTS'] = parent::render($template);
-        $template->setGroup();
-        $out = $template->parse(get_class($this), $this->attrs);
-        $template->unsetGroup();
-        return $out;
-    }
-    // -X2C
-
-} // -X2C Class :Generic
-
-?>
\ No newline at end of file
index 02a3c80be43e537d8b55e55b2b766f0790f703a1..c8900d68b36fa018384469ea68998a9c3d44fc6b 100644 (file)
@@ -27,7 +27,7 @@
 //
 
 // +X2C includes
-require_once 'BIFE/Generic.php';
+require_once 'BIFE/Container.php';
 // ~X2C
 
 // +X2C Class 110 :Link
@@ -36,7 +36,7 @@ require_once 'BIFE/Generic.php';
  *
  * @access public
  */
-class BIFE_Link extends BIFE_Generic {
+class BIFE_Link extends BIFE_Container {
     // ~X2C
 
     // +X2C Operation 111
@@ -65,26 +65,9 @@ class BIFE_Link extends BIFE_Generic {
      */
     function __construct($attrs) // ~X2C
     {
-        $link_attrs['URL'] = @$attrs['URL'];
-        unset($attrs['URL']);
-        $link_attrs['DESC'] = @$attrs['DESC'];
-        unset($attrs['DESC']);
-        if (isset($attrs['BIFE'])) {
-            $link_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) {
-            $link_attrs['URL'] .= '?' . join('&', $query);
-        }
+        $link_attrs['URL']    = $this->getURL($attrs);
+        $link_attrs['DESC']   = @$attrs['DESC'];
+        $link_attrs['TARGET'] = @$attrs['TARGET'];
         parent::__construct($link_attrs);
     }
     // -X2C
@@ -121,6 +104,22 @@ class BIFE_Link extends BIFE_Generic {
     }
     // -X2C
 
+    // +X2C Operation 157
+    /**
+     * Renders the widget.
+     *
+     * @param  HTML_Template_HIT &$template Template to use to render the widget.
+     *
+     * @return string
+     * @access public
+     */
+    function render(&$template) // ~X2C
+    {
+        $this->attrs['CONTENTS'] = $this->renderContents($template);
+        return $template->parse('bife_link', $this->attrs, '', '');
+    }
+    // -X2C
+
 } // -X2C Class :Link
 
 ?>
\ No newline at end of file
diff --git a/modules/basic/BIFE/Page.php b/modules/basic/BIFE/Page.php
deleted file mode 100644 (file)
index 17b3abb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +--------------------------------------------------------------------+
-// |                       BIFE - Buil It FastEr                        |
-// +--------------------------------------------------------------------+
-// | This file is part of BIFE.                                         |
-// |                                                                    |
-// | BIFE is free software; you can redistribute it and/or modify it    |
-// | under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation; either version 2 of the License, or  |
-// | (at your option) any later version.                                |
-// |                                                                    |
-// | BIFE is distributed in the hope that it will be useful, but        |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of         |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   |
-// | General Public License for more details.                           |
-// |                                                                    |
-// | You should have received a copy of the GNU General Public License  |
-// | along with Hooks; if not, write to the Free Software Foundation,   |
-// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
-// +--------------------------------------------------------------------+
-// | Created: Wed May 17 18:16:54 ART 2003                              |
-// | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
-// +--------------------------------------------------------------------+
-//
-// $Id$
-//
-
-// +X2C includes
-require_once 'BIFE/Generic.php';
-// ~X2C
-
-// +X2C Class 14 :Page
-/**
- * Page widget.
- *
- * @access public
- */
-class BIFE_Page extends BIFE_Generic {
-    // ~X2C
-
-} // -X2C Class :Page
-
-?>
diff --git a/modules/basic/BIFE/Title.php b/modules/basic/BIFE/Title.php
deleted file mode 100644 (file)
index 12d6698..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +--------------------------------------------------------------------+
-// |                       BIFE - Buil It FastEr                        |
-// +--------------------------------------------------------------------+
-// | This file is part of BIFE.                                         |
-// |                                                                    |
-// | BIFE is free software; you can redistribute it and/or modify it    |
-// | under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation; either version 2 of the License, or  |
-// | (at your option) any later version.                                |
-// |                                                                    |
-// | BIFE is distributed in the hope that it will be useful, but        |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of         |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   |
-// | General Public License for more details.                           |
-// |                                                                    |
-// | You should have received a copy of the GNU General Public License  |
-// | along with Hooks; if not, write to the Free Software Foundation,   |
-// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
-// +--------------------------------------------------------------------+
-// | Created: Wed May 17 18:16:54 ART 2003                              |
-// | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
-// +--------------------------------------------------------------------+
-//
-// $Id$
-//
-
-// +X2C includes
-require_once 'BIFE/Generic.php';
-// ~X2C
-
-// +X2C Class 17 :Title
-/**
- * Title widget.
- *
- * @access public
- */
-class BIFE_Title extends BIFE_Generic {
-    // ~X2C
-
-} // -X2C Class :Title
-
-?>
similarity index 61%
rename from modules/basic/BIFE/Copy.php
rename to modules/basic/BIFE/Translate.php
index f58dec1cb03e80a84842e0e3bfdab6eaf3a885b6..6a16273a9ab202fd4d508d9805ba8a13cda59b86 100644 (file)
@@ -19,7 +19,7 @@
 // | along with Hooks; if not, write to the Free Software Foundation,   |
 // | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
 // +--------------------------------------------------------------------+
-// | Created: Wed May 21 15:55:29 2003                                  |
+// | Created: Wed May 17 18:16:54 ART 2003                              |
 // | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
 // +--------------------------------------------------------------------+
 //
 require_once 'BIFE/Fallback.php';
 // ~X2C
 
-// +X2C Class 76 :Copy
+// +X2C Class 7 :Translate
 /**
- * Fallback widget that copies the XML.
+ * This is a generic and simple (but very usefull) BIFE_Fallback implementation. Translate widgets using a template with it's name, prepended with 'bife_'.
  *
  * @access public
  */
-class BIFE_Copy extends BIFE_Fallback {
+class BIFE_Translate extends BIFE_Fallback {
     // ~X2C
 
-    // +X2C Operation 79
+    // +X2C Operation 12
     /**
-     * Constructor.
-     *
-     * @param  string $name Widget name.
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function BIFE_Copy($name, $attrs) // ~X2C
-    {
-        $this->__construct($name, $attrs);
-    }
-    // -X2C
-
-    // +X2C Operation 80
-    /**
-     * Constructor.
-     *
-     * @param  string $name Widget name.
-     * @param  array $attrs Attributes.
-     *
-     * @return void
-     * @access public
-     */
-    function __construct($name, $attrs) // ~X2C
-    {
-        parent::__construct($name, $attrs);
-    }
-    // -X2C
-
-    // +X2C Operation 82
-    /**
-     * Renders the widget returning a string with the results.
+     * Renders the widget.
      *
      * @param  HTML_Template_HIT &$template Template to use to render the widget.
      *
-     * @return void
+     * @return string
      * @access public
      */
     function render(&$template) // ~X2C
     {
-        $name = $this->name;
-        $ret = "<$name";
-        foreach ($this->attrs as $attr => $val) {
-            $ret .= sprintf(' %s="%s"', $attr, $val);
-        }
-        $contents = parent::render($template);
-        if ($contents) {
-            $ret .= ">$contents</$name>";
+        $this->attrs['CONTENTS'] = $this->renderContents($template);
+        $name = "bife_{$this->name}";
+        if ($template->exists($name, '')) {
+            $out = $template->parse($name, $this->attrs, '', '');
         } else {
-            $ret .= "/>";
+            $name = $this->name;
+            $out = "<$name";
+            foreach ($this->attrs as $attr => $val) {
+                $out .= sprintf(' %s="%s"', $attr, $val);
+            }
+            $contents = $this->renderContents($template);
+            if ($contents !== '') {
+                $out .= ">$contents</$name>";
+            } else {
+                $out .= "/>";
+            }
         }
-        return $ret;
+        return $out;
     }
     // -X2C
 
-} // -X2C Class :Copy
+} // -X2C Class :Translate
 
 ?>
\ No newline at end of file
index 7b8943381dec785e3ad90cac17be68f107404916..556ba2ed2db0128a2377286cede56d8433b028f6 100644 (file)
@@ -9,41 +9,17 @@
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="113" documentation="Parse XML data getting widgets." uniqueid="155" />
+  <docsettings viewid="113" documentation="Parse XML data getting widgets." uniqueid="157" />
   <umlobjects>
    <UML:Class stereotype="" package="BIFE" xmi.id="5" abstract="1" documentation="Base container widget class.
 x2c:extern" name="Container" static="0" scope="200" />
-   <UML:Class stereotype="" package="BIFE" xmi.id="7" abstract="1" documentation="This is a generic and simple BIFE_Container implementation." name="Generic" static="0" scope="200" >
-    <UML:Operation stereotype="" package="" xmi.id="10" type="void" abstract="0" documentation="Constructor." name="BIFE_Generic" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="51" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="11" type="void" abstract="0" documentation="Add contents to the container." name="addContents" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;mixed" abstract="0" documentation="Contents to add." name="contents" static="0" scope="200" />
-    </UML:Operation>
+   <UML:Class stereotype="" package="BIFE" xmi.id="7" abstract="0" documentation="This is a generic and simple (but very usefull) BIFE_Fallback implementation. Translate widgets using a template with it's name, prepended with 'bife_'." name="Translate" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="12" type="string" abstract="0" documentation="Renders the widget." name="render" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_HIT" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
     </UML:Operation>
    </UML:Class>
-   <UML:Class stereotype="" package="BIFE" xmi.id="14" abstract="0" documentation="Page widget." name="Page" static="0" scope="200" />
-   <UML:Class stereotype="" package="BIFE" xmi.id="17" abstract="0" documentation="Title widget." name="Title" static="0" scope="200" />
    <UML:Class stereotype="" package="BIFE" xmi.id="61" abstract="1" documentation="Fallback widget to use when no specific widget is implemented.
 x2c:extern" name="Fallback" static="0" scope="200" />
-   <UML:Class stereotype="" package="BIFE" xmi.id="76" abstract="0" documentation="Fallback widget that copies the XML." name="Copy" static="0" scope="200" >
-    <UML:Operation stereotype="" package="" xmi.id="79" type="void" abstract="0" documentation="Constructor." name="BIFE_Copy" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Widget name." name="name" static="0" scope="200" />
-     <UML:Parameter stereotype="" package="" xmi.id="2" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="80" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Widget name." name="name" static="0" scope="200" />
-     <UML:Parameter stereotype="" package="" xmi.id="2" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="82" type="void" abstract="0" documentation="Renders the widget returning a string with the results." name="render" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_HIT" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
-    </UML:Operation>
-   </UML:Class>
    <UML:Class stereotype="" package="BIFE" xmi.id="110" abstract="0" documentation="Link to another page." name="Link" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="111" type="void" abstract="0" documentation="Constructor." name="BIFE_Link" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
@@ -54,57 +30,31 @@ x2c:extern" name="Fallback" static="0" scope="200" />
     <UML:Operation stereotype="" package="" xmi.id="142" type="string" abstract="0" documentation="Gets a URL string based on Link attributes." name="getURL" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Link attributes." name="attrs" static="0" scope="200" />
     </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="157" type="string" abstract="0" documentation="Renders the widget." name="render" static="0" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_HIT" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
+    </UML:Operation>
    </UML:Class>
-   <UML:Class stereotype="" package="HTML/Template" xmi.id="130" abstract="0" documentation="Hooks vs. IT (HIT) is a simple template implementation, based on hooks and IT template systems.
-x2c:extern" name="HIT" static="0" scope="200" />
   </umlobjects>
   <diagrams>
    <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="0" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="113" documentation="Class diagram for the basic classes." type="402" showops="1" showpackage="1" name="Basic Classes" localid="30000" showstereotype="0" showscope="1" font="Helvetica,9,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
     <widgets>
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="107" showattsigs="601" usesdiagramusefillcolour="0" x="55" linecolour="#ff0000" y="330" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="67" usefillcolor="1" showattributes="1" xmi.id="76" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="117" showattsigs="601" usesdiagramusefillcolour="0" x="308" linecolour="#ff0000" y="150" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="82" usefillcolor="1" showattributes="1" xmi.id="7" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="1" width="107" showattsigs="601" usesdiagramusefillcolour="1" x="313" linecolour="none" y="330" showopsigs="600" usesdiagramlinecolour="1" fillcolour="none" height="67" usefillcolor="1" showattributes="1" xmi.id="110" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="79" showattsigs="601" usesdiagramusefillcolour="0" x="447" linecolour="#ff0000" y="330" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="29" usefillcolor="1" showattributes="1" xmi.id="14" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="76" showattsigs="601" usesdiagramusefillcolour="0" x="210" linecolour="#ff0000" y="330" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="29" usefillcolor="1" showattributes="1" xmi.id="17" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="97" showattsigs="600" usesdiagramusefillcolour="0" x="60" linecolour="#ff0000" y="150" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="25" usefillcolor="1" showattributes="0" xmi.id="61" showoperations="0" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="106" showattsigs="600" usesdiagramusefillcolour="0" x="178" linecolour="#ff0000" y="30" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="25" usefillcolor="1" showattributes="0" xmi.id="5" showoperations="0" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="104" showattsigs="601" usesdiagramusefillcolour="0" x="184" linecolour="#ff0000" y="110" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="37" usefillcolor="1" showattributes="1" xmi.id="7" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="107" showattsigs="601" usesdiagramusefillcolour="0" x="40" linecolour="#ff0000" y="110" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="82" usefillcolor="1" showattributes="1" xmi.id="110" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="97" showattsigs="600" usesdiagramusefillcolour="0" x="188" linecolour="#ff0000" y="30" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="25" usefillcolor="1" showattributes="0" xmi.id="61" showoperations="0" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="106" showattsigs="601" usesdiagramusefillcolour="0" x="40" linecolour="#ff0000" y="30" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="25" usefillcolor="1" showattributes="0" xmi.id="5" showoperations="0" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
     </widgets>
     <messages/>
     <associations>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="1" widgetbid="7" widgetaid="17" documentation="" type="500" >
-      <linepath>
-       <startpoint startx="248" starty="330" />
-       <endpoint endx="337" endy="232" />
-      </linepath>
-     </UML:AssocWidget>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="2" widgetbid="7" widgetaid="110" documentation="" type="500" >
+     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="61" widgetaid="7" documentation="" type="500" >
       <linepath>
-       <startpoint startx="366" starty="330" />
-       <endpoint endx="366" endy="232" />
+       <startpoint startx="236" starty="110" />
+       <endpoint endx="236" endy="55" />
       </linepath>
      </UML:AssocWidget>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="61" widgetaid="76" documentation="" type="500" >
+     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="5" widgetaid="110" documentation="" type="500" >
       <linepath>
-       <startpoint startx="108" starty="330" />
-       <endpoint endx="108" endy="175" />
-      </linepath>
-     </UML:AssocWidget>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" widgetbid="5" widgetaid="7" documentation="" type="500" >
-      <linepath>
-       <startpoint startx="366" starty="150" />
-       <endpoint endx="248" endy="55" />
-      </linepath>
-     </UML:AssocWidget>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" widgetbid="5" widgetaid="61" documentation="" type="500" >
-      <linepath>
-       <startpoint startx="108" starty="150" />
-       <endpoint endx="213" endy="55" />
-      </linepath>
-     </UML:AssocWidget>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="3" widgetbid="7" widgetaid="14" documentation="" type="500" >
-      <linepath>
-       <startpoint startx="486" starty="330" />
-       <endpoint endx="395" endy="232" />
+       <startpoint startx="93" starty="110" />
+       <endpoint endx="93" endy="55" />
       </linepath>
      </UML:AssocWidget>
     </associations>
@@ -119,27 +69,15 @@ x2c:extern" name="HIT" static="0" scope="200" />
      </listitem>
      <listitem open="1" type="803" id="-1" label="Basic" >
       <listitem open="0" type="807" id="113" label="Basic Classes" />
-      <listitem open="0" type="813" id="76" label="Copy" >
-       <listitem open="0" type="815" id="79" label="BIFE_Copy" />
-       <listitem open="0" type="815" id="80" label="__construct" />
-       <listitem open="0" type="815" id="82" label="render" />
-      </listitem>
-      <listitem open="0" type="813" id="7" label="Generic" >
-       <listitem open="0" type="815" id="10" label="BIFE_Generic" />
-       <listitem open="0" type="815" id="51" label="__construct" />
-       <listitem open="0" type="815" id="11" label="addContents" />
-       <listitem open="0" type="815" id="12" label="render" />
-      </listitem>
       <listitem open="0" type="813" id="110" label="Link" >
        <listitem open="0" type="815" id="111" label="BIFE_Link" />
        <listitem open="0" type="815" id="112" label="__construct" />
        <listitem open="0" type="815" id="142" label="getURL" />
+       <listitem open="0" type="815" id="157" label="render" />
+      </listitem>
+      <listitem open="0" type="813" id="7" label="Translate" >
+       <listitem open="0" type="815" id="12" label="render" />
       </listitem>
-      <listitem open="0" type="813" id="14" label="Page" />
-      <listitem open="0" type="813" id="17" label="Title" />
-     </listitem>
-     <listitem open="1" type="803" id="-1" label="HIT" >
-      <listitem open="0" type="813" id="130" label="HIT" />
      </listitem>
     </listitem>
     <listitem open="1" type="802" id="-1" label="Use Case View" />
index 5fb8ff5c5290cf40953657a9400c567edf43a5ce..1b77a2235cde00b31b4610ce18486409eb5a933a 100644 (file)
@@ -24,8 +24,6 @@ x2c:extern" name="Widget" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_HIT" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
     </UML:Operation>
    </UML:Class>
-   <UML:Class stereotype="" package="HTML/Template" xmi.id="130" abstract="0" documentation="Hooks vs. IT (HIT) is a simple template implementation, based on hooks and IT template systems.
-x2c:extern" name="HIT" static="0" scope="200" />
   </umlobjects>
   <diagrams>
    <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="0" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="116" documentation="" type="402" showops="1" showpackage="1" name="Menu Classes" localid="30000" showstereotype="0" showscope="1" font="Helvetica,9,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
@@ -50,9 +48,6 @@ x2c:extern" name="HIT" static="0" scope="200" />
      <listitem open="1" type="803" id="-1" label="BIFE" >
       <listitem open="0" type="813" id="3" label="Widget" />
      </listitem>
-     <listitem open="1" type="803" id="-1" label="HIT" >
-      <listitem open="0" type="813" id="130" label="HIT" />
-     </listitem>
      <listitem open="1" type="803" id="-1" label="Menu" >
       <listitem open="0" type="813" id="115" label="Menu" >
        <listitem open="0" type="815" id="121" label="BIFE_Menu_Menu" />