aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-01-27 01:11:43 +0000
committerrvelices <rv-github@modusoptimus.com>2006-01-27 01:11:43 +0000
commita8fd5ee6cf5cf061ed0ff789d6030290b3418be5 (patch)
tree7c31e61422551c2c0672cd43611729f70202bfae
parent10329e517b22671f002bcb2929ebb54a09f22573 (diff)
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
-rw-r--r--category.php12
-rw-r--r--include/category_default.inc.php7
-rw-r--r--include/functions_html.inc.php17
-rw-r--r--picture.php61
-rw-r--r--template/yoga/icon/first.pngbin0 -> 1645 bytes
-rw-r--r--template/yoga/icon/last.pngbin0 -> 1642 bytes
-rw-r--r--template/yoga/picture.tpl19
7 files changed, 83 insertions, 33 deletions
diff --git a/category.php b/category.php
index 1a74a912f..6a0b7a651 100644
--- a/category.php
+++ b/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 :-)
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 0965b331e..fd04181e9 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -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')
{
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index 4f41d858c..bff44f620 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -82,7 +82,7 @@ function create_navigation_bar($url, $nb_element, $start,
{
$navbar.= '<a href="';
$navbar.= $url.'&amp;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.'&amp;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.= '&nbsp;<a href="';
$navbar.= $url.'&amp;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.'&amp;start='.$next;
- $navbar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
+ $navbar.= '" class="'.$link_class.'" rel="next">'.$lang['next_page'].'</a>';
}
else
{
diff --git a/picture.php b/picture.php
index a9655f712..11353de52 100644
--- a/picture.php
+++ b/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.= '&amp;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.= '&amp;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'].= '&amp;image_id='.$row['id'];
}
-$url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&amp;';
-$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 .= '&amp;start='.$url_up_start;
+}
+
if ( $page['cat'] == 'search' )
{
$url_up.= "&amp;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
));
}
diff --git a/template/yoga/icon/first.png b/template/yoga/icon/first.png
new file mode 100644
index 000000000..2b8db1cff
--- /dev/null
+++ b/template/yoga/icon/first.png
Binary files differ
diff --git a/template/yoga/icon/last.png b/template/yoga/icon/last.png
new file mode 100644
index 000000000..12e1367a7
--- /dev/null
+++ b/template/yoga/icon/last.png
Binary files differ
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl
index d28632ca0..ceafa6a96 100644
--- a/template/yoga/picture.tpl
+++ b/template/yoga/picture.tpl
@@ -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 -->