Issue #1208 : Implementation of the new album edit page

This commit is contained in:
Zacharie
2020-08-12 10:20:29 +02:00
committed by plegall
parent e6b0574cde
commit d4436b825d
7 changed files with 348 additions and 119 deletions
+56 -13
View File
@@ -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.= '<br>'.l10n('Numeric identifier : %d', $category['id']);
$template->assign(array(
'INTRO' => $intro,
'U_MANAGE_RANKS' => $base_url.'element_set_ranks&amp;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 ?