diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index c817f93bc..64ffe55c4 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -99,6 +99,7 @@ if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) )
//--------------------------------------------------------- form criteria check
if (isset($_POST['submit']))
{
+
$data = array(
'id' => $_GET['cat_id'],
'name' => @$_POST['name'],
@@ -109,9 +110,9 @@ if (isset($_POST['submit']))
if ($conf['activate_comments'])
{
- $data['commentable'] = isset($_POST['commentable'])?$_POST['commentable']:'false';
+ $data['commentable'] = isset($_POST['commentable'])? 'true':'false';
}
-
+
single_update(
CATEGORIES_TABLE,
$data,
@@ -131,11 +132,11 @@ UPDATE '.CATEGORIES_TABLE.'
// retrieve cat infos before continuing (following updates are expensive)
$cat_info = get_cat_info($_GET['cat_id']);
- if ($_POST['visible']=='true_sub')
+ if (isset($_POST['visible']))
{
set_cat_visible(array($_GET['cat_id']), true, true);
}
- elseif ($cat_info['visible'] != get_boolean( $_POST['visible'] ) )
+ elseif ($cat_info['visible'] != isset($_POST['visible']))
{
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
}
@@ -317,7 +318,7 @@ SELECT
if ($min_date == $max_date)
{
- $intro = l10n(
+ $info_title = l10n(
'This album contains %d photos, added on %s.',
$image_count,
format_date($min_date)
@@ -325,19 +326,64 @@ SELECT
}
else
{
- $intro = l10n(
+ $info_title = l10n(
'This album contains %d photos, added between %s and %s.',
$image_count,
format_date($min_date),
format_date($max_date)
);
}
+ $info_photos = l10n('%d photos', $image_count);
+
+ $template->assign(
+ array(
+ 'INFO_PHOTO' => $info_photos,
+ 'INFO_TITLE' => $info_title
+ )
+ );
+
}
-else
-{
- $intro = l10n('This album contains no photo.');
+
+// date creation
+$query = '
+SELECT occured_on
+ FROM `'.ACTIVITY_TABLE.'`
+ WHERE object_id = '.$category['id'].'
+ AND object = "album"
+ AND action = "add"
+';
+$result = query2array($query);
+
+if (count($result) > 0) {
+ $template->assign(
+ array(
+ 'INFO_CREATION' => l10n('Created on %s',format_date($result[0]['occured_on']))
+ )
+ );
}
+// Sub Albums
+$query = '
+SELECT COUNT(*)
+ FROM `'.CATEGORIES_TABLE.'`
+ WHERE id_uppercat = '.$category['id'].'
+';
+$result = query2array($query);
+
+if ($result[0]['COUNT(*)'] > 0) {
+ $template->assign(
+ array(
+ 'INFO_DIRECT_SUB' => l10n('%d sub-albums',$result[0]['COUNT(*)'])
+ )
+ );
+}
+
+$template->assign(array(
+ 'INFO_ID' => l10n('Numeric identifier : %d',$category['id']),
+ 'INFO_LAST_MODIFIED'=> l10n('Edited on %s',format_date($category['lastmodified']))
+ )
+ );
+
// info for deletion
$template->assign(
array(
@@ -349,10 +395,7 @@ $template->assign(
)
);
-$intro.= '
'.l10n('Numeric identifier : %d', $category['id']);
-
$template->assign(array(
- 'INTRO' => $intro,
'U_MANAGE_RANKS' => $base_url.'element_set_ranks&cat_id='.$category['id'],
'CACHE_KEYS' => get_admin_client_cache_keys(array('categories')),
));
@@ -393,7 +436,7 @@ if ($category['has_images'] or !empty($category['representative_picture_id']))
// representant ?
if (!empty($category['representative_picture_id']))
{
- $tpl_representant['picture'] = get_category_representant_properties($category['representative_picture_id']);
+ $tpl_representant['picture'] = get_category_representant_properties($category['representative_picture_id'], IMG_SMALL);
}
// can the admin choose to set a new random representant ?
diff --git a/admin/include/functions.php b/admin/include/functions.php
index aa2cd5c7c..d81ae8942 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -989,15 +989,20 @@ SELECT uppercats
/**
*/
-function get_category_representant_properties($image_id)
+function get_category_representant_properties($image_id, $size = NULL)
{
$query = '
SELECT id,representative_ext,path
FROM '.IMAGES_TABLE.'
WHERE id = '.$image_id.'
;';
+
$row = pwg_db_fetch_assoc(pwg_query($query));
- $src = DerivativeImage::thumb_url($row);
+ if ($size == NULL) {
+ $src = DerivativeImage::thumb_url($row);
+ } else {
+ $src = DerivativeImage::url($size, $row);
+ }
$url = get_root_url().'admin.php?page=photo-'.$image_id;
return array(
diff --git a/admin/themes/clear/theme.css b/admin/themes/clear/theme.css
index a0f0ad73e..a19b00530 100644
--- a/admin/themes/clear/theme.css
+++ b/admin/themes/clear/theme.css
@@ -662,6 +662,13 @@ table.dataTable thead th, table.dataTable.no-footer {
background-color:#fff;
}
+FORM#categoryOrdering p.albumTitle a { color: #5B5B5B; }
+FORM#categoryOrdering p.albumActions a { border-left:1px solid #D6D6D6; background-color: #E8E8E8;}
+.albumInfos {color: #999999;}
+FORM#categoryOrdering p.albumActions a:hover {background-color: #FFA844; color: #3A3A3A;}
+FORM#categoryOrdering p.albumActions .userSeparator {border: 1px solid #E1E1E1;}
+#addAlbumOpen, #autoOrderOpen {border: 1px solid #D6D6D6; color: #5B5B5B;}
+#addAlbumOpen:hover, #autoOrderOpen:hover {border: 1px solid #aaa; text-decoration: none;}
.afterUploadActions a {color: #3C3C3C; font-weight: bold; background-color: #FFA646;}
.afterUploadActions a:hover {text-decoration: none; background-color: #ff7700;}
.font-checkbox:hover {color: #FFA844;}
diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl
index f89613c67..3f349c75a 100644
--- a/admin/themes/default/template/cat_modify.tpl
+++ b/admin/themes/default/template/cat_modify.tpl
@@ -45,11 +45,19 @@ jQuery(document).ready(function() {
success:function(data) {
var data = jQuery.parseJSON(data);
if (data.stat == 'ok') {
- jQuery(".albumThumbnailImage")
- .attr('href', data.result.url)
- .find("img").attr('src', data.result.src)
- .end().show();
+ console.log('plouk');
+
+ jQuery(".albumThumbailImage, .albumThumbnailRandom").on('load', function () {
+ cropImage();
+ })
+ jQuery(".albumThumbailImage, .albumThumbnailRandom")
+ .attr('src', data.result.src)
+ .end().show();
+
+
+ jQuery(".albumThumbnailEdit")
+ .attr('href', data.result.url)
jQuery(".albumThumbnailRandom").hide();
}
else {
@@ -132,6 +140,29 @@ jQuery(document).ready(function() {
});
});
+$(window).bind("load", function() {
+ cropImage();
+});
+
+$(window).resize(function() {
+ cropImage();
+});
+
+function cropImage() {
+ let image = $(".albumThumbailImage");
+ let imageW = image[0].naturalWidth;
+ let imageH = image[0].naturalHeight;
+ let size = $('.catThumbnail').innerWidth();
+
+ if (imageW > imageH) {
+ image.css('height', size+'px');
+ image.css('width', (imageW * size / imageH)+'px');
+ } else {
+ image.css('width', size+'px');
+ image.css('heigth', (imageH * size / imageW)+'px');
+ }
+}
+
{/footer_script}
{html_style}
@@ -170,62 +201,106 @@ jQuery(document).ready(function() {