From 45716d15c1aef18fa036eec7bd8678de5fd65081 Mon Sep 17 00:00:00 2001
From: Olivier PEREZ <olivier@olivierperez.fr>
Date: Sun, 21 Dec 2014 00:04:23 +0100
Subject: [PATCH] Display confirmation page before to delete all votes of one
 poll.

---
 adminstuds.php               |  7 +++++++
 tpl/confirm/delete_votes.tpl | 11 +++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 tpl/confirm/delete_votes.tpl

diff --git a/adminstuds.php b/adminstuds.php
index 0aad6edf..0fbbef1e 100644
--- a/adminstuds.php
+++ b/adminstuds.php
@@ -128,6 +128,13 @@ if (!empty($_POST['delete_comment'])) {
 // Remove all votes
 // -------------------------------
 if (isset($_POST['remove_all_votes'])) {
+    $smarty->assign('poll_id', $poll_id);
+    $smarty->assign('admin_poll_id', $admin_poll_id);
+    $smarty->assign('title', _('Poll') . ' - ' . $poll->title);
+    $smarty->display('confirm/delete_votes.tpl');
+    exit;
+}
+if (isset($_POST['confirm_remove_all_votes'])) {
     $adminPollService->cleanVotes($poll_id);
 }
 
diff --git a/tpl/confirm/delete_votes.tpl b/tpl/confirm/delete_votes.tpl
new file mode 100644
index 00000000..28490b04
--- /dev/null
+++ b/tpl/confirm/delete_votes.tpl
@@ -0,0 +1,11 @@
+{extends file='page.tpl'}
+
+{block name=main}
+    <form action="{$admin_poll_id|poll_url:true}" method="POST">
+        <div class="alert alert-danger text-center">
+            <h2>{_("Confirm removal of all votes of the poll")}</h2>
+            <p><button class="btn btn-default" type="submit" name="cancel">{_("Keep votes")}</button>
+                <button type="submit" name="confirm_remove_all_votes" class="btn btn-danger">{_("Remove all votes!")}</button></p>
+        </div>
+    </form>
+{/block}
\ No newline at end of file
-- 
GitLab