Skip to content

Commit

Permalink
bug 2558 fixed: instead of locking the gallery with a simple checkbox…
Browse files Browse the repository at this point in the history
… among

configuration options, "lock gallery" becomes a maintenance action, with a
confirmation on popup.


git-svn-id: http://piwigo.org/svn/trunk@13001 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Jan 31, 2012
1 parent 907c8e2 commit 7c322f6
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
11 changes: 0 additions & 11 deletions admin/configuration.php
Expand Up @@ -46,7 +46,6 @@
}

$main_checkboxes = array(
'gallery_locked',
'allow_user_registration',
'obligatory_user_mail_address',
'rate',
Expand Down Expand Up @@ -172,16 +171,6 @@
}
}

if (empty($_POST['gallery_locked']) and $conf['gallery_locked'])
{
$tpl_var = & $template->get_template_vars('header_msgs');
$msg_key = array_search(l10n('The gallery is locked for maintenance. Please, come back later.'), $tpl_var);
unset($tpl_var[$msg_key]);
}
elseif (!empty($_POST['gallery_locked']) and !$conf['gallery_locked'])
{
$template->append('header_msgs', l10n('The gallery is locked for maintenance. Please, come back later.'));
}
foreach( $main_checkboxes as $checkbox)
{
$_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
Expand Down
30 changes: 30 additions & 0 deletions admin/maintenance.php
Expand Up @@ -47,6 +47,19 @@

switch ($action)
{
case 'lock_gallery' :
{
conf_update_param('gallery_locked', 'true');
redirect(get_root_url().'admin.php?page=maintenance');
break;
}
case 'unlock_gallery' :
{
conf_update_param('gallery_locked', 'false');
$_SESSION['page_infos'] = array(l10n('Gallery unlocked'));
redirect(get_root_url().'admin.php?page=maintenance');
break;
}
case 'categories' :
{
update_uppercats();
Expand Down Expand Up @@ -164,6 +177,23 @@
)
);

if ($conf['gallery_locked'])
{
$template->assign(
array(
'U_MAINT_UNLOCK_GALLERY' => sprintf($url_format, 'unlock_gallery'),
)
);
}
else
{
$template->assign(
array(
'U_MAINT_LOCK_GALLERY' => sprintf($url_format, 'lock_gallery'),
)
);
}

// +-----------------------------------------------------------------------+
// | Define advanced features |
// +-----------------------------------------------------------------------+
Expand Down
7 changes: 0 additions & 7 deletions admin/themes/default/template/configuration.tpl
Expand Up @@ -32,13 +32,6 @@
<fieldset id="mainConfCheck">
<legend></legend>
<ul>
<li>
<label>
<span class="property">{'Lock gallery'|@translate}</span>
<input type="checkbox" name="gallery_locked" {if ($main.gallery_locked)}checked="checked"{/if}>
</label>
</li>

<li>
<label>
<span class="property">{'Allow rating'|@translate}</span>
Expand Down
13 changes: 9 additions & 4 deletions admin/themes/default/template/maintenance.tpl
Expand Up @@ -3,13 +3,17 @@
</div>

<ul>
{foreach from=$advanced_features item=feature}
<li><a href="{$feature.URL}">{$feature.CAPTION}</a></li>
{/foreach}
{if (isset($U_MAINT_LOCK_GALLERY))}
<li><a href="{$U_MAINT_LOCK_GALLERY}" onclick="return confirm('{'A locked gallery is only visible to administrators'|@translate|@escape:'javascript'}');">{'Lock gallery'|@translate}</a></li>
{else}
<li><a href="{$U_MAINT_UNLOCK_GALLERY}">{'Unlock gallery'|@translate}</a></li>
{/if}
</ul>

<ul>
<li><a href="{$U_MAINT_ORPHAN_TAGS}">{'Delete orphan tags'|@translate}</a></li>
{foreach from=$advanced_features item=feature}
<li><a href="{$feature.URL}">{$feature.CAPTION}</a></li>
{/foreach}
</ul>

<ul>
Expand All @@ -23,6 +27,7 @@
</ul>

<ul>
<li><a href="{$U_MAINT_ORPHAN_TAGS}">{'Delete orphan tags'|@translate}</a></li>
<li><a href="{$U_MAINT_HISTORY_DETAIL}" onclick="return confirm('{'Purge history detail'|@translate|@escape:'javascript'}');">{'Purge history detail'|@translate}</a></li>
<li><a href="{$U_MAINT_HISTORY_SUMMARY}" onclick="return confirm('{'Purge history summary'|@translate|@escape:'javascript'}');">{'Purge history summary'|@translate}</a></li>
<li><a href="{$U_MAINT_SESSIONS}">{'Purge sessions'|@translate}</a></li>
Expand Down
3 changes: 3 additions & 0 deletions language/en_UK/admin.lang.php
Expand Up @@ -832,4 +832,7 @@
$lang['Resize after upload'] = 'Resize after upload';
$lang['Photo Sizes'] = 'Photo Sizes';
$lang['Original Size'] = 'Original Size';
$lang['A locked gallery is only visible to administrators'] = 'A locked gallery is only visible to administrators';
$lang['Unlock gallery'] = 'Unlock gallery';
$lang['Gallery unlocked'] = 'Gallery unlocked';
?>
4 changes: 3 additions & 1 deletion language/fr_FR/admin.lang.php
Expand Up @@ -845,5 +845,7 @@
$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
$lang['Activate comments'] = 'Activer les commentaires';
$lang['Default comments order'] = 'Ordre par défaut des commentaires';

$lang['A locked gallery is only visible to administrators'] = 'Une galerie verrouillée n\'est visible que des administrateurs';
$lang['Unlock gallery'] = 'Déverouiller la galerie';
$lang['Gallery unlocked'] = 'Galerie déverouillée';
?>

0 comments on commit 7c322f6

Please sign in to comment.