improvement: got rid of num= _GET param in category.php (use only start=) so
that links to category for search engines are the same as in category pagination feature 77: standard navigation link : HTML Link types improvement: add go to first and last image buttons in picture page improvement: do not increase image hit in picture.php when rating, adding to favorites, caddie, ... improvement: show number of hits in most_visited (as best_rated shows the rate) git-svn-id: http://piwigo.org/svn/trunk@1014 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
10329e517b
commit
a8fd5ee6cf
7 changed files with 83 additions and 33 deletions
12
category.php
12
category.php
|
@ -64,18 +64,6 @@ else
|
|||
$page['start'] = $_GET['start'];
|
||||
}
|
||||
|
||||
// Sometimes, a "num" is provided in the URL. It is the number
|
||||
// of the picture to show. This picture must be in the thumbnails page.
|
||||
// We have to find the right $page['start'] that show the num picture
|
||||
// in this category
|
||||
if ( isset( $_GET['num'] )
|
||||
and is_numeric( $_GET['num'] )
|
||||
and $_GET['num'] >= 0 )
|
||||
{
|
||||
$page['start'] = floor( $_GET['num'] / $user['nb_image_page'] );
|
||||
$page['start']*= $user['nb_image_page'];
|
||||
}
|
||||
|
||||
initialize_category();
|
||||
|
||||
// caddie filling :-)
|
||||
|
|
|
@ -39,7 +39,7 @@ $array_cat_directories = array();
|
|||
|
||||
$query = '
|
||||
SELECT DISTINCT(id),path,file,date_available
|
||||
,tn_ext,name,filesize,storage_category_id,average_rate
|
||||
,tn_ext,name,filesize,storage_category_id,average_rate,hit
|
||||
FROM '.IMAGES_TABLE.' AS i
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id
|
||||
'.$page['where'].'
|
||||
|
@ -108,6 +108,11 @@ while ($row = mysql_fetch_array($result))
|
|||
{
|
||||
$name = '('.$row['average_rate'].') '.$name;
|
||||
}
|
||||
else
|
||||
if ($page['cat'] == 'most_visited')
|
||||
{
|
||||
$name = '('.$row['hit'].') '.$name;
|
||||
}
|
||||
|
||||
if ($page['cat'] == 'search')
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ function create_navigation_bar($url, $nb_element, $start,
|
|||
{
|
||||
$navbar.= '<a href="';
|
||||
$navbar.= $url.'&start=0';
|
||||
$navbar.= '" class="'.$link_class.'">'.$lang['first_page'];
|
||||
$navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page'];
|
||||
$navbar.= '</a>';
|
||||
}
|
||||
else
|
||||
|
@ -96,7 +96,7 @@ function create_navigation_bar($url, $nb_element, $start,
|
|||
$previous = $start - $nb_element_page;
|
||||
$navbar.= '<a href="';
|
||||
$navbar.= $url.'&start='.$previous;
|
||||
$navbar.= '" class="'.$link_class.'">'.$lang['previous_page'];
|
||||
$navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page'];
|
||||
$navbar.= '</a>';
|
||||
}
|
||||
else
|
||||
|
@ -130,7 +130,16 @@ function create_navigation_bar($url, $nb_element, $start,
|
|||
$temp_start = ($i - 1) * $nb_element_page;
|
||||
$navbar.= ' <a href="';
|
||||
$navbar.= $url.'&start='.$temp_start;
|
||||
$navbar.= '" class="'.$link_class.'">'.$i.'</a>';
|
||||
$navbar.= '" class="'.$link_class.'"';
|
||||
if ($i == $cur_page - 1)
|
||||
{
|
||||
$navbar.= ' rel="prev"';
|
||||
}
|
||||
if ($i == $cur_page + 1)
|
||||
{
|
||||
$navbar.= ' rel="next"';
|
||||
}
|
||||
$navbar.='>'.$i.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,7 +168,7 @@ function create_navigation_bar($url, $nb_element, $start,
|
|||
$next = $start + $nb_element_page;
|
||||
$navbar.= '<a href="';
|
||||
$navbar.= $url.'&start='.$next;
|
||||
$navbar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
|
||||
$navbar.= '" class="'.$link_class.'" rel="next">'.$lang['next_page'].'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
61
picture.php
61
picture.php
|
@ -43,12 +43,18 @@ if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
|
|||
check_restrictions( $page['cat'] );
|
||||
}
|
||||
//---------------------------------------- incrementation of the number of hits
|
||||
$query = '
|
||||
UPDATE '.IMAGES_TABLE.'
|
||||
SET hit = hit+1
|
||||
WHERE id = '.$_GET['image_id'].'
|
||||
;';
|
||||
@pwg_query( $query );
|
||||
if ( count(array_intersect(
|
||||
array_keys($_GET),
|
||||
array('add_fav', 'caddie', 'rate', 'representative', 'del') )
|
||||
)==0 )
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.IMAGES_TABLE.'
|
||||
SET hit = hit+1
|
||||
WHERE id = '.$_GET['image_id'].'
|
||||
;';
|
||||
@pwg_query( $query );
|
||||
}
|
||||
//-------------------------------------------------------------- initialization
|
||||
initialize_category( 'picture' );
|
||||
// retrieving the number of the picture in its category (in order)
|
||||
|
@ -69,8 +75,35 @@ while ($row = mysql_fetch_array($result))
|
|||
$belongs = true;
|
||||
break;
|
||||
}
|
||||
if ($page['num']==0)
|
||||
{
|
||||
$url_first_last = PHPWG_ROOT_PATH.'picture.php';
|
||||
$url_first_last.= get_query_string_diff(array('image_id','add_fav',
|
||||
'slideshow','rate'));
|
||||
$url_first_last.= '&image_id=';
|
||||
$template->assign_block_vars(
|
||||
'first',
|
||||
array(
|
||||
'U_IMG' => $url_first_last . $row['id'],
|
||||
));
|
||||
}
|
||||
$page['num']++;
|
||||
}
|
||||
if ($page['cat_nb_images']>0 and $page['num'] < $page['cat_nb_images'] - 1)
|
||||
{
|
||||
mysql_data_seek($result, $page['cat_nb_images'] - 1);
|
||||
$row = mysql_fetch_array($result);
|
||||
$url_first_last = PHPWG_ROOT_PATH.'picture.php';
|
||||
$url_first_last.= get_query_string_diff(array('image_id','add_fav',
|
||||
'slideshow','rate'));
|
||||
$url_first_last.= '&image_id=';
|
||||
$template->assign_block_vars(
|
||||
'last',
|
||||
array(
|
||||
'U_IMG' => $url_first_last . $row['id'],
|
||||
));
|
||||
}
|
||||
|
||||
// if this image_id doesn't correspond to this category, an error message is
|
||||
// displayed, and execution is stopped
|
||||
if (!$belongs)
|
||||
|
@ -247,8 +280,14 @@ foreach (array('prev', 'current', 'next') as $i)
|
|||
$picture[$i]['url'].= '&image_id='.$row['id'];
|
||||
}
|
||||
|
||||
$url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&';
|
||||
$url_up.= 'num='.$page['num'];
|
||||
$url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'];
|
||||
$url_up_start = floor( $page['num'] / $user['nb_image_page'] );
|
||||
$url_up_start *= $user['nb_image_page'];
|
||||
if ($url_up_start>0)
|
||||
{
|
||||
$url_up .= '&start='.$url_up_start;
|
||||
}
|
||||
|
||||
if ( $page['cat'] == 'search' )
|
||||
{
|
||||
$url_up.= "&search=".$_GET['search'];
|
||||
|
@ -642,7 +681,8 @@ if ($has_prev)
|
|||
array(
|
||||
'TITLE_IMG' => $picture['prev']['name'],
|
||||
'IMG' => $picture['prev']['thumbnail'],
|
||||
'U_IMG' => $picture['prev']['url']
|
||||
'U_IMG' => $picture['prev']['url'],
|
||||
'U_IMG_SRC' => $picture['prev']['src']
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -653,7 +693,8 @@ if ($has_next)
|
|||
array(
|
||||
'TITLE_IMG' => $picture['next']['name'],
|
||||
'IMG' => $picture['next']['thumbnail'],
|
||||
'U_IMG' => $picture['next']['url']
|
||||
'U_IMG' => $picture['next']['url'],
|
||||
'U_IMG_SRC' => $picture['next']['src'] // allow navigator to preload
|
||||
));
|
||||
}
|
||||
|
||||
|
|
BIN
template/yoga/icon/first.png
Normal file
BIN
template/yoga/icon/first.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
template/yoga/icon/last.png
Normal file
BIN
template/yoga/icon/last.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -14,7 +14,7 @@
|
|||
<div id="imageToolBar">
|
||||
|
||||
<div class="randomButtons">
|
||||
<a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}"><img src="{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a>
|
||||
<a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}" rel="nofollow"><img src="{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a>
|
||||
<a href="{U_METADATA}" title="{L_PICTURE_METADATA}"><img src="{themeconf:icon_dir}/metadata.png" class="button" alt="{L_PICTURE_METADATA}"></a>
|
||||
<!-- BEGIN representative -->
|
||||
<a href="{representative.URL}" title="{lang:set as category representative}"><img src="{themeconf:icon_dir}/representative.png" class="button" alt="{lang:representative}" /></a>
|
||||
|
@ -34,13 +34,20 @@
|
|||
</div>
|
||||
|
||||
<div class="navButtons">
|
||||
<!-- BEGIN last -->
|
||||
<a class="navButton prev" href="{last.U_IMG}"><img src="{themeconf:icon_dir}/last.png" class="button" alt="{lang:last_page}"></a>
|
||||
<!-- END last -->
|
||||
<!-- BEGIN next -->
|
||||
<a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}"><img src="{themeconf:icon_dir}/right.png" class="button" alt="next"></a>
|
||||
<a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"><img src="{themeconf:icon_dir}/right.png" class="button" alt="next"></a>
|
||||
<link rel="prefetch" href="{next.U_IMG_SRC}"><link rel="prefetch" href="{next.U_IMG}">
|
||||
<!-- END next -->
|
||||
<a class="navButton up" href="{U_UP}" title="{L_UP_HINT}"><img src="{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a>
|
||||
<!-- BEGIN previous -->
|
||||
<a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}"><img src="{themeconf:icon_dir}/left.png" class="button" alt="previous"></a>
|
||||
<a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"><img src="{themeconf:icon_dir}/left.png" class="button" alt="previous"></a>
|
||||
<!-- END previous -->
|
||||
<!-- BEGIN first -->
|
||||
<a class="navButton prev" href="{first.U_IMG}" rel="start"><img src="{themeconf:icon_dir}/first.png" class="button" alt="{lang:first_page}"></a>
|
||||
<!-- END first -->
|
||||
</div>
|
||||
|
||||
</div> <!-- imageToolBar -->
|
||||
|
@ -65,12 +72,12 @@
|
|||
</div>
|
||||
|
||||
<!-- BEGIN previous -->
|
||||
<a class="navThumb" id="thumbPrev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}">
|
||||
<a class="navThumb" id="thumbPrev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev">
|
||||
<img src="{previous.IMG}" class="thumbLink" id="linkPrev" alt="{previous.TITLE_IMG}">
|
||||
</a>
|
||||
<!-- END previous -->
|
||||
<!-- BEGIN next -->
|
||||
<a class="navThumb" id="thumbNext" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}">
|
||||
<a class="navThumb" id="thumbNext" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next">
|
||||
<img src="{next.IMG}" class="thumbLink" id="linkNext" alt="{next.TITLE_IMG}">
|
||||
</a>
|
||||
<!-- END next -->
|
||||
|
@ -146,7 +153,7 @@
|
|||
<p>
|
||||
{rate.SENTENCE} :
|
||||
<!-- BEGIN rate_option -->
|
||||
{rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}">{rate.rate_option.OPTION}</a>
|
||||
{rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}" rel="nofollow">{rate.rate_option.OPTION}</a>
|
||||
<!-- END rate_option -->
|
||||
</p>
|
||||
<!-- END rate -->
|
||||
|
|
Loading…
Reference in a new issue