From 0a2c5204369bdbf4f8b761444056d90c15b98317 Mon Sep 17 00:00:00 2001 From: vdigital Date: Tue, 30 Jan 2007 07:00:17 +0000 Subject: Issue 0000614: Display hits under thumbnails like comments counter - Comments are not plurial < 2 - hits and comments have specific classes for css control git-svn-id: http://piwigo.org/svn/trunk@1769 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/category_default.inc.php | 14 ++++++++++++-- include/functions_html.inc.php | 13 +++++++++++++ language/en_UK.iso-8859-1/common.lang.php | 2 ++ language/fr_FR.iso-8859-1/common.lang.php | 2 ++ template/yoga/theme/p0w0/theme.css | 5 +++++ template/yoga/theme/wipi/theme.css | 18 ++++++++++++++++++ template/yoga/thumbnails.tpl | 12 +++++++++--- 7 files changed, 61 insertions(+), 5 deletions(-) diff --git a/include/category_default.inc.php b/include/category_default.inc.php index db8091c3e..fed872691 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -110,7 +110,12 @@ foreach ($pictures as $row) { $template->assign_block_vars( 'thumbnails.line.thumbnail.nb_hits', - array('HITS'=> l10n_dec('%d hit', '%d hits', $row['hit']))); + array( + 'HITS'=> l10n_dec('%d hit', '%d hits', $row['hit']), + 'CLASS'=> set_span_class($row['hit']) . ' nb-hits', + ) + ); + } if ($conf['show_thumbnail_caption']) @@ -165,7 +170,12 @@ SELECT COUNT(*) AS nb_comments $row = mysql_fetch_array(pwg_query($query)); $template->assign_block_vars( 'thumbnails.line.thumbnail.nb_comments', - array('NB_COMMENTS'=>$row['nb_comments'])); + array( + 'NB_COMMENTS'=> l10n_dec('%d comment', '%d comments', + $row['nb_comments']), + 'CLASS'=> set_span_class($row['nb_comments']) . ' nb-comments', + ) + ); } //plugins need to add/modify sth in this loop ? diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 48c05ea06..53690211b 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -718,4 +718,17 @@ function set_status_header($code, $text='') header("Status: $code $text"); trigger_action('set_status_header', $code, $text); } + +/** + * set a class to display a counter + * .zero .one .2nmore + */ +function set_span_class($count) +{ + if ($count > 1) + { + return '2nmore'; + } + return ( $count == 0 ) ? 'zero':'one'; +} ?> diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php index 5de07a9d7..ad03a30ff 100644 --- a/language/en_UK.iso-8859-1/common.lang.php +++ b/language/en_UK.iso-8859-1/common.lang.php @@ -299,6 +299,8 @@ $lang['%d comment to validate'] = '%d comment to validate'; $lang['%d comments to validate'] = '%d comments to validate'; $lang['%d new comment'] = '%d new comment'; $lang['%d new comments'] = '%d new comments'; +$lang['%d comment'] = '%d comment'; +$lang['%d comments'] = '%d comments'; $lang['%d hit'] = '%d hit'; $lang['%d hits'] = '%d hits'; $lang['%d new element'] = '%d new element'; diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php index 73ec8159c..647f5fdc9 100644 --- a/language/fr_FR.iso-8859-1/common.lang.php +++ b/language/fr_FR.iso-8859-1/common.lang.php @@ -299,6 +299,8 @@ $lang['%d comment to validate'] = '%d commentaire utilisateur $lang['%d comments to validate'] = '%d commentaires utilisateur à valider'; $lang['%d new comment'] = '%d nouveau commentaire utilisateur'; $lang['%d new comments'] = '%d nouveaux commentaires utilisateur'; +$lang['%d comment'] = '%d commentaire'; +$lang['%d comments'] = '%d commentaires'; $lang['%d hit'] = 'vue %d fois'; $lang['%d hits'] = 'vue %d fois'; $lang['%d new element'] = '%d nouvel élément'; diff --git a/template/yoga/theme/p0w0/theme.css b/template/yoga/theme/p0w0/theme.css index f50b666af..e87174ba1 100644 --- a/template/yoga/theme/p0w0/theme.css +++ b/template/yoga/theme/p0w0/theme.css @@ -248,6 +248,11 @@ SPAN.calItem, SPAN.calItemEmpty label { cursor:pointer } + +.zero { display: none } +.one { } +.2nmore { } + /* nice looking month calendar*/ TD.calDayCellEmpty, TD.calDayCellFull { border: 1px solid gray;} diff --git a/template/yoga/theme/wipi/theme.css b/template/yoga/theme/wipi/theme.css index 6460ee03d..e28625b12 100644 --- a/template/yoga/theme/wipi/theme.css +++ b/template/yoga/theme/wipi/theme.css @@ -238,6 +238,11 @@ SPAN.calItem, SPAN.calItemEmpty label { cursor:pointer } + +.zero { display: none } +.one { } +.2nmore { } + /* nice looking month calendar*/ TD.calDayCellEmpty, TD.calDayCellFull { border: 1px solid gray;} @@ -246,3 +251,16 @@ TD.calDayCellEmpty { color: silver; } .calBackDate { color: #000; } .calForeDate { color: #fff; } .virtual_cat { background: #222 !important; } + +.PWG { + font-family: verdana, arial, helvetica, sans-serif !important; + font-size: 0.9em; + font-weight: normal; + letter-spacing: 0px; +} +a.PWG { border: 0px; } +a.PWG .P { color : #f92; } +a.PWG .W { color : #aaa; } +a.PWG .G { color : #69c; } +a.PWG:hover .P { color : #69c; } +a.PWG:hover .G { color : #f92; } diff --git a/template/yoga/thumbnails.tpl b/template/yoga/thumbnails.tpl index 8bf9d8e01..d5c1a906d 100644 --- a/template/yoga/thumbnails.tpl +++ b/template/yoga/thumbnails.tpl @@ -21,11 +21,17 @@ {thumbnails.line.thumbnail.IMAGE_TS} -
{thumbnails.line.thumbnail.nb_comments.NB_COMMENTS} {lang:comments} + +
+ {thumbnails.line.thumbnail.nb_comments.NB_COMMENTS} +
-
{thumbnails.line.thumbnail.nb_hits.HITS} - + +
+ {thumbnails.line.thumbnail.nb_hits.HITS} +
+ -- cgit v1.2.3