aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2007-01-28 20:56:10 +0000
committervdigital <vdigital@piwigo.org>2007-01-28 20:56:10 +0000
commit7ee3f5579aab21257d236e6f8aa853cd639ff460 (patch)
treee13479319990abbe9f96366bef547708f8766c38
parent7709c4189cadfcfc56c97fd5cd47df06033b6429 (diff)
Issue 0000614: Display hits under thumbnails like comments counter
git-svn-id: http://piwigo.org/svn/trunk@1763 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/configuration.php6
-rw-r--r--admin/include/functions.php2
-rw-r--r--admin/user_list.php10
-rw-r--r--include/category_default.inc.php8
-rw-r--r--include/config_default.inc.php4
-rw-r--r--include/functions_user.inc.php2
-rw-r--r--language/en_UK.iso-8859-1/common.lang.php3
-rw-r--r--language/en_UK.iso-8859-1/help/configuration.html6
-rw-r--r--language/fr_FR.iso-8859-1/common.lang.php3
-rw-r--r--language/fr_FR.iso-8859-1/help/configuration.html6
-rw-r--r--profile.php13
-rw-r--r--template/yoga/admin/configuration.tpl6
-rw-r--r--template/yoga/admin/user_list.tpl10
-rw-r--r--template/yoga/profile_content.tpl5
-rw-r--r--template/yoga/thumbnails.tpl3
15 files changed, 81 insertions, 6 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 1d295e7cd..12235cce6 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -232,6 +232,8 @@ switch ($page['section'])
{
$show_yes = ($conf['show_nb_comments']==true)?'checked="checked"':'';
$show_no = ($conf['show_nb_comments']==false)?'checked="checked"':'';
+ $hits_yes = ($conf['show_nb_hits']==true)?'checked="checked"':'';
+ $hits_no = ($conf['show_nb_hits']==false)?'checked="checked"':'';
$expand_yes = ($conf['auto_expand']==true)?'checked="checked"':'';
$expand_no = ($conf['auto_expand']==false)?'checked="checked"':'';
@@ -247,7 +249,9 @@ switch ($page['section'])
'EXPAND_YES'=>$expand_yes,
'EXPAND_NO'=>$expand_no,
'SHOW_COMMENTS_YES'=>$show_yes,
- 'SHOW_COMMENTS_NO'=>$show_no
+ 'SHOW_COMMENTS_NO'=>$show_no,
+ 'SHOW_HITS_YES'=>$hits_yes,
+ 'SHOW_HITS_NO'=>$hits_no,
));
$blockname = 'default.language_option';
diff --git a/admin/include/functions.php b/admin/include/functions.php
index a28e42582..a7fd10e36 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1157,6 +1157,8 @@ SELECT user_id
$insert['expand'] = boolean_to_string($conf['auto_expand']);
$insert['show_nb_comments'] =
boolean_to_string($conf['show_nb_comments']);
+ $insert['show_nb_hits'] =
+ boolean_to_string($conf['show_nb_hits']);
$insert['maxwidth'] = $conf['default_maxwidth'];
$insert['maxheight'] = $conf['default_maxheight'];
$insert['registration_date'] = $dbnow;
diff --git a/admin/user_list.php b/admin/user_list.php
index 84efc057f..3f663509b 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -342,9 +342,10 @@ DELETE FROM '.USER_GROUP_TABLE.'
$formfields =
array('nb_image_line', 'nb_line_page', 'template', 'language',
'recent_period', 'maxwidth', 'expand', 'show_nb_comments',
- 'maxheight', 'status', 'enabled_high');
+ 'show_nb_hits', 'maxheight', 'status', 'enabled_high');
- $true_false_fields = array('expand', 'show_nb_comments', 'enabled_high');
+ $true_false_fields = array('expand', 'show_nb_comments',
+ 'show_nb_hits', 'enabled_high');
if ($conf['allow_adviser'])
{
array_push($formfields, 'adviser');
@@ -556,6 +557,7 @@ foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
// $user['recent_period'] = $conf['recent_period'];
// $user['expand'] = $conf['auto_expand'];
// $user['show_nb_comments'] = $conf['show_nb_comments'];
+// $user['show_nb_hits'] = $conf['show_nb_hits'];
// ---
if (isset($_POST['pref_submit']))
@@ -576,6 +578,10 @@ if (isset($_POST['pref_submit']))
'true' == $_POST['show_nb_comments'] ? 'checked="checked"' : '',
'SHOW_NB_COMMENTS_NO' =>
'false' == $_POST['show_nb_comments'] ? 'checked="checked"' : '',
+ 'SHOW_NB_HITS_YES' =>
+ 'true' == $_POST['show_nb_hits'] ? 'checked="checked"' : '',
+ 'SHOW_NB_HITS_NO' =>
+ 'false' == $_POST['show_nb_hits'] ? 'checked="checked"' : '',
'ENABLED_HIGH_YES' => 'true' == $_POST['enabled_high'] ? 'checked="checked"' : '',
'ENABLED_HIGH_NO' => 'false' == $_POST['enabled_high'] ? 'checked="checked"' : '',
));
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 8422fcf13..db8091c3e 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -104,6 +104,14 @@ foreach ($pictures as $row)
'CLASS' => 'thumbElmt',
)
);
+ if ($user['show_nb_hits']
+ and isset($page['category'])
+ and $conf['show_nb_hits'])
+ {
+ $template->assign_block_vars(
+ 'thumbnails.line.thumbnail.nb_hits',
+ array('HITS'=> l10n_dec('%d hit', '%d hits', $row['hit'])));
+ }
if ($conf['show_thumbnail_caption'])
{
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 26e0a6a33..32ad4036a 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -161,6 +161,10 @@ $conf['tn_height'] = 128;
// bottom of each page ?
$conf['show_version'] = true;
+// show_nb_hits : Show hits count under thumbnails
+// false = never... true = depending on profile...
+$conf['show_nb_hits'] = false;
+
// links : list of external links to add in the menu. An example is the best
// than a long explanation :
//
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 74c1c81f1..bf514ed31 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -160,6 +160,7 @@ function build_user( $user_id, $use_cache )
$user['recent_period'] = $conf['recent_period'];
$user['expand'] = $conf['auto_expand'];
$user['show_nb_comments'] = $conf['show_nb_comments'];
+ $user['show_nb_hits'] = $conf['show_nb_hits'];
$user['enabled_high'] = $conf['newuser_default_enabled_high'];
}
else
@@ -775,6 +776,7 @@ function create_user_infos($user_id)
'recent_period' => $conf['recent_period'],
'expand' => boolean_to_string($conf['auto_expand']),
'show_nb_comments' => boolean_to_string($conf['show_nb_comments']),
+ 'show_nb_hits' => boolean_to_string($conf['show_nb_hits']),
'maxwidth' => $conf['default_maxwidth'],
'maxheight' => $conf['default_maxheight'],
'registration_date' => $dbnow,
diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php
index 6f382efdc..5de07a9d7 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 hit'] = '%d hit';
+$lang['%d hits'] = '%d hits';
$lang['%d new element'] = '%d new element';
$lang['%d new elements'] = '%d new elements';
$lang['%d new user'] = '%d new user';
@@ -570,6 +572,7 @@ $lang['searched words : %s'] = 'searched words : %s';
$lang['send_mail'] = 'Contact';
$lang['set as category representative'] = 'set as category representative';
$lang['show_nb_comments'] = 'Show number of comments';
+$lang['show_nb_hits'] = 'Show hits count';
$lang['slideshow'] = 'slideshow';
$lang['slideshow_stop'] = 'stop the slideshow';
$lang['special_categories'] = 'Specials';
diff --git a/language/en_UK.iso-8859-1/help/configuration.html b/language/en_UK.iso-8859-1/help/configuration.html
index f26d7f3b9..8e6068c6e 100644
--- a/language/en_UK.iso-8859-1/help/configuration.html
+++ b/language/en_UK.iso-8859-1/help/configuration.html
@@ -93,6 +93,12 @@ users.</p>
<li><strong>Show number of comments</strong>: show the number of comments
for each picture on the thumbnails page. Resource consuming.</li>
+ <li><strong>Show hits count</strong>: display hits observed on picture
+ just under its thumbnail on the thumbnails page.
+ Only when advanced configuration parameter is: <br />
+ $conf['show_nb_hits'] = true; <br />
+ Notice: it is false by default.</li>
+
<li><strong>Maximum width of the pictures</strong>: maximum displayed
width. If pictures are larger than this setting, they will be resized on
display. If you consider filling this option, you'd better consider
diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php
index db6561a12..73ec8159c 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 à valider';
$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 hit'] = 'vue %d fois';
+$lang['%d hits'] = 'vue %d fois';
$lang['%d new element'] = '%d nouvel élément';
$lang['%d new elements'] = '%d nouveaux éléments';
$lang['%d new user'] = '%d nouvel utilisateur';
@@ -571,6 +573,7 @@ $lang['searched words : %s'] = 'mots recherchés : %s';
$lang['send_mail'] = 'Contacter';
$lang['set as category representative'] = 'élire comme représentant de cette catégorie';
$lang['show_nb_comments'] = 'Montrer le nombre de commentaires';
+$lang['show_nb_hits'] = 'Montrer le nombre de visualisations';
$lang['slideshow'] = 'diaporama';
$lang['slideshow_stop'] = 'arrêter le diaporama';
$lang['special_categories'] = 'Spéciales';
diff --git a/language/fr_FR.iso-8859-1/help/configuration.html b/language/fr_FR.iso-8859-1/help/configuration.html
index 001daf336..ab0ae03c3 100644
--- a/language/fr_FR.iso-8859-1/help/configuration.html
+++ b/language/fr_FR.iso-8859-1/help/configuration.html
@@ -98,6 +98,12 @@ catégories contient de nombreux éléments.</li>
de commentaires utilisateur en dessous de chaque miniature. Consomme des
ressources.</li>
+ <li><strong>Montrer le nombre de visualisations </strong>: affiche les
+ « hits » relevés sur une image sous sa miniature dans la page de miniatures.
+ Uniquement valable si le paramètre de configuration avancée est :<br />
+ $conf['show_nb_hits'] = true; <br />
+ N.B.: par defaut il est à false.</li>
+
<li><strong>Largeur maximum des images</strong>: à l'affichage. Si l'image
est plus large que ce paramètre, alors elle sera redimensionnée à
l'affichage. Si vous pensez nécessaire de modifier ce paramétrage (donc pour
diff --git a/profile.php b/profile.php
index df2d46ae3..3e512703a 100644
--- a/profile.php
+++ b/profile.php
@@ -172,7 +172,7 @@ function save_profile_from_post(&$userdata, &$errors)
// update user "additional" informations (specific to PhpWebGallery)
$fields = array(
'nb_image_line', 'nb_line_page', 'language', 'maxwidth', 'maxheight',
- 'expand', 'show_nb_comments', 'recent_period', 'template'
+ 'expand', 'show_nb_comments', 'show_nb_hits', 'recent_period', 'template'
);
$data = array();
@@ -201,10 +201,16 @@ function load_profile_in_template($url_action, $url_redirect, $userdata)
$template->set_filename('profile_content', 'profile_content.tpl');
- $expand = ($userdata['expand'] == 'true') ? 'EXPAND_TREE_YES':'EXPAND_TREE_NO';
+ $expand = ($userdata['expand'] == 'true') ?
+ 'EXPAND_TREE_YES':'EXPAND_TREE_NO';
$nb_comments =
- ($userdata['show_nb_comments'] == 'true') ? 'NB_COMMENTS_YES':'NB_COMMENTS_NO';
+ ($userdata['show_nb_comments'] == 'true') ?
+ 'NB_COMMENTS_YES':'NB_COMMENTS_NO';
+
+ $nb_hits =
+ ($userdata['show_nb_hits'] == 'true') ?
+ 'NB_HITS_YES':'NB_HITS_NO';
$template->assign_vars(
array(
@@ -219,6 +225,7 @@ function load_profile_in_template($url_action, $url_redirect, $userdata)
$expand=>'checked="checked"',
$nb_comments=>'checked="checked"',
+ $nb_hits=>'checked="checked"',
'REDIRECT' => $url_redirect,
diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl
index 6f4010a5f..f4c30bb78 100644
--- a/template/yoga/admin/configuration.tpl
+++ b/template/yoga/admin/configuration.tpl
@@ -194,6 +194,12 @@
</li>
<li>
+ <span class="property">{lang:show_nb_hits}</span>
+ <label><input type="radio" class="radio" name="show_nb_hits" value="true" {default.SHOW_HITS_YES} />{lang:Yes}</label>
+ <label><input type="radio" class="radio" name="show_nb_hits" value="false" {default.SHOW_HITS_NO} />{lang:No}</label>
+ </li>
+
+ <li>
<span class="property">
<label for="default_maxwidth">{lang:Maximum width of the pictures}</label>
</span>
diff --git a/template/yoga/admin/user_list.tpl b/template/yoga/admin/user_list.tpl
index 08b981882..0eaf67fc0 100644
--- a/template/yoga/admin/user_list.tpl
+++ b/template/yoga/admin/user_list.tpl
@@ -268,6 +268,16 @@
</tr>
<tr>
+ <td>{lang:show_nb_hits}</td>
+ <td>
+ <label><input type="radio" name="show_nb_hits" value="leave" checked="checked" /> {lang:leave}</label>
+ / {lang:set to}
+ <label><input type="radio" name="show_nb_hits" value="true" {SHOW_NB_HITS_YES} />{lang:yes}</label>
+ <label><input type="radio" name="show_nb_hits" value="false" {SHOW_NB_HITS_NO} />{lang:no}</label>
+ </td>
+ </tr>
+
+ <tr>
<td>{lang:maxwidth}</td>
<td>
<label><input type="radio" name="maxwidth_action" value="leave" checked="checked" /> {lang:leave}</label>
diff --git a/template/yoga/profile_content.tpl b/template/yoga/profile_content.tpl
index e738e59c6..931b08c61 100644
--- a/template/yoga/profile_content.tpl
+++ b/template/yoga/profile_content.tpl
@@ -91,6 +91,11 @@
<label><input type="radio" name="show_nb_comments" value="false" {NB_COMMENTS_NO}> {lang:no}</label>
</li>
<li>
+ <span class="property">{lang:show_nb_hits}</span>
+ <label><input type="radio" name="show_nb_hits" value="true" {NB_HITS_YES}> {lang:yes}</label>
+ <label><input type="radio" name="show_nb_hits" value="false" {NB_HITS_NO}> {lang:no}</label>
+ </li>
+ <li>
<span class="property">
<label for="maxwidth">{lang:maxwidth}</label>
</span>
diff --git a/template/yoga/thumbnails.tpl b/template/yoga/thumbnails.tpl
index d1757489b..8bf9d8e01 100644
--- a/template/yoga/thumbnails.tpl
+++ b/template/yoga/thumbnails.tpl
@@ -23,6 +23,9 @@
<!-- BEGIN nb_comments -->
<br />{thumbnails.line.thumbnail.nb_comments.NB_COMMENTS} {lang:comments}
<!-- END nb_comments -->
+ <!-- BEGIN nb_hits -->
+ <br />{thumbnails.line.thumbnail.nb_hits.HITS}
+ <!-- END nb_comments -->
</span>
</span>
</li>