Changeset 531 for trunk/picture.php


Ignore:
Timestamp:
Sep 23, 2004, 6:42:11 PM (20 years ago)
Author:
gweltas
Message:
  • New template for picture.tpl
  • Creation of a menu bar in the picture display
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r511 r531  
    194194
    195195  $picture[$i]['url'] = PHPWG_ROOT_PATH.'picture.php';
    196   $picture[$i]['url'].= get_query_string_diff(array('image_id','add_fav'));
     196  $picture[$i]['url'].= get_query_string_diff(array('image_id','add_fav',
     197                          'slideshow'));
    197198  $picture[$i]['url'].= '&image_id='.$row['id'];
    198199}
     
    208209$url_admin.= '&cat_id='.$page['cat'];
    209210$url_admin.= '&image_id='.$_GET['image_id'];
     211
     212$url_slide = $picture['current']['url'].'&slideshow='.$conf['slideshow_period'];
    210213//----------------------------------------------------------- rate registration
    211214if (isset($_GET['rate'])
     
    374377$title =  $picture['current']['name'];
    375378$refresh = 0;
    376 if ( isset( $_GET['slideshow'] ) and $next )
     379if ( isset( $_GET['slideshow'] ) and $has_next )
    377380{
    378381  $refresh= $_GET['slideshow'];
     
    386389  $title_img = replace_space(get_cat_display_name( $page['cat_name'], " > "));
    387390  $n = $page['num'] + 1;
    388   $title_nb = "Photo".' '.$n.'/';
    389   $title_nb.= $page['cat_nb_images'];
    390   //$title_img.= $picture['current']['name'];
     391  $title_nb = $n.'/'.$page['cat_nb_images'];
    391392}
    392393else if ( $page['cat'] == 'search' )
     
    410411$picture_size = get_picture_size( $original_width, $original_height,
    411412                                  $user['maxwidth'], $user['maxheight'] );
     413
     414// metadata
     415if ($conf['show_exif'] or $conf['show_iptc'])
     416{
     417  $metadata_showable = true;
     418}
     419else
     420{
     421  $metadata_showable = false;
     422}
     423
     424$url_metadata = PHPWG_ROOT_PATH.'picture.php';
     425$url_metadata .=  get_query_string_diff(array('add_fav', 'slideshow', 'show_metadata'));
     426if ($metadata_showable and !isset($_GET['show_metadata']))
     427{
     428  $url_metadata.= '&show_metadata=1';
     429}
    412430                                 
    413431include(PHPWG_ROOT_PATH.'include/page_header.php');
     
    438456  'L_DOWNLOAD' => $lang['download'],
    439457  'L_DOWNLOAD_HINT' => $lang['download_hint'],
    440   'L_PICTURE_SHOW_METADATA' => $lang['picture_show_metadata'],
    441   'L_PICTURE_HIDE_METADATA' => $lang['picture_hide_metadata'],
    442  
    443   'T_DEL_IMG' =>PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/delete.gif',
     458  'L_PICTURE_METADATA' => $lang['picture_show_metadata'],
    444459 
    445460  'U_HOME' => add_session_id($url_home),
     461  'U_METADATA' => add_session_id($url_metadata),
    446462  'U_ADMIN' => add_session_id($url_admin),
     463  'U_SLIDESHOW'=> add_session_id($url_slide),
    447464  'U_ADD_COMMENT' => add_session_id(str_replace( '&', '&', $_SERVER['REQUEST_URI'] ))
    448465  )
    449466);
    450 
    451 //-------------------------------------------------------- slideshow management
    452 if ( isset( $_GET['slideshow'] ) )
    453 {
    454   if ( !is_numeric( $_GET['slideshow'] ) ) $_GET['slideshow'] = $conf['slideshow_period'][0];
    455        
    456   $template->assign_block_vars('stop_slideshow', array(
    457   'U_SLIDESHOW'=>add_session_id( $picture['current']['url'] )
    458   ));
     467//-------------------------------------------------------- upper menu management
     468// download link if file is not a picture
     469if (!$picture['current']['is_picture'])
     470{
     471  $template->assign_block_vars('download', array(
     472        'U_DOWNLOAD' => $picture['current']['download']
     473      ));
    459474}
    460475else
    461476{
    462   $template->assign_block_vars('start_slideshow', array());
    463   foreach ( $conf['slideshow_period'] as $option )
    464   {
    465     $template->assign_block_vars('start_slideshow.second', array(
    466           'SLIDESHOW_SPEED'=>$option,
    467           'U_SLIDESHOW'=>add_session_id( $picture['current']['url'].'&slideshow='.$option)
    468           ));
    469   }
    470 }
    471 
     477  $template->assign_block_vars('ecard', array(
     478        'U_ECARD' => $picture['current']['url']
     479      ));
     480}
     481
     482//------------------------------------------------------- favorite manipulation
     483if ( !$user['is_the_guest'] )
     484{
     485  // verify if the picture is already in the favorite of the user
     486  $query = 'SELECT COUNT(*) AS nb_fav';
     487  $query.= ' FROM '.FAVORITES_TABLE.' WHERE image_id = '.$_GET['image_id'];
     488  $query.= ' AND user_id = '.$user['id'].';';
     489  $result = mysql_query( $query );
     490  $row = mysql_fetch_array( $result );
     491  if (!$row['nb_fav'])
     492  {
     493    $url = PHPWG_ROOT_PATH.'picture.php';
     494    $url.= get_query_string_diff(array('rate','add_fav'));
     495    $url.= '&add_fav=1';
     496
     497    $template->assign_block_vars(
     498      'favorite',
     499      array(
     500        'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/favorite.gif',
     501        'FAVORITE_HINT' =>$lang['add_favorites_hint'],
     502        'FAVORITE_ALT' =>$lang['add_favorites_alt'],
     503        'U_FAVORITE' => $url
     504        ));
     505  }
     506  else
     507  {
     508    $url = PHPWG_ROOT_PATH.'picture.php';
     509    $url.= get_query_string_diff(array('rate','add_fav'));
     510    $url.= '&add_fav=0';
     511   
     512    $template->assign_block_vars(
     513      'favorite',
     514      array(
     515        'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/del_favorite.gif',
     516        'FAVORITE_HINT' =>$lang['del_favorites_hint'],
     517        'FAVORITE_ALT' =>$lang['del_favorites_alt'],
     518        'U_FAVORITE'=> $url
     519        ));
     520  }
     521}
     522//------------------------------------ admin link for information modifications
     523if ( $user['status'] == 'admin' )
     524{
     525  $template->assign_block_vars('admin', array());
     526}
     527
     528//-------------------------------------------------------- navigation management
    472529if ($has_prev)
    473530{
     
    503560      ));
    504561}
    505 // download link if file is not a picture
    506 if (!$picture['current']['is_picture'])
    507 {
    508   $template->assign_block_vars(
    509     'download',
    510     array(
    511         'U_DOWNLOAD' => $picture['current']['download']
    512       ));
    513 }
     562
    514563
    515564// author
     
    643692      ));
    644693}
    645 //-------------------------------------------------------------------- metadata
    646 if ($conf['show_exif'] or $conf['show_iptc'])
    647 {
    648   $metadata_showable = true;
    649 }
    650 else
    651 {
    652   $metadata_showable = false;
    653 }
    654 
    655 if ($metadata_showable and !isset($_GET['show_metadata']))
    656 {
    657   $url = PHPWG_ROOT_PATH.'picture.php?'.$_SERVER['QUERY_STRING'];
    658   $url.= '&show_metadata=1';
    659   $template->assign_block_vars('show_metadata', array('URL' => $url));
    660 }
     694
     695//metadata
    661696
    662697if ($metadata_showable and isset($_GET['show_metadata']))
    663698{
    664   $url = PHPWG_ROOT_PATH.'picture.php';
    665   $url.= get_query_string_diff(array('show_metadata','add_fav'));
    666  
    667   $template->assign_block_vars('hide_metadata', array('URL' => $url));
    668  
    669699  include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
    670  
    671700  $template->assign_block_vars('metadata', array());
    672  
    673701  if ($conf['show_exif'])
    674702  {
     
    679707        array('TITLE' => 'EXIF Metadata')
    680708        );
    681      
     709
    682710      foreach ($conf['show_exif_fields'] as $field)
    683711      {
     
    724752    }
    725753  }
    726 
    727754  if ($conf['show_iptc'])
    728755  {
     
    756783  }
    757784}
     785//slideshow end
     786if ( isset( $_GET['slideshow'] ) )
     787{
     788  if ( !is_numeric( $_GET['slideshow'] ) ) $_GET['slideshow'] = $conf['slideshow_period'];
     789       
     790  $template->assign_block_vars('stop_slideshow', array(
     791  'U_SLIDESHOW'=>add_session_id( $picture['current']['url'] )
     792  ));
     793}
     794
    758795//------------------------------------------------------------------- rate form
    759796if ($conf['rate'])
     
    806843        ));
    807844  }
    808 }
    809 //------------------------------------------------------- favorite manipulation
    810 if ( !$user['is_the_guest'] )
    811 {
    812   // verify if the picture is already in the favorite of the user
    813   $query = 'SELECT COUNT(*) AS nb_fav';
    814   $query.= ' FROM '.FAVORITES_TABLE.' WHERE image_id = '.$_GET['image_id'];
    815   $query.= ' AND user_id = '.$user['id'].';';
    816   $result = mysql_query( $query );
    817   $row = mysql_fetch_array( $result );
    818   if (!$row['nb_fav'])
    819   {
    820     $url = PHPWG_ROOT_PATH.'picture.php';
    821     $url.= get_query_string_diff(array('rate','add_fav'));
    822     $url.= '&add_fav=1';
    823 
    824     $template->assign_block_vars(
    825       'favorite',
    826       array(
    827         'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/favorite.gif',
    828         'FAVORITE_HINT' =>$lang['add_favorites_hint'],
    829         'FAVORITE_ALT' =>'[ '.$lang['add_favorites_alt'].' ]',
    830         'U_FAVORITE' => $url
    831         ));
    832   }
    833   else
    834   {
    835     $url = PHPWG_ROOT_PATH.'picture.php';
    836     $url.= get_query_string_diff(array('rate','add_fav'));
    837     $url.= '&add_fav=0';
    838    
    839     $template->assign_block_vars(
    840       'favorite',
    841       array(
    842         'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/del_favorite.gif',
    843         'FAVORITE_HINT' =>$lang['del_favorites_hint'],
    844         'FAVORITE_ALT' =>'[ '.$lang['del_favorites_alt'].' ]',
    845         'U_FAVORITE'=> $url
    846         ));
    847   }
    848 }
    849 //------------------------------------ admin link for information modifications
    850 if ( $user['status'] == 'admin' )
    851 {
    852   $template->assign_block_vars('modification', array());
    853845}
    854846
Note: See TracChangeset for help on using the changeset viewer.