mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-06 16:53:34 +02:00
Added filters according to global mode
This commit is contained in:
@@ -96,6 +96,40 @@ SELECT id, date_creation
|
||||
invalidate_user_cache();
|
||||
}
|
||||
|
||||
//collection
|
||||
$collection = array();
|
||||
if (isset($_POST['nb_photos_deleted']))
|
||||
{
|
||||
check_input_parameter('nb_photos_deleted', $_POST, false, '/^\d+$/');
|
||||
|
||||
// let's fake a collection (we don't know the image_ids so we use "null", we only
|
||||
// care about the number of items here)
|
||||
$collection = array_fill(0, $_POST['nb_photos_deleted'], null);
|
||||
}
|
||||
else if (isset($_POST['setSelected']))
|
||||
{
|
||||
// Here we don't use check_input_parameter because preg_match has a limit in
|
||||
// the repetitive pattern. Found a limit to 3276 but may depend on memory.
|
||||
//
|
||||
// check_input_parameter('whole_set', $_POST, false, '/^\d+(,\d+)*$/');
|
||||
//
|
||||
// Instead, let's break the input parameter into pieces and check pieces one by one.
|
||||
$collection = explode(',', $_POST['whole_set']);
|
||||
|
||||
foreach ($collection as $id)
|
||||
{
|
||||
if (!preg_match('/^\d+$/', $id))
|
||||
{
|
||||
fatal_error('[Hacking attempt] the input parameter "whole_set" is not valid');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isset($_POST['selection']))
|
||||
{
|
||||
$collection = $_POST['selection'];
|
||||
}
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template init |
|
||||
// +-----------------------------------------------------------------------+
|
||||
@@ -108,12 +142,127 @@ $base_url = PHPWG_ROOT_PATH.'admin.php';
|
||||
$template->assign(
|
||||
array(
|
||||
'U_ELEMENTS_PAGE' => $base_url.get_query_string_diff(array('display','start')),
|
||||
'F_ACTION' => $base_url.get_query_string_diff(array()),
|
||||
'level_options' => get_privacy_level_options(),
|
||||
'ADMIN_PAGE_TITLE' => l10n('Batch Manager'),
|
||||
'PWG_TOKEN' => get_pwg_token(),
|
||||
)
|
||||
);
|
||||
//prefilter
|
||||
$prefilters = array(
|
||||
array('ID' => 'caddie', 'NAME' => l10n('Caddie')),
|
||||
array('ID' => 'favorites', 'NAME' => l10n('Your favorites')),
|
||||
array('ID' => 'last_import', 'NAME' => l10n('Last import')),
|
||||
array('ID' => 'no_album', 'NAME' => l10n('With no album').' ('.l10n('Orphans').')'),
|
||||
array('ID' => 'no_tag', 'NAME' => l10n('With no tag')),
|
||||
array('ID' => 'duplicates', 'NAME' => l10n('Duplicates')),
|
||||
array('ID' => 'all_photos', 'NAME' => l10n('All'))
|
||||
);
|
||||
|
||||
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'));
|
||||
}
|
||||
|
||||
function UC_name_compare($a, $b)
|
||||
{
|
||||
return strcmp(strtolower($a['NAME']), strtolower($b['NAME']));
|
||||
}
|
||||
|
||||
$prefilters = trigger_change('get_batch_manager_prefilters', $prefilters);
|
||||
|
||||
// Sort prefilters by localized name.
|
||||
usort($prefilters, function ($a, $b) {
|
||||
return strcmp(strtolower($a['NAME']), strtolower($b['NAME']));
|
||||
});
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'conf_checksum_compute_blocksize' => $conf['checksum_compute_blocksize'],
|
||||
'prefilters' => $prefilters,
|
||||
'filter' => $_SESSION['bulk_manager_filter'],
|
||||
'selection' => $collection,
|
||||
'all_elements' => $page['cat_elements_id'],
|
||||
'START' => $page['start'],
|
||||
'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
|
||||
'F_ACTION'=>$base_url.get_query_string_diff(array('cat','start','tag','filter')),
|
||||
)
|
||||
);
|
||||
|
||||
if (isset($page['no_md5sum_number']))
|
||||
{
|
||||
$template->assign(
|
||||
array(
|
||||
'NB_NO_MD5SUM' => $page['no_md5sum_number'],
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$template->assign('NB_NO_MD5SUM', '');
|
||||
}
|
||||
|
||||
|
||||
// privacy level
|
||||
foreach ($conf['available_permission_levels'] as $level)
|
||||
{
|
||||
$level_options[$level] = l10n(sprintf('Level %d', $level));
|
||||
|
||||
if (0 == $level)
|
||||
{
|
||||
$level_options[$level] = l10n('Everybody');
|
||||
}
|
||||
}
|
||||
$template->assign(
|
||||
array(
|
||||
'filter_level_options'=> $level_options,
|
||||
'filter_level_options_selected' => isset($_SESSION['bulk_manager_filter']['level'])
|
||||
? $_SESSION['bulk_manager_filter']['level']
|
||||
: 0,
|
||||
)
|
||||
);
|
||||
|
||||
// tags
|
||||
$filter_tags = array();
|
||||
|
||||
if (!empty($_SESSION['bulk_manager_filter']['tags']))
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
id,
|
||||
name
|
||||
FROM '.TAGS_TABLE.'
|
||||
WHERE id IN ('.implode(',', $_SESSION['bulk_manager_filter']['tags']).')
|
||||
;';
|
||||
|
||||
$filter_tags = get_taglist($query);
|
||||
}
|
||||
|
||||
$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 = array($_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'];
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign('filter_category_selected', $selected_category);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | global mode thumbnails |
|
||||
|
||||
@@ -1,4 +1,73 @@
|
||||
/* ********** Filters*/
|
||||
function filter_enable(filter) {
|
||||
/* show the filter*/
|
||||
$("#"+filter).show();
|
||||
|
||||
/* check the checkbox to declare we use this filter */
|
||||
$("input[type=checkbox][name="+filter+"_use]").prop("checked", true);
|
||||
|
||||
/* forbid to select this filter in the addFilter list */
|
||||
$("#addFilter").find("a[data-value="+filter+"]").addClass("disabled", "disabled");
|
||||
|
||||
/* hide the no filter message */
|
||||
$('.noFilter').hide();
|
||||
$('.addFilter-button').removeClass('highlight');
|
||||
}
|
||||
|
||||
function filter_disable(filter) {
|
||||
/* hide the filter line */
|
||||
$("#"+filter).hide();
|
||||
|
||||
/* uncheck the checkbox to declare we do not use this filter */
|
||||
$("input[name="+filter+"_use]").prop("checked", false);
|
||||
|
||||
/* give the possibility to show it again */
|
||||
$("#addFilter").find("a[data-value="+filter+"]").removeClass("disabled");
|
||||
|
||||
/* show the no filter message if no filter selected */
|
||||
if ($('#filterList li:visible').length == 0) {
|
||||
$('.noFilter').show();
|
||||
$('.addFilter-button').addClass('highlight');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".removeFilter").addClass("icon-cancel-circled");
|
||||
|
||||
$(".removeFilter").click(function () {
|
||||
var filter = $(this).parent('li').attr("id");
|
||||
filter_disable(filter);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#addFilter a").on('click', function () {
|
||||
var filter = $(this).attr("data-value");
|
||||
filter_enable(filter);
|
||||
});
|
||||
|
||||
$("#removeFilters").click(function() {
|
||||
$("#filterList li").each(function() {
|
||||
var filter = $(this).attr("id");
|
||||
filter_disable(filter);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('[data-slider=widths]').pwgDoubleSlider(sliders.widths);
|
||||
$('[data-slider=heights]').pwgDoubleSlider(sliders.heights);
|
||||
$('[data-slider=ratios]').pwgDoubleSlider(sliders.ratios);
|
||||
$('[data-slider=filesizes]').pwgDoubleSlider(sliders.filesizes);
|
||||
|
||||
$(document).mouseup(function (e) {
|
||||
e.stopPropagation();
|
||||
if (!$(event.target).hasClass('addFilter-button')) {
|
||||
$('.addFilter-dropdown').slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
// Detect unsaved changes on any inputs
|
||||
var user_interacted = false;
|
||||
|
||||
@@ -10,129 +79,18 @@ $(document).ready(function () {
|
||||
var pictureId = $(this).parents("fieldset").data("image_id");
|
||||
if (user_interacted == true) {
|
||||
showUnsavedLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.icon-cancel-circled, .item-add').on('click', function() {
|
||||
$('.related-categories-container .remove-item').on('click', function() {
|
||||
user_interacted = true;
|
||||
var pictureId = $(this).parents("fieldset").data("image_id");
|
||||
showUnsavedLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
|
||||
|
||||
});
|
||||
|
||||
function updateUnsavedGlobalBadge() {
|
||||
var visibleLocalUnsavedCount = $(".local-unsaved-badge").filter(function() {
|
||||
return $(this).css('display') === 'block';
|
||||
}).length;
|
||||
|
||||
if (visibleLocalUnsavedCount > 0) {
|
||||
$(".global-unsaved-badge").css('display', 'block');
|
||||
$("#unsaved-count").text(visibleLocalUnsavedCount);
|
||||
} else {
|
||||
$(".global-unsaved-badge").css('display', 'none');
|
||||
$("#unsaved-count").text('');
|
||||
}
|
||||
}
|
||||
|
||||
function showUnsavedLocalBadge(pictureId) {
|
||||
hideSuccesLocalBadge(pictureId);
|
||||
hideErrorLocalBadge(pictureId);
|
||||
$("#picture-" + pictureId + " .local-unsaved-badge").css('display', 'block');
|
||||
}
|
||||
|
||||
function hideUnsavedLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-unsaved-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
if (user_interacted) {
|
||||
return "You have unsaved changes, are you sure you want to leave this page?";
|
||||
}
|
||||
});
|
||||
//Error badge
|
||||
function showErrorLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-error-badge").css('display', 'block');
|
||||
}
|
||||
function hideErrorLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-error-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
//Succes badge
|
||||
function updateSuccesGlobalBadge() {
|
||||
var visibleLocalSuccesCount = $(".local-succes-badge").filter(function() {
|
||||
return $(this).css('display') === 'block';
|
||||
}).length;
|
||||
|
||||
if (visibleLocalSuccesCount > 0) {
|
||||
showSuccesGlobalBadge()
|
||||
} else {
|
||||
hideSuccesGlobalBadge()
|
||||
}
|
||||
}
|
||||
|
||||
function showSuccesLocalBadge(pictureId) {
|
||||
var badge = $("#picture-" + pictureId + " .local-succes-badge");
|
||||
badge.css({
|
||||
'display': 'block',
|
||||
'opacity': 1
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
badge.fadeOut(1000, function() {
|
||||
badge.css('display', 'none');
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function hideSuccesLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-succes-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
function showSuccesGlobalBadge() {
|
||||
var badge = $(".global-succes-badge");
|
||||
badge.css({
|
||||
'display': 'block',
|
||||
'opacity': 1
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
badge.fadeOut(1000, function() {
|
||||
badge.css('display', 'none');
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function hideSuccesGlobalBadge() {
|
||||
$("global-succes-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
function disableLocalButton(pictureId) {
|
||||
$("#picture-" + pictureId + " .action-save-picture").addClass("disabled");
|
||||
|
||||
$("#picture-" + pictureId + " .action-save-picture i").removeClass("icon-floppy").addClass("icon-spin6 animate-spin");
|
||||
}
|
||||
|
||||
function enableLocalButton(pictureId) {
|
||||
$("#picture-" + pictureId + " .action-save-picture").removeClass("disabled");
|
||||
|
||||
$("#picture-" + pictureId + " .action-save-picture i").removeClass("icon-spin6 animate-spin").addClass("icon-floppy");
|
||||
}
|
||||
|
||||
function disableGlobalButton() {
|
||||
$(".action-save-global").addClass("disabled");
|
||||
|
||||
$(".action-save-global i").removeClass("icon-floppy").addClass("icon-spin6 animate-spin");
|
||||
}
|
||||
|
||||
function enableGlobalButton() {
|
||||
$(".action-save-global").removeClass("disabled");
|
||||
|
||||
$(".action-save-global i").removeClass("icon-spin6 animate-spin").addClass("icon-floppy");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// DELETE
|
||||
$('.action-delete-picture').on('click', function(event) {
|
||||
var $fieldset = $(this).parents("fieldset");
|
||||
@@ -213,80 +171,7 @@ function enableGlobalButton() {
|
||||
saveAllChanges();
|
||||
});
|
||||
|
||||
function saveChanges(pictureId) {
|
||||
if ($("#picture-" + pictureId + " .local-unsaved-badge").css('display') === 'block') {
|
||||
disableGlobalButton();
|
||||
disableLocalButton(pictureId)
|
||||
console.log("Saving changes for " + pictureId);
|
||||
|
||||
// Retrieve Infos
|
||||
var name = $("#name-" + pictureId).val();
|
||||
var author = $("#author-" + pictureId).val();
|
||||
var date_creation = $("#date_creation-" + pictureId).val();
|
||||
var comment = $("#description-" + pictureId).val();
|
||||
var level = $("#level-" + pictureId + " option:selected").val();
|
||||
|
||||
// Get Categories
|
||||
var categories = [];
|
||||
$("#picture-" + pictureId + " .remove-item").each(function() {
|
||||
categories.push($(this).attr("id"));
|
||||
});
|
||||
var categoriesStr = categories.join(';');
|
||||
|
||||
// Get Tags
|
||||
var tags = [];
|
||||
$("#tags-" + pictureId + " option").each(function() {
|
||||
var tagId = $(this).val().replace(/~~/g, '');
|
||||
tags.push(tagId);
|
||||
});
|
||||
var tagsStr = tags.join(',');
|
||||
|
||||
$.ajax({
|
||||
url: 'ws.php?format=json',
|
||||
method: 'POST',
|
||||
data: {
|
||||
method: 'pwg.images.setInfo',
|
||||
image_id: pictureId,
|
||||
name: name,
|
||||
author: author,
|
||||
date_creation: date_creation,
|
||||
comment: comment,
|
||||
categories: categoriesStr,
|
||||
tag_ids: tagsStr,
|
||||
level: level,
|
||||
single_value_mode: "replace",
|
||||
multiple_value_mode: "replace",
|
||||
pwg_token: jQuery("input[name=pwg_token]").val()
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
enableLocalButton(pictureId);
|
||||
enableGlobalButton();
|
||||
hideUnsavedLocalBadge(pictureId);
|
||||
showSuccesLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
updateSuccesGlobalBadge();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
enableLocalButton(pictureId);
|
||||
enableGlobalButton();
|
||||
hideUnsavedLocalBadge(pictureId);
|
||||
showErrorLocalBadge(pictureId);
|
||||
updateUnsavedGlobalBadge();
|
||||
updateSuccesGlobalBadge();
|
||||
console.error('Error:', error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("No changes to save for " + pictureId);
|
||||
}
|
||||
}
|
||||
function saveAllChanges() {
|
||||
$("fieldset").each(function() {
|
||||
var pictureId = $(this).data("image_id");
|
||||
saveChanges(pictureId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Categories
|
||||
@@ -337,7 +222,7 @@ function fill_results(cats, pictureId) {
|
||||
cats.forEach(cat => {
|
||||
$("#searchResult").append(
|
||||
"<div class='search-result-item' id="+ cat.id + ">" +
|
||||
"<span class='search-result-path'>" + cat.fullname +"</span><span id="+ cat.id + " class='icon-plus-circled item-add'></span>" +
|
||||
"<span class='search-result-path'>" + cat.fullname +"</span><span id="+ cat.id + " class='icon-plus-circled item-add' onclick='showUnsavedLocalBadge("+ pictureId + ")'></span>" +
|
||||
"</div>"
|
||||
);
|
||||
var this_related_category_ids = window["related_category_ids_" + pictureId];
|
||||
@@ -411,7 +296,189 @@ function fill_results(cats, pictureId) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateUnsavedGlobalBadge() {
|
||||
var visibleLocalUnsavedCount = $(".local-unsaved-badge").filter(function() {
|
||||
return $(this).css('display') === 'block';
|
||||
}).length;
|
||||
|
||||
if (visibleLocalUnsavedCount > 0) {
|
||||
$(".global-unsaved-badge").css('display', 'block');
|
||||
$("#unsaved-count").text(visibleLocalUnsavedCount);
|
||||
} else {
|
||||
$(".global-unsaved-badge").css('display', 'none');
|
||||
$("#unsaved-count").text('');
|
||||
}
|
||||
}
|
||||
|
||||
function showUnsavedLocalBadge(pictureId) {
|
||||
hideSuccesLocalBadge(pictureId);
|
||||
hideErrorLocalBadge(pictureId);
|
||||
$("#picture-" + pictureId + " .local-unsaved-badge").css('display', 'block');
|
||||
updateUnsavedGlobalBadge();
|
||||
}
|
||||
|
||||
function hideUnsavedLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-unsaved-badge").css('display', 'none');
|
||||
updateUnsavedGlobalBadge();
|
||||
}
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
if (user_interacted) {
|
||||
return "You have unsaved changes, are you sure you want to leave this page?";
|
||||
}
|
||||
});
|
||||
//Error badge
|
||||
function showErrorLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-error-badge").css('display', 'block');
|
||||
}
|
||||
function hideErrorLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-error-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
//Succes badge
|
||||
function updateSuccessGlobalBadge() {
|
||||
var visibleLocalSuccesCount = $(".local-succes-badge").filter(function() {
|
||||
return $(this).css('display') === 'block';
|
||||
}).length;
|
||||
|
||||
if (visibleLocalSuccesCount > 0) {
|
||||
showSuccesGlobalBadge()
|
||||
} else {
|
||||
hideSuccesGlobalBadge()
|
||||
}
|
||||
}
|
||||
|
||||
function showSuccessLocalBadge(pictureId) {
|
||||
var badge = $("#picture-" + pictureId + " .local-succes-badge");
|
||||
badge.css({
|
||||
'display': 'block',
|
||||
'opacity': 1
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
badge.fadeOut(1000, function() {
|
||||
badge.css('display', 'none');
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function hideSuccesLocalBadge(pictureId) {
|
||||
$("#picture-" + pictureId + " .local-succes-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
function showSuccesGlobalBadge() {
|
||||
var badge = $(".global-succes-badge");
|
||||
badge.css({
|
||||
'display': 'block',
|
||||
'opacity': 1
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
badge.fadeOut(1000, function() {
|
||||
badge.css('display', 'none');
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function hideSuccesGlobalBadge() {
|
||||
$("global-succes-badge").css('display', 'none');
|
||||
}
|
||||
|
||||
function disableLocalButton(pictureId) {
|
||||
$("#picture-" + pictureId + " .action-save-picture").addClass("disabled");
|
||||
|
||||
$("#picture-" + pictureId + " .action-save-picture i").removeClass("icon-floppy").addClass("icon-spin6 animate-spin");
|
||||
disableGlobalButton();
|
||||
}
|
||||
|
||||
function enableLocalButton(pictureId) {
|
||||
$("#picture-" + pictureId + " .action-save-picture").removeClass("disabled");
|
||||
|
||||
$("#picture-" + pictureId + " .action-save-picture i").removeClass("icon-spin6 animate-spin").addClass("icon-floppy");
|
||||
}
|
||||
|
||||
function disableGlobalButton() {
|
||||
$(".action-save-global").addClass("disabled");
|
||||
|
||||
$(".action-save-global i").removeClass("icon-floppy").addClass("icon-spin6 animate-spin");
|
||||
}
|
||||
|
||||
function enableGlobalButton() {
|
||||
$(".action-save-global").removeClass("disabled");
|
||||
|
||||
$(".action-save-global i").removeClass("icon-spin6 animate-spin").addClass("icon-floppy");
|
||||
}
|
||||
|
||||
function saveChanges(pictureId) {
|
||||
if ($("#picture-" + pictureId + " .local-unsaved-badge").css('display') === 'block') {
|
||||
disableLocalButton(pictureId)
|
||||
console.log("Saving changes for " + pictureId);
|
||||
|
||||
// Retrieve Infos
|
||||
var name = $("#name-" + pictureId).val();
|
||||
var author = $("#author-" + pictureId).val();
|
||||
var date_creation = $("#date_creation-" + pictureId).val();
|
||||
var comment = $("#description-" + pictureId).val();
|
||||
var level = $("#level-" + pictureId + " option:selected").val();
|
||||
|
||||
// Get Categories
|
||||
var categories = [];
|
||||
$("#picture-" + pictureId + " .remove-item").each(function() {
|
||||
categories.push($(this).attr("id"));
|
||||
});
|
||||
var categoriesStr = categories.join(';');
|
||||
|
||||
// Get Tags
|
||||
var tags = [];
|
||||
$("#tags-" + pictureId + " option").each(function() {
|
||||
var tagId = $(this).val().replace(/~~/g, '');
|
||||
tags.push(tagId);
|
||||
});
|
||||
var tagsStr = tags.join(',');
|
||||
|
||||
$.ajax({
|
||||
url: 'ws.php?format=json',
|
||||
method: 'POST',
|
||||
data: {
|
||||
method: 'pwg.images.setInfo',
|
||||
image_id: pictureId,
|
||||
name: name,
|
||||
author: author,
|
||||
date_creation: date_creation,
|
||||
comment: comment,
|
||||
categories: categoriesStr,
|
||||
tag_ids: tagsStr,
|
||||
level: level,
|
||||
single_value_mode: "replace",
|
||||
multiple_value_mode: "replace",
|
||||
pwg_token: jQuery("input[name=pwg_token]").val()
|
||||
},
|
||||
success: function(response) {
|
||||
enableLocalButton(pictureId);
|
||||
enableGlobalButton();
|
||||
hideUnsavedLocalBadge(pictureId);
|
||||
showSuccessLocalBadge(pictureId);
|
||||
updateSuccessGlobalBadge();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
enableLocalButton(pictureId);
|
||||
enableGlobalButton();
|
||||
hideUnsavedLocalBadge(pictureId);
|
||||
showErrorLocalBadge(pictureId);
|
||||
updateSuccessGlobalBadge();
|
||||
console.error('Error:', error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("No changes to save for " + pictureId);
|
||||
}
|
||||
}
|
||||
function saveAllChanges() {
|
||||
$("fieldset").each(function() {
|
||||
var pictureId = $(this).data("image_id");
|
||||
saveChanges(pictureId);
|
||||
});
|
||||
}
|
||||
|
||||
// $(function () {
|
||||
// $('.privacy-filter-slider').each(function() {
|
||||
@@ -435,71 +502,3 @@ function fill_results(cats, pictureId) {
|
||||
// }
|
||||
|
||||
|
||||
/* ********** Filters*/
|
||||
// function filter_enable(filter) {
|
||||
// /* show the filter*/
|
||||
// $("#"+filter).show();
|
||||
|
||||
// /* check the checkbox to declare we use this filter */
|
||||
// $("input[type=checkbox][name="+filter+"_use]").prop("checked", true);
|
||||
|
||||
// /* forbid to select this filter in the addFilter list */
|
||||
// $("#addFilter").find("a[data-value="+filter+"]").addClass("disabled", "disabled");
|
||||
|
||||
// /* hide the no filter message */
|
||||
// $('.noFilter').hide();
|
||||
// $('.addFilter-button').removeClass('highlight');
|
||||
// }
|
||||
|
||||
// function filter_disable(filter) {
|
||||
// /* hide the filter line */
|
||||
// $("#"+filter).hide();
|
||||
|
||||
// /* uncheck the checkbox to declare we do not use this filter */
|
||||
// $("input[name="+filter+"_use]").prop("checked", false);
|
||||
|
||||
// /* give the possibility to show it again */
|
||||
// $("#addFilter").find("a[data-value="+filter+"]").removeClass("disabled");
|
||||
|
||||
// /* show the no filter message if no filter selected */
|
||||
// if ($('#filterList li:visible').length == 0) {
|
||||
// $('.noFilter').show();
|
||||
// $('.addFilter-button').addClass('highlight');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// $(".removeFilter").addClass("icon-cancel-circled");
|
||||
|
||||
// $(".removeFilter").click(function () {
|
||||
// var filter = $(this).parent('li').attr("id");
|
||||
// filter_disable(filter);
|
||||
|
||||
// return false;
|
||||
// });
|
||||
|
||||
// $("#addFilter a").on('click', function () {
|
||||
// var filter = $(this).attr("data-value");
|
||||
// filter_enable(filter);
|
||||
// });
|
||||
|
||||
// $("#removeFilters").click(function() {
|
||||
// $("#filterList li").each(function() {
|
||||
// var filter = $(this).attr("id");
|
||||
// filter_disable(filter);
|
||||
// });
|
||||
// return false;
|
||||
// });
|
||||
|
||||
// $('[data-slider=widths]').pwgDoubleSlider(sliders.widths);
|
||||
// $('[data-slider=heights]').pwgDoubleSlider(sliders.heights);
|
||||
// $('[data-slider=ratios]').pwgDoubleSlider(sliders.ratios);
|
||||
// $('[data-slider=filesizes]').pwgDoubleSlider(sliders.filesizes);
|
||||
|
||||
|
||||
// $(document).mouseup(function (e) {
|
||||
// e.stopPropagation();
|
||||
// if (!$(event.target).hasClass('addFilter-button')) {
|
||||
// $('.addFilter-dropdown').slideUp();
|
||||
// }
|
||||
// });
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
{combine_script id='jquery.selectize' load='header' path='themes/default/js/plugins/selectize.min.js'}
|
||||
{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.{$themeconf.colorscheme}.css"}
|
||||
{combine_script id='doubleSlider' load='footer' require='jquery.ui.slider' path='admin/themes/default/js/doubleSlider.js'}
|
||||
|
||||
{combine_script id='jquery.ui.slider' require='jquery.ui' load='header' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'}
|
||||
{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
|
||||
@@ -17,6 +18,8 @@
|
||||
{combine_script id='jquery.confirm' load='footer' require='jquery' path='themes/default/js/plugins/jquery-confirm.min.js'}
|
||||
{combine_css path="themes/default/js/plugins/jquery-confirm.min.css"}
|
||||
|
||||
{combine_css path="admin/themes/default/fontello/css/animation.css" order=10}
|
||||
|
||||
{footer_script}
|
||||
(function(){
|
||||
{* <!-- TAGS --> *}
|
||||
@@ -61,7 +64,8 @@ const strs_privacy = {
|
||||
"3" : "{$level_options[1]}",
|
||||
"4" : "{$level_options[0]}",
|
||||
};
|
||||
{* <!-- sliders config -->
|
||||
<!-- sliders config -->
|
||||
|
||||
var sliders = {
|
||||
widths: {
|
||||
values: [{$dimensions.widths}],
|
||||
@@ -98,34 +102,24 @@ var sliders = {
|
||||
},
|
||||
text: '{'between %s and %s MB'|translate|escape:'javascript'}'
|
||||
}
|
||||
}; *}
|
||||
};
|
||||
|
||||
|
||||
|
||||
console.log(sliders);
|
||||
{/footer_script}
|
||||
|
||||
{combine_script id='batchManagerUnit' load='footer' require='jquery.ui.effect-blind,jquery.sort' path='admin/themes/default/js/batchManagerUnit.js'}
|
||||
|
||||
<div id="batchManagerGlobal" style="margin-bottom: 80px;">
|
||||
|
||||
<div style="margin: 30px 0; display: flex; justify-content: space-between;">
|
||||
<div style="margin-right: 21px;" class="pagination-per-page">
|
||||
<span style="font-weight: bold;color: unset;">{'photos per page'|@translate} :</span>
|
||||
<a href="{$U_ELEMENTS_PAGE}&display=5">5</a>
|
||||
<a href="{$U_ELEMENTS_PAGE}&display=10">10</a>
|
||||
<a href="{$U_ELEMENTS_PAGE}&display=50">50</a>
|
||||
</div>
|
||||
<div style="margin-left: 22px;">
|
||||
<div class="pagination-reload">
|
||||
{if !empty($navbar) }<a class="button-reload tiptip" title="Pagination has changed and needs to be reloaded !" style="display: none;" href="{$F_ACTION}"><i class="icon-cw"></i></a>{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
|
||||
{if !empty($elements) }
|
||||
<div><input type="hidden" name="element_ids" value="{$ELEMENT_IDS}"></div>
|
||||
{* <fieldset>
|
||||
<legend><span class='icon-filter icon-green'></span>{'Filter'|@translate}</legend>
|
||||
|
||||
<div><input type="hidden" name="element_ids" value="{$ELEMENT_IDS}"></div>
|
||||
<fieldset>
|
||||
<legend><span class='icon-filter icon-green'></span>{'Filter'|@translate}</legend>
|
||||
<form method="post" action="{$F_ACTION}" class="filter">
|
||||
<div class="filterBlock">
|
||||
<ul id="filterList">
|
||||
<li id="filter_prefilter" {if !isset($filter.prefilter)}style="display:none"{/if}>
|
||||
@@ -321,16 +315,33 @@ var sliders = {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset> *}
|
||||
</fieldset>
|
||||
</form>
|
||||
{if !empty($elements) }
|
||||
<div style="margin: 30px 0; display: flex; justify-content: space-between;">
|
||||
<div style="margin-right: 21px;" class="pagination-per-page">
|
||||
<span style="font-weight: bold;color: unset;">{'photos per page'|@translate} :</span>
|
||||
<a href="{$U_ELEMENTS_PAGE}&display=5">5</a>
|
||||
<a href="{$U_ELEMENTS_PAGE}&display=10">10</a>
|
||||
<a href="{$U_ELEMENTS_PAGE}&display=50">50</a>
|
||||
</div>
|
||||
<div style="margin-left: 22px;">
|
||||
<div class="pagination-reload">
|
||||
{if !empty($navbar) }<a class="button-reload tiptip" title="Pagination has changed and needs to be reloaded !" style="display: none;" href="{$F_ACTION}"><i class="icon-cw"></i></a>{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{foreach from=$elements item=element}
|
||||
{footer_script}
|
||||
var related_category_ids_{$element.ID} = {$element.related_category_ids};
|
||||
url_delete_{$element.id} = '{$element.U_DELETE}';
|
||||
{/footer_script}
|
||||
|
||||
{debug}
|
||||
<div class="deleted-element" data-image_id="{$element.ID}" style="display: none;"><i class="icon-ok"></i><p>Image #{$element.ID} '{$element.FILE}' was succesfully deleted</p></div>
|
||||
<fieldset class="elementEdit" id="picture-{$element.ID}" data-image_id="{$element.ID}">
|
||||
<div class="pictureIdLabel">#{$element.ID}</div>
|
||||
<div class="media-box">
|
||||
<img src="{$element.TN_SRC}" alt="imagename" class="media-box-embed" style="{if $element.FORMAT}width:100%; max-height:100%;{else}max-width:100%; height:100%;{/if}">
|
||||
<div class="media-hover">
|
||||
@@ -479,10 +490,6 @@ var sliders = {
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="bottom-save-bar">
|
||||
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
|
||||
@@ -504,6 +511,7 @@ var sliders = {
|
||||
<div class="buttonLike action-save-global"><i class="icon-floppy"></i>Save all photos</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{include file='include/album_selector.inc.tpl'
|
||||
title={'Associate to album'|@translate}
|
||||
@@ -556,6 +564,7 @@ var sliders = {
|
||||
}
|
||||
|
||||
.elementEdit{
|
||||
position: relative;
|
||||
display:flex;
|
||||
flex-direction:row;
|
||||
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
|
||||
@@ -565,6 +574,15 @@ var sliders = {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.pictureIdLabel{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
color:#7A7A7A;
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.media-box{
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user