mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-29 12:49:57 +03:00
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:
parent
78769be780
commit
95e85f264e
4 changed files with 42 additions and 35 deletions
|
@ -21,7 +21,8 @@ $prefilters = array(
|
||||||
array('ID' => 'all_photos', 'NAME' => l10n('All'))
|
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_virtual_album', 'NAME' => l10n('With no virtual album'));
|
||||||
$prefilters[] = array('ID' => 'no_sync_md5sum', 'NAME' => l10n('With no checksum'));
|
$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(
|
$template->assign(
|
||||||
array(
|
array(
|
||||||
'NB_NO_MD5SUM' => $page['no_md5sum_number'],
|
'NB_NO_MD5SUM' => $page['no_md5sum_number'],
|
||||||
|
@ -64,7 +66,8 @@ if (isset($page['no_md5sum_number'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// privacy level
|
// privacy level
|
||||||
foreach ($conf['available_permission_levels'] as $level) {
|
foreach ($conf['available_permission_levels'] as $level)
|
||||||
|
{
|
||||||
$level_options[$level] = l10n(sprintf('Level %d', $level));
|
$level_options[$level] = l10n(sprintf('Level %d', $level));
|
||||||
|
|
||||||
if (0 == $level) {
|
if (0 == $level) {
|
||||||
|
@ -83,7 +86,8 @@ $template->assign(
|
||||||
// tags
|
// tags
|
||||||
$filter_tags = array();
|
$filter_tags = array();
|
||||||
|
|
||||||
if (!empty($_SESSION['bulk_manager_filter']['tags'])) {
|
if (!empty($_SESSION['bulk_manager_filter']['tags']))
|
||||||
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
|
@ -98,36 +102,25 @@ SELECT
|
||||||
$template->assign('filter_tags', $filter_tags);
|
$template->assign('filter_tags', $filter_tags);
|
||||||
|
|
||||||
// in the filter box, which category to select by default
|
// in the filter box, which category to select by default
|
||||||
$selected_category = array();
|
$selected_category = null;
|
||||||
if (isset($_SESSION['bulk_manager_filter']['category'])) {
|
$selected_category_name = '';
|
||||||
$selected_category = $_SESSION['bulk_manager_filter']['category'];
|
|
||||||
} else {
|
if (isset($_SESSION['bulk_manager_filter']['category']))
|
||||||
// we need to know the category in which the last photo was added
|
{
|
||||||
$query = '
|
$selected_category = intval($_SESSION['bulk_manager_filter']['category']);
|
||||||
SELECT category_id
|
$selected_category_name = get_cat_display_name_from_id($selected_category);
|
||||||
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_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_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
|
// Dissociate from a category : categories listed for dissociation can only
|
||||||
// represent virtual links. We can't create orphans. Links to physical
|
// represent virtual links. We can't create orphans. Links to physical
|
||||||
// categories can't be broken.
|
// categories can't be broken.
|
||||||
$associated_categories = array();
|
$associated_categories = array();
|
||||||
|
|
||||||
if (count($page['cat_elements_id']) > 0) {
|
if (count($page['cat_elements_id']) > 0)
|
||||||
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT(category_id) AS id
|
DISTINCT(category_id) AS id
|
||||||
|
|
|
@ -33,9 +33,11 @@ function filter_disable(filter) {
|
||||||
}
|
}
|
||||||
// Album Selector
|
// Album Selector
|
||||||
function select_album_filter({ album, newSelectedAlbum, getSelectedAlbum }) {
|
function select_album_filter({ album, newSelectedAlbum, getSelectedAlbum }) {
|
||||||
$('#selectedAlbumNameFilter').html(album.full_name_with_admin_links);
|
$('#selectedAlbumNameFilter').html(album.name);
|
||||||
newSelectedAlbum();
|
newSelectedAlbum();
|
||||||
$('#filterCategoryValue').val(+getSelectedAlbum()[0]);
|
$('#filterCategoryValue').val(+getSelectedAlbum()[0]);
|
||||||
|
$('#selectAlbumFilter').hide();
|
||||||
|
$('#selectedAlbumFilterArea').fadeIn();
|
||||||
}
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
const ab_filter = new AlbumSelector({
|
const ab_filter = new AlbumSelector({
|
||||||
|
@ -44,7 +46,7 @@ $(document).ready(function () {
|
||||||
adminMode: true,
|
adminMode: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#selectedAlbumEditFilter').on('click', function() {
|
$('#selectAlbumFilter, #selectedAlbumEditFilter').on('click', function() {
|
||||||
ab_filter.open();
|
ab_filter.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,11 @@ var sliders = {
|
||||||
text: '{'between %s and %s MB'|translate|escape:'javascript'}'
|
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}"];
|
const selected_filter_cat_ids = ["{$filter_category_selected|@json_encode|escape:html}"];
|
||||||
|
{else}
|
||||||
|
const selected_filter_cat_ids = [];
|
||||||
|
{/if}
|
||||||
{/footer_script}
|
{/footer_script}
|
||||||
|
|
||||||
{combine_script id='batchManagerFilter' load='footer' path='admin/themes/default/js/batchManagerFilter.js'}
|
{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>
|
<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}"
|
{* <select data-selectize="categories" data-value="{$filter_category_selected|@json_encode|escape:html}"
|
||||||
data-default="first" name="filter_category"></select> *}
|
data-default="first" name="filter_category"></select> *}
|
||||||
<div class="selectedAlbum" id="selectedAlbumFilter">
|
<div id="selectedAlbumFilterArea" {if !$filter_category_selected}style="display: none;"{/if}>
|
||||||
<input type="hidden" name="filter_category" id="filterCategoryValue" value="{$filter_category_selected|@json_encode|escape:html}">
|
<div class="selectedAlbum" id="selectedAlbumFilter">
|
||||||
<span class="icon-sitemap" id="selectedAlbumNameFilter">{$filter_category_selected_name}</span>
|
<input type="hidden" name="filter_category" id="filterCategoryValue" value="{$filter_category_selected|@json_encode|escape:html}">
|
||||||
<a class="icon-pencil" id="selectedAlbumEditFilter"></a>
|
<span class="icon-sitemap" id="selectedAlbumNameFilter">{$filter_category_selected_name}</span>
|
||||||
</div>
|
<a class="icon-pencil" id="selectedAlbumEditFilter"></a>
|
||||||
<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>
|
||||||
|
<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>
|
||||||
|
|
||||||
<li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>
|
<li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}>
|
||||||
|
|
|
@ -6472,6 +6472,10 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#selectAlbumFilter {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
.selectedAlbum span.icon-sitemap::before, .afterUploadActions a.batchLink.icon-pencil::before, .afterUploadActions a.icon-plus-circled::before {
|
.selectedAlbum span.icon-sitemap::before, .afterUploadActions a.batchLink.icon-pencil::before, .afterUploadActions a.icon-plus-circled::before {
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue