aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-10-05 19:36:38 +0000
committerrvelices <rv-github@modusoptimus.com>2012-10-05 19:36:38 +0000
commit8fb19cb1a45b978844c45050bad10c1ab732b000 (patch)
treea06447ffa6b716bb8ec064e6ab682c674f8faf76 /admin/themes
parent85015562012d7e1d54ff702d6d21b7f6dae3049c (diff)
added "are you sure?" confirmation before deleting all derivatives in maintenance or before deleting more than 500 derivatives in the batch manager
git-svn-id: http://piwigo.org/svn/trunk@18484 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl24
-rw-r--r--admin/themes/default/template/maintenance.tpl2
2 files changed, 15 insertions, 11 deletions
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index a3e5c156d..821c4caef 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -94,6 +94,7 @@ jQuery(document).ready(function() {ldelim}
{footer_script}
var nb_thumbs_page = {$nb_thumbs_page};
var nb_thumbs_set = {$nb_thumbs_set};
+var are_you_sure = "{'Are you sure?'|@translate|@escape:'javascript'}";
var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}";
var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}];
var derivatives = {ldelim}
@@ -187,11 +188,7 @@ $(document).ready(function() {
nbSelected = nb_thumbs_set;
}
else {
- $(".thumbnails input[type=checkbox]").each(function() {
- if ($(this).is(':checked')) {
- nbSelected++;
- }
- });
+ nbSelected = $(".thumbnails input[type=checkbox]").filter(':checked').length;
}
if (nbSelected == 0) {
@@ -417,7 +414,15 @@ $(document).ready(function() {
});
jQuery('#applyAction').click(function() {
- if (jQuery('[name="selectAction"]').val() != 'generate_derivatives'
+ var action = jQuery('[name="selectAction"]').val();
+ if (action == 'delete_derivatives') {
+ var d_count = $('#action_delete_derivatives input[type=checkbox]').filter(':checked').length
+ , e_count = $('input[name="setSelected"]').is(':checked') ? nb_thumbs_set : $('.thumbnails input[type=checkbox]').filter(':checked').length;
+ if (d_count*e_count > 500)
+ return confirm(are_you_sure);
+ }
+
+ if (action != 'generate_derivatives'
|| derivatives.finished() )
{
return true;
@@ -435,7 +440,7 @@ $(document).ready(function() {
if (jQuery('input[name="setSelected"]').attr('checked'))
derivatives.elements = all_elements;
else
- jQuery('input[name="selection[]"]').each(function() {
+ jQuery('.thumbnails input[type=checkbox]').each(function() {
if (jQuery(this).attr('checked')) {
derivatives.elements.push(jQuery(this).val());
}
@@ -580,7 +585,6 @@ $(document).ready(function() {
<option value="filter_level" {if isset($filter.level)}disabled="disabled"{/if}>{'Privacy level'|@translate}</option>
<option value="filter_dimension" {if isset($filter.dimension)}disabled="disabled"{/if}>{'Dimensions'|@translate}</option>
</select>
-<!-- <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
<a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
</p>
@@ -712,7 +716,7 @@ UL.thumbnails SPAN.wrap2 {ldelim}
<select style="width:400px" name="associate" size="1">
{html_options options=$associate_options }
</select>
-<br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
+<br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</div>
<!-- move -->
@@ -720,7 +724,7 @@ UL.thumbnails SPAN.wrap2 {ldelim}
<select style="width:400px" name="move" size="1">
{html_options options=$move_options }
</select>
-<br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
+<br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</div>
diff --git a/admin/themes/default/template/maintenance.tpl b/admin/themes/default/template/maintenance.tpl
index fc568fa42..c17b2dccf 100644
--- a/admin/themes/default/template/maintenance.tpl
+++ b/admin/themes/default/template/maintenance.tpl
@@ -35,6 +35,6 @@
<li><a href="{$U_MAINT_SEARCH}"onclick="return confirm('{'Purge search history'|@translate|@escape:'javascript'}');">{'Purge search history'|@translate}</a></li>
<li><a href="{$U_MAINT_COMPILED_TEMPLATES}">{'Purge compiled templates'|@translate}</a></li>
<li>{'Delete multiple size images'|@translate}:
- {foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}">{$name}</a>{/foreach}
+ {foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}"{if $smarty.foreach.loop.first} onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"{/if}>{$name}</a>{/foreach}
</li>
</ul>