Started working on client-side restriction of donations
Signed-off-by: Edouard Poitras <edouard@eclipse.org>
diff --git a/content/en_index.php b/content/en_index.php
index 0caeb87..08fecbb 100644
--- a/content/en_index.php
+++ b/content/en_index.php
@@ -139,7 +139,7 @@
</div>
<div id="custom-donation" class="row">
<div class="col-md-24">
- <form action="<?php print $Paypal->get_paypal_url(); ?>" method="POST">
+ <form action="<?php print $Paypal->get_paypal_url(); ?>" onsubmit="valid_donation()" method="POST">
<input type="hidden" name="business" value="<?php print $Paypal->get_donation_email(); ?>"/>
<input type="hidden" name="item_name" value="Donation"/>
<input type="hidden" name="no_shipping" value="1"/>
diff --git a/index.php b/index.php
index 24ea4db..65165d0 100644
--- a/index.php
+++ b/index.php
@@ -19,9 +19,9 @@
$Nav = new Nav();
$Menu = new Menu();
$Paypal = new Paypal();
-//$Paypal->set_debug_mode(TRUE);
-//$Paypal->set_sandbox_mode(TRUE);
-//$Paypal->set_show_all(TRUE);
+$Paypal->set_debug_mode(TRUE);
+$Paypal->set_sandbox_mode(TRUE);
+$Paypal->set_show_all(TRUE);
# Begin: page-specific settings. Change these.
$pageTitle = "Support Eclipse";
@@ -37,4 +37,15 @@
# Generate the web page
$App->AddExtraHtmlHeader('<link rel="stylesheet" type="text/css" href="style.css" media="screen" />');
+$App->AddExtraJSFooter('
+<script>
+ function valid_donation () {
+ valid = true;
+ if (document.getElementById("donation-amount").value < 1) {
+ alert("Sorry, only donations above $1 are allowed");
+ valid = false;
+ }
+ return valid;
+ }
+</script>');
$App->generatePage("solstice", $Menu, NULL, $pageAuthor, $pageKeywords, $pageTitle, $html);
diff --git a/thankyou.php b/thankyou.php
index 62e2e41..3ac635e 100644
--- a/thankyou.php
+++ b/thankyou.php
@@ -36,9 +36,9 @@
// Set up Paypal
$Paypal = new Paypal();
-//$Paypal->set_debug_mode(TRUE);
-//$Paypal->set_sandbox_mode(TRUE);
-//$Paypal->set_show_all(TRUE);
+$Paypal->set_debug_mode(TRUE);
+$Paypal->set_sandbox_mode(TRUE);
+$Paypal->set_show_all(TRUE);
// Confirm Donation
$success = $Paypal->confirm_donation();
if ($success) {