You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2015/12/04 19:14:39 UTC
[whimsy.git] [1/50] Commit 74d7c7d: Start the migration to a new home for whimsy with a script that was created
Commit 74d7c7de71e424bb97ac68329b6679e947c910f7:
Start the migration to a new home for whimsy with a script that was created
today and the index for the site.
git-svn-id: https://svn.apache.org/repos/infra/infrastructure/trunk/projects/whimsy@818883 90ea9780-b833-de11-8433-001ec94261de
Branch: refs/heads/master
Author: Sam Ruby <ru...@apache.org>
Committer: Sam Ruby <ru...@apache.org>
Pusher: rubys <ru...@apache.org>
------------------------------------------------------------
www/index.html | +++++++++++++
www/treasurer/paypal.cgi | +++++++++
------------------------------------------------------------
158 changes: 158 additions, 0 deletions.
------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
new file mode 100644
index 0000000..c5e452f
--- /dev/null
+++ b/www/index.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Whimsy</title>
+</head>
+<body>
+<h1>Whimsy</h1>
+<ul>
+<li><a href="board/agenda/">Board Agenda</a></li>
+<li><a href="board/draft-minutes">Board Minutes -- draft</a></li>
+<li><a href="board/minutes/">Board Minutes Collated by PMC/officer/topic</a></li>
+<li><a href="roster/committer/">Email address lookup</a></li>
+<li><a href="fundraising/invoice/">Fundraising Invoice</a></li>
+<li><a href="incubator/moderators">Incubator moderators</a></li>
+<li><a href="incubator/podlings/by-age">Incubator podlings by age</a></li>
+<li><a href="members/subscriptions/">Member subscription cross-checks</a></li>
+<li><a href="members/watch/">Member watch</a></li>
+<li><a href="new-account-request-queue">New Account Requests Queue</a></li>
+<li><a href="board/subscriptions/">PMC-chair vs board subscriptions</a></li>
+<li><a href="roster/committee/">PMC Roster</a></li>
+<li><a href="voter/whatif">STV Explorer</a></li>
+</ul>
+<p><a href="https://issues.apache.org/jira/browse/INFRA/component/12318503">JIRA</a></p>
+</body>
+</html>
diff --git a/www/treasurer/paypal.cgi b/www/treasurer/paypal.cgi
new file mode 100755
index 0000000..3833777
--- /dev/null
+++ b/www/treasurer/paypal.cgi
@@ -0,0 +1,133 @@
+#!/usr/bin/ruby1.9.1
+require 'wunderbar'
+require 'csv'
+require '/var/tools/asf'
+
+user = ASF::Person.new($USER)
+unless user.asf_member? or ASF.pmc_chairs.include? user or $USER=='ea'
+ print "Status: 401 Unauthorized\r\n"
+ print "WWW-Authenticate: Basic realm=\"ASF Members and Officers\"\r\n\r\n"
+ exit
+end
+
+csv = CSV.open('/var/tools/paypal/Download.csv','r')
+headers = csv.take(1).flatten
+
+skip = [2,6,10,11,12,13,14,16]
+
+_html do
+ _head_ do
+ _title 'Paypal Donations'
+ _style %{
+ thead th {border-bottom: solid black}
+ tbody tr:hover {background-color: #FF8}
+ tfoot th {border-top: solid black}
+ table {border-spacing: 0.3em 0.2em }
+ .issue {background-color: yellow}
+ .large {background-color: #7FFF00}
+ }
+ end
+
+ _body? do
+ # common banner
+ _a href: 'https://id.apache.org/' do
+ _img alt: "Logo", src: "https://id.apache.org/img/asf_logo_wide.png"
+ end
+
+ _h1_ 'Paypal donations'
+
+ if ENV['PATH_INFO'] == '/'
+ pattern = :index
+ elsif ENV['PATH_INFO'] =~ /(\d{4})-0?(\d\d?)/
+ pattern = Regexp.new("#{$2}/..?/#{$1}")
+ else
+ pattern = /^$/
+ end
+
+ _table do
+ _thead_ do
+ _tr do
+ if pattern == :index
+ _th 'Month'
+ _th 'Balance'
+ _th 'Transactions'
+ else
+ headers.each_with_index do |header, index|
+ next if skip.include? index
+ _th header
+ end
+ end
+ end
+ end
+
+ month = '5'
+ entries = []
+ count = 0
+ old_balance = nil
+ _tbody do
+ csv.each do |transaction|
+ if pattern == :index
+ m,d,y = transaction[0].split('/')
+ if m != month
+ entries.last[-1] = count if not entries.empty?
+ entries << ["#{y}-#{m.rjust(2,'0')}", transaction[15], 0]
+ count = 0
+ month = m
+ end
+ count += 1
+ elsif pattern =~ transaction[0]
+ new_balance = (transaction[15].gsub(',','').to_f*100).round
+ old_balance ||= new_balance
+ amount = (transaction[9].gsub(',','').to_f*100).round
+
+ color = nil
+ color = 'large' if amount >= 200_00
+ color = 'issue' if new_balance != old_balance
+
+ _tr_ class: color do
+ transaction.each_with_index do |col, index|
+ next if skip.include? index
+ if index > 6 or index == 0
+ _td col, align: 'right'
+ else
+ _td col
+ end
+ end
+ end
+
+ next if transaction[4] == 'Web Accept Payment Received' and
+ transaction[5] == 'Cleared'
+ next if transaction[4] == 'Web Accept Payment Received' and
+ transaction[5] == 'Canceled'
+ next if transaction[4] == 'Cancelled Fee' and
+ transaction[5] == 'Completed'
+ next if transaction[4] == 'Update to eCheck Received' and
+ transaction[5] == 'Canceled'
+
+ old_balance = new_balance - amount
+ end
+ end
+
+ if pattern == :index
+ entries.last[-1] = count
+ entries.each do |month, balance, transactions|
+ _tr_ do
+ _td! {_a month, href: month}
+ _td balance, align: 'right'
+ _td transactions, align: 'right'
+ end
+ end
+ end
+ end
+
+ if pattern == :index
+ _tfoot_ do
+ _tr do
+ _th 'Total', colspan: 2, align: 'right'
+ _th entries.map(&:last).reduce(&:+), align: 'right'
+ end
+ end
+ end
+ end
+ end
+end