fixes #377 use Ajax calls to refresh/delete album thumbnail

This commit is contained in:
plegall 2015-12-01 12:08:10 +01:00
parent 27389102d1
commit be6afad731
6 changed files with 211 additions and 40 deletions

View file

@ -172,21 +172,6 @@ UPDATE '.CATEGORIES_TABLE.'
$_SESSION['page_infos'][] = l10n('Album updated successfully');
$redirect = true;
}
elseif (isset($_POST['set_random_representant']))
{
set_random_representant(array($_GET['cat_id']));
$redirect = true;
}
elseif (isset($_POST['delete_representant']))
{
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET representative_picture_id = NULL
WHERE id = '.$_GET['cat_id'].'
;';
pwg_query($query);
$redirect = true;
}
if (isset($redirect))
{
@ -336,8 +321,7 @@ else
}
// representant management
if ($category['has_images']
or !empty($category['representative_picture_id']))
if ($category['has_images'] or !empty($category['representative_picture_id']))
{
$tpl_representant = array();
@ -345,20 +329,7 @@ if ($category['has_images']
// representant ?
if (!empty($category['representative_picture_id']))
{
$query = '
SELECT id,representative_ext,path
FROM '.IMAGES_TABLE.'
WHERE id = '.$category['representative_picture_id'].'
;';
$row = pwg_db_fetch_assoc(pwg_query($query));
$src = DerivativeImage::thumb_url($row);
$url = get_root_url().'admin.php?page=photo-'.$category['representative_picture_id'];
$tpl_representant['picture'] =
array(
'SRC' => $src,
'URL' => $url
);
$tpl_representant['picture'] = get_category_representant_properties($category['representative_picture_id']);
}
// can the admin choose to set a new random representant ?