From a8fd5ee6cf5cf061ed0ff789d6030290b3418be5 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 27 Jan 2006 01:11:43 +0000 Subject: [PATCH] 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 --- category.php | 12 ------ include/category_default.inc.php | 7 +++- include/functions_html.inc.php | 17 +++++++-- picture.php | 61 ++++++++++++++++++++++++++----- template/yoga/icon/first.png | Bin 0 -> 1645 bytes template/yoga/icon/last.png | Bin 0 -> 1642 bytes template/yoga/picture.tpl | 19 +++++++--- 7 files changed, 83 insertions(+), 33 deletions(-) create mode 100644 template/yoga/icon/first.png create mode 100644 template/yoga/icon/last.png 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.= ''.$lang['first_page']; + $navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page']; $navbar.= ''; } else @@ -96,7 +96,7 @@ function create_navigation_bar($url, $nb_element, $start, $previous = $start - $nb_element_page; $navbar.= ''.$lang['previous_page']; + $navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page']; $navbar.= ''; } else @@ -130,7 +130,16 @@ function create_navigation_bar($url, $nb_element, $start, $temp_start = ($i - 1) * $nb_element_page; $navbar.= ' '.$i.''; + $navbar.= '" class="'.$link_class.'"'; + if ($i == $cur_page - 1) + { + $navbar.= ' rel="prev"'; + } + if ($i == $cur_page + 1) + { + $navbar.= ' rel="next"'; + } + $navbar.='>'.$i.''; } else { @@ -159,7 +168,7 @@ function create_navigation_bar($url, $nb_element, $start, $next = $start + $nb_element_page; $navbar.= ''.$lang['next_page'].''; + $navbar.= '" class="'.$link_class.'" rel="next">'.$lang['next_page'].''; } 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.= '&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 )); } diff --git a/template/yoga/icon/first.png b/template/yoga/icon/first.png new file mode 100644 index 0000000000000000000000000000000000000000..2b8db1cff6af8d28f6d8afd0521b58635b078fbc GIT binary patch literal 1645 zcmV-z29o)SP)hK~#9!eU)2`R#z3re`}xf9p?JM48y<- z*8z&90%A*A3N})j($s1iV=y%h(bNZD+8E=lHojP^hDM`_k%y+z^ub_5y@ZBP0$56^ z)>;a+G>sN#C{AaF%P>smyPdQ5UdxC11}AD<$|HoVt9D(~1$4fxobkbS<%(&_t2Y{{r=|B6lv%wYUb;2(V zK5d3}b%@+?Q=%JIIO{GWMSu&J)lR*qa(Yl*5kLgN*lX|zP;27a>;N<1H#)~5RaVUJ z#D8aJCSTlMN_ystm|)_O5V1TclU3vFg~-!~L;TIFiW;d1ZBeyMQe$fSJBuYgh1|%x)<^Q5KII)^hUJDp7nmBLMFoNW^4zlGaoa3 z1!2D$x7@kT`NO-*rS1h~LZe$KEfANsPGTTiA9h^1;MPv0L{s@5Tp^+8BfiU^u(V z_>_=uc!ot=9)~bRb@&99%we*stn3pxf6;X4BF+i(44!i$Y*S;?z(TQ|TQkRGPTIMg z1$`?>vrcFqz%=4qgYl^r@{RjgyylZ65|Om+dX6~f#0Rm@+&29xYTN~^c22k(;I55{ zc6C4zOhjwMqKaz3ii;$EkSkYn@^yRYTeTUBIr-oBF!kp5z=8P+#0HH#%D^IF*#aWa zDZ(8oun}Ox3Wtvnf}znv%+cUT{TSop;}q-n(zo(vVqT##c8c-0o}p;{7>(d4(uie- zA3sl)R9L>yapAHeurW1bAwYKr((ooRf)5dmb+ClS)F_RCN9kX68=*1+E+Lz@ir#w; zfCe-cn0mxHCWc?*-9ryEx2>2deul0y5&mSx%^O!r*!@tNmLym`H_7IduFIRM5zP^T z(x?ZbI2u7{$*{pulimB(Pt_;^2Y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f#p$ELWHP@eWFH^h%ko1)d^=Ao3g1>kBF_CJaYJUAyLW_&c$$Zay2G7CO>$FE3f~EibAR$(}-y#mb2!AtUbN^}yPd<_)*#xVkh!;g;#0>CRq8TC12Nb4D zk(@Uh8F#YpSxt*2GQbPKE0Bs^#el|`nvHg1+1JpsxgtOdMc?>NsUSh zm2@se>g$}GyX57-Uo@R8kr81Sco3MLCoq{KxqjywcN%!;AJ?q@P3rnUSIM5KYiCh1rJ>^3mejGLc zx~KtqSBkD|7s=O)gb3qPW<%H1E?&h|1Aw^oJ-L_nekJVw>wsSU`C)ZVP&L5MNeSCF zc+%(dF1%P^=E#cdzHhC3bX7Sz0QUwH9ra$*niyT`MxvF;PE zlld!bS?5SH=u}Z%Lt!>N{>{z<-+r*`;ITKSb{so%{quuY^L^u`T$`ZUvM4j!+w|_h z#=hH+KK$6B*V?+4h4V*#;3j9V)
- {L_SLIDESHOW} + {L_SLIDESHOW} {L_PICTURE_METADATA} {lang:representative} @@ -34,13 +34,20 @@
@@ -65,12 +72,12 @@ - + - + @@ -146,7 +153,7 @@

{rate.SENTENCE} : -{rate.rate_option.SEPARATOR} {rate.rate_option.OPTION} +{rate.rate_option.SEPARATOR} {rate.rate_option.OPTION}