From: Michael J. Rubinsky Date: Thu, 16 Sep 2010 16:22:32 +0000 (-0400) Subject: Document the supported style properties, add default widget array X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8d6a2b5ab210eddfc283c09d3c14a5129b0cb0c5;p=horde.git Document the supported style properties, add default widget array --- diff --git a/ansel/lib/Style.php b/ansel/lib/Style.php index 162aceb2b..86656d0fe 100644 --- a/ansel/lib/Style.php +++ b/ansel/lib/Style.php @@ -13,7 +13,21 @@ class Ansel_Style { /** - * Holds the style definition + * Holds the style definition. Currently supported properties are: + *
+     *   'thumbstyle'    -  The ImageGenerator to use for thumbnails,
+     *                      e.g. PolaroidThumb or RoundedThumb
+     *   'background'    -  The background color of the view area. If needed,
+     *                      generated images will contain this as their
+     *                      background color.
+     *   'gallery_view'  -  The GalleryRenderer type to use for the gallery
+     *                      view, e.g. GalleryLightbox or Gallery.
+     *   'widgets'       -  An array of widgets and their configuration values
+     *                      to display on the gallery view.
+     *                      e.g. Array('Geotag' => array(),
+     *                                 'Tags' => array('view' => 'gallery'))
+     *   'image_widgets' - @TODO: not yet implemented.
+     * 
* * @var array */ @@ -21,19 +35,24 @@ class Ansel_Style public function __construct($properties) { + $widgets = !empty($properties['widgets']) ? $properties['widgets'] : array(); + unset($properties['widgets']); $this->_properties = array_merge(array('gallery_view' => 'Gallery', - 'background' => 'none'), - $properties); + 'background' => 'none', + 'widgets' => array_merge(array('Actions' => array()), $widgets)), + $properties); } /** - * Return if this style requires PNG support in the browser. + * Return if this style requires PNG support in the browser. Assumes that + * any thumbstyle other than the traditional "Thumb", withOUT a background + * is considered to requre PNG support in the browser. * * @return boolean */ public function requiresPng() { - return true; + return ($this->_properties['thumbstyle'] != 'Thumb' && $this->_properties['background'] == 'none'); } public function getHash($view) diff --git a/ansel/lib/View/GalleryProperties.php b/ansel/lib/View/GalleryProperties.php index d75bbec3f..067f61df3 100644 --- a/ansel/lib/View/GalleryProperties.php +++ b/ansel/lib/View/GalleryProperties.php @@ -238,7 +238,7 @@ class Ansel_View_GalleryProperties 'thumbstyle' => Horde_Util::getFormData('thumbnail_style'), 'background' => Horde_Util::getFormData('background_color'), // temporary hack - 'widgets' => array('Actions' => array(), + 'widgets' => array( 'Tags' => array('view' => 'gallery'), 'OtherGalleries' => array(), 'Geotag' => array(),