]> git.llucax.com Git - software/bife/bife-all.git/commitdiff
- Added package.xml to make a PEAR package.
authorLeandro Lucarella <llucax@gmail.com>
Sat, 24 May 2003 03:36:32 +0000 (03:36 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Sat, 24 May 2003 03:36:32 +0000 (03:36 +0000)
- Added more rules to Makefile.
- BIFE_Album now it's a full independent widget, implementing the album
  functions (no need for the external Album class any more).
- Minor bugfixes.

Doxyfile
Makefile
doc/bife.xmi
src/Album.php
src/BIFE/Album.php
src/BIFE/Parser.php

index c1720c30a509301c313e08daf8668851c931e878..448b4a718e5906b9b43dc794174fedbcf65eecd5 100644 (file)
--- a/Doxyfile
+++ b/Doxyfile
@@ -140,7 +140,7 @@ COMPACT_LATEX          = NO
 PAPER_TYPE             = a4wide
 EXTRA_PACKAGES         = 
 LATEX_HEADER           = 
 PAPER_TYPE             = a4wide
 EXTRA_PACKAGES         = 
 LATEX_HEADER           = 
-PDF_HYPERLINKS         = NO
+PDF_HYPERLINKS         = YES
 USE_PDFLATEX           = NO
 LATEX_BATCHMODE        = NO
 #---------------------------------------------------------------------------
 USE_PDFLATEX           = NO
 LATEX_BATCHMODE        = NO
 #---------------------------------------------------------------------------
@@ -149,7 +149,7 @@ LATEX_BATCHMODE        = NO
 GENERATE_RTF           = NO
 RTF_OUTPUT             = rtf
 COMPACT_RTF            = NO
 GENERATE_RTF           = NO
 RTF_OUTPUT             = rtf
 COMPACT_RTF            = NO
-RTF_HYPERLINKS         = NO
+RTF_HYPERLINKS         = YES
 RTF_STYLESHEET_FILE    = 
 RTF_EXTENSIONS_FILE    = 
 #---------------------------------------------------------------------------
 RTF_STYLESHEET_FILE    = 
 RTF_EXTENSIONS_FILE    = 
 #---------------------------------------------------------------------------
index 808da6b2c327ce282e2751fee3ab262de555ead8..70f738349daae4ee521863aab40716f766a4892f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
+# vim: set noexpandtab tabstop=4 softtabstop=4 shiftwidth=4:
 # +--------------------------------------------------------------------+
 # |                       BIFE - Buil It FastEr                        |
 # +--------------------------------------------------------------------+
 # +--------------------------------------------------------------------+
 # |                       BIFE - Buil It FastEr                        |
 # +--------------------------------------------------------------------+
 # $Id$
 #
 
 # $Id$
 #
 
-all: doc code
+VERSION=0.8
+PHP_FILES=src/BIFE/*.php
+META_FILES=xmi2code.config xmi2code.tpl.php Makefile Doxyfile package.xml
+DOC_FILES=doc/bife.xmi
+APIDOC_FILES=doc/api/* doc/api/*/*
+
+code: doc/bife.xmi xmi2code.config
+       xmi2code -a
+
+all: code doc pear-packages tarball
 
 doc: api
 
 
 doc: api
 
-api: Doxyfile src/*.php src/BIFE/*.php
+api: Doxyfile $(PHP_FILES)
        doxygen
 
        doxygen
 
-code: doc/bife.xmi
-       xmi2code -a
-
 clean-code:
        find src/ -name '*.bak' | xargs rm -vf
 
 clean-code:
        find src/ -name '*.bak' | xargs rm -vf
 
@@ -43,5 +49,12 @@ clean-doc:
 
 clean: clean-doc clean-backup
 
 
 clean: clean-doc clean-backup
 
-tarball:
-       tar --exclude bife/doxygen.warn --exclude .svn --exclude .bak --exclude .swp --exclude 'bife/doc/api/*' -C .. -cvzf ../bife.tar.gz bife
+tarball: bife.tar.gz
+
+bife.tar.gz: $(PHP_FILES) $(DOC_FILES) $(META_FILES)
+       tar --exclude bife.tar.gz --exclude bife/doxygen.warn --exclude .svn --exclude '*.bak' --exclude '*.swp' --exclude 'bife/doc/api/*' -C .. -cvzf bife.tar.gz bife
+
+pear-packages: BIFE-$(VERSION).tgz
+
+BIFE-$(VERSION).tgz: $(PHP_FILES) $(DOC_FILES) package.xml
+       pear package
index 789b2b37f99667f6ee512739cd1f22907f857ab9..a21c9deae1e35f073b2e238816293214bdb04ed5 100644 (file)
@@ -9,7 +9,7 @@
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="2" documentation="" uniqueid="93" />
+  <docsettings viewid="2" documentation="" uniqueid="102" />
   <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="4" type="string" abstract="1" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
   <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="4" type="string" abstract="1" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
@@ -65,9 +65,7 @@
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
     </UML:Operation>
    </UML:Class>
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
     </UML:Operation>
    </UML:Class>
-   <UML:Class stereotype="" package="BIFE" xmi.id="20" abstract="0" documentation="Photo album widget.
-
-[TODO: Make a better explanation]" name="Album" static="0" scope="200" >
+   <UML:Class stereotype="" package="BIFE" xmi.id="20" abstract="0" documentation="Photo album widget. [TODO: Make a better explanation]" name="Album" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="22" type="void" abstract="0" documentation="Constructor." name="BIFE_Album" 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="22" type="void" abstract="0" documentation="Constructor." name="BIFE_Album" 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="23" 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_Sigma" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="23" 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_Sigma" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
     </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="95" type="array" abstract="0" documentation="Gets a list of photos with their descriptions and thumbnails.
+
+Returns an array of associative arrays with this keys:
+&lt;ul>
+&lt;li>&lt;b>file:&lt;/b> Photo filename.&lt;/li>
+&lt;li>&lt;b>desc:&lt;/b> Photo Description.&lt;/li>
+&lt;li>&lt;b>thumb:&lt;/b> Photo thumbnail filename.&lt;/li>
+&lt;/ul>
+" name="getList" static="0" scope="202" />
+    <UML:Operation stereotype="" package="" xmi.id="97" type="string" abstract="0" documentation="Creates an image thumbnail, returning his filename." name="makeThumb" static="0" scope="202" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Filename of the image to create the thumb." name="filename" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="2" value="100" type="int" abstract="0" documentation="Maximum thumbnail size." name="size" static="0" scope="200" />
+    </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="98" type="string" abstract="0" documentation="Returns the filename of an image thumb." name="getThumbFilename" static="0" scope="202" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Filename of the image to get the thumb name." name="filename" static="0" scope="200" />
+    </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="102" type="string" abstract="0" documentation="Returns the description of the album." name="getDescription" static="0" scope="202" />
+    <UML:Operation stereotype="" package="" xmi.id="100" type="array" abstract="0" documentation="Splits a filename returning an array with the path, name and extension." name="splitFilename" static="1" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Filename to split." name="filename" static="0" scope="200" />
+    </UML:Operation>
     <UML:Attribute stereotype="" package="" xmi.id="21" value="" type="array" abstract="0" documentation="Attributes." name="attrs" 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:Attribute stereotype="" package="" xmi.id="21" value="" type="array" abstract="0" documentation="Attributes." name="attrs" 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" >
   <diagrams>
    <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="2" documentation="" type="402" showops="1" showpackage="1" name="Class Diagram" localid="30000" showstereotype="0" showscope="1" font="Helvetica,10,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
     <widgets>
   <diagrams>
    <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="2" documentation="" type="402" showops="1" showpackage="1" name="Class Diagram" localid="30000" showstereotype="0" showscope="1" font="Helvetica,10,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
     <widgets>
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="104" showattsigs="601" usesdiagramusefillcolour="0" x="301" linecolour="#ff0000" y="32" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="45" usefillcolor="1" showattributes="1" xmi.id="3" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="104" showattsigs="601" usesdiagramusefillcolour="0" x="211" linecolour="#ff0000" y="22" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="45" usefillcolor="1" showattributes="1" xmi.id="3" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="145" showattsigs="601" usesdiagramusefillcolour="0" x="191" linecolour="#ff0000" y="132" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="5" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="131" showattsigs="601" usesdiagramusefillcolour="0" x="41" linecolour="#ff0000" y="322" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="7" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="127" showattsigs="601" usesdiagramusefillcolour="0" x="352" linecolour="#ff0000" y="436" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="14" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="600" usesdiagramusefillcolour="0" x="46" linecolour="#ff0000" y="481" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="17" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="145" showattsigs="601" usesdiagramusefillcolour="0" x="191" linecolour="#ff0000" y="132" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="5" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="131" showattsigs="601" usesdiagramusefillcolour="0" x="41" linecolour="#ff0000" y="322" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="7" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="127" showattsigs="601" usesdiagramusefillcolour="0" x="352" linecolour="#ff0000" y="436" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="14" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="600" usesdiagramusefillcolour="0" x="46" linecolour="#ff0000" y="481" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="17" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="391" linecolour="#ff0000" y="132" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="90" usefillcolor="1" showattributes="1" xmi.id="20" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="169" showattsigs="601" usesdiagramusefillcolour="0" x="420" linecolour="#ff0000" y="92" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="180" usefillcolor="1" showattributes="1" xmi.id="20" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="134" showattsigs="601" usesdiagramusefillcolour="0" x="196" linecolour="#ff0000" y="322" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="61" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="203" linecolour="#ff0000" y="436" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="76" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="355" linecolour="#ff0000" y="321" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="85" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
     </widgets>
     <messages/>
     <associations>
      <UML:ConceptWidget usesdiagramfillcolour="0" width="134" showattsigs="601" usesdiagramusefillcolour="0" x="196" linecolour="#ff0000" y="322" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="61" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="203" linecolour="#ff0000" y="436" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="76" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="355" linecolour="#ff0000" y="321" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="85" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
     </widgets>
     <messages/>
     <associations>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" widgetbid="3" widgetaid="5" documentation="" type="500" >
+     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="3" widgetaid="5" documentation="" type="500" >
       <linepath>
        <startpoint startx="263" starty="132" />
       <linepath>
        <startpoint startx="263" starty="132" />
-       <endpoint endx="335" endy="77" />
+       <endpoint endx="263" endy="67" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="1" widgetbid="5" widgetaid="7" documentation="" type="500" >
       <linepath>
        <startpoint startx="106" starty="322" />
        <endpoint endx="227" endy="240" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="1" widgetbid="5" widgetaid="7" documentation="" type="500" >
       <linepath>
        <startpoint startx="106" starty="322" />
        <endpoint endx="227" endy="240" />
-       <point x="168" y="282" />
+       <point x="167" y="281" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="7" widgetaid="17" documentation="" type="500" >
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="7" widgetaid="17" documentation="" type="500" >
        <endpoint endx="106" endy="430" />
       </linepath>
      </UML:AssocWidget>
        <endpoint endx="106" endy="430" />
       </linepath>
      </UML:AssocWidget>
-     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" widgetbid="3" widgetaid="20" documentation="" type="500" >
+     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="3" widgetaid="20" documentation="" type="500" >
       <linepath>
       <linepath>
-       <startpoint startx="451" starty="132" />
-       <endpoint endx="370" endy="77" />
+       <startpoint startx="504" starty="92" />
+       <endpoint endx="315" endy="44" />
+       <point x="418" y="44" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="2" widgetbid="5" widgetaid="61" documentation="" type="500" >
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="2" widgetbid="5" widgetaid="61" documentation="" type="500" >
        <listitem open="0" type="815" id="22" label="BIFE_Album" />
        <listitem open="0" type="815" id="57" label="__construct" />
        <listitem open="0" type="814" id="21" label="attrs" />
        <listitem open="0" type="815" id="22" label="BIFE_Album" />
        <listitem open="0" type="815" id="57" label="__construct" />
        <listitem open="0" type="814" id="21" label="attrs" />
+       <listitem open="0" type="815" id="102" label="getDescription" />
+       <listitem open="0" type="815" id="95" label="getList" />
+       <listitem open="0" type="815" id="98" label="getThumbFilename" />
+       <listitem open="0" type="815" id="97" label="makeThumb" />
        <listitem open="0" type="815" id="23" label="render" />
        <listitem open="0" type="815" id="23" label="render" />
+       <listitem open="0" type="815" id="100" label="splitFilename" />
       </listitem>
       <listitem open="0" type="807" id="2" label="Class Diagram" />
       <listitem open="0" type="813" id="5" label="Container" >
       </listitem>
       <listitem open="0" type="807" id="2" label="Class Diagram" />
       <listitem open="0" type="813" id="5" label="Container" >
index 24c0826b890cee5b0e16d81c0f1c58af5f651733..7ec9ca0ee7cc492f0b06673c6e1e4cdf4720533a 100644 (file)
@@ -28,8 +28,6 @@
 // $Id$
 //
 
 // $Id$
 //
 
-require_once 'PEAR.php';
-require_once 'Util.php';
 require_once 'Image/Transform.php';
 require_once 'HTML/Template/Sigma.php';
 
 require_once 'Image/Transform.php';
 require_once 'HTML/Template/Sigma.php';
 
@@ -40,9 +38,9 @@ require_once 'HTML/Template/Sigma.php';
  *
  * @package     Hooks
  * @subpackage  Album
  *
  * @package     Hooks
  * @subpackage  Album
+ * @author      Leandro Lucarella <luca@lugmen.org.ar>
  * @author      Harpo Maxx <harpo@lugmen.org.ar>
  * @author      Groucho Marx <groucho@lugmen.org.ar>
  * @author      Harpo Maxx <harpo@lugmen.org.ar>
  * @author      Groucho Marx <groucho@lugmen.org.ar>
- * @author      Leandro Lucarella <luca@lugmen.org.ar>
  * @version     $Rev$
  * @since       rev 130
  * @access      public
  * @version     $Rev$
  * @since       rev 130
  * @access      public
@@ -145,7 +143,7 @@ class Hook_Album {
     function photo($photo) {
         list($path, $name, $ext) = File_Util::splitFilename($photo);
         $tpl =& new HTML_Template_Sigma('.');
     function photo($photo) {
         list($path, $name, $ext) = File_Util::splitFilename($photo);
         $tpl =& new HTML_Template_Sigma('.');
-        $tpl->loadTemplateFile('photo.html');
+        $tpl->loadTemplateFile('bife_album_photo.html');
         $tpl->setVariable(
             array(
                 'DESC'  => $name,
         $tpl->setVariable(
             array(
                 'DESC'  => $name,
index 07fb437c64509fd5b6f2ac7dd3ca1382d8bf8974..1788ee87b657ac0c2ff9d20370925befe5c26781 100644 (file)
 // +X2C includes
 require_once 'BIFE/Widget.php';
 // ~X2C
 // +X2C includes
 require_once 'BIFE/Widget.php';
 // ~X2C
-require_once 'Album.php';
 
 // +X2C Class 20 :Album
 /**
 
 // +X2C Class 20 :Album
 /**
- * Photo album widget.
-[TODO: Make a better explanation]
+ * Photo album widget. [TODO: Make a better explanation]
  *
  * @access public
  */
  *
  * @access public
  */
@@ -75,17 +73,19 @@ class BIFE_Album extends BIFE_Widget {
      */
     function __construct($attrs) // ~X2C
     {
      */
     function __construct($attrs) // ~X2C
     {
+        // TODO - get defaults from an INI file.
         $defaults = array(
             'DIR'           => '.',
             'RECURSIVE'     => true,
             'THUMBSFORMAT'  => 'jpeg',
             'THUMBSDIR'     => '.thumbs',
         $defaults = array(
             'DIR'           => '.',
             'RECURSIVE'     => true,
             'THUMBSFORMAT'  => 'jpeg',
             'THUMBSDIR'     => '.thumbs',
-            'EXTENSIONS'    => 'png,jpg,jpeg,gif',
+            'EXTENSIONS'    => 'png,jpg,jpeg,PNG,JPG,JPEG',
             'SELECTED'      => '',
             'MAXROWS'       => 0,
             'COLUMNS'       => 4,
         );
         $this->attrs = array_merge($defaults, $attrs);
             'SELECTED'      => '',
             'MAXROWS'       => 0,
             'COLUMNS'       => 4,
         );
         $this->attrs = array_merge($defaults, $attrs);
+        $this->attrs['EXTENSIONS'] = explode(',', $this->attrs['EXTENSIONS']);
     }
     // -X2C
 
     }
     // -X2C
 
@@ -100,12 +100,182 @@ class BIFE_Album extends BIFE_Widget {
      */
     function render(&$template) // ~X2C
     {
      */
     function render(&$template) // ~X2C
     {
-        extract($this->attrs, EXTR_SKIP);
-        $album =& new Hook_Album($DIR, $RECURSIVE, $THUMBSFORMAT, $THUMBSDIR, $EXTENSIONS);
-        return $album->album($template, $SELECTED, $MAXROWS, $COLUMNS);
+        $template->loadTemplateFile('bife_album.html');
+        $template->addBlockFile('ITEMS', 'ITEM', 'bife_album_item.html');
+        $root = $this->attrs['DIR'];
+        $list = $this->getList();
+        $tot  = count($list);
+        $rows = ceil($tot / $this->attrs['COLUMNS']);
+        for ($row = 0; $row < $rows; $row++) {
+            for ($col = 0; $col < $this->attrs['COLUMNS']; $col++) {
+                $cur = $row * $this->attrs['COLUMNS'] + $col;
+                if ($photo = @$list[$cur]) {
+                    $selected = ($photo['file'] === $this->attrs['SELECTED']);
+                    if (is_null($photo['thumb'])) {
+                        $photo['thumb'] = $this->makeThumb($photo['file']);
+                    }
+                    // FIXME - Si no se pudo crear el thumb, devuelve null
+                    // (ver si se agrega otro template para indicar error
+                    // o algo asi).
+                    $template->setVariable(
+                        array(
+                            'PHOTO' => $photo['file'],
+                            'DESC'  => $photo['desc'],
+                            'THUMB' => $photo['thumb'],
+                        )
+                    );
+                    $template->parse('ITEM');
+                } else {
+                    if (!@$empty) {
+                        $template->replaceBlockFile('ITEM',
+                            'bife_album_emptyitem.html', true);
+                        $empty = true;
+                    }
+                    $template->touchBlock('ITEM');
+                    $template->parse('ITEM');
+                }
+            }
+            $template->parse('FILA');
+        }
+        $template->setVariable('DESC', $this->getDescription());
+        return $template->get();
+    }
+    // -X2C
+
+    // +X2C Operation 95
+    /**
+     * Gets a list of photos with their descriptions and thumbnails.
+Returns an array of associative arrays with this keys:
+<ul>
+<li><b>file:</b> Photo filename.</li>
+<li><b>desc:</b> Photo Description.</li>
+<li><b>thumb:</b> Photo thumbnail filename.</li>
+</ul>
+     *
+     * @return array
+     * @access protected
+     */
+    function getList() // ~X2C
+    {
+        $root = $this->attrs['DIR'];
+        $exts = $this->attrs['EXTENSIONS'];
+        $format = $this->attrs['THUMBSFORMAT'];
+        $return = array();
+        
+        $d = dir($root);
+        while (($file = $d->read()) !== false) {
+            list($path, $name, $ext) = $this->splitFilename("$root/$file");
+            if (is_readable("$root/$file") and in_array($ext, $exts)) {
+                $thumb = $this->getThumbFilename("$root/$file");
+                $return[] = array(
+                    'file'  => "$root/$file",
+                    'desc'  => $name,
+                    'thumb' => is_readable($thumb) ? $thumb : null,
+                );
+            }          
+        }
+        $d->close();
+
+        return $return;
+    }
+    // -X2C
+
+    // +X2C Operation 97
+    /**
+     * Creates an image thumbnail, returning his filename.
+     *
+     * @param  string $filename Filename of the image to create the thumb.
+     * @param  int $size Maximum thumbnail size.
+     *
+     * @return string
+     * @access protected
+     */
+    function makeThumb($filename, $size = 100) // ~X2C
+    {
+        $format = $this->attrs['THUMBSFORMAT'];
+        $thumb = $this->getThumbFilename($filename);
+        list($path, $name, $ext) = $this->splitFilename($thumb);
+        $img =& Image_Transform::factory('GD');
+        $img->load($filename);
+        // If image is larger than the maximum size, we resize it.
+        if ($img->img_x > $size or $img->img_y > $size ) {
+            if (!@is_dir($path) and !@mkdir($path)) {
+                return null;
+            }
+            if (PEAR::isError($img)) {
+                return null;
+            }
+            if (!$img->scale($size)) {
+                return null;
+            }
+        }
+        $img->save("$path/$name.$format", $format);
+        $img->free();
+
+        return $thumb;
+    }
+    // -X2C
+
+    // +X2C Operation 98
+    /**
+     * Returns the filename of an image thumb.
+     *
+     * @param  string $filename Filename of the image to get the thumb name.
+     *
+     * @return string
+     * @access protected
+     */
+    function getThumbFilename($filename) // ~X2C
+    {
+        $root = $this->attrs['DIR'];
+        $format = $this->attrs['THUMBSFORMAT'];
+        $thumbsdir = $this->attrs['THUMBSDIR'];
+
+        list($path, $name, $ext) = $this->splitFilename($filename);
+
+        return "$root/$thumbsdir/$name.$format";
+    }
+    // -X2C
+
+    // +X2C Operation 102
+    /**
+     * Returns the description of the album.
+     *
+     * @return string
+     * @access protected
+     */
+    function getDescription() // ~X2C
+    {
+        $root = $this->attrs['DIR'];
+        return @join('', file($file));
+    }
+    // -X2C
+
+    // +X2C Operation 100
+    /**
+     * Splits a filename returning an array with the path, name and extension.
+     *
+     * @param  string $filename Filename to split.
+     *
+     * @return array
+     * @access public
+     * @static
+     */
+    function splitFilename($filename) // ~X2C
+    {
+        $path = explode('/', $filename);
+        $file = array_pop($path);
+        $ext  = '';
+        if (strstr($file, '.')) {
+            preg_match('|([^/]+?)(\.([^\.]*))?$|', $file, $m);
+            $file = @$m[1] . ((@$m[2] == '.' ) ? '.' : '');
+            $ext  = @$m[3];
+        }
+        $dir = count($path) ? join('/', $path) : '';
+        return array($dir, $file, $ext);
     }
     // -X2C
 
 } // -X2C Class :Album
 
     }
     // -X2C
 
 } // -X2C Class :Album
 
-?>
\ No newline at end of file
+?>
index 66be14942130c7f985c6081a25faff7e72b611d2..4598ea1cba7fc2003d80c5de2c2b9644970c3902 100644 (file)
@@ -128,6 +128,9 @@ class BIFE_Parser {
     function startElement($parser, $name, $attrs) // ~X2C
     {
         $class = "BIFE_$name";
     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')) {
         if (class_exists($class)) {
             $obj =& new $class($attrs);
             if (!is_a($obj, 'bife_widget')) {
@@ -259,4 +262,4 @@ class BIFE_Parser {
 
 } // -X2C Class :Parser
 
 
 } // -X2C Class :Parser
 
-?>
+?>
\ No newline at end of file