aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/cat_list.php57
-rw-r--r--admin/themes/default/template/cat_list.tpl4
-rw-r--r--admin/themes/default/theme.css4
3 files changed, 50 insertions, 15 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php
index f728e8f73..0ca366e84 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -251,13 +251,53 @@ $categories = hash_from_query($query, 'id');
// get the categories containing images directly
$categories_with_images = array();
-if ( count($categories) )
+if (count($categories))
{
$query = '
-SELECT DISTINCT category_id
+SELECT
+ category_id,
+ COUNT(*) AS nb_photos
FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE category_id IN ('.implode(',', array_keys($categories)).')';
- $categories_with_images = array_flip( array_from_query($query, 'category_id') );
+ GROUP BY category_id
+;';
+ // WHERE category_id IN ('.implode(',', array_keys($categories)).')
+
+ $nb_photos_in = query2array($query, 'category_id', 'nb_photos');
+
+ $query = '
+SELECT
+ id,
+ uppercats
+ FROM '.CATEGORIES_TABLE.'
+;';
+ $all_categories = query2array($query, 'id', 'uppercats');
+ $subcats_of = array();
+
+ foreach (array_keys($categories) as $cat_id)
+ {
+ foreach ($all_categories as $id => $uppercats)
+ {
+ if (preg_match('/(^|,)'.$cat_id.',/', $uppercats))
+ {
+ @$subcats_of[$cat_id][] = $id;
+ }
+ }
+ }
+
+ $nb_sub_photos = array();
+ foreach ($subcats_of as $cat_id => $subcat_ids)
+ {
+ $nb_photos = 0;
+ foreach ($subcat_ids as $id)
+ {
+ if (isset($nb_photos_in[$id]))
+ {
+ $nb_photos+= $nb_photos_in[$id];
+ }
+ }
+
+ $nb_sub_photos[$cat_id] = $nb_photos;
+ }
}
$template->assign('categories', array());
@@ -289,6 +329,9 @@ foreach ($categories as $category)
$category['name'],
'admin_cat_list'
),
+ 'NB_PHOTOS' => isset($nb_photos_in[$category['id']]) ? $nb_photos_in[$category['id']] : 0,
+ 'NB_SUB_PHOTOS' => isset($nb_sub_photos[$category['id']]) ? $nb_sub_photos[$category['id']] : 0,
+ 'NB_SUB_ALBUMS' => isset($subcats_of[$category['id']]) ? count($subcats_of[$category['id']]) : 0,
'ID' => $category['id'],
'RANK' => $category['rank']*10,
@@ -317,12 +360,6 @@ foreach ($categories as $category)
}
}
- if ( array_key_exists($category['id'], $categories_with_images) )
- {
- $tpl_cat['U_MANAGE_ELEMENTS']=
- $base_url.'batch_manager&filter=album-'.$category['id'];
- }
-
$template->append('categories', $tpl_cat);
}
diff --git a/admin/themes/default/template/cat_list.tpl b/admin/themes/default/template/cat_list.tpl
index 8b173034c..5fe54b9eb 100644
--- a/admin/themes/default/template/cat_list.tpl
+++ b/admin/themes/default/template/cat_list.tpl
@@ -116,15 +116,13 @@ jQuery(document).ready(function(){
<p class="albumTitle">
<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="drag_button" style="display:none;" alt="{'Drag to re-order'|@translate}" title="{'Drag to re-order'|@translate}">
<strong><a href="{$category.U_CHILDREN}" title="{'manage sub-albums'|@translate}">{$category.NAME}</a></strong>
+ <span class="albumInfos"><span class="userSeparator">&middot;</span> {$category.NB_PHOTOS|translate_dec:'%d photo':'%d photos'} <span class="userSeparator">&middot;</span> {$category.NB_SUB_PHOTOS|translate_dec:'%d photo':'%d photos'} {$category.NB_SUB_ALBUMS|translate_dec:'in %d sub-album':'in %d sub-albums'}</span>
</p>
<input type="hidden" name="catOrd[{$category.ID}]" value="{$category.RANK}">
<p class="albumActions">
<a href="{$category.U_EDIT}"><span class="icon-pencil"></span>{'Edit'|@translate}</a>
- {if isset($category.U_MANAGE_ELEMENTS) }
- | <a href="{$category.U_MANAGE_ELEMENTS}"><span class="icon-picture"></span>{'manage album photos'|@translate}</a>
- {/if}
| <a href="{$category.U_CHILDREN}"><span class="icon-sitemap"></span>{'manage sub-albums'|@translate}</a>
{if isset($category.U_SYNC) }
| <a href="{$category.U_SYNC}"><span class="icon-exchange"></span>{'Synchronize'|@translate}</a>
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index 7a9322deb..654685563 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -1064,8 +1064,8 @@ p#uploadModeInfos {text-align:left;margin-top:1em;font-size:90%;color:#999;}
.commentFilter .navigationBar {float:right; margin:0;}
FORM#categoryOrdering p.albumTitle {margin:0;}
-FORM#categoryOrdering p.albumActions {visibility:hidden; margin:0}
-FORM#categoryOrdering .categoryLi:hover p.albumActions {visibility:visible;}
+FORM#categoryOrdering p.albumActions, FORM#categoryOrdering span.albumInfos {visibility:hidden; margin:0}
+FORM#categoryOrdering .categoryLi:hover p.albumActions, FORM#categoryOrdering .categoryLi:hover span.albumInfos {visibility:visible;}
.showCreateAlbum {text-align:left; margin:0 1em 1em 1em;line-height:22px;}
#autoOrder p, #createAlbum p {text-align:left; margin:0 0 1em 0;}