mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
related to #1704 Added alert is album is locked
* Corrected french sentences spelled wrong * Added max length for album names in breadcrumbs * Added attribute 'visible' in categories.setInfos * Can now unlock an album by clicking on the alert * Switch used to lock an album works properly now
This commit is contained in:
@@ -159,6 +159,9 @@ if (!empty($category['id_uppercat']))
|
||||
$self_url.= '&parent_id='.$category['id_uppercat'];
|
||||
}
|
||||
|
||||
// We show or hide this warning in JS
|
||||
$page['warnings'][] = l10n('This album is currently locked, visible only to administrators.').'<span class="icon-key unlock-album">'.l10n('Unlock it').'</span>';
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'CATEGORIES_NAV' => preg_replace("# {2,}#"," ",preg_replace("#(\r\n|\n\r|\n|\r)#"," ",$navigation)),
|
||||
@@ -167,7 +170,7 @@ $template->assign(
|
||||
'CAT_ID' => $category['id'],
|
||||
'CAT_NAME' => @htmlspecialchars($category['name']),
|
||||
'CAT_COMMENT' => @htmlspecialchars($category['comment']),
|
||||
'IS_LOCKED' => $category['status'] == "private",
|
||||
'IS_VISIBLE' => boolean_to_string($category['visible']),
|
||||
|
||||
'U_DELETE' => $base_url.'albums',
|
||||
|
||||
|
||||
@@ -1,6 +1,56 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
activateCommentDropdown()
|
||||
activateCommentDropdown();
|
||||
checkAlbumLock();
|
||||
|
||||
$(".unlock-album").on('click', function () {
|
||||
jQuery.ajax({
|
||||
url: "ws.php?format=json&method=pwg.categories.setInfo",
|
||||
type:"POST",
|
||||
dataType: "json",
|
||||
data: {
|
||||
category_id: album_id,
|
||||
visible: 'true',
|
||||
},
|
||||
success:function(data) {
|
||||
if (data.stat == "ok") {
|
||||
|
||||
is_visible = 'true';
|
||||
if ($("#cat-locked").is(":checked")) {
|
||||
$("input[id='cat-locked']").trigger('click');
|
||||
}
|
||||
checkAlbumLock();
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
jQuery('.tiptip').tipTip({
|
||||
'delay' : 0,
|
||||
@@ -21,8 +71,8 @@ jQuery(document).ready(function() {
|
||||
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",
|
||||
visible: $("#cat-locked").is(":checked") ? 'false' : 'true',
|
||||
commentable: $("#cat-commentable").is(":checked") ? "true":"false",
|
||||
apply_commentable_to_subalbums: $("#cat-apply-commentable-on-sub").is(":checked")? "true":"false",
|
||||
},
|
||||
success:function(data) {
|
||||
@@ -32,6 +82,10 @@ jQuery(document).ready(function() {
|
||||
$('.info-message').show()
|
||||
$('.cat-modification .cat-modify-info-subcontent').html(str_just_now)
|
||||
$('.cat-modification .cat-modify-info-content').html(str_just_now)
|
||||
|
||||
is_visible = $("#cat-locked").is(":checked") ? 'false' : 'true';
|
||||
checkAlbumLock();
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
$('.info-message').hide()
|
||||
@@ -410,6 +464,15 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
function checkAlbumLock() {
|
||||
console.log(is_visible);
|
||||
if (is_visible == 'true') {
|
||||
$(".warnings").hide();
|
||||
} else {
|
||||
$(".warnings").show();
|
||||
}
|
||||
}
|
||||
|
||||
// Parent album popin functions
|
||||
function set_up_popin() {
|
||||
$(".ClosePopIn").on('click', function () {
|
||||
|
||||
@@ -17,6 +17,7 @@ const album_name = "{$CAT_NAME}"
|
||||
const nb_sub_albums = {$NB_SUBCATS}
|
||||
const pwg_token = '{$PWG_TOKEN}'
|
||||
const u_delete = '{$U_DELETE}'
|
||||
var is_visible = '{$IS_VISIBLE}'
|
||||
|
||||
const str_cancel = '{'No, I have changed my mind'|@translate|@escape}'
|
||||
const str_delete_album = '{'Delete album'|@translate|escape:javascript}'
|
||||
@@ -170,12 +171,12 @@ str_root = '{'Root'|@translate}';
|
||||
<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}>
|
||||
<input type="checkbox" name="locked" id="cat-locked" value="true" {if $IS_VISIBLE == 'false'}checked{/if}>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<label class="switch-label" for="cat-locked"><span>{'Unlocked album'|@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>
|
||||
<label class="switch-label" for="cat-locked"><span>{'Locked album'|@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>
|
||||
|
||||
@@ -404,6 +404,10 @@ LI.menuLi {
|
||||
}
|
||||
|
||||
/* Cat Modify */
|
||||
.unlock-album {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cat-modify {
|
||||
height: calc(100vh - 192px);
|
||||
width: calc(100vw - 205px);
|
||||
@@ -425,6 +429,25 @@ LI.menuLi {
|
||||
}
|
||||
.cat-modify-ariane a {
|
||||
white-space: nowrap;
|
||||
max-width: 300px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#cat-parent {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
#cat-parent span {
|
||||
margin: 0 5px;
|
||||
}
|
||||
#cat-parent a {
|
||||
max-width: 175px;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.cat-modify-ariane > * {
|
||||
|
||||
@@ -753,6 +753,7 @@ SELECT id
|
||||
* @option int cat_id
|
||||
* @option string name (optional)
|
||||
* @option string status (optional)
|
||||
* @option bool visible (optional)
|
||||
* @option string comment (optional)
|
||||
* @option bool commentable (optional)
|
||||
* @option bool apply_commentable_to_subalbums (optional)
|
||||
@@ -791,7 +792,7 @@ SELECT *
|
||||
'id' => $params['category_id'],
|
||||
);
|
||||
|
||||
$info_columns = array('name', 'comment','commentable');
|
||||
$info_columns = array('name', 'comment','commentable', 'visible');
|
||||
|
||||
$perform_update = false;
|
||||
foreach ($info_columns as $key)
|
||||
|
||||
@@ -1258,7 +1258,7 @@ $lang['Your selection'] = 'Your selection';
|
||||
$lang['action successfully performed.'] = 'action successfully performed.';
|
||||
$lang['%s lines'] = "%s lines";
|
||||
$lang['%s line'] = "%s line";
|
||||
$lang['Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Lock this album will also lock his Sub-albums'] = 'Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Locking this album will also lock its sub-albums';
|
||||
$lang['Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Lock this album will also lock his Sub-albums'] = 'Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Locking this album will also lock its sub-albums.';
|
||||
$lang['Webmaster status required'] = 'Webmaster status required';
|
||||
$lang['%s plugins found'] = '<b>%s</b> plugins found';
|
||||
$lang['%s plugin found'] = '<b>%s</b> plugin found';
|
||||
@@ -1342,4 +1342,7 @@ $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';
|
||||
$lang['Locked album'] = 'Locked album';
|
||||
$lang['This album is currently locked, visible only to administrators.'] = 'This album is currently locked, visible only to administrators.';
|
||||
$lang['Unlock it'] = 'Unlock it';
|
||||
// Leave this line empty
|
||||
|
||||
@@ -1261,7 +1261,7 @@ $lang['Your selection'] = 'Votre selection';
|
||||
$lang['action successfully performed.'] = 'action effectuée avec succès.';
|
||||
$lang['%s lines'] = "%s lignes";
|
||||
$lang['%s line'] = "%s ligne";
|
||||
$lang['Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Lock this album will also lock his Sub-albums'] = 'Les albums vérrouillés sont désactivé pour maintenance. Seul les administrateurs peuvent les voir dans la gallerie. Vérrouiller cet album vérouillera aussi ses sous-albums';
|
||||
$lang['Locked albums are disabled for maintenance. Only administrators can view them in the gallery. Lock this album will also lock his Sub-albums'] = 'Les albums verrouillés sont désactivés pour maintenance. Seuls les administrateurs peuvent les voir dans la galerie. Verrouiller cet album verrouillera aussi ses sous-albums.';
|
||||
$lang['Webmaster status required'] = 'Statut Webmaster nécéssaire';
|
||||
$lang['%s plugins found'] = '<b>%s</b> plugins trouvés';
|
||||
$lang['%s plugin found'] = '<b>%s</b> plugin trouvé';
|
||||
@@ -1314,7 +1314,7 @@ $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['Unlocked album'] = 'Album dévérouillé';
|
||||
$lang['Unlocked album'] = 'Album déverouillé';
|
||||
$lang['Created'] = 'Créé';
|
||||
$lang['Modified'] = 'Modifié';
|
||||
$lang['%d including sub-albums'] = '%d en incluant les sous-albums';
|
||||
@@ -1342,4 +1342,7 @@ $lang['Comments allowed for sub-albums'] = 'Commentaires autorisés pour tous le
|
||||
$lang['Comments disallowed for sub-albums'] = 'Commentaires interdit pour tous les sous-albums';
|
||||
$lang['Put at the root'] = 'Placer à la racine';
|
||||
$lang['or'] = 'ou';
|
||||
$lang['Locked album'] = 'Album verrouillé';
|
||||
$lang['This album is currently locked, visible only to administrators.'] = 'Cet album est actuellement verrouillé, visible uniquement par les administrateurs.';
|
||||
$lang['Unlock it'] = 'Le déverrouiller';
|
||||
// Leave this line empty
|
||||
|
||||
2
ws.php
2
ws.php
@@ -854,6 +854,8 @@ function ws_addDefaultMethods( $arr )
|
||||
'status' => array('default'=>null,
|
||||
'flags'=>WS_PARAM_OPTIONAL,
|
||||
'info'=>'public, private'),
|
||||
'visible' => array('default'=>null,
|
||||
'flags'=>WS_PARAM_OPTIONAL),
|
||||
'commentable' => array('default'=>true,
|
||||
'flags'=>WS_PARAM_OPTIONAL,
|
||||
'info'=>'Boolean, effective if configuration variable activate_comments is set to true'),
|
||||
|
||||
Reference in New Issue
Block a user