Ignore:
Timestamp:
May 1, 2007, 3:57:52 PM (17 years ago)
Author:
rub
Message:

Issue 0000684: History [Search] - Add a thumbnail display

o Display choice can be selected
o Display choice is saved on on cookie
o Small improvement picture link (hoverbox on all the link, alt&title on classic mode)
o New cookie functions and use

Enhance computing method of script_basename function.

http://forum.phpwebgallery.net/viewtopic.php?pid=58258#p58258

Merge BSF 1988:1989 into branch-1_7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/history.php

    r1991 r1992  
    2929 */
    3030
    31 // echo '<pre>$_POST:
    32 // '; print_r($_POST); echo '</pre>';
    33 // echo '<pre>$_GET:
    34 // '; print_r($_GET); echo '</pre>';
    35 
    3631// +-----------------------------------------------------------------------+
    3732// |                              functions                                |
     
    6055
    6156$types = array('none', 'picture', 'high', 'other');
     57$display_thumbnails = array('no_display_thumbnail', 'display_thumbnail_classic', 'display_thumbnail_hoverbox');
    6258
    6359// +-----------------------------------------------------------------------+
     
    114110      );
    115111  }
     112
     113  $search['fields']['display_thumbnail'] = $_POST['display_thumbnail'];
     114  // Display choise are also save to one cookie
     115  pwg_set_cookie_var('history_display_thumbnail', $_POST['display_thumbnail']);
    116116
    117117  // TODO manage inconsistency of having $_POST['image_id'] and
     
    561561          )
    562562        );
    563      
    564       // <a class="thumbnail" href="#thumb">(1258)<span><img src="./galleries/category/thumbnail/th-dsc1258.png"></span></a>
     563
    565564      $element = array(
    566565           'id' => $line['image_id'],
     
    569568           'tn_ext' => $tn_ext_of_image[$line['image_id']],
    570569           );
    571       $image_string = '';   
    572       if (!isset($conf['history_no_thumb']) or $conf['history_no_thumb']) {
    573         $thumb_mode = "over";
    574         if (isset($conf['history_no_hover']) and $conf['history_no_hover']) {
    575           $thumb_mode = "thumbnail";
    576         }
    577         $image_string = '<a class="'.$thumb_mode.'" href="#thumb">'   
    578                       .'('.$line['image_id'].') <span><img src="'
    579                       . get_thumbnail_url( $element )
    580                       .'"></span></a><a href="'.$picture_url.'">';
    581       }
    582       else {
    583         $image_string= '<a href="'.$picture_url.'">';
    584         $image_string.= '('.$line['image_id'].')';
    585       }
    586      
     570
     571      $image_title = '('.$line['image_id'].')';
     572
    587573      if (isset($label_of_image[$line['image_id']]))
    588574      {
    589         $image_string.= ' '.$label_of_image[$line['image_id']];
     575        $image_title.= ' '.$label_of_image[$line['image_id']];
    590576      }
    591577      else
    592578      {
    593         $image_string.= ' unknown filename';
     579        $image_title.= ' unknown filename';
     580      }
     581
     582      $image_string = '';
     583
     584      switch ($page['search']['fields']['display_thumbnail'])
     585      {
     586        case 'no_display_thumbnail':
     587        {
     588          $image_string= '<a href="'.$picture_url.'">'.$image_title.'</a>';
     589          break;
     590        }
     591        case 'display_thumbnail_classic':
     592        {
     593          $image_string =
     594            '<a class="thumbnail" href="'.$picture_url.'">'
     595            .'<span><img src="'.get_thumbnail_url($element)
     596            .'" alt="'.$image_title.'" title="'.$image_title.'">'
     597            .'</span></a>';
     598          break;
     599        }
     600        case 'display_thumbnail_hoverbox':
     601        {
     602          $image_string =
     603            '<a class="over" href="'.$picture_url.'">'
     604            .'<span><img src="'.get_thumbnail_url($element)
     605            .'" alt="'.$image_title.'" title="'.$image_title.'">'
     606            .'</span>'.$image_title.'</a>';
     607          break;
     608        }
    594609      }
    595610    }
     
    727742  $form['image_id'] = @$page['search']['fields']['image_id'];
    728743  $form['filename'] = @$page['search']['fields']['filename'];
     744
     745  $form['display_thumbnail'] = @$page['search']['fields']['display_thumbnail'];
    729746}
    730747else
     
    736753  $form['start_day']   = $form['end_day']   = date('j');
    737754  $form['types'] = $types;
     755  // Hoverbox by default
     756  $form['display_thumbnail'] =
     757    pwg_get_cookie_var('history_display_thumbnail', $display_thumbnails[2]);
    738758}
    739759
     
    810830    );
    811831}
    812  
     832
     833foreach ($display_thumbnails as $display_thumbnail)
     834{
     835  $selected = '';
     836 
     837  if ($display_thumbnail === $form['display_thumbnail'])
     838  {
     839    $selected = 'selected="selected"';
     840  }
     841 
     842  $template->assign_block_vars(
     843    'display_thumbnail',
     844    array(
     845      'VALUE' => $display_thumbnail,
     846      'CONTENT' => l10n($display_thumbnail),
     847      'SELECTED' => $selected,
     848      )
     849    );
     850}
     851
    813852// +-----------------------------------------------------------------------+
    814853// |                           html code display                           |
Note: See TracChangeset for help on using the changeset viewer.