diff --git a/admin/cat_modify.php b/admin/cat_modify.php index cf2181042..4f0a6fae1 100644 --- a/admin/cat_modify.php +++ b/admin/cat_modify.php @@ -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.').''.l10n('Unlock it').''; + $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', diff --git a/admin/themes/default/js/cat_modify.js b/admin/themes/default/js/cat_modify.js index c56cd898b..23959dc36 100644 --- a/admin/themes/default/js/cat_modify.js +++ b/admin/themes/default/js/cat_modify.js @@ -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 () { diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl index 9e6289a31..9f48b709a 100644 --- a/admin/themes/default/template/cat_modify.tpl +++ b/admin/themes/default/template/cat_modify.tpl @@ -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}';
- +
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index 484aaa909..44706d1c0 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -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 > * { diff --git a/include/ws_functions/pwg.categories.php b/include/ws_functions/pwg.categories.php index 9f1392e8f..abbcba43f 100644 --- a/include/ws_functions/pwg.categories.php +++ b/include/ws_functions/pwg.categories.php @@ -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) diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index 1c2d0cb8c..e516c57ff 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -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'] = '%s plugins found'; $lang['%s plugin found'] = '%s plugin found'; @@ -1342,4 +1342,7 @@ $lang['%d filtered user'] = '%d 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 diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index e0fb27a9e..c2c84bc6f 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -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'] = '%s plugins trouvés'; $lang['%s plugin found'] = '%s 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 diff --git a/ws.php b/ws.php index 1af41d7ac..2d5ccd99e 100644 --- a/ws.php +++ b/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'),