Ignore:
Timestamp:
Sep 6, 2009, 10:26:32 AM (15 years ago)
Author:
vdigital
Message:

Partial thumbnail navigation

Location:
extensions/akBookStyle/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/akBookStyle/trunk/css/ak_style_h.css

    r3807 r3829  
    22  margin-right:10%;
    33}
     4
     5.fleft, .fright {
     6  padding:33% 0;
     7}
  • extensions/akBookStyle/trunk/include/akContent.class.php

    r3813 r3829  
    3535
    3636  public function loc_begin_index_thumbnails($images) {
    37     global $template;
     37    global $template, $page;
    3838
    3939    $this->category_url = make_index_url(array('section' => 'category',
    40                                                'category' => $GLOBALS['page']['category'],
    41                                                'start' => $GLOBALS['page']['start']
    42                                                )
    43                                         );
     40                 'category' => $GLOBALS['page']['category'],
     41                 'start' => $GLOBALS['page']['start']
     42                 )
     43          );
    4444    $this->current_picture = $this->getPictureId($images);
    4545
     
    5858    $template->assign('AK_HORIZONTAL_TPL', AK_PLUGIN_TEMPLATE. '/ak_horizontal.tpl');
    5959    $template->assign('AK_THUMBNAILS_LOC', $this->plugin_config->ak_thumbnails_loc);
    60   }
    61 
     60                /* Thumbnail Nav */
     61                if (isset($page['navigation_bar'])) {
     62                        $nav = explode(' | ', $page['navigation_bar']);
     63                        if (substr($nav[1],0,2)=='<a') {
     64                                $this->navbar['URL_PREV'] = substr($nav[1],9,stripos($nav[1],'" rel="'));
     65                        }
     66                        if (substr($nav[3],0,2)=='<a') {
     67                                $this->navbar['URL_NEXT'] = substr($nav[3],9,stripos($nav[3],'" rel="'));
     68                        }
     69                        $template->assign('navbar', $this->navbar);
     70                }
     71}
    6272
    6373  public function loc_end_index_thumbnails($tpl_vars, $images) {
     
    8595  private function getPictureId($images) {
    8696    if ($GLOBALS['conf']['question_mark_in_urls']==false and
    87         isset($_SERVER["PATH_INFO"]) and !empty($_SERVER["PATH_INFO"]) ) {
     97      isset($_SERVER["PATH_INFO"]) and !empty($_SERVER["PATH_INFO"]) ) {
    8898      $rewritten = $_SERVER["PATH_INFO"];
    8999      $rewritten = str_replace('//', '/', $rewritten);
     
    91101      $rewritten = '';
    92102      foreach (array_keys($_GET) as $keynum => $key) {
    93         $rewritten = $key;
    94         break;
     103        $rewritten = $key;
     104        break;
    95105      }
    96106    }
    97107    $rewritten = make_index_url().$rewritten;
    98108    $pattern = sprintf('`^%s/(?:start\-\d+/)?picture/(\d+)$`',
    99                        str_replace('?', '\?', $this->category_url)
    100                        );
     109           str_replace('?', '\?', $this->category_url)
     110           );
    101111
    102112    if (preg_match($pattern, $rewritten, $matches)) {
    103113      foreach ($images as $index => $image) {
    104         if ($image['id']==$matches[1]) {
    105           return $index;
    106         }
     114        if ($image['id']==$matches[1]) {
     115          return $index;
     116        }
    107117      }
    108118      return false;
  • extensions/akBookStyle/trunk/template/ak_horizontal.tpl

    r3814 r3829  
     1{assign var=AK_THUMB_COUNT value=$thumbnails|@count}
     2{assign var=AK_BY_COLUMNS value=$AK_THUMB_COUNT/$AK_BY_LINE|@round}
    13<td>
    2   {if !empty($navbar) and isset($navbar.URL_PREV)}
    3   <div class="navbar fleft">
    4     <a class="navButton" href="{$navbar.URL_PREV}"
    5        title="{'previous_page'|@translate}">
    6       <img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png"
    7            class="button" alt="{'previous_page'|@translate}">
    8     </a>       
    9   </div>
    10   {/if}
    11   {if !empty($navbar) and isset($navbar.URL_NEXT)}
    12   <div class="navbar fright">
    13     <a class="navButton" href="{$navbar.URL_NEXT}"
    14        title="{'next_page'|@translate}">
    15       <img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png"
    16            class="button" alt="{'next_page'|@translate}">
    17     </a>
    18   </div>
    19   {/if}
    20 
    214  <table class="thumbnails">
    22     {assign var=AK_THUMB_COUNT value=$thumbnails|@count}
    23     {assign var=AK_BY_COLUMNS value=$AK_THUMB_COUNT/$AK_BY_LINE|@round}
    245    {foreach from=$thumbnails item=thumbnail name=tn}
    256    {if ($smarty.foreach.tn.index % $AK_BY_COLUMNS == 0)}
    267    <tr class="nline">
     8      {/if}
     9      {if ($smarty.foreach.tn.first)}
     10          <td class="ncol" rowspan="{$AK_BY_LINE}">{* Left thumbnail navigation
     11          *}{if !empty($navbar) and isset($navbar.URL_PREV)}{*
     12            *}<div class="navbar fright">
     13              <a class="navButton" href="{$navbar.URL_PREV}"
     14                 title="{'previous_page'|@translate}">
     15                <img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png"
     16                     class="button" alt="{'previous_page'|@translate}">
     17              </a>       
     18            </div>
     19          {/if}
     20          </td>
    2721      {/if}
    2822      <td class="ncol">
     
    3630        </div>
    3731      </td>
     32      {if ($smarty.foreach.tn.index == $AK_BY_COLUMNS) or ($smarty.foreach.tn.index < $AK_BY_COLUMNS and $smarty.foreach.tn.last)}
     33          <td class="ncol" rowspan="{$AK_BY_LINE}">{* Right thumbnail navigation *}
     34          {if !empty($navbar) and isset($navbar.URL_NEXT)}
     35            <div class="navbar fleft">
     36              <a class="navButton" href="{$navbar.URL_NEXT}"
     37                 title="{'next_page'|@translate}">
     38                <img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png"
     39                     class="button" alt="{'next_page'|@translate}">
     40              </a>
     41            </div>
     42          {/if}
     43          </td>
     44      {/if}
     45
    3846      {if ($smarty.foreach.tn.iteration % $AK_BY_COLUMNS == 0) or $smarty.foreach.tn.last }
    3947    </tr>
  • extensions/akBookStyle/trunk/template/ak_vertical.tpl

    r3814 r3829  
    1     {if !empty($navbar) and isset($navbar.URL_PREV)}
    2     <td class="navbar fleft">
    3       <a class="navButton" href="{$navbar.URL_PREV}"
    4          title="{'previous_page'|@translate}">
    5         <img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png"
    6              class="button" alt="{'previous_page'|@translate}">
    7       </a>       
    8     </td>
    9     {/if}
    101    <td>
    112      <table class="thumbnails">
     3        <tr class="nline"> {* Top thumbnail navigation *}
     4          <td class="ncol" colspan="{$AK_BY_LINE}">
     5          {if !empty($navbar) and isset($navbar.URL_PREV)}
     6            <div class="navbar fleft">
     7              <a class="navButton" href="{$navbar.URL_PREV}"
     8                 title="{'previous_page'|@translate}">
     9                <img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png"
     10                     class="button" alt="{'previous_page'|@translate}">
     11              </a>       
     12            </div>
     13          {/if}
     14          {if !empty($navbar) and isset($navbar.URL_NEXT)}
     15            <div class="navbar fright">
     16              <a class="navButton" href="{$navbar.URL_NEXT}"
     17                 title="{'next_page'|@translate}">
     18                <img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png"
     19                     class="button" alt="{'next_page'|@translate}">
     20              </a>
     21            </div>
     22          {/if}
     23          </td>
     24        </tr>
    1225        {foreach from=$thumbnails item=thumbnail name=tn}
    1326        {if $smarty.foreach.tn.index % $AK_BY_LINE == 0}
     
    1528          {/if}
    1629          <td class="ncol">
    17             <div class="clipwrapper" style="width:{$AK_THUMBNAIL_SIZE}px;height:{$AK_THUMBNAIL_SIZE}px">
    18               <div class="clip" style="clip:rect({$thumbnail.CLIP_TOP}px {$thumbnail.CLIP_RIGHT}px {$thumbnail.CLIP_BOTTOM}px {$thumbnail.CLIP_LEFT}px);top:-{$thumbnail.CLIP_TOP}px;left:-{$thumbnail.CLIP_LEFT}px">
    19                 <a href="{$thumbnail.AK_URL}" class="load">
    20                   <img class="thumbnail" src="{$thumbnail.TN_SRC}"
    21                        alt="{$thumbnail.TN_ALT}" title="{$thumbnail.TN_TITLE}">
    22                 </a>
    23               </div>
    24             </div>
     30            <div class="clipwrapper" style="width:{$AK_THUMBNAIL_SIZE}px;height:{$AK_THUMBNAIL_SIZE}px">
     31              <div class="clip" style="clip:rect({$thumbnail.CLIP_TOP}px {$thumbnail.CLIP_RIGHT}px {$thumbnail.CLIP_BOTTOM}px {$thumbnail.CLIP_LEFT}px);top:-{$thumbnail.CLIP_TOP}px;left:-{$thumbnail.CLIP_LEFT}px">
     32                <a href="{$thumbnail.AK_URL}" class="load">
     33                  <img class="thumbnail" src="{$thumbnail.TN_SRC}" alt="{$thumbnail.TN_ALT}" title="{$thumbnail.TN_TITLE}">
     34                </a>
     35              </div>
     36            </div>
    2537          </td>
    2638        {if ($smarty.foreach.tn.iteration % $AK_BY_LINE == 0) or $smarty.foreach.tn.last }
     
    2840        {/if}
    2941        {/foreach}
    30       </table> {* end of Thumbnails *}
     42        <tr class="nline">  {* Bottom thumbnail navigation *}
     43          <td class="ncol" colspan="{$AK_BY_LINE}">
     44          {if !empty($navbar) and isset($navbar.URL_PREV)}
     45            <div class="navbar fleft">
     46              <a class="navButton" href="{$navbar.URL_PREV}"
     47                 title="{'previous_page'|@translate}">
     48                <img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png"
     49                     class="button" alt="{'previous_page'|@translate}">
     50              </a>       
     51            </div>
     52          {/if}
     53          {if !empty($navbar) and isset($navbar.URL_NEXT)}
     54            <div class="navbar fright">
     55              <a class="navButton" href="{$navbar.URL_NEXT}"
     56                 title="{'next_page'|@translate}">
     57                <img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png"
     58                     class="button" alt="{'next_page'|@translate}">
     59              </a>
     60            </div>
     61          {/if}
     62          </td>
     63        </tr>
     64        </table> {* end of Thumbnails *}
    3165    </td>
    32     {if !empty($navbar) and isset($navbar.URL_NEXT)}
    33     <td class="navbar fright">
    34       <a class="navButton" href="{$navbar.URL_NEXT}"
    35          title="{'next_page'|@translate}">
    36         <img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png"
    37              class="button" alt="{'next_page'|@translate}">
    38       </a>
    39     </td>
    40     {/if}
    41 
Note: See TracChangeset for help on using the changeset viewer.