web: Move donation form to donate.org and adjust procdonate.
authorWerner Koch <wk@gnupg.org>
Thu, 4 May 2017 08:06:07 +0000 (10:06 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 4 May 2017 08:06:07 +0000 (10:06 +0200)
cgi/procdonate.cgi
web/donate/donate.org [new file with mode: 0644]
web/donate/index.org

index 650f803..c0894af 100755 (executable)
@@ -39,6 +39,7 @@ my $paytype = "";
 my $stripeamount = "";
 my $euroamount = "";
 my $currency = "";
+my $recur = "";
 my $name = "";
 my $mail = "";
 my $message = "";
@@ -77,6 +78,10 @@ sub write_template ($) {
     my $sel_usd = '';
     my $sel_gbp = '';
     my $sel_jpy = '';
+    my $recur_none = '';
+    my $recur_month = '';
+    my $recur_quarter = '';
+    my $recur_year = '';
     my $message_fmt;
     my $publishname;
     my $check_paytype = 'none';
@@ -85,6 +90,7 @@ sub write_template ($) {
     $amount =~ s/\x22/\x27/g;
     $stripeamount =~ s/\x22/\x27/g;
     $currency =~ s/\x22/\x27/g;
+    $recur =~ s/\x22/\x27/g;
     $name =~ s/\x22/\x27/g;
     $mail =~ s/\x22/\x27/g;
     $message =~ s/\x22/\x27/g;
@@ -95,6 +101,7 @@ sub write_template ($) {
     $amount =~ s/</\x26lt;/g;
     $stripeamount =~ s/</\x26lt;/g;
     $currency =~ s/</\x26lt;/g;
+    $recur =~ s/</\x26lt;/g;
     $name =~ s/</\x26lt;/g;
     $mail =~ s/</\x26lt;/g;
     $message =~ s/</\x26lt;/g;
@@ -116,6 +123,16 @@ sub write_template ($) {
         $sel_jpy = ' selected="selected"';
     }
 
+    if ( $recur =~ /0/ ) {
+        $recur_none    = ' selected="selected"';
+    } elsif ( $recur =~ /12/ ) {
+        $recur_month   = ' selected="selected"';
+    } elsif ( $recur =~ /4/ ) {
+        $recur_quarter = ' selected="selected"';
+    } elsif ( $recur =~ /1/ ) {
+        $recur_year    = ' selected="selected"';
+    }
+
     if ( $paytype eq "cc" ) {
         $check_paytype = "CC";
     } elsif ( $paytype eq "pp" ) {
@@ -171,6 +188,10 @@ sub write_template ($) {
             || s/(<selected=\x22selected\x22)?><!--SEL_USD-->/$sel_usd>/
             || s/(<selected=\x22selected\x22)?><!--SEL_GBP-->/$sel_gbp>/
             || s/(<selected=\x22selected\x22)?><!--SEL_JPY-->/$sel_jpy>/
+            || s/(<selected=\x22selected\x22)?><!--RECUR_NONE-->/$recur_none>/
+            || s/(<selected=\x22selected\x22)?><!--RECUR_MONTH-->/$recur_month>/
+            || s/(<selected=\x22selected\x22)?><!--RECUR_QUARTER-->/$recur_quarter>/
+            || s/(<selected=\x22selected\x22)?><!--RECUR_YEAR-->/$recur_year>/
             || s/<!--PUBLISH_NAME-->/$publishname/
             || s/<!--SEPA_REF-->/$separef/
             || s/<!--ERRORSTR-->/$errorstr/
@@ -298,7 +319,7 @@ sub write_main_page ()
 {
     print $q->header(-type=>'text/html', -charset=>'utf-8');
     print "\n";
-    write_template("donate/index.html");
+    write_template("donate/donate.html");
 }
 
 
@@ -337,7 +358,7 @@ sub check_donation ()
     my %sepa;
     my $anyerr = 0;
 
-    # Note: When re-displaying the page we always use amount other
+    # Note: When re-displaying the page we always use amount "other"
     # because that is easier to implement than figuring out which
     # amount and currency was used and check the appropriate radio
     # button.
@@ -349,21 +370,24 @@ sub check_donation ()
       $currency = 'EUR';
     }
 
+    $recur = $q->param("recur");
     $name = $q->param("name");
     $name = 'Anonymous' if $name eq '';
     $mail = $q->param("mail");
     $message = $q->param("message");
     $stripeamount = "0";
 
-    # Check the amount.
+    # Check the amount and the recurring value
     $data{"Amount"} = $amount;
     $data{"Currency"} = $currency;
+    $data{"Recur"} = $recur;
     if (not payproc ('CHECKAMOUNT', \%data )) {
         $errdict{"amount"} = $data{"ERR_Description"};
         $anyerr = 1;
     }
     $stripeamount = $data{"_amount"};
     $amount = $data{"Amount"};
+    $recur = $data{"Recur"};
     $currency = $data{"Currency"};
     $euroamount = $data{"Euro"};
 
@@ -433,6 +457,7 @@ sub resend_main_page ()
     payproc ('SESSION get ' . $sessid, \%data) or fail $data{"ERR_Description"};
     $amount = $data{"Amount"};
     $currency = $data{"Currency"};
+    $recur = $data{"Recur"};
     $paytype = $data{"Paytype"};
     $stripeamount = $data{"Stripeamount"};
     $euroamount = $data{"Euroamount"};
diff --git a/web/donate/donate.org b/web/donate/donate.org
new file mode 100644 (file)
index 0000000..f645796
--- /dev/null
@@ -0,0 +1,155 @@
+#+TITLE: GnuPG - Donate
+#+STARTUP: showall
+#+SETUPFILE: "../share/setup.inc"
+#
+# Note: Do not use relative links because this page is also used as a
+#       template from cgi-bin/.  Using https://www.gnupg.org/... is
+#       fine as it is stripped before publishing.
+
+#+BEGIN_HTML
+<!--custom-page-->  <!-- this disables all standard processing. -->
+<link rel="stylesheet" href="/share/site.css" type="text/css" />
+</head>
+<body>
+
+
+  <!--ERRORPANEL-->
+
+  <form action="/cgi-bin/procdonate.cgi" method="post" class="inputpanel">
+   <input type="hidden" name="mode" value="main">
+   <p class="ii">Keep this field clear:
+                 <input type="text" size="40" name="url"></p>
+   <table border="0" cellpadding="0" cellspacing="4">
+    <tr>
+      <td></td>
+      <td>How much do you want to donate?<br/>
+          <span class="smallnote">(choosing “other” allows
+          to donate in other currencies)</span></td>
+    </tr>
+    <tr>
+      <td align="right">Amount:</td>
+      <td>
+          <label><input type="radio" name="amount" value="500"/>500 EUR</label>
+          <label><input type="radio" name="amount" value="200"/>200 EUR</label>
+          <label><input type="radio" name="amount" value="100"/>100 EUR</label>
+          <label><input type="radio" name="amount" value="50"/>50 EUR</label>
+          <label><input type="radio" name="amount" value="20"/>20 EUR</label>
+          <label><input type="radio" name="amount" value="5"/>5 EUR</label>
+      </td>
+    </tr>
+    <tr>
+      <td></td>
+      <td>
+          <input type="radio" name="amount"
+                              value="other"/><!--CHECKOTHER-->other:
+          <input type="text"  size="6" name="amountother"
+                              value=""/><!--AMOUNT-->
+          <select name="currency" size="1">
+            <option value="EUR" selected="selected"><!--SEL_EUR-->Euro</option>
+            <option value="USD" ><!--SEL_USD-->US Dollar</option>
+            <option value="GBP" ><!--SEL_GBP-->British Pound</option>
+            <option value="JPY" ><!--SEL_JPY-->Yen</option>
+          </select>
+          <!--ERR_AMOUNT-->
+      </td>
+    </tr>
+    <tr>
+      <td align="right">Recurring:</td>
+      <td>
+          <select name="recur" size="1">
+            <option value="0"
+            selected="selected"><!--RECUR_NONE-->Just once</option>
+            <option value="12" ><!--RECUR_MONTH-->Monthly</option>
+            <option value="4" ><!--RECUR_QUARTER-->Quarterly</option>
+            <option value="1" ><!--RECUR_YEAR-->Yearly</option>
+          </select>
+      </td>
+    </tr>
+   <tr><td>&nbsp;</td></tr>
+    <tr>
+      <td align="right">Pay&nbsp;using:</td>
+      <td>
+        <label><input type="radio" name="paytype"
+                      value="cc" /><!--CHECK_CC-->Credit Card</label>
+        <!--ERR_PAYTYPE-->
+      </td>
+   </tr>
+   <tr>
+     <td></td>
+     <td>
+       <label><input type="radio" name="paytype"
+                     value="pp" /><!--CHECK_PP-->PayPal</label>
+     </td>
+   </tr>
+   <tr>
+     <td></td>
+     <td>
+       <label><input type="radio" name="paytype"
+                     value="se" /><!--CHECK_SE-->SEPA (European bank transfer)</label>
+     </td>
+   </tr>
+   <tr><td>&nbsp;</td></tr>
+   <tr>
+      <td></td>
+      <td>
+          If you want to be listed on the
+          <a href="/donate/kudos.html">list of donors</a>,
+          please enter your name as it shall appear there.
+      </td>
+    </tr>
+    <tr>
+      <td align="right"><label for="f_name">Name:</label></td>
+      <td>
+          <input id="f_name" type="text"
+                 size="40" style="width:200px" name="name"
+                 value=""/><!--NAME--> (optional)
+          <!--ERR_NAME-->
+      </td>
+    </tr>
+    <tr>
+      <td></td>
+      <td>
+          In case of payment problems we may want to contact you, thus please
+          enter your e-mail address.
+      </td>
+    </tr>
+    <tr>
+      <td align="right"><label for="f_mail">E-mail:</label></td>
+      <td>
+          <input id="f_mail" type="text" size="40" style="width:200px"
+                 name="mail"
+                 value=""/><!--MAIL--> (optional)
+           <!--ERR_MAIL-->
+      </td>
+    </tr>
+    <tr>
+      <td></td>
+      <td>
+          If you want to leave a message for us, please enter it here:
+      </td>
+    </tr>
+    <tr>
+      <td></td>
+      <td>
+          <textarea cols="40" rows="4" style="width:500px" name="message"
+                    ></textarea><!--MESSAGE-->
+      </td>
+    </tr>
+    <tr>
+      <td></td>
+      <td>
+        <div class="buttonbox">
+          <input type="submit" class="donate-button-low"
+                 value="Proceed to checkout" />
+         </div>
+      </td>
+    </tr>
+   </table>
+  </form>
+
+
+</body>
+</html>
+#+END_HTML
+
+# eof #
index fe13ab3..d34a02b 100644 (file)
 </head>
 <body>
 
+<blockquote>
+<p>
+Arguing that you don't care about the right to privacy
+because you have nothing to hide is no different from
+saying you don't care about free speech because you have
+nothing to say.   &ndash;&nbsp;Edward&nbsp;Snowden
+</p>
+</blockquote>
 
-  <!--ERRORPANEL-->
-
-  <form action="/cgi-bin/procdonate.cgi" method="post" class="inputpanel">
-   <input type="hidden" name="mode" value="main">
-   <p class="ii">Keep this field clear:
-                 <input type="text" size="40" name="url"></p>
-   <table border="0" cellpadding="0" cellspacing="4">
-    <tr>
-      <td></td>
-      <td>How much do you want to donate?<br/>
-          <span class="smallnote">(choosing “other” allows
-          to donate in other currencies)</span></td>
-    </tr>
-    <tr>
-      <td align="right">Amount:</td>
-      <td>
-          <label><input type="radio" name="amount" value="500"/>500 EUR</label>
-          <label><input type="radio" name="amount" value="200"/>200 EUR</label>
-          <label><input type="radio" name="amount" value="100"/>100 EUR</label>
-          <label><input type="radio" name="amount" value="50"/>50 EUR</label>
-          <label><input type="radio" name="amount" value="20"/>20 EUR</label>
-          <label><input type="radio" name="amount" value="5"/>5 EUR</label>
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td>
-          <input type="radio" name="amount"
-                              value="other"/><!--CHECKOTHER-->other:
-          <input type="text"  size="6" name="amountother"
-                              value=""/><!--AMOUNT-->
-          <select name="currency" size="1">
-            <option value="EUR" selected="selected"><!--SEL_EUR-->Euro</option>
-            <option value="USD" ><!--SEL_USD-->US Dollar</option>
-            <option value="GBP" ><!--SEL_GBP-->British Pound</option>
-            <option value="JPY" ><!--SEL_JPY-->Yen</option>
-          </select>
-          <!--ERR_AMOUNT-->
-      </td>
-    </tr>
-    <tr>
-      <td align="right">Recurring:</td>
-      <td>
-          <select name="recurring" size="1">
-            <option value="0"
-            selected="selected"><!--RECUR_NONE-->Just once</option>
-            <option value="12" ><!--RECUR_MONTH-->Monthly</option>
-            <option value="4" ><!--RECUR_QUARTER-->Quarterly</option>
-            <option value="1" ><!--RECUR_YEAR-->Yearly</option>
-          </select>
-      </td>
-    </tr>
-   <tr><td>&nbsp;</td></tr>
-    <tr>
-      <td align="right">Pay&nbsp;using:</td>
-      <td>
-        <label><input type="radio" name="paytype"
-                      value="cc" /><!--CHECK_CC-->Credit Card</label>
-        <!--ERR_PAYTYPE-->
-      </td>
-   </tr>
-   <tr>
-     <td></td>
-     <td>
-       <label><input type="radio" name="paytype"
-                     value="pp" /><!--CHECK_PP-->PayPal</label>
-     </td>
-   </tr>
-   <tr>
-     <td></td>
-     <td>
-       <label><input type="radio" name="paytype"
-                     value="se" /><!--CHECK_SE-->SEPA (European bank transfer)</label>
-     </td>
-   </tr>
-   <tr><td>&nbsp;</td></tr>
-   <tr>
-      <td></td>
-      <td>
-          If you want to be listed on the
-          <a href="/donate/kudos.html">list of donors</a>,
-          please enter your name as it shall appear there.
-      </td>
-    </tr>
-    <tr>
-      <td align="right"><label for="f_name">Name:</label></td>
-      <td>
-          <input id="f_name" type="text"
-                 size="40" style="width:200px" name="name"
-                 value=""/><!--NAME--> (optional)
-          <!--ERR_NAME-->
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td>
-          In case of payment problems we may want to contact you, thus please
-          enter your e-mail address.
-      </td>
-    </tr>
-    <tr>
-      <td align="right"><label for="f_mail">E-mail:</label></td>
-      <td>
-          <input id="f_mail" type="text" size="40" style="width:200px"
-                 name="mail"
-                 value=""/><!--MAIL--> (optional)
-           <!--ERR_MAIL-->
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td>
-          If you want to leave a message for us, please enter it here:
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td>
-          <textarea cols="40" rows="4" style="width:500px" name="message"
-                    ></textarea><!--MESSAGE-->
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td>
-        <div class="buttonbox">
-          <input type="submit" class="donate-button-low"
-                 value="Proceed to checkout" />
-         </div>
-      </td>
-    </tr>
-   </table>
-  </form>
-
+<p>
+Please <a href="/cgi-bin/procdonate.cgi">donate</a>".
+</p>
 
 <p>Recent donors</p>