fixes #2253 use only bulk_manager_filter category for album selection

I've also adapted the tpl and js files
This commit is contained in:
Linty 2024-10-31 12:13:52 +01:00
parent 78769be780
commit 95e85f264e
4 changed files with 42 additions and 35 deletions

View file

@ -21,7 +21,8 @@ $prefilters = array(
array('ID' => 'all_photos', 'NAME' => l10n('All'))
);
if ($conf['enable_synchronization']) {
if ($conf['enable_synchronization'])
{
$prefilters[] = array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'));
$prefilters[] = array('ID' => 'no_sync_md5sum', 'NAME' => l10n('With no checksum'));
}
@ -53,7 +54,8 @@ $template->assign(
)
);
if (isset($page['no_md5sum_number'])) {
if (isset($page['no_md5sum_number']))
{
$template->assign(
array(
'NB_NO_MD5SUM' => $page['no_md5sum_number'],
@ -64,7 +66,8 @@ if (isset($page['no_md5sum_number'])) {
}
// privacy level
foreach ($conf['available_permission_levels'] as $level) {
foreach ($conf['available_permission_levels'] as $level)
{
$level_options[$level] = l10n(sprintf('Level %d', $level));
if (0 == $level) {
@ -83,7 +86,8 @@ $template->assign(
// tags
$filter_tags = array();
if (!empty($_SESSION['bulk_manager_filter']['tags'])) {
if (!empty($_SESSION['bulk_manager_filter']['tags']))
{
$query = '
SELECT
id,
@ -98,36 +102,25 @@ SELECT
$template->assign('filter_tags', $filter_tags);
// in the filter box, which category to select by default
$selected_category = array();
if (isset($_SESSION['bulk_manager_filter']['category'])) {
$selected_category = $_SESSION['bulk_manager_filter']['category'];
} else {
// we need to know the category in which the last photo was added
$query = '
SELECT category_id
FROM ' . IMAGE_CATEGORY_TABLE . '
ORDER BY image_id DESC
LIMIT 1
;';
$result = pwg_query($query);
if (pwg_db_num_rows($result) > 0) {
$row = pwg_db_fetch_assoc($result);
$selected_category = $row['category_id'];
}
}
$selected_category = null;
$selected_category_name = '';
if (isset($_SESSION['bulk_manager_filter']['category']))
{
$selected_category = intval($_SESSION['bulk_manager_filter']['category']);
$selected_category_name = get_cat_display_name_from_id($selected_category);
}
$selected_category_name = get_cat_display_name_from_id(
$selected_category,
);
$template->assign('filter_category_selected_name', strip_tags($selected_category_name));
$template->assign('filter_category_selected', intval($selected_category));
$template->assign('filter_category_selected', $selected_category);
// Dissociate from a category : categories listed for dissociation can only
// represent virtual links. We can't create orphans. Links to physical
// categories can't be broken.
$associated_categories = array();
if (count($page['cat_elements_id']) > 0) {
if (count($page['cat_elements_id']) > 0)
{
$query = '
SELECT
DISTINCT(category_id) AS id

View file

@ -33,9 +33,11 @@ function filter_disable(filter) {
}
// Album Selector
function select_album_filter({ album, newSelectedAlbum, getSelectedAlbum }) {
$('#selectedAlbumNameFilter').html(album.full_name_with_admin_links);
$('#selectedAlbumNameFilter').html(album.name);
newSelectedAlbum();
$('#filterCategoryValue').val(+getSelectedAlbum()[0]);
$('#selectAlbumFilter').hide();
$('#selectedAlbumFilterArea').fadeIn();
}
$(document).ready(function () {
const ab_filter = new AlbumSelector({
@ -44,7 +46,7 @@ $(document).ready(function () {
adminMode: true,
});
$('#selectedAlbumEditFilter').on('click', function() {
$('#selectAlbumFilter, #selectedAlbumEditFilter').on('click', function() {
ab_filter.open();
});

View file

@ -44,8 +44,11 @@ var sliders = {
text: '{'between %s and %s MB'|translate|escape:'javascript'}'
}
};
{if isset($filter_category_selected) and $filter_category_selected}
const selected_filter_cat_ids = ["{$filter_category_selected|@json_encode|escape:html}"];
{else}
const selected_filter_cat_ids = [];
{/if}
{/footer_script}
{combine_script id='batchManagerFilter' load='footer' path='admin/themes/default/js/batchManagerFilter.js'}
@ -107,12 +110,17 @@ const selected_filter_cat_ids = ["{$filter_category_selected|@json_encode|escape
<a href="#" class="removeFilter" title="{'remove this filter'|translate}"><span>[x]</span></a>
{* <select data-selectize="categories" data-value="{$filter_category_selected|@json_encode|escape:html}"
data-default="first" name="filter_category"></select> *}
<div class="selectedAlbum" id="selectedAlbumFilter">
<input type="hidden" name="filter_category" id="filterCategoryValue" value="{$filter_category_selected|@json_encode|escape:html}">
<span class="icon-sitemap" id="selectedAlbumNameFilter">{$filter_category_selected_name}</span>
<a class="icon-pencil" id="selectedAlbumEditFilter"></a>
</div>
<label class="font-checkbox"><span class="icon-check"></span><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
<div id="selectedAlbumFilterArea" {if !$filter_category_selected}style="display: none;"{/if}>
<div class="selectedAlbum" id="selectedAlbumFilter">
<input type="hidden" name="filter_category" id="filterCategoryValue" value="{$filter_category_selected|@json_encode|escape:html}">
<span class="icon-sitemap" id="selectedAlbumNameFilter">{$filter_category_selected_name}</span>
<a class="icon-pencil" id="selectedAlbumEditFilter"></a>
</div>
<label class="font-checkbox"><span class="icon-check"></span><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
</div>
<p class="head-button-1" id="selectAlbumFilter" {if $filter_category_selected}style="display: none;"{/if}>
{"Select an album"|translate}
</p>
</li>
<li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>

View file

@ -6472,6 +6472,10 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important;
text-align: start;
}
#selectAlbumFilter {
width: fit-content;
}
.selectedAlbum span.icon-sitemap::before, .afterUploadActions a.batchLink.icon-pencil::before, .afterUploadActions a.icon-plus-circled::before {
margin-right: 12px;
}