Update slideshow output for no titles
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 2 May 2014 19:29:19 +0000 (19:29 +0000)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 2 May 2014 19:29:19 +0000 (19:29 +0000)
If the titles are turned off then keep nivo from outputting them.
Markup changes

Toolkit/RotatingImages/Decorator/Anchor.php
Toolkit/RotatingImages/Decorator/Image.php
Toolkit/RotatingImages/Decorator/User.php
Toolkit/RotatingImages/Forms/EditImage.php
Toolkit/RotatingImages/templates/rotatingImages.html
admin/rotatingImages.php

index e83266e..5b19eeb 100644 (file)
  * @link      <>
  */
 class Toolkit_RotatingImages_Decorator_Anchor
-       extends Toolkit_RotatingImages_Decorator_DecoratorAbstract
+    extends Toolkit_RotatingImages_Decorator_DecoratorAbstract
 {
-       //      {{{     properties
+    //  {{{ properties
 
     /**
      * The image decorator object
      * @var    Toolkit_RotatingImages_Decorator_Image
      * @access private
      */
-       private $_imageDecorator;
+    private $_imageDecorator;
 
-       //      }}}
-       //  {{{ __construct()
+    //  }}}
+    //  {{{ __construct()
 
     /**
      * constructor
      *
      * create a shallow copy of the image passed in so we can manipulate
-        * it all we want and not worry about affecting the original object
+     * it all we want and not worry about affecting the original object
      *
      * @param Toolkit_RotatingImages_Decorator_Image $imageDecorator Object to decorate image markup
      * @param Toolkit_RotatingImages_Image           $image          Node to be decorated
-        *
+     *
      * @return void
      * @access protected
      */
-       public function __construct(
-               Toolkit_RotatingImages_Decorator_Image $imageDecorator,
-               Toolkit_RotatingImages_Image $image
-       ) {
-               $this->_imageDecorator = $imageDecorator;
-               //      Clone the node object so we keep original properties the same
-               $this->image = clone $image;
-       }
+    public function __construct(
+        Toolkit_RotatingImages_Decorator_Image $imageDecorator,
+        Toolkit_RotatingImages_Image $image
+    ) {
+        $this->_imageDecorator = $imageDecorator;
+        //  Clone the node object so we keep original properties the same
+        $this->image = clone $image;
+    }
 
-       //  }}}
+    //  }}}
     //  {{{ toHtml()
 
     /**
@@ -70,16 +70,16 @@ class Toolkit_RotatingImages_Decorator_Anchor
      * @return string HTML output of the anchor
      * @access public
      */
-       public function toHtml()
-       {
-               $anchorFormat = '<a href="%s" %s>%s</a>';
-               return sprintf(
-                       $anchorFormat,
-                       $this->image->getUrl(),
+    public function toHtml()
+    {
+        $anchorFormat = '<a href="%s" %s>%s</a>';
+        return sprintf(
+            $anchorFormat,
+            $this->image->getUrl(),
             $this->image->getExternal() ? 'class="external"' : '',
-                       $this->_imageDecorator->toHtml()
-               );
-       }
+            $this->_imageDecorator->toHtml()
+        );
+    }
 
     //  }}}
     public function getTitle()
index 5f872ab..5b1a62e 100644 (file)
@@ -57,19 +57,42 @@ class Toolkit_RotatingImages_Decorator_Image
      */
     public function toHtml()
     {
-        $format = '<img '
-            . 'width="%s" '
-            . 'height="%s" '
-            . 'src="%s" '
-            . 'alt="" '
-            . 'title="#event-%d">';
-        return sprintf(
-            $format,
-            $this->image->getWidth(),
-            $this->image->getHeight(),
-            ROTATING_IMAGE_RESIZED . $this->image->getImage(),
-            $this->image->getId()
+        $rotatingImagesConf = new Config;
+        $rotatingImagesRoot =& $rotatingImagesConf->parseConfig(
+            BASE . 'Toolkit/RotatingImages/config.ini',
+            'IniFile'
         );
+        $useTitles = $rotatingImagesRoot
+            ->getItem('section','conf')
+            ->getItem('directive', 'useTitles')
+            ->getContent();
+        if ($useTitles) {
+            $format = '<img '
+                . 'width="%s" '
+                . 'height="%s" '
+                . 'src="%s" '
+                . 'alt="" '
+                . 'title="#event-%d">';
+            return sprintf(
+                $format,
+                $this->image->getWidth(),
+                $this->image->getHeight(),
+                ROTATING_IMAGE_RESIZED . $this->image->getImage(),
+                $this->image->getId()
+            );
+        } else {
+            $format = '<img '
+                . 'width="%s" '
+                . 'height="%s" '
+                . 'src="%s" '
+                . 'alt="">';
+            return sprintf(
+                $format,
+                $this->image->getWidth(),
+                $this->image->getHeight(),
+                ROTATING_IMAGE_RESIZED . $this->image->getImage()
+            );
+        }
     }
 
     //  }}}
index af07f71..0eee3a0 100644 (file)
@@ -92,6 +92,15 @@ class Toolkit_RotatingImages_Decorator_User
      */
     public function toHtml()
     {
+        $rotatingImagesConf = new Config;
+        $rotatingImagesRoot =& $rotatingImagesConf->parseConfig(
+            BASE . 'Toolkit/RotatingImages/config.ini',
+            'IniFile'
+        );
+        $useTitles = $rotatingImagesRoot
+            ->getItem('section','conf')
+            ->getItem('directive', 'useTitles')
+            ->getContent();
         $glmAppBaseUrl = MEDIA_APP_BASE_URL;
         $baseUrl       = MEDIA_BASE_URL;
 
@@ -111,6 +120,9 @@ class Toolkit_RotatingImages_Decorator_User
         $tpl->compile('rotatingImages.html');
         $page = new stdClass();
         $page->images = array();
+        $page->useTitles = $useTitles;
+        //var_dump($page);
+        //exit;
         $images = '';
         foreach ($this->_decorators as $i) {
             $images .= $i->toHtml();
index ba8da0b..1f20bdf 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-//     vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
+//  vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
 
 /**
  * File Doc Comment
@@ -10,9 +10,9 @@
  * @category RotatingImages
  * @package  Toolkit_RotatingImages
  * @author   Jamie Kahgee <steve@gaslightmedia.com>
- * @license     http://www.gaslightmedia.com Gaslightmedia
+ * @license  http://www.gaslightmedia.com Gaslightmedia
  * @version  CVS: $Id: EditImage.php,v 1.2 2010/08/15 18:40:57 jamie Exp $
- * @link        http://demo.gaslightmedia.com
+ * @link     http://demo.gaslightmedia.com
  */
 require_once BASE . 'Toolkit/Forms/Rules/Image.php';
 require_once BASE . 'Toolkit/Forms/Rules/Url.php';
@@ -26,8 +26,8 @@ require_once BASE . 'Toolkit/Forms/Rules/Url.php';
  * @package   Toolkit_RotatingImages
  * @author    Jamie Kahgee <steve@gaslightmedia.com>
  * @copyright 2008 Gaslight Media
- * @license      http://www.gaslightmedia.com Gaslightmedia
- * @link         http://demo.gaslightmedia.com
+ * @license   http://www.gaslightmedia.com Gaslightmedia
+ * @link      http://demo.gaslightmedia.com
  */
 class Toolkit_RotatingImages_Forms_EditImage
     extends Toolkit_FormBuilder
@@ -79,12 +79,12 @@ class Toolkit_RotatingImages_Forms_EditImage
     {
         $c = array();
 
-        //     If we are adding a new banner
+        //  If we are adding a new banner
         if (!filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT)) {
             $c['current_image_thumb'] = 'Image not yet uploaded';
         }
 
-        //     If the form has been submitted and a new image was uploaded
+        //  If the form has been submitted and a new image was uploaded
         $currImg = $this->getSubmitValue('image');
         if ($this->isSubmitted() && !empty($currImg)) {
             $img                      = '<img src="%s%s">';
@@ -135,7 +135,7 @@ class Toolkit_RotatingImages_Forms_EditImage
         $this->setupDefaults($d);
     }
 
-    // }}}
+    //  }}}
     //  {{{ configureElements()
 
     /**
@@ -153,8 +153,8 @@ class Toolkit_RotatingImages_Forms_EditImage
             ->getItem('directive', 'useTitles')
             ->getContent();
 
-        //     All Grouped Elements are created here.
-        //     All Elements are created here.  This includes group element definitions.
+        //  All Grouped Elements are created here.
+        //  All Elements are created here.  This includes group element definitions.
         $e[] = array(
             'type'    => 'advcheckbox',
             'req'     => false,
@@ -227,8 +227,8 @@ class Toolkit_RotatingImages_Forms_EditImage
         $this->setupElements($e);
     }
 
-    // }}}
-    // {{{     configureFilters()
+    //  }}}
+    //  {{{ configureFilters()
 
     /**
      * Configure how the form elements should act when being submitted
@@ -251,8 +251,8 @@ class Toolkit_RotatingImages_Forms_EditImage
         $this->setupFilters($f);
     }
 
-    // }}}
-    // {{{     configureForm()
+    //  }}}
+    //  {{{ configureForm()
 
     /**
      * Configure a form so we can use it
@@ -272,8 +272,8 @@ class Toolkit_RotatingImages_Forms_EditImage
         $this->configureConstants();
     }
 
-    // }}}
-    // {{{     configureRules()
+    //  }}}
+    //  {{{ configureRules()
 
     /**
      * Configure how the form elements should act
@@ -339,8 +339,8 @@ class Toolkit_RotatingImages_Forms_EditImage
         $this->setupRules($r);
     }
 
-    // }}}
-    // {{{     setupRenderers()
+    //  }}}
+    //  {{{ setupRenderers()
 
     /**
      * Custom rendering templates for special fields on the form
@@ -356,17 +356,17 @@ class Toolkit_RotatingImages_Forms_EditImage
         $error    = '<!-- BEGIN error --><div class="req"> {error} </div><!-- END error -->';
         $renderer->setElementTemplate(
             '<tr align="center">
-                               <td colspan="2">' . $required . '{label}' . $error . '{element}</td>
-                       </tr>', 'submit'
+                <td colspan="2">' . $required . '{label}' . $error . '{element}</td>
+            </tr>', 'submit'
         );
         $renderer->setElementTemplate(
             '<tr align="center">
-                               <td colspan="2">' . $required . '{label}' . $error . '{element}</td>
-                       </tr>', 'delete'
+                <td colspan="2">' . $required . '{label}' . $error . '{element}</td>
+            </tr>', 'delete'
         );
     }
 
-    // }}}
+    //  }}}
     //  {{{ toHtml()
 
     /**
index 7a63826..88f6e4f 100644 (file)
     top: -10px;
     right: 10px;
     }
+.theme-default .nivoSlider {
+    background: none;
+    box-shadow: 0  0 0 0 transparent;
+    margin-bottom: 10px;
+    position: relative;
+}
 #slider-wrapper {
     width: 100%;
     height: auto;
     {end:}
     </div>
 </div>
+{if:useTitles}
 <div flexy:foreach="images,image" id="event-{image.getId():h}" class="nivo-html-caption">
     {if:image.getTitle()}<strong>{image.getTitle()}</strong>{end:}
     {if:image.getDescr()}<span>{image.getDescr()}</span>{end:}
 </div>
 {end:}
+{end:}
index 5b4a1c5..514a991 100644 (file)
@@ -2,8 +2,8 @@
 require_once '../setup.phtml';
 $rotatingImagesConf = new Config;
 $rotatingImagesRoot =& $rotatingImagesConf->parseConfig(
-       BASE . 'Toolkit/RotatingImages/config.ini',
-       'IniFile'
+    BASE . 'Toolkit/RotatingImages/config.ini',
+    'IniFile'
 );
 
 $registry = new Toolkit_Registry;
@@ -15,8 +15,8 @@ $registry->router->setPath(BASE . 'Toolkit/RotatingImages');
 $registry->router->setApplication('RotatingImages');
 
 $navigation = new Toolkit_RotatingImages_Navigation(
-       new HTML_Menu(),
-       new HTML_Menu_DirectRenderer()
+    new HTML_Menu(),
+    new HTML_Menu_DirectRenderer()
 );
 
 $navArray = $navigation->getNavStructure($rotatingImagesRoot);
@@ -25,18 +25,18 @@ $navHtml  = $navigation->renderPageNav($navArray, 'rows');
 $html = $registry->router->loader();
 
 $appName
-       = $rotatingImagesRoot->getItem('section', 'conf')
-       ->getItem('directive', 'applicationName')
-       ->getContent();
+    = $rotatingImagesRoot->getItem('section', 'conf')
+    ->getItem('directive', 'applicationName')
+    ->getContent();
 
 if (filter_input(INPUT_GET, 'ac') == 'preview') {
-       GLM_TOOLBOX::top('', '', null, false);
-       echo $html;
-       GLM_TOOLBOX::footer();
+    GLM_TOOLBOX::top('', '', null, false);
+    echo $html;
+    GLM_TOOLBOX::footer();
 } else {
-       GLM_TOOLBOX::top($appName, '');
-       echo $navHtml;
-       echo $html;
-       GLM_TOOLBOX::footer();
+    GLM_TOOLBOX::top($appName, '');
+    echo $navHtml;
+    echo $html;
+    GLM_TOOLBOX::footer();
 }
 ?>