aboutsummaryrefslogtreecommitdiff
path: root/app/install.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-07-20 17:10:18 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-07-20 17:10:18 +0200
commit5d9b5f07feee3e388e747e5791cd91d1b98f55ef (patch)
treef7e00d34453853b2317d535b1cc5eba3483d7c83 /app/install.php
parent2c8b4f5a502cb387f5eccfcc38aa7434bd75637a (diff)
Ask confirmation before reinstallation
See https://github.com/FreshRSS/FreshRSS/issues/909
Diffstat (limited to 'app/install.php')
-rw-r--r--app/install.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/app/install.php b/app/install.php
index 61d2f5df9..ebd785f65 100644
--- a/app/install.php
+++ b/app/install.php
@@ -609,9 +609,31 @@ function printStep1() {
<form action="index.php?step=1" method="post">
<input type="hidden" name="freshrss-keep-install" value="1" />
- <button type="submit" class="btn btn-important" tabindex="1" ><?php echo _t('install.action.keep_install'); ?></button>
- <a class="btn btn-attention next-step" href="?step=2" tabindex="2" ><?php echo _t('install.action.reinstall'); ?></a>
+ <button type="submit" class="btn btn-important next-step" tabindex="1" ><?php echo _t('install.action.keep_install'); ?></button>
+ <a class="btn btn-attention next-step confirm" data-str-confirm="<?php echo _t('install.js.confirm_reinstall'); ?>" href="?step=2" tabindex="2" ><?php echo _t('install.action.reinstall'); ?></a>
</form>
+
+ <script>
+ function ask_confirmation(e) {
+ var str_confirmation = this.getAttribute('data-str-confirm');
+ if (!str_confirmation) {
+ str_confirmation = "<?php echo _t('gen.js.confirm_action'); ?>";
+ }
+
+ if (!confirm(str_confirmation)) {
+ e.preventDefault();
+ }
+ }
+
+ function init_confirm() {
+ confirms = document.getElementsByClassName('confirm');
+ for (var i = 0 ; i < confirms.length ; i++) {
+ confirms[i].addEventListener('click', ask_confirmation);
+ }
+ }
+
+ init_confirm();
+ </script>
<?php } elseif ($res['all'] == 'ok') { ?>
<a class="btn btn-important next-step" href="?step=2" tabindex="1" ><?php echo _t('install.action.next_step'); ?></a>
<?php } else { ?>