[ansel] Fix for Page Browsing

Mike Bydalek mbydalek at zivix.com
Sat Nov 15 16:53:21 PST 2003


Just checked out the latest code and found an error when trying to go from Page
1 to page 2 in a gallery.

Attached is a patch to fix this.

-Mike
-------------- next part --------------
*** Ansel.php   Sat Nov 15 19:49:25 2003
--- Ansel.php.new       Sat Nov 15 19:49:10 2003
***************
*** 211,217 ****
  
          // Create the '<< Prev' link if we are not on the first page.
          if ($current_page > 0) {
!             $html .= '<td>' . Horde::link(Util::addParameter($url, 'page', $current_page - 1), _("Previous Page"));
              $html .= Horde::img('nav/left.gif', _("Previous Page"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '</a></td>';
          }
  
--- 211,217 ----
  
          // Create the '<< Prev' link if we are not on the first page.
          if ($current_page > 0) {
!             $html .= '<td>' . Horde::link(Horde::applicationUrl(Util::addParameter($url, 'page', $current_page - 1)), _("Previous Page"));
              $html .= Horde::img('nav/left.gif', _("Previous Page"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '</a></td>';
          }
  
***************
*** 221,227 ****
  
          // Create bottom '[x-y]' link if necessary.
          if ($bottom > 1) {
!             $html .= '<td>' . Horde::link(Util::addParameter($url, 'page', $bottom - 1)) . '[' . ($bottom - $page_limit + 1) . '-' . $bottom . ']</a></td>';
          }
  
          // Create links to individual pages between limits.
--- 221,227 ----
  
          // Create bottom '[x-y]' link if necessary.
          if ($bottom > 1) {
!             $html .= '<td>' . Horde::link(Horde::applicationUrl(Util::addParameter($url, 'page', $bottom - 1))) . '[' . ($bottom - $page_limit + 1) . '-' . $bottom . ']</a></td>';
          }
  
          // Create links to individual pages between limits.
***************
*** 229,247 ****
              if ($i == $current_page) {
                  $html .= '<td><b>' . ($i + 1) . '</b></td>';
              } elseif ($i >= 0 && $i <= $pages) {
!                 $html .= '<td>' . Horde::link(Util::addParameter($url, 'page', $i)) . ($i + 1) . '</a></td>';
              }
          }
  
          // Create top '[x-y]' link if necessary.
          if ($top < $pages) {
              $last = $top + $page_limit < $pages ? $top + $page_limit + 1 : $pages + 1;
!             $html .= '<td>' . Horde::link(Util::addParameter($url, 'page', $top + 1)) . '[' . ($top + 2) . '-' . $last . ']</a></td>';
          }
  
          // Create the 'Next>>' link if we are not on the last page.
          if ($current_page < $pages) {
!             $html .= '<td>' . Horde::link(Util::addParameter($url, 'page', $current_page + 1), _("Next Page"));
              $html .= Horde::img('nav/right.gif', _("Next Page"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '</a></td>';
          }
  
--- 229,247 ----
              if ($i == $current_page) {
                  $html .= '<td><b>' . ($i + 1) . '</b></td>';
              } elseif ($i >= 0 && $i <= $pages) {
!                 $html .= '<td>' . Horde::link(Horde::applicationUrl(Util::addParameter($url, 'page', $i))) . ($i + 1) . '</a></td>';
              }
          }
  
          // Create top '[x-y]' link if necessary.
          if ($top < $pages) {
              $last = $top + $page_limit < $pages ? $top + $page_limit + 1 : $pages + 1;
!             $html .= '<td>' . Horde::link(Horde::applicationUrl(Util::addParameter($url, 'page', $top + 1))) . '[' . ($top + 2) . '-' . $last . ']</a></td>';
          }
  
          // Create the 'Next>>' link if we are not on the last page.
          if ($current_page < $pages) {
!             $html .= '<td>' . Horde::link(Horde::applicationUrl(Util::addParameter($url, 'page', $current_page + 1), _("Next Page")));
              $html .= Horde::img('nav/right.gif', _("Next Page"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '</a></td>';
          }
  


More information about the ansel mailing list