use the tilesperrow/page value if it exists
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 22 Sep 2010 21:16:29 +0000 (17:16 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 23 Sep 2010 15:53:26 +0000 (11:53 -0400)
ansel/lib/View/List.php
ansel/templates/view/list.inc

index c351faa..389dd4a 100644 (file)
@@ -85,7 +85,7 @@ class Ansel_View_List extends Ansel_View_Base
         } else {
             $this->_page = Horde_Util::getFormData('page', 0);
         }
-        $this->_g_perPage = $prefs->getValue('tilesperpage');
+        $this->_g_perPage = $this->tilesperpage ? $this->tilesperpage : $prefs->getValue('tilesperpage');
 
         // If we are calling from the api, we can just pass a list of gallery
         // ids instead of doing grouping stuff.
@@ -235,6 +235,7 @@ class Ansel_View_List extends Ansel_View_Base
                                                        'page' => $this->_page));
             }
 
+            $tilesperrow = $this->tilesperrow ? $this->tilesperrow : $prefs->getValue('tilesperrow');
             // Get top-level / default gallery style.
             if (empty($this->_params['style'])) {
                 $style = Ansel::getStyleDefinition($prefs->getValue('default_gallerystyle'));
@@ -242,7 +243,7 @@ class Ansel_View_List extends Ansel_View_Base
                 $style = Ansel::getStyleDefinition($this->_params['style']);
             }
             $count = 0;
-            $width = round(100 / ($this->tilesperrow ? $this->tilesperrow : $prefs->getValue('tilesperrow')));
+            $width = round(100 / $tilesperrow);
 
             Horde::startBuffer();
             include ANSEL_TEMPLATES . '/view/list.inc';
index 14abb68..746e349 100644 (file)
 <table width="<?php echo ($this->countWidgets() ? 73 : 100) ?>%" style="background-color:<?php echo $style->background ?>;">
  <tr>
  <?php
- $tilesperrow = $prefs->getValue('tilesperrow');
  $cellwidth = round(100 / $tilesperrow);
  $count = 0;
  foreach ($this->_galleryList as $galleryId => $gallery) {
      echo '<td width="' . $width . '%" class="ansel-tile">' . $gallery->getTile(null, $style, false, $this->_params) . '</td>';
-     if (!(++$count % $prefs->getValue('tilesperrow'))) {
+     if (!(++$count % $tilesperrow)) {
          if ($count < $this->_numGalleries) {
              echo '</tr><tr>';
          }
      }
  }
- $tilesperrow = $prefs->getValue('tilesperrow');
  while ($count++ % $tilesperrow) {
      echo '<td width="' . $width . '%">&nbsp;</td>';
  } ?>