aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-01-31 00:33:01 +0000
committerplegall <plg@piwigo.org>2012-01-31 00:33:01 +0000
commit7c322f6d9c241c9282bc9c8362e702b49814fbad (patch)
tree82a8b6a2eb7bd7fda8ea2882f586c3ef9ddcd269
parent907c8e2104ac7f96327b16a3daee78947c21432f (diff)
bug 2558 fixed: instead of locking the gallery with a simple checkbox 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
Diffstat (limited to '')
-rw-r--r--admin/configuration.php11
-rw-r--r--admin/maintenance.php30
-rw-r--r--admin/themes/default/template/configuration.tpl7
-rw-r--r--admin/themes/default/template/maintenance.tpl13
-rw-r--r--language/en_UK/admin.lang.php3
-rw-r--r--language/fr_FR/admin.lang.php4
6 files changed, 45 insertions, 23 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 3a2a90640..e03d84fb0 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -46,7 +46,6 @@ else
}
$main_checkboxes = array(
- 'gallery_locked',
'allow_user_registration',
'obligatory_user_mail_address',
'rate',
@@ -172,16 +171,6 @@ if (isset($_POST['submit']))
}
}
- 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';
diff --git a/admin/maintenance.php b/admin/maintenance.php
index 405f45053..c8547a118 100644
--- a/admin/maintenance.php
+++ b/admin/maintenance.php
@@ -47,6 +47,19 @@ $action = isset($_GET['action']) ? $_GET['action'] : '';
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();
@@ -164,6 +177,23 @@ $template->assign(
)
);
+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 |
// +-----------------------------------------------------------------------+
diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl
index 232b00356..ea4e32fab 100644
--- a/admin/themes/default/template/configuration.tpl
+++ b/admin/themes/default/template/configuration.tpl
@@ -34,13 +34,6 @@
<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>
<input type="checkbox" name="rate" {if ($main.rate)}checked="checked"{/if}>
</label>
diff --git a/admin/themes/default/template/maintenance.tpl b/admin/themes/default/template/maintenance.tpl
index 2c5f59713..a7e0112a9 100644
--- a/admin/themes/default/template/maintenance.tpl
+++ b/admin/themes/default/template/maintenance.tpl
@@ -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>
@@ -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>
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index dc041b02f..c1b5f3db9 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -832,4 +832,7 @@ $lang['[NBM] Problems or questions'] = "[NBM] Problems or questions";
$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';
?> \ No newline at end of file
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index b01a5b642..7766df892 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -845,5 +845,7 @@ $lang['Original Size'] = 'Taille originale';
$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';
?> \ No newline at end of file