Issue #1704 New album edition page

* Front end development according to the mockup
* Save changes in ajax
* Implement the delete album behaviour with Jconfirm in ajax
* Adding a new Css component : infos (factorized in the tag page)
* Add a new general admin template variable : ADMIN_PAGE_OBJECT_ID (adding the id of an object on the page)
* Modify the pwg.categories.setInfo api method to fit the need of the album edition pages
* Slightly change the method time_since, add a parameter to display only the greates time unit
* Popin to change parent album, and changed it as a re-usable component
* Dropdown to replace the checkbox for comments
This commit is contained in:
Matthieu Leproux
2023-01-02 16:18:34 +01:00
parent 0d70ce6a64
commit f4a4473f37
19 changed files with 1305 additions and 751 deletions
+1
View File
@@ -230,6 +230,7 @@ $template->assign(
'U_CHANGE_THEME' => $change_theme_url,
'U_UPDATES' => $link_start.'updates',
'ADMIN_PAGE_TITLE' => 'Piwigo Administration Page',
'ADMIN_PAGE_OBJECT_ID' => '',
'U_SHOW_TEMPLATE_TAB' => $conf['show_template_in_side_menu'],
'SHOW_RATING' => $conf['rate'],
)
+2 -1
View File
@@ -56,7 +56,8 @@ $tabsheet->assign();
// +-----------------------------------------------------------------------+
$template->assign(array(
'ADMIN_PAGE_TITLE' => l10n('Edit album'),
'ADMIN_PAGE_TITLE' => l10n('Edit album').' <strong>'.$category['name'].'</strong>',
'ADMIN_PAGE_OBJECT_ID' => '#'.$category['id'],
));
if ('properties' == $page['tab'])
+71 -108
View File
@@ -97,69 +97,6 @@ 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'],
'comment' =>
$conf['allow_html_descriptions'] ?
@$_POST['comment'] : strip_tags(@$_POST['comment']),
);
if ($conf['activate_comments'])
{
$data['commentable'] = isset($_POST['commentable'])? 'true':'false';
}
single_update(
CATEGORIES_TABLE,
$data,
array('id' => $data['id'])
);
if (isset($_POST['apply_commentable_on_sub']))
{
$subcats = get_subcat_ids(array('id' => $data['id']));
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET commentable = \''.$data['commentable'].'\'
WHERE id IN ('.implode(',', $subcats).')
;';
pwg_query($query);
}
// retrieve cat infos before continuing (following updates are expensive)
$cat_info = get_cat_info($_GET['cat_id']);
$visible = false;
if (!isset($_POST['locked']))
{
$visible = true;
}
if ($visible !== $cat_info['visible'])
{
set_cat_visible(array($_GET['cat_id']), $visible);
}
// in case the use moves his album to the gallery root, we force
// $_POST['parent'] from 0 to null to be compared with
// $cat_info['id_uppercat']
if (empty($_POST['parent']))
{
$_POST['parent'] = null;
}
// only move virtual albums
if (empty($cat_info['dir']) and $cat_info['id_uppercat'] != $_POST['parent'])
{
move_categories( array($_GET['cat_id']), $_POST['parent'] );
}
$_SESSION['page_infos'][] = l10n('Album updated successfully');
pwg_activity('album', $_GET['cat_id'], 'edit');
$redirect = true;
}
if (isset($redirect))
{
@@ -193,9 +130,22 @@ $category['nb_subcats'] = count($subcat_ids) - 1;
$navigation = get_cat_display_name_cache(
$category['uppercats'],
get_root_url().'admin.php?page=album-'
);
);
$form_action = $admin_album_base_url.'-properties';
// Parent navigation path
$uppercats_array = explode(',', $category['uppercats']);
if (count($uppercats_array) > 1)
{
array_pop($uppercats_array);
$parent_navigation = get_cat_display_name_cache(
implode(',', $uppercats_array),
get_root_url().'admin.php?page=album-'
);
}
else
{
$parent_navigation = l10n('Root');
}
//----------------------------------------------------- template initialization
$template->set_filename( 'album_properties', 'cat_modify.tpl');
@@ -212,10 +162,14 @@ if (!empty($category['id_uppercat']))
$template->assign(
array(
'CATEGORIES_NAV' => preg_replace("# {2,}#"," ",preg_replace("#(\r\n|\n\r|\n|\r)#"," ",$navigation)),
'CATEGORIES_PARENT_NAV' => preg_replace("# {2,}#"," ",preg_replace("#(\r\n|\n\r|\n|\r)#"," ",$parent_navigation)),
'PARENT_CAT_ID' => !empty($category['id_uppercat']) ? $category['id_uppercat'] : 0,
'CAT_ID' => $category['id'],
'CAT_NAME' => @htmlspecialchars($category['name']),
'CAT_COMMENT' => @htmlspecialchars($category['comment']),
'IS_LOCKED' => !get_boolean($category['visible']),
'IS_LOCKED' => $category['status'] == "private",
'U_DELETE' => $base_url.'albums',
'U_JUMPTO' => make_index_url(
array(
@@ -225,10 +179,7 @@ $template->assign(
'U_ADD_PHOTOS_ALBUM' => $base_url.'photos_add&amp;album='.$category['id'],
'U_CHILDREN' => $cat_list_url.'&amp;parent_id='.$category['id'],
'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_modify',
'U_MOVE' => $base_url.'albums&amp;parent_id='.$category['id'].'#cat-'.$category['id'],
'F_ACTION' => $form_action,
)
);
@@ -238,6 +189,8 @@ if ($conf['activate_comments'])
}
// manage album elements link
$image_count = 0;
$info_title = "";
if ($category['has_images'])
{
$template->assign(
@@ -273,16 +226,29 @@ SELECT
format_date($max_date)
);
}
$info_photos = l10n('%d photos', $image_count);
$template->assign(
array(
'INFO_PHOTO' => $info_photos,
'INFO_TITLE' => $info_title
)
);
}
$info_photos = l10n('%d photos', $image_count);
$template->assign(
array(
'INFO_PHOTO' => $info_photos,
'INFO_TITLE' => $info_title
)
);
// total number of images under this category (including sub-categories)
$query = '
SELECT DISTINCT
(image_id)
FROM
'.IMAGE_CATEGORY_TABLE.'
WHERE
category_id IN ('.implode(',', $subcat_ids).')
;';
$image_ids_recursive = query2array($query, null, 'image_id');
$category['nb_images_recursive'] = count($image_ids_recursive);
// date creation
$query = '
@@ -297,7 +263,8 @@ $result = query2array($query);
if (count($result) > 0) {
$template->assign(
array(
'INFO_CREATION' => l10n('Created on %s',format_date($result[0]['occured_on'], array('day', 'month','year')))
'INFO_CREATION_SINCE' => time_since($result[0]['occured_on'], 'day', $format=null, $with_text=true, $with_week=true, $only_last_unit=true),
'INFO_CREATION' => format_date($result[0]['occured_on'], array('day', 'month','year'))
)
);
}
@@ -310,45 +277,39 @@ SELECT COUNT(*)
';
$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_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'], array('day', 'month','year')))
)
);
'INFO_LAST_MODIFIED_SINCE' => time_since($category['lastmodified'], 'minute', $format=null, $with_text=true, $with_week=true, $only_last_unit=true),
'INFO_LAST_MODIFIED'=> format_date($category['lastmodified'], array('day', 'month','year')),
'INFO_IMAGES_RECURSIVE' => l10n(
'%d including sub-albums',
$category['nb_images_recursive']
),
'INFO_SUBCATS' => l10n(
'%d in whole branch',
$category['nb_subcats']
),
// info for deletion
$template->assign(
array(
'CATEGORY_FULLNAME' => trim(strip_tags($navigation)),
'NB_SUBCATS' => $category['nb_subcats'],
// 'NB_IMAGES_RECURSIVE' => $category['nb_images_recursive'],
// 'NB_IMAGES_BECOMING_ORPHAN' => $category['nb_images_becoming_orphan'],
// 'NB_IMAGES_ASSOCIATED_OUTSIDE' => $category['nb_images_associated_outside'],
)
);
'NB_SUBCATS' => $category['nb_subcats'],
),
);
$template->assign(array(
'U_MANAGE_RANKS' => $base_url.'element_set_ranks&amp;cat_id='.$category['id'],
'CACHE_KEYS' => get_admin_client_cache_keys(array('categories')),
));
if ($category['is_virtual'])
{
$template->assign(
array(
'U_DELETE' => $self_url.'&amp;delete='.$category['id'].'&amp;pwg_token='.get_pwg_token(),
)
);
}
else
if (!$category['is_virtual'])
{
$category['cat_full_dir'] = get_complete_dir($_GET['cat_id']);
$template->assign(
@@ -400,6 +361,8 @@ if ($category['is_virtual'])
$template->assign('parent_category', empty($category['id_uppercat']) ? array() : array($category['id_uppercat']));
}
$template->assign('PWG_TOKEN', get_pwg_token());
trigger_notify('loc_end_cat_modify');
//----------------------------------------------------------- sending html code
@@ -255,4 +255,73 @@ a.info-framed:hover {
.info-framed-title {
color: #3c3c3c;
font-weight: bold;
}
}
/* -------------
Info
-------------
.info-message.icon-*, .info-warning.icon-*, .info-error.icon-*
p
(a)
*/
.info-message, .info-warning, .info-error {
height: 35px;
overflow: hidden;
border-radius: 20px;
display: flex;
padding: 0px 10px 0px 0px;
font-weight: bold;
margin-left: 10px;
}
.info.hide {
display: none;
}
.info-message p, .info-warning p, .info-error p {
margin: auto;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
text-align: initial;
}
.info-message::before, .info-warning::before, .info-error::before {
line-height: 35px;
margin: 0px 10px;
font-size: 16px;
}
.info-warning {
color: #ee8800;
background-color:#ffdd99;
}
.info-message {
color: #0a0;
background-color:#c2f5c2;
display: none;
}
.info-error {
color: #f22;
background-color: #ffd5dc;
display: none;
animation-name: info-error-appear ;
animation-duration: 0.4s;
animation-timing-function: ease;
}
.info-message a:hover, .info-warning a:hover, .info-error a:hover {
color: white;
}
@keyframes info-error-appear {
25% { transform: translateX(-10px)}
50% { transform: translateX(10px)}
75% { transform: translateX(-10px)}
100% { transform: translateX(0px)}
}
+527
View File
@@ -0,0 +1,527 @@
jQuery(document).ready(function() {
activateCommentDropdown()
jQuery('.tiptip').tipTip({
'delay' : 0,
'fadeIn' : 200,
'fadeOut' : 200
});
$('#cat-properties-save').click(() => {
save_button_set_loading(true)
$('.info-error,.info-message').hide()
jQuery.ajax({
url: "ws.php?format=json&method=pwg.categories.setInfo",
type:"POST",
dataType: "json",
data: {
category_id: album_id,
name: $("#cat-name").val(),
comment: $("#cat-comment").val(),
status: $("#cat-locked").is(":checked")? "public":"private",
commentable: $("#cat-commentable").is(":checked")? "true":"false",
apply_commentable_to_subalbums: $("#cat-apply-commentable-on-sub").is(":checked")? "true":"false",
},
success:function(data) {
if (data.stat == "ok") {
save_button_set_loading(false)
$('.info-message').show()
$('.cat-modification .cat-modify-info-subcontent').html(str_just_now)
$('.cat-modification .cat-modify-info-content').html(str_just_now)
setTimeout(
function() {
$('.info-message').hide()
},
5000
)
} else {
$('.info-error').show()
setTimeout(
function() {
$('.info-error').hide()
},
5000
)
}
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
save_button_set_loading(false)
$('.info-error').show()
setTimeout(
function() {
$('.info-error').hide()
},
5000
)
console.log(errorThrows);
}
});
if (parent_album != default_parent_album) {
jQuery.ajax({
url: "ws.php?format=json&method=pwg.categories.move",
type:"POST",
dataType: "json",
data: {
category_id: album_id,
parent: parent_album,
pwg_token: pwg_token,
},
success: function (data) {
if (data.stat === "ok") {
$(".cat-modify-ariane").html(
data.result.new_ariane_string
)
default_parent_album = parent_album;
} else {
$('.info-error').show()
setTimeout(
function() {
$('.info-error').hide()
},
5000
)
}
},
error: function(e) {
console.log(e.message);
}
});
}
})
function save_button_set_loading(state = true) {
if (state) {
$('#cat-properties-save i').removeClass("icon-floppy")
$('#cat-properties-save i').addClass("icon-spin6")
$('#cat-properties-save i').addClass("animate-spin")
} else {
$('#cat-properties-save i').addClass("icon-floppy")
$('#cat-properties-save i').removeClass("icon-spin6")
$('#cat-properties-save i').removeClass("animate-spin")
}
$('#cat-properties-save').attr("disabled", state)
}
$(".deleteAlbum").on("click", function() {
$.confirm({
title: str_delete_album,
content : function () {
const self = this
return $.ajax({
url: "ws.php?format=json&method=pwg.categories.calculateOrphans",
type: "GET",
data: {
category_id: album_id,
},
success: function (raw_data) {
let data = JSON.parse(raw_data).result[0]
let message = "<p>" + str_delete_album_and_his_x_subalbums
.replace("%s", "<strong>"+album_name+"</strong>")
.replace("%d", "<strong>"+nb_sub_albums+"</strong>") + "</p>"
message += `<div class="cat-delete-modes">`;
message +=
`<div ${data.nb_images_recursive? "":"style='display:none'"}>
<input type="radio" name="deletion-mode" value="no_delete" id="no_delete" checked>
<label for="no_delete">${str_dont_delete_photos}</label>
</div>`;
if (data.nb_images_recursive) {
let t = 0
message += `<div>
<input type="radio" name="deletion-mode" value="force_delete" id="force_delete">
<label for="force_delete">${str_delete_all_photos.replaceAll("%d", _ => [data.nb_images_recursive, data.nb_images_associated_outside][t++])}</label>
</div>`;
}
if (data.nb_images_becoming_orphan)
message +=
`<div>
<input type="radio" name="deletion-mode" value="delete_orphans" id="delete_orphans">
<label for="delete_orphans">${str_delete_orphans.replace("%d", data.nb_images_becoming_orphan)}</label>
</div>`;
message += `</div>`;
self.setContent(message)
},
error: function(message) {
console.log(message);
self.setContent("An error has occured while calculating orphans")
}
});
},
buttons: {
deleteAlbum: {
text: str_delete_album,
btnClass: 'btn-red',
action: function () {
this.showLoading()
let deletionMode = $('input[name="deletion-mode"]:checked').val();
delete_album(deletionMode)
.then(()=>window.location.href = u_delete)
.catch((err)=> {
this.close()
console.log(err)
})
return false
},
},
cancel: {
text: str_cancel
}
},
...jConfirm_confirm_options
})
});
function delete_album(photo_deletion_mode) {
return new Promise((res, rej) => {
$.ajax({
url: "ws.php?format=json&method=pwg.categories.delete",
type: "POST",
data: {
category_id: album_id,
photo_deletion_mode: photo_deletion_mode,
pwg_token : pwg_token,
},
success: function (raw_data) {
res()
},
error: function(message) {
rej(message)
}
});
})
}
$('#refreshRepresentative').on('click', function(e) {
var method = 'pwg.categories.refreshRepresentative';
$('#refreshRepresentative i').removeClass("icon-ccw").addClass("icon-spin6").addClass("animate-spin")
jQuery.ajax({
url: "ws.php?format=json&method="+method,
type:"POST",
data: {
category_id: album_id
},
success:function(data) {
var data = jQuery.parseJSON(data);
if (data.stat == 'ok') {
jQuery("#deleteRepresentative").show();
jQuery(".cat-modify-representative")
.attr('style', `background-image:url('${data.result.src}')`)
.removeClass('icon-dice-solid')
}
else {
console.error(data);
}
$('#refreshRepresentative i').addClass("icon-ccw").removeClass("icon-spin6").removeClass("animate-spin")
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
console.error(errorThrows);
$('#refreshRepresentative i').addClass("icon-ccw").removeClass("icon-spin6").removeClass("animate-spin")
}
});
e.preventDefault();
});
$('#deleteRepresentative').on('click', function(e) {
var method = 'pwg.categories.deleteRepresentative';
$('#deleteRepresentative i').removeClass("icon-cancel").addClass("icon-spin6").addClass("animate-spin")
jQuery.ajax({
url: "ws.php?format=json&method="+method,
type:"POST",
data: {
category_id: album_id
},
success:function(data) {
var data = jQuery.parseJSON(data);
if (data.stat == 'ok') {
jQuery("#deleteRepresentative").hide();
jQuery(".cat-modify-representative")
.attr('style', ``)
.addClass('icon-dice-solid')
}
else {
console.error(data);
}
$('#deleteRepresentative i').addClass("icon-cancel").removeClass("icon-spin6").removeClass("animate-spin")
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
console.error(errorThrows);
$('#deleteRepresentative i').addClass("icon-cancel").removeClass("icon-spin6").removeClass("animate-spin")
}
});
e.preventDefault();
});
// Parent album popin
$("#cat-parent.icon-pencil").on("click", function (e) {
// Don't open the popin if you click on the album link
if (e.target.localName != 'a') {
linked_albums_open();
set_up_popin();
if (parent_album != 0) {
$(".put-to-root").removeClass("notClickable");
$(".put-to-root").click(function () {
add_related_category(0, str_root);
});
} else {
$(".put-to-root").addClass("notClickable");
}
}
});
$(".limitReached").html(str_no_search_in_progress);
$(".search-cancel-linked-album").hide();
$(".linkedAlbumPopInContainer .searching").hide();
$("#linkedAlbumSearch .search-input").on('input', function () {
if ($(this).val() != 0) {
$("#linkedAlbumSearch .search-cancel-linked-album").show()
} else {
$("#linkedAlbumSearch .search-cancel-linked-album").hide();
}
if ($(this).val().length > 2) {
linked_albums_search($(this).val());
} else {
$(".limitReached").html(str_no_search_in_progress);
$("#searchResult").empty();
}
})
$(".search-cancel-linked-album").on("click", function () {
$("#linkedAlbumSearch .search-input").val("");
$("#linkedAlbumSearch .search-input").trigger("input");
})
$(".allow-comments").on("click", function () {
jQuery.ajax({
url: "ws.php?format=json&method=pwg.categories.setInfo",
type:"POST",
dataType: "json",
data: {
category_id: album_id,
commentable: true,
apply_commentable_to_subalbums: true,
},
beforeSend: function () {
save_button_set_loading(true);
},
success:function(data) {
if (data.stat == "ok") {
save_button_set_loading(false);
if (!$("#cat-commentable").is(":checked")) {
$("#cat-commentable").trigger("click");
}
temp_txt = $(".info-message").text();
$(".info-message").text(str_album_comment_allow);
$(".info-message").show();
setTimeout(
function() {
$('.info-message').hide()
$(".info-message").text(temp_txt);
},
5000
)
} else {
$('.info-error').show()
setTimeout(
function() {
$('.info-error').hide()
},
5000
)
}
},
error:function(e) {
console.log(e);
save_button_set_loading(false);
}
});
});
$(".disallow-comments").on("click", function () {
jQuery.ajax({
url: "ws.php?format=json&method=pwg.categories.setInfo",
type:"POST",
dataType: "json",
data: {
category_id: album_id,
commentable: false,
apply_commentable_to_subalbums: true,
},
beforeSend: function () {
save_button_set_loading(true);
},
success:function(data) {
if (data.stat == "ok") {
save_button_set_loading(false);
if ($("#cat-commentable").is(":checked")) {
$("#cat-commentable").trigger("click");
}
temp_txt = $(".info-message").text();
$(".info-message").text(str_album_comment_disallow);
$(".info-message").show();
setTimeout(
function() {
$('.info-message').hide()
$(".info-message").text(temp_txt);
},
5000
)
} else {
$('.info-error').show()
setTimeout(
function() {
$('.info-error').hide()
},
5000
)
}
},
error:function(e) {
console.log(e);
save_button_set_loading(false);
}
});
});
});
// Parent album popin functions
function set_up_popin() {
$(".ClosePopIn").on('click', function () {
linked_albums_close();
});
}
function linked_albums_close() {
$("#addLinkedAlbum").fadeOut();
}
function linked_albums_open() {
$("#addLinkedAlbum").fadeIn();
$(".search-input").val("");
$(".search-input").focus();
$("#searchResult").empty();
$(".limitReached").html(str_no_search_in_progress);
}
function linked_albums_search(searchText) {
$(".linkedAlbumPopInContainer .searching").show();
$.ajax({
url: "ws.php?format=json&method=pwg.categories.getAdminList",
type: "POST",
dataType: "json",
data : {
search: searchText,
additional_output: "full_name_with_admin_links",
},
before: function () {
},
success: function (raw_data) {
$(".linkedAlbumPopInContainer .searching").hide();
categories = raw_data.result.categories;
fill_results(categories);
if (raw_data.result.limit_reached) {
$(".limitReached").html(str_result_limit.replace("%d", categories.length));
} else {
if (categories.length == 1) {
$(".limitReached").html(str_album_found);
} else {
$(".limitReached").html(str_albums_found.replace("%d", categories.length));
}
}
},
error: function (e) {
$(".linkedAlbumPopInContainer .searching").hide();
console.log(e.message);
}
})
}
function fill_results(cats) {
$("#searchResult").empty();
cats.forEach(cat => {
$("#searchResult").append(
"<div class='search-result-item' id="+ cat.id + ">" +
"<span class='search-result-path'>" + cat.fullname +"</span><span class='icon-plus-circled item-add'></span>" +
"</div>"
);
// If the searched albums are in the children of the current album they become unclickable
// Same if the album is already selected
if (parent_album == cat.id || cat.uppercats.split(',').includes(album_id+"")) {
$(" #"+ cat.id +".search-result-item").addClass("notClickable").attr("title", str_already_in_related_cats).on("click", function (event) {
event.preventDefault();
});
} else {
$("#"+ cat.id + ".search-result-item ").on("click", function () {
add_related_category(cat.id, cat.full_name_with_admin_links);
});
}
});
}
function add_related_category(cat_id, cat_link_path) {
if (parent_album != cat_id) {
$("#cat-parent").html(
cat_link_path
);
$(".search-result-item #" + cat_id).addClass("notClickable");
parent_album = cat_id;
$(".invisible-related-categories-select").append("<option selected value="+ cat_id +"></option>");
linked_albums_close();
}
}
function activateCommentDropdown() {
$(".toggle-comment-option").find(".comment-option").hide();
/* Display the option on the click on "..." */
$(".toggle-comment-option").on("click", function () {
$(this).find(".comment-option").toggle();
})
/* Hide img options and rename field on click on the screen */
$(document).mouseup(function (e) {
e.stopPropagation();
let option_is_clicked = false
$(".comment-option span").each(function () {
if (!($(this).has(e.target).length === 0)) {
option_is_clicked = true;
}
})
if (!option_is_clicked) {
$(".toggle-comment-option").find(".comment-option").hide();
}
});
}
+11 -11
View File
@@ -5,8 +5,8 @@ var dataTags = $('.tag-container').data('tags');
$('#select-100').prop('checked', true)
//Orphan tags
$('.tag-warning p a').on('click', () => {
let url = $('.tag-warning p a').data('url');
$('.info-warning p a').on('click', () => {
let url = $('.info-warning p a').data('url');
let tags = orphan_tag_names;
let str_orphans = str_orphan_tags.replace('%s1', tags.length).replace('%s2', tags.join(', '));
$.confirm({
@@ -32,7 +32,7 @@ $('.tag-warning p a').on('click', () => {
keep : {
text:str_keep_them,
action: function() {
$('.tag-warning').hide();
$('.info-warning').hide();
}
}
}
@@ -823,17 +823,17 @@ function isDataSearched(tagObj) {
Show Info
-------*/
function showError(message) {
$('.tag-error p').html(message);
$('.tag-error').attr('title', message)
$('.tag-info').hide()
$('.tag-error').css('display', 'flex');
$('.info-error p').html(message);
$('.info-error').attr('title', message)
$('.info-info').hide()
$('.info-error').css('display', 'flex');
}
function showMessage(message) {
$('.tag-message p').html(message);
$('.tag-message').attr('title', message)
$('.tag-info').hide()
$('.tag-message').css('display', 'flex');
$('.info-message p').html(message);
$('.info-message').attr('title', message)
$('.info-info').hide()
$('.info-message').css('display', 'flex');
}
+1 -1
View File
@@ -127,7 +127,7 @@ jQuery(document).ready(function() {
<div id="content" class="content">
<h1>{$ADMIN_PAGE_TITLE}</h1>
<h1>{$ADMIN_PAGE_TITLE}<span class="admin-object-id">{$ADMIN_PAGE_OBJECT_ID}</span></h1>
{if isset($TABSHEET)}
{$TABSHEET}
+224 -366
View File
@@ -1,407 +1,265 @@
{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
{include file='include/colorbox.inc.tpl'}
{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
{combine_script id='cat_modify' load='footer' path='admin/themes/default/js/cat_modify.js'}
{combine_script id='jquery.confirm' load='footer' require='jquery' path='themes/default/js/plugins/jquery-confirm.min.js'}
{* {combine_script id='cat_modify' load='footer' path='admin/themes/default/js/cat_modify.js'} *}
{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.{$themeconf.colorscheme}.css"}
{combine_css path="themes/default/js/plugins/jquery-confirm.min.css"}
{combine_css path="admin/themes/default/fontello/css/animation.css" order=10} {* order 10 is required, see issue 1080 *}
{combine_script id='jquery.tipTip' load='footer' path='themes/default/js/plugins/jquery.tipTip.minified.js'}
{footer_script}
const has_images_associated_outside = '{"delete album and all %d photos, even the %d associated to other albums"|@translate|escape:javascript}';
const has_images_becomming_orphans = '{'delete album and the %d orphan photos'|@translate|escape:javascript}';
const has_images_recursives = '{'delete only album, not photos'|@translate|escape:javascript}';
const cat_nav = '{$CATEGORIES_NAV|escape:javascript}';
const album_id = {$CAT_ID}
var parent_album = {$PARENT_CAT_ID}
var default_parent_album = {$PARENT_CAT_ID}
const album_name = "{$CAT_NAME}"
const nb_sub_albums = {$NB_SUBCATS}
const pwg_token = '{$PWG_TOKEN}'
const u_delete = '{$U_DELETE}'
{* <!-- CATEGORIES --> *}
var categoriesCache = new CategoriesCache({
serverKey: '{$CACHE_KEYS.categories}',
serverId: '{$CACHE_KEYS._hash}',
rootUrl: '{$ROOT_URL}'
});
const str_cancel = '{'No, I have changed my mind'|@translate|@escape}'
const str_delete_album = '{'Delete album'|@translate|escape:javascript}'
const str_delete_album_and_his_x_subalbums = '{'Delete album "%s" and its %d sub-albums.'|@translate|escape:javascript}'
const str_just_now = '{'Just now'|@translate|escape:javascript}'
categoriesCache.selectize(jQuery('[data-selectize=categories]'), {
default: 0,
filter: function(categories, options) {
// remove itself and children
var filtered = jQuery.grep(categories, function(cat) {
return !(/\b{$CAT_ID}\b/.test(cat.uppercats));
});
filtered.push({
id: 0,
fullname: '------------',
global_rank: 0
});
return filtered;
}
});
jQuery(document).ready(function() {
$("h1").append('<span title="{"Numeric identifier"|@translate}"> <span class="image-id">#{$CAT_ID}</span></span> <span style="letter-spacing:0" class="bc-albums">'+cat_nav+'</span>');
jQuery(document).on('click', '.refreshRepresentative', function(e) {
var $this = jQuery(this);
var method = 'pwg.categories.refreshRepresentative';
jQuery.ajax({
url: "ws.php?format=json&method="+method,
type:"POST",
data: {
category_id: $this.data("category_id")
},
success:function(data) {
var data = jQuery.parseJSON(data);
if (data.stat == 'ok') {
jQuery(".deleteRepresentative").show();
jQuery(".albumThumbailImage, .albumThumbnailRandom").on('load', function () {
cropImage();
})
jQuery(".albumThumbailImage, .albumThumbnailRandom")
.attr('src', data.result.src)
.end().show();
jQuery(".albumThumbnailRandom").hide();
}
else {
alert("error on "+method);
}
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
alert("serious error on "+method);
}
});
e.preventDefault();
});
jQuery(document).on('click', '.deleteRepresentative', function(e) {
var $this = jQuery(this);
var method = 'pwg.categories.deleteRepresentative';
jQuery.ajax({
url: "ws.php?format=json&method="+method,
type:"POST",
data: {
category_id: $this.data("category_id")
},
success:function(data) {
var data = jQuery.parseJSON(data);
if (data.stat == 'ok') {
jQuery(".deleteRepresentative").hide();
jQuery(".albumThumbnailImage").hide();
jQuery(".albumThumbnailRandom").show();
}
else {
alert("error on "+method);
}
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
alert("serious error on "+method);
}
});
e.preventDefault();
});
$(".deleteAlbum").on("click", function() {
$.ajax({
url: "ws.php?format=json&method=pwg.categories.calculateOrphans",
type: "GET",
data: {
category_id: {$CAT_ID},
},
success: function (raw_data) {
let data = JSON.parse(raw_data).result[0]
console.log(data);
if (data.nb_images_recursive == 0) {
$(".delete_popin ul").hide();
} else {
if (data.nb_images_associated_outside == 0) {
$("#IMAGES_ASSOCIATED_OUTSIDE").hide();
} else {
$("#IMAGES_ASSOCIATED_OUTSIDE .innerText").html("");
$("#IMAGES_ASSOCIATED_OUTSIDE .innerText").append(has_images_associated_outside.replace('%d', data.nb_images_recursive).replace('%d', data.nb_images_associated_outside));
}
if (data.nb_images_becoming_orphan == 0) {
$("#IMAGES_BECOMING_ORPHAN").hide();
} else {
$("#IMAGES_BECOMING_ORPHAN .innerText").html("");
$("#IMAGES_BECOMING_ORPHAN .innerText").append(has_images_becomming_orphans.replace('%d', data.nb_images_becoming_orphan));
}
}
},
error: function(message) {
console.log(message);
}
});
});
jQuery(".deleteAlbum").click(function() {
jQuery.colorbox({
inline:true,
title:"{'delete album'|translate|escape:javascript}",
href:".delete_popin"
});
return false;
});
function set_photo_deletion_mode() {
if (jQuery("input[name=photo_deletion_mode]").length > 0) {
var $photo_deletion_mode = jQuery("input[name=photo_deletion_mode]:checked").val();
jQuery("#deleteConfirm").data("photo_deletion_mode", $photo_deletion_mode);
}
}
set_photo_deletion_mode();
jQuery("input[name=photo_deletion_mode]").change(function() {
set_photo_deletion_mode();
});
jQuery("#deleteConfirm").click(function() {
if (jQuery("input[name=photo_deletion_mode]").length > 0) {
var $href = jQuery(this).attr("href");
jQuery(this).attr("href", $href+"&photo_deletion_mode="+jQuery(this).data("photo_deletion_mode"));
}
});
jQuery(document).on('click', '.close-delete_popin', function(e) {
jQuery('.delete_popin').colorbox.close();
e.preventDefault();
});
});
$(window).bind("load", function() {
cropImage();
});
$(window).resize(function() {
cropImage();
});
function cropImage() {
let image = $(".albumThumbailImage");
let imageW = image[0].naturalWidth;
let imageH = image[0].naturalHeight;
let size = $('.catThumbnail').innerWidth();
if (imageW > imageH) {
image.css('height', size+'px');
image.css('width', (imageW * size / imageH)+'px');
} else {
image.css('width', size+'px');
image.css('heigth', (imageH * size / imageW)+'px');
}
}
const str_dont_delete_photos = '{'delete only album, not photos'|@translate|escape:javascript}';
const str_delete_orphans = '{'delete album and the %d orphan photos'|@translate|escape:javascript}';
const str_delete_all_photos = '{'delete album and all %d photos, even the %d associated to other albums'|@translate|escape:javascript}';
str_albums_found = '{"<b>%d</b> albums found"|translate}';
str_album_found = '{"<b>1</b> album found"|translate}';
str_result_limit = '{"<b>%d+</b> albums found, try to refine the search"|translate|escape:javascript}';
str_orphan = '{'This photo is an orphan'|@translate}';
str_no_search_in_progress = '{'No search in progress'|@translate}';
str_already_in_related_cats = '{'This albums is already in related categories list'|@translate}';
str_album_comment_allow = '{'Comments allowed down the line'|@translate}';
str_album_comment_disallow = '{'Comments disallowed down the line'|@translate}';
str_root = '{'Root'|@translate}';
{/footer_script}
{html_style}
.delete_popin {
padding:20px 30px;
}
<div class="cat-modify">
.delete_popin p {
margin:0;
}
.delete_popin ul {
padding:0;
margin:30px 0;
}
.delete_popin ul li {
list-style-type:none;
margin:10px 0;
}
.delete_popin .buttonLike {
padding:5px;
margin-right:10px;
}
.delete_popin p.popin-actions {
margin-top:30px;
}
#cboxContent {
background: none;
}
{/html_style}
<div id="catModify">
<form action="{$F_ACTION}" method="POST">
<fieldset>
<legend><span class="icon-info-circled-1 icon-blue"></span>{'Informations'|@translate}</legend>
<div id="catHeader">
<div class="catThumbnail">
<div class="thumbnailContainer">
{if isset($representant) }
<img class="albumThumbailImage" src="{$representant.picture.src}">
<div class="albumThumbnailRandom" style="{if isset($representant.picture)}display:none{/if}"><span class="icon-dice-solid"></span></div>
<div class="albumThumbnailActions" data-random_allowed="{$representant.ALLOW_SET_RANDOM}">
<div class="albumThumbnailActionContainer">
{if $representant.ALLOW_SET_RANDOM }
<a href="#refresh" data-category_id="{$CAT_ID}" class="refreshRepresentative icon-ccw" title="{'Find a new representant by random'|@translate}">{'Refresh thumbnail'|@translate}</a>
{/if}
{if isset($representant.ALLOW_DELETE)}
<a href="#delete" data-category_id="{$CAT_ID}" class="deleteRepresentative icon-cancel" title="{'Delete Representant'|@translate}" style="{if !isset($representant.picture)}display:none{/if}">{'Remove thumbnail'|translate}</a>
{/if}
</div>
</div>
{else}
<div class="albumThumbnailNoPhoto" title="{'No photos in the current album, no thumbnail available'|@translate}"><span class="icon-file-image"></span></div>
{/if}
</div>
<div class="cat-modify-header">
<div class="cat-modify-ariane icon-sitemap">
{$CATEGORIES_NAV}
</div>
<div class="catInfo">
<div class="container">
{if isset($INFO_CREATION)}
<span class="icon-yellow">{$INFO_CREATION}</span>
{/if}
<span class="icon-red">{$INFO_LAST_MODIFIED}</span>
{if isset($INFO_PHOTO)}
<span class="icon-purple" title="{$INFO_TITLE}">{$INFO_PHOTO}</span>
{/if}
{if isset($INFO_DIRECT_SUB)}
<span class="icon-blue">{$INFO_DIRECT_SUB}</span>
{/if}
{if isset($U_SYNC) }
<span class="icon-green" >{'Directory'|@translate} : {$CAT_FULL_DIR}</span>
{/if}
</div>
</div>
<div class="catAction">
<div class="container">
<strong>{"Actions"|@translate}</strong>
<div class="cat-modify-actions">
{if cat_admin_access($CAT_ID)}
<a class="icon-eye" href="{$U_JUMPTO}">{'Open in gallery'|@translate}</a>
<a class="icon-eye tiptip" href="{$U_JUMPTO}" title="{'Open in gallery'|@translate}"></a>
{/if}
{if isset($U_MANAGE_ELEMENTS) }
<a class="icon-picture" href="{$U_MANAGE_ELEMENTS}">{'Manage album photos'|@translate}</a>
<a class="icon-picture tiptip" href="{$U_MANAGE_ELEMENTS}" title="{'Manage album photos'|@translate}"></a>
{/if}
<a class="icon-plus-circled" href="{$U_ADD_PHOTOS_ALBUM}">{'Add Photos'|translate}</a>
<a class="icon-plus-circled tiptip" href="{$U_ADD_PHOTOS_ALBUM}" title="{'Add Photos'|translate}"></a>
<a class="icon-sitemap" href="{$U_MOVE}">{'Manage sub-albums'|@translate}</a>
<a class="icon-sitemap tiptip" href="{$U_MOVE}" title="{'Manage sub-albums'|@translate}"></a>
{if isset($U_SYNC) }
<a class="icon-exchange" href="{$U_SYNC}">{'Synchronize'|@translate}</a>
<a class="icon-exchange tiptip" href="{$U_SYNC}" title="{'Synchronize'|@translate}"></a>
{/if}
{if isset($U_DELETE) }
<a class="icon-trash deleteAlbum" href="#">{'Delete album'|@translate}</a>
<a class="icon-trash deleteAlbum tiptip" href="#" title="{'Delete album'|@translate}"></a>
{/if}
{* <a class="icon-ellipsis-vert tiptip" href="#" title="{'Comments'|@translate}"></a> *}
<span class="icon-ellipsis-vert toggle-comment-option">
<div class="comment-option">
<span class="allow-comments icon-ok"> {'Allow comments down the line'|translate} </span>
<span class="disallow-comments icon-cancel" target="_blank">{'Disallow comments down the line'|@translate}</span>
</div>
</span>
{* Comment for extensions to add their custom actions *}
</div>
</div>
<div class="cat-modify-content">
<div class="cat-modify-infos">
<div class="cat-modify-info-card cat-creation">
<span class="cat-modify-info-title">{'Created'|@translate}</span>
<span class="cat-modify-info-content">{$INFO_CREATION_SINCE}</span>
<span class="cat-modify-info-subcontent">{$INFO_CREATION}</span>
</div>
<div class="cat-modify-info-card cat-modification">
<span class="cat-modify-info-title">{'Modified'|@translate}</span>
<span class="cat-modify-info-content">{$INFO_LAST_MODIFIED_SINCE}</span>
<span class="cat-modify-info-subcontent">{$INFO_LAST_MODIFIED}</span>
</div>
<div title="{$INFO_TITLE}" class="cat-modify-info-card cat-photos">
<span class="cat-modify-info-title">{'Photos'|@translate}</span>
<span class="cat-modify-info-content">{$INFO_PHOTO}</span>
<span class="cat-modify-info-subcontent">{$INFO_IMAGES_RECURSIVE}</span>
</div>
<div class="cat-modify-info-card cat-albums">
<span class="cat-modify-info-title">{'sub-albums'|@translate}</span>
<span class="cat-modify-info-content">{$INFO_DIRECT_SUB}</span>
<span class="cat-modify-info-subcontent">{$INFO_SUBCATS}</span>
</div>
{if isset($U_SYNC) }
<div class="cat-modify-info-card">
<span class="cat-modify-info-title">{'Directory'}</span>
<span class="cat-modify-info-content">{$CAT_FULL_DIR}</span>
</div>
{/if}
</div>
<div class="catLock">
<div class="container">
<div>
<strong>
{'Publication'|@translate}
</strong>
<div class="switch-input">
{* <span class="label">{'Unlocked'|@translate}</span> *}
<label class="switch">
<input type="checkbox" name="locked" id="toggleSelectionMode" value="true" {if $IS_LOCKED}checked{/if}>
<span class="slider round"></span>
</label>
<span class="label">{'Locked'|@translate}</span>
<span class="icon-help-circled" title="{'Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Lock this album will also lock his Sub-albums'|@translate}" style="cursor:help"></span>
</div>
</div>
{if isset($CAT_COMMENTABLE)}
<div>
<strong>{'Comments'|@translate} <span class="icon-help-circled" title="{'A photo can receive comments from your visitors if it belongs to an album with comments activated.'|@translate}" style="cursor:help"></span></strong>
<div class="switch-input">
<span class="label">{'Forbidden'|@translate}</span>
<label class="switch">
<input type="checkbox" name="commentable" id="commentable" value="true" {if $CAT_COMMENTABLE == "true"}checked{/if}>
<span class="slider round"></span>
</label>
<span class="label">{'Authorized'|@translate}</span>
<div>
<label id="applytoSubAction">
{if isset($INFO_DIRECT_SUB)}
<label class="font-checkbox"><span class="icon-check"></span><input type="checkbox" name="apply_commentable_on_sub"></label>
{'Apply to sub-albums'|@translate}
</label>
<div
class="cat-modify-representative {if !isset($representant)}icon-file-image{elseif !isset($representant.picture)}icon-dice-solid{/if}"
{if !isset($representant)}title="{'No photos in the current album, no thumbnail available'|@translate}"{/if}
{if isset($representant) && isset($representant.picture)}style="background-image:url('{$representant.picture.src}')"{/if}
>
{if isset($representant) and ($representant.ALLOW_SET_RANDOM || $representant.ALLOW_SET_RANDOM)}
<div class="cat-modify-representative-actions">
{if $representant.ALLOW_SET_RANDOM }
<a class="refreshRepresentative buttonLike" id="refreshRepresentative" title="{'Find a new representant by random'|@translate}">
<i class="icon-ccw"></i>
{'Refresh thumbnail'|@translate}
</a>
{/if}
{if isset($representant.ALLOW_DELETE)}
<a class="deleteRepresentative buttonLike" id="deleteRepresentative" title="{'Delete Representant'|@translate}" style="{if !isset($representant.picture)}display:none{/if}">
<i class="icon-cancel"></i>
{'Remove thumbnail'|translate}
</a>
{/if}
</div>
{/if}
{/if}
</div>
<div class="cat-modify-form">
<div class="cat-modify-input-container">
<label for="cat-name">{'Name'|@translate}</label>
<input type="text" id="cat-name" value="{$CAT_NAME}" maxlength="255">
</div>
<div class="cat-modify-input-container">
<label for="cat-comment">{'Description'|@translate}</label>
<textarea resize="false" rows="5" name="comment" id="cat-comment">{$CAT_COMMENT}</textarea>
</div>
<div class="cat-modify-input-container">
<label for="cat-parent">{'Parent album'|@translate}</label>
<div class="icon-pencil" id="cat-parent">{$CATEGORIES_PARENT_NAV}</div>
</div>
{include file='include/album_selector.inc.tpl'
title={'New parent album'|@translate}
searchPlaceholder={'Search'|@translate}
show_root_btn=true
}
{if isset($CAT_COMMENTABLE)}
<div class="cat-modify-switch-container">
<div class="switch-input">
<label class="switch">
<input type="checkbox" name="commentable" id="cat-commentable" value="true" {if $CAT_COMMENTABLE == "true"}checked{/if}>
<span class="slider round"></span>
</label>
</div>
<label class="switch-label" for="cat-commentable"><span>{'Authorize comments'|@translate}</span> <i class="icon-help-circled tiptip" title="{'A photo can receive comments from your visitors if it belongs to an album with comments activated.'|@translate}" style="cursor:help"></i></label>
</div>
{/if}
<div class="cat-modify-switch-container">
<div class="switch-input">
<label class="switch">
<input type="checkbox" name="locked" id="cat-locked" value="true" {if !$IS_LOCKED}checked{/if}>
<span class="slider round"></span>
</label>
</div>
<label class="switch-label" for="cat-locked"><span>{'Authorize publications'|@translate}</span> <i class="icon-help-circled tiptip" title="{'Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Lock this album will also lock his Sub-albums'|@translate}" style="cursor:help"></i></label>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend><span class="icon-tools icon-red"></span>{'Properties'|@translate}</legend>
<p>
<strong>{'Name'|@translate}</strong>
<br>
<input type="text" class="large" name="name" value="{$CAT_NAME}" maxlength="255">
</p>
<p>
<strong>{'Description'|@translate}</strong>
<br>
<textarea cols="50" rows="5" name="comment" id="comment" class="description">{$CAT_COMMENT}</textarea>
</p>
{if isset($parent_category) }
<p>
<strong>{'Parent album'|@translate}</strong>
<br>
<select data-selectize="categories" data-value="{$parent_category|@json_encode|escape:html}"
name="parent" style="width:100%"></select>
</p>
{/if}
<p style="margin:0">
<button name="submit" type="submit" class="buttonLike">
<i class="icon-floppy"></i> {'Save Settings'|@translate}
</button>
</p>
</fieldset>
</form>
<div style="display:none">
<div class="delete_popin">
<p>
{if $NB_SUBCATS == 0}
{'Delete album "%s".'|translate:$CATEGORY_FULLNAME}
{else}
{'Delete album "%s" and its %d sub-albums.'|translate:$CATEGORIES_NAV:$NB_SUBCATS}
{/if}
</p>
<ul>
<li id="IMAGES_ASSOCIATED_OUTSIDE"><label class="font-checkbox"><span class="icon-dot-circled"></span><input type="radio" name="photo_deletion_mode" value="force_delete"><span class="innerText"></span></label></li>
<li id="IMAGES_BECOMING_ORPHAN"><label class="font-checkbox"><span class="icon-dot-circled"></span><input type="radio" name="photo_deletion_mode" value="delete_orphans"><span class="innerText"></span></label></li>
<li id="IMAGES_RECURSIVE"><label class="font-checkbox"><span class="icon-dot-circled"></span><input type="radio" name="photo_deletion_mode" value="no_delete" checked="checked">{'delete only album, not photos'|translate}</label></li>
</ul>
<p class="popin-actions">
<a id="deleteConfirm" class="buttonLike" type="submit" href="{$U_DELETE}"><i class="icon-trash"></i> {'Confirm deletion'|translate}</button>
<a class="icon-cancel-circled close-delete_popin" href="#">{'Cancel'|translate}</a>
</p>
<div class="cat-modify-footer">
<div class="info-message icon-ok">{'Album updated'|@translate}</div>
<div class="info-error icon-cancel">{'An error has occured while saving album settings'|@translate}</div>
<span class="buttonLike" id="cat-properties-save"><i class="icon-floppy"></i> {'Save Settings'|@translate}</span>
</div>
</div>
</div> {* #catModify *}
<style>
.toggle-comment-option {
cursor: pointer;
position: relative;
}
.toggle-comment-option::before{
transform: scale(1.3);
}
.comment-option {
position: absolute;
display: flex;
flex-direction: column;
background: linear-gradient(130deg, #ff7700 0%, #ffa744 100%);
right: -10px;
top: 45px;
width: max-content;
border-radius: 10px;
}
.comment-option span, .comment-option a {
padding: 5px 10px;
text-decoration: none;
color: white;
font-weight: 600;
text-align: initial;
}
.comment-option::after {
content: " ";
position: absolute;
top: -10px;
right: 21px;
transform: rotate(0deg);
border-width: 5px;
border-style: solid;
border-color: transparent transparent #ff7700 transparent;
}
.comment-option span:first-child::before {
margin-right: -1px;
}
.comment-option span:hover:first-child {
color: white;
background-color: #00000012;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.comment-option span:hover:last-child {
color: white;
background-color: #00000012;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.put-to-root {
width: 220px;
margin-top: 5px;
}
.put-to-root p {
margin: 0 auto;
}
.notClickable {
opacity: 0.5;
pointer-events: none;
}
.cat-modify-footer .spinner {
width: 20px;
height: 20px;
}
</style>
@@ -0,0 +1,34 @@
{if empty($load_mode)}{$load_mode='footer'}{/if}
{include file='include/colorbox.inc.tpl' load_mode=$load_mode}
<div id="addLinkedAlbum" class="linkedAlbumPopIn">
<div class="linkedAlbumPopInContainer">
<a class="icon-cancel ClosePopIn"></a>
<div class="AddIconContainer">
<span class="AddIcon icon-blue icon-plus-circled"></span>
</div>
<div class="AddIconTitle">
<span>{$title}</span>
</div>
{if $show_root_btn}
<label class="head-button-2 put-to-root">
<p class="icon-home">{'Put at the root'|@translate}</p>
</label>
<p>{'or'|@translate}</p>
{/if}
<div id="linkedAlbumSearch">
<span class='icon-search search-icon'> </span>
<span class="icon-cancel search-cancel-linked-album"></span>
<input class='search-input' type='text' placeholder={$searchPlaceholder}>
</div>
<div class="limitReached"></div>
<div class="noSearch"></div>
<div class="searching icon-spin6 animate-spin"> </div>
<div id="searchResult">
</div>
</div>
</div>
@@ -233,30 +233,10 @@ $('#action-delete-picture').on('click', function() {
</form>
<div id="addLinkedAlbum" class="linkedAlbumPopIn">
<div class="linkedAlbumPopInContainer">
<a class="icon-cancel ClosePopIn"></a>
<div class="AddIconContainer">
<span class="AddIcon icon-blue icon-plus-circled"></span>
</div>
<div class="AddIconTitle">
<span>{'Associate to album'|@translate}</span>
</div>
<div id="linkedAlbumSearch">
<span class='icon-search search-icon'> </span>
<span class="icon-cancel search-cancel-linked-album"></span>
<input class='search-input' type='text' placeholder='{'Search'|@translate}'>
</div>
<div class="limitReached"></div>
<div class="noSearch"></div>
<div class="searching icon-spin6 animate-spin"> </div>
<div id="searchResult">
</div>
</div>
</div>
{include file='include/album_selector.inc.tpl'
title={'Associate to album'|@translate}
searchPlaceholder={'Search'|@translate}
}
<style>
.selectize-input .item,
+3 -3
View File
@@ -139,10 +139,10 @@ if (!$.cookie("pwg_tags_per_page")) {
<a id="selectInvert">{'Invert'|@translate}</a>
</div>
{if $warning_tags != ""}
<div class='tag-warning tag-info icon-attention not-in-selection-mode'><p> {$warning_tags} </p></div>
<div class='info-warning tag-info icon-attention not-in-selection-mode'><p> {$warning_tags} </p></div>
{/if}
<div class='tag-message tag-info icon-ok not-in-selection-mode' {if $message_tags != ""}style='display:flex'{/if}> <p> {$message_tags} </p> </div>
<div class='tag-error tag-info icon-cancel not-in-selection-mode'> <p> </p> </div>
<div class='info-message tag-info icon-ok not-in-selection-mode' {if $message_tags != ""}style='display:flex'{/if}> <p> {$message_tags} </p> </div>
<div class='info-error tag-info icon-cancel not-in-selection-mode'> <p> </p> </div>
</div>
<div class="pageLoad">
<i class='icon-spin6 animate-spin'> </i>
+220 -208
View File
@@ -403,200 +403,263 @@ LI.menuLi {
margin-bottom: 5px;
}
/* Cat modify */
#catHeader {
/* Cat Modify */
.cat-modify {
height: calc(100vh - 192px);
width: calc(100vw - 205px);
display: grid;
grid-template-columns: 25% 25% 25% 25%;
min-height: 200px;
grid-template-rows: 50px auto 60px;
}
#catHeader .catThumbnail {
.cat-modify-header {
display: grid;
grid-template-columns: auto 200px;
padding: 0px 20px;
}
.cat-modify-ariane {
display: flex;
align-items: center;
font-size: 18px;
}
.cat-modify-ariane > * {
margin-right: 8px;
}
.cat-modify-ariane::before {
margin-right: 10px;
}
.cat-modify-actions {
display: flex;
align-items: center;
justify-content: end;
}
.cat-modify-actions a {
font-size: 20px;
position: relative;
overflow: hidden;
width: 24px;
height: 24px;
padding: 5px;
color: #757575;
}
.cat-modify-actions .toggle-comment-option {
font-size: 16px;
padding: 5px;
width: 20px;
height: 24px;
}
#catHeader .catThumbnail .thumbnailContainer {
width: 100%;
padding-top: 100%;
}
#catHeader .albumThumbailImage, #catHeader .albumThumbnailRandom, #catHeader .albumThumbnailActions, #catHeader .albumThumbnailActionContainer, #catHeader .albumThumbnailNoPhoto{
.cat-modify-actions a::after,
.cat-modify-actions .toggle-comment-option::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#catHeader .albumThumbnailRandom, #catHeader .albumThumbnailNoPhoto {
height: 100%;
width: 100%;
background-color: #fafafa;
display: flex;
justify-content: center;
align-items: center;
}
#catHeader .albumThumbnailRandom span, #catHeader .albumThumbnailNoPhoto span {
font-size: 100px;
opacity: 0.4;
}
#catHeader .albumThumbnailActions {
width: 101%;
height: 100%;
background-color: #00000070;
background-color: #f0f0f0;
width: 0px;
height: 0px;
border-radius: 100%;
transition: ease-in-out 0.2s;
z-index: 0;
opacity: 0;
}
#catHeader .catThumbnail:hover .albumThumbnailActions {
.cat-modify-actions a:hover,
.cat-modify-actions .toggle-comment-option:hover {
color: #444444;
}
.cat-modify-actions a:hover::after,
.cat-modify-actions .toggle-comment-option:hover::after {
width: 40px;
height: 40px;
opacity: 1;
}
#catHeader .albumThumbnailActionContainer {
display: flex;
flex-direction: column;
}
#catHeader .albumThumbnailActions a {
background-color: #ffffffbd;
margin: 10px;
padding: 10px 20px;
white-space: nowrap;
font-weight: bold;
color: #3C3C3C;
text-align: center;
}
#catHeader .albumThumbnailActions a:hover {
color: #3C3C3C;
text-decoration: none;
background-color: #ff7700;
}
#catHeader .catInfo, #catHeader .catAction {
border-right: 1px solid #00000017;
}
#catHeader .catInfo {
display: flex;
justify-content: center;
padding: 10px
}
#catHeader .catInfo .container{
display: flex;
flex-direction: column;
align-items: baseline;
justify-content: space-between;
height: 100%;
}
#catHeader .catInfo span {
padding: 10px;
border-radius: 20px;
font-weight: bold;
}
#catHeader .catAction {
display: flex;
position: relative;
justify-content: center;
align-items: center;
overflow: hidden;
}
#catHeader .catAction .container {
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: baseline;
height: 100%;
padding-top: 30px;
}
#catHeader .catAction strong{
.cat-modify-actions a::before,
.cat-modify-actions .toggle-comment-option::before {
z-index: 1;
position: absolute;
top: 0;
color: #3C3C3C;
font-size: 16px;
top: 50%;
left: 50%;
transform: translate(calc(-50% - 4px), -50%);
}
#catHeader .catAction a {
color: #888;
font-size: 14px;
white-space: nowrap;
.cat-modify-content {
display: grid;
grid-template-rows: 70px 380px;
grid-template-columns: 350px 400px;
grid-template-areas: "info info" "repres form";
justify-content: center;
align-content: center;
gap: 24px;
}
#catHeader .catAction a:hover {
color: #ff7700;
text-decoration: none;
.cat-modify-infos {
grid-area: info;
display: grid;
grid-auto-flow: column;
gap: 10px;
grid-auto-columns: minmax(0, 1fr);
}
#catHeader .catAction a::before {
font-size: 20px;
margin-right: 10px;
.cat-modify-infos .cat-modify-info-card {
background: #fafafa;
padding: 5px 10px;
display: grid;
grid-template-rows: repeat(3, 33%);
align-items: center;
align-content: center;
}
#catHeader .catLock {
.cat-modify-infos .cat-modify-info-title {
text-transform: uppercase;
font-weight: bold;
color: #ffa646;
}
.cat-modify-infos .cat-modify-info-content {
font-size: 15px;
color: #333;
font-weight: bold;
}
.cat-modify-infos .cat-modify-info-content::first-letter {
text-transform: uppercase;
}
.cat-modify-infos .cat-modify-info-subcontent {
opacity: 0.7;
font-size: 11px;
}
.cat-modify-representative {
position: relative;
background: #f3f3f3;
align-items: center;
justify-content: center;
display: flex;
font-size: 30px;
background-position: center;
background-size: cover;
}
.cat-modify-representative-actions {
position: absolute;
width: 100%;
height: 100%;
bottom: 0;
left: 0;
padding: 15px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#catHeader .catLock .container{
position: relative;
height: 100%;
}
#catHeader .catLock strong {
color: #3C3C3C;
opacity: 0;
transition: 0.2s ease-in-out;
font-size: 16px;
margin-bottom: 15px;
display: block;
box-sizing: border-box;
background: rgba(0, 0, 0, 0.301)
}
#catHeader .catLock .container > div {
margin-bottom: 40px;
.cat-modify-representative:hover .cat-modify-representative-actions {
opacity: 1;
}
#catHeader .catLock > div .label {
.cat-modify-representative-actions a{
color: white;
transform: translateY(5px);
transition: 0.3s ease-in-out;
margin-bottom: 10px;
}
.cat-modify-representative:hover .cat-modify-representative-actions a {
transform: translateY(0px);
}
.cat-modify-form {
margin: 0;
}
.cat-modify-input-container {
position: relative;
display: flex;
flex-direction: column;
align-items: start;
margin-bottom: 10px;
}
.cat-modify-input-container label {
color: #A4A4A4;
font-weight: bold;
font-size: 14px;
margin-bottom: 5px;
}
#catHeader label[id=applytoSubAction] {
margin-top: 10px;
display: block;
.cat-modify-input-container textarea,
.cat-modify-input-container input {
width: 100%;
resize: none;
color:#353535;
background-color:#F3F3F3 !important;
border: none;
box-sizing: border-box;
font-size: 1.1em;
padding: 8px 12px;
font-family: inherit;
font-size: 1.1em;
}
#catHeader .catLock .switch {
margin: 0 5px;
.cat-modify-input-container #cat-parent {
width: 100%;
padding: 8px 12px;
font-family: inherit;
font-size: 1.1em;
background: #fafafa;
box-shadow: 0px 2px #00000024;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
box-sizing: border-box;
text-align: initial;
}
#catModify input[type="text"], #catModify textarea{
width: 98%;
background-color: #f8f8f8;
padding: 8px;
border-radius: 4px;
border-color: #DDD;
transition: ease 0.2s;
font-family: "Open Sans", "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
.cat-modify-input-container #cat-parent::before {
position: absolute;
right: 12px;
margin-top: 4px;
}
#catModify input[type="text"]:focus, #catModify textarea:focus{
border-color: #888;
.cat-modify-switch-container {
display: flex;
margin-bottom: 10px;
flex-wrap: wrap;
}
#catModify button[type="submit"] {
margin: 13px;
font-size: 12px;
.cat-modify-footer {
display: flex;
align-items: end;
justify-content: end;
border-top: 1px solid #ececec;
padding: 12px;
margin-left: 0;
}
#catModify p {
margin-left: 0;
.cat-delete-modes {
display: flex;
flex-direction: column;
justify-content: center;
}
.cat-delete-modes div {
margin-top: 5px;
}
/* Search bar */
@@ -1493,6 +1556,13 @@ a.stat-box:hover {
margin-bottom: 0.5em;
}
.content .admin-object-id {
position: absolute;
right: 20px;
opacity: 0.4;
font-size: 16px;
}
/* button tools */
UL.actions {
text-indent: 0;
@@ -3439,66 +3509,6 @@ a#showPermissions:hover {text-decoration: none;}
text-decoration: none;
}
.tag-info {
height: 35px;
overflow: hidden;
border-radius: 20px;
display: flex;
padding: 0px 10px 0px 0px;
font-weight: bold;
margin-left: 10px;
}
.tag-info.hide {
display: none;
}
.tag-info p {
margin: auto;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
text-align: initial;
}
.tag-info::before {
line-height: 35px;
margin: 0px 10px;
font-size: 16px;
}
.tag-info.tag-warning {
color: #ee8800;
background-color:#ffdd99;
}
.tag-info.tag-message {
color: #0a0;
background-color:#c2f5c2;
display: none;
}
.tag-info.tag-error {
color: #f22;
background-color: #ffd5dc;
display: none;
animation-name: tag-error-appear ;
animation-duration: 0.4s;
animation-timing-function: ease;
}
.tag-info a:hover {
color: white;
}
@keyframes tag-error-appear {
25% { transform: translateX(-10px)}
50% { transform: translateX(10px)}
75% { transform: translateX(-10px)}
100% { transform: translateX(0px)}
}
.tag-container {
display: flex;
padding: 10px 25px;
@@ -6675,8 +6685,10 @@ color:#FF7B00;
padding: 5px 0;
}
.search-result-item .item-add:hover {
color: #ff7700;
.search-result-item:hover {
background: #ffc17e;
color: #000;
cursor: pointer;
}
.search-result-item .notClickable {
+38 -17
View File
@@ -469,19 +469,7 @@ div.token-input-dropdown ul li.token-input-selected-dropdown-item {background-co
color: #fff;
}
#catModify input[type="text"], #catModify textarea{
background-color: #444444;
border: 1px solid #666;
color: #c1c1c1;
}
#catHeader .catAction strong, #catHeader .catLock strong {
color: #c1c1c1;
}
#catHeader .catAction a:hover {
color: white;
}
/* Cat modify */
.selectedComment {background-color:#555; color:#fff;}
@@ -952,6 +940,39 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important;
color: #333;
transition: 0.2s linear;
}
.cat-modify-info-card, .cat-modify-input-container input, .cat-modify-input-container textarea {
background: #333 !important;
color : #c1c1c1 !important
}
.cat-modify-representative {
background-color: #333;
}
.cat-modify-info-content {
color : #c1c1c1 !important
}
.cat-modify-footer {
border-color: rgba(0, 0, 0, 0.2);
}
.cat-modify-actions a:hover
.cat-modify-actions .toggle-comment-option:hover {
color: white !important;
}
.cat-modify-actions a::after,
.cat-modify-actions .toggle-comment-option::after {
background: #111 !important;
}
.cat-modify-input-container #cat-parent {
background: #333333;
box-shadow: 0px 2px #00000024;
}
.albumActions a:hover span {
color: #fff !important;
}
@@ -1172,21 +1193,21 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important;
color: #0051a5;
}
.tag-info.tag-warning {
.info-warning {
color: #ffdd99;
background-color: #ee8800;
}
.tag-info.tag-warning a {
.info-warning a, .info-message a, .info-error a {
color: white;
}
.tag-info.tag-message {
.info-message {
color: #c2f5c2 ;
background-color:#0a0;
}
.tag-info.tag-error {
.info-error {
color: #ffd5dc;
background-color:#f22;
}
+27 -7
View File
@@ -844,7 +844,7 @@ function format_fromto($from, $to, $full=false)
* @param bool $with_weeks
* @return string
*/
function time_since($original, $stop='minute', $format=null, $with_text=true, $with_week=true)
function time_since($original, $stop='minute', $format=null, $with_text=true, $with_week=true, $only_last_unit=false)
{
$date = str2DateTime($original, $format);
@@ -876,17 +876,37 @@ function time_since($original, $stop='minute', $format=null, $with_text=true, $w
$j = array_search($stop, array_keys($chunks));
$print = ''; $i=0;
foreach ($chunks as $name => $value)
if (!$only_last_unit)
{
if ($value != 0)
foreach ($chunks as $name => $value)
{
$print.= ' '.l10n_dec('%d '.$name, '%d '.$name.'s', $value);
if ($value != 0)
{
$print.= ' '.l10n_dec('%d '.$name, '%d '.$name.'s', $value);
}
if (!empty($print) && $i >= $j)
{
break;
}
$i++;
}
if (!empty($print) && $i >= $j)
} else {
$reversed_chunks_names = array_keys($chunks);
while ($print == '' && $i<count($reversed_chunks_names ))
{
break;
$name = $reversed_chunks_names[$i];
$value = $chunks[$name];
if ($value != 0)
{
$print = l10n_dec('%d '.$name, '%d '.$name.'s', $value);
}
if (!empty($print) && $i >= $j)
{
break;
}
$i++;
}
$i++;
}
$print = trim($print);
+1 -1
View File
@@ -136,7 +136,7 @@ SELECT id, name, permalink
}
else
{
$output.= $conf['level_separator'];
$output.= '<span>'.$conf['level_separator'].'</span>';
}
if ( !isset($url) or $single_link )
+34 -1
View File
@@ -752,7 +752,10 @@ SELECT id
* @param mixed[] $params
* @option int cat_id
* @option string name (optional)
* @option string status (optional)
* @option string comment (optional)
* @option bool commentable (optional)
* @option bool apply_commentable_to_subalbums (optional)
*/
function ws_categories_setInfo($params, &$service)
{
@@ -788,7 +791,7 @@ SELECT *
'id' => $params['category_id'],
);
$info_columns = array('name', 'comment',);
$info_columns = array('name', 'comment','commentable');
$perform_update = false;
foreach ($info_columns as $key)
@@ -801,6 +804,20 @@ SELECT *
}
}
if (isset($params['commentable']) && isset($params['apply_commentable_to_subalbums']) && $params['apply_commentable_to_subalbums'])
{
$subcats = get_subcat_ids(array('id' => $params['category_id']));
if (count($subcats) > 0)
{
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET commentable = \''.$params['commentable'].'\'
WHERE id IN ('.implode(',', $subcats).')
;';
pwg_query($query);
}
}
if ($perform_update)
{
single_update(
@@ -1146,6 +1163,22 @@ SELECT id, name, dir
{
return new PwgError(403, implode('; ', $page['errors']));
}
$query = '
SELECT uppercats
FROM '. CATEGORIES_TABLE .'
WHERE id IN ('. implode(',', $category_ids) .')
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
$cat_display_name = get_cat_display_name_cache(
$row['uppercats'],
'admin.php?page=album-'
);
}
return array('new_ariane_string' => $cat_display_name);
}
/**
+13
View File
@@ -1314,6 +1314,17 @@ $lang['and %d more'] = 'and %d more';
$lang['Picture to associate formats with'] = 'Picture to associate formats with';
$lang['The original picture will be detected with the filename (without extension).'] = 'The original picture will be detected with the filename (without extension).';
$lang['Delete %s format ?'] = 'Delete %s format ?';
$lang['Authorize publications'] = 'Authorize publications';
$lang['Created'] = 'Created';
$lang['Modified'] = 'Modified';
$lang['%d including sub-albums'] = '%d including sub-albums';
$lang['%d in whole branch'] = '%d in whole branch';
$lang['Authorize comments'] = 'Authorize comments';
$lang['Remove thumbnail'] = 'Remove thumbnail';
$lang['Allow comments down the line'] = 'Allow comments down the line';
$lang['Disallow comments down the line'] = 'Disallow comments down the line';
$lang['Comments allowed down the line'] = 'Comments allowed down the line';
$lang['Comments disallowed down the line'] = 'Comments disallowed down the line';
$lang['Installed on %s, %s'] = 'Installed on %s, %s';
$lang['While restoring this plugin, it will be reset to its original parameters and associated data is going to be reset'] = 'While restoring this plugin, it will be reset to its original parameters and associated data is going to be reset';
$lang['This picture is physically linked to this album, you can\'t dissociate them'] = 'This picture is physically linked to this album, you can\'t dissociate them.';
@@ -1329,4 +1340,6 @@ $lang['Some photos are missing from your file system. Details provided by plugin
$lang['<b>%d</b> filtered users'] = '<b>%d</b> filtered users';
$lang['<b>%d</b> filtered user'] = '<b>%d</b> filtered user';
$lang['%d lineage pictures'] = '%d lineage pictures';
$lang['Put at the root'] = 'Put at the root';
$lang['or'] = 'or';
// Leave this line empty
+13
View File
@@ -1314,6 +1314,13 @@ $lang['and %d more'] = 'et %d autre(s)';
$lang['Picture to associate formats with'] = 'Photo à associer avec les formats';
$lang['The original picture will be detected with the filename (without extension).'] = 'La photo originale sera détectée en comparant les noms des fichiers (sans extension).';
$lang['Delete %s format ?'] = 'Supprimer le format %s ?';
$lang['Authorize publications'] = 'Authoriser les publications';
$lang['Created'] = 'Créé';
$lang['Modified'] = 'Modifié';
$lang['%d including sub-albums'] = '%d en incluant les sous-albums';
$lang['%d in whole branch'] = '%d dans toute la branche';
$lang['Authorize comments'] = 'Autoriser les commentaires';
$lang['Remove thumbnail'] = 'Retirer la miniature';
$lang['Installed on %s, %s'] = 'Installé le %s, %s';
$lang['While restoring this plugin, it will be reset to its original parameters and associated data is going to be reset'] = 'En restaurant ce plugin, il reviendra à son paramétrage dorigine et les données associées seront remises à zero';
$lang['This picture is physically linked to this album, you can\'t dissociate them'] = 'Cette photo est physiquement liée à cet album, vous ne pouvez pas les dissocier.';
@@ -1329,4 +1336,10 @@ $lang['Some photos are missing from your file system. Details provided by plugin
$lang['<b>%d</b> filtered users'] = '<b>%d</b> utilisateurs filtrés';
$lang['<b>%d</b> filtered user'] = '<b>%d</b> utilisateur filtré';
$lang['%d lineage pictures'] = '%d images de lignée';
$lang['Allow comments down the line'] = 'Autoriser les commentaires pour toute la lignée';
$lang['Disallow comments down the line'] = 'Interdire les commentaires pour toute la lignée';
$lang['Comments allowed down the line'] = 'Commentaires autorisés pour toute la lignée';
$lang['Comments disallowed down the line'] = 'Commentaires interdit pour toute la lignée';
$lang['Put at the root'] = 'Placer à la racine';
$lang['or'] = 'ou';
// Leave this line empty
+11 -2
View File
@@ -847,10 +847,19 @@ function ws_addDefaultMethods( $arr )
'ws_categories_setInfo',
array(
'category_id' => array('type'=>WS_TYPE_ID),
'name' => array('default'=>null),
'comment' => array('default'=>null),
'name' => array('default'=>null,
'flags'=>WS_PARAM_OPTIONAL,),
'comment' => array('default'=>null,
'flags'=>WS_PARAM_OPTIONAL,),
'status' => array('default'=>null,
'flags'=>WS_PARAM_OPTIONAL,
'info'=>'public, private'),
'commentable' => array('default'=>true,
'flags'=>WS_PARAM_OPTIONAL,
'info'=>'Boolean, effective if configuration variable activate_comments is set to true'),
'apply_commentable_to_subalbums' => array('default'=>false,
'flags'=>WS_PARAM_OPTIONAL,
'info'=>'If true, set commentable to all sub album'),
),
'Changes properties of an album.',
$ws_functions_root . 'pwg.categories.php',