This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new aacc3d50 Belongs with officer reports
aacc3d50 is described below
commit aacc3d50f4691ee1aacfc3b5f1dff46605c2c7e3
Author: Sebb <[email protected]>
AuthorDate: Wed Oct 23 23:52:44 2024 +0100
Belongs with officer reports
---
www/board/subscriptioncheck.cgi | 160 +-------------------------
www/officers/calendar.cgi | 105 +++++++++++++++++
www/{board => officers}/subscriptioncheck.cgi | 7 ++
3 files changed, 116 insertions(+), 156 deletions(-)
diff --git a/www/board/subscriptioncheck.cgi b/www/board/subscriptioncheck.cgi
index 7f498680..2c29d0d4 100755
--- a/www/board/subscriptioncheck.cgi
+++ b/www/board/subscriptioncheck.cgi
@@ -1,158 +1,6 @@
#!/usr/bin/env ruby
-PAGETITLE = "Member-only private list checks" # Wvisible:board,mail
-$LOAD_PATH.unshift '/srv/whimsy/lib'
-require 'wunderbar'
-require 'wunderbar/bootstrap'
-require 'whimsy/asf'
-require 'whimsy/asf/mlist'
-
-DEFAULT_LISTS =
'board,markpub,members,members-announce,members-notify,operations,press,trademarks,[email protected]'
-listnames = ENV['QUERY_STRING']
-listnames = DEFAULT_LISTS if listnames == ''
-
-info_chairs = ASF::Committee.load_committee_info.group_by(&:chair)
-ldap_chairs = ASF.pmc_chairs
-
-member_statuses = ASF::Member.member_statuses
-
-_html do
- _body? do
- _whimsy_body(
- title: PAGETITLE,
- subtitle: 'How Subscribers Are Checked',
- relatedtitle: 'More Useful Links',
- related: {
- "/committers/tools" => "Whimsy Tool Listing",
- "/committers/subscribe" => "Committer Self-subscribe Tool",
- "/committers/moderationhelper" => "Mail List Moderation Helper",
-
"https://github.com/apache/whimsy/blob/master/www#{ENV['SCRIPT_NAME']}" => "See
This Source Code"
- },
- helpblock: -> {
- _h2 'DRAFT - may not be 100% accurate'
- _p! do
- _ "This script takes a list of subscribers to a list"
- _ ' which are matched against '
- _a 'members.txt', href: ASF::SVN.svnpath!('foundation',
'members.txt')
- _ ', '
- _a 'iclas.txt', href: ASF::SVN.svnpath!('officers', 'iclas.txt')
- _ ', and '
- _code 'ldapsearch mail'
- _ ' to match each email address to an Apache ID. '
- _br
- _ 'Those that are not found are listed as '
- _code.text_danger '*missing*'
- _ '. Non ASF member, non-committee chairs are also '
- _span.text_danger 'listed in red'
- _ '.'
- end
- _p! do
- _ 'The resulting list is then cross-checked against '
- _a 'committee-info.text', href: ASF::SVN.svnpath!('board',
'committee-info.txt')
- _ ' and '
- _code 'ldapsearch cn=pmc-chairs'
- _ '. Membership that is only listed in one of these two sources is '
- _span.text_danger 'listed in red'
- _ '.'
- end
- _p %q(
- If you want to check a particular list, append it to the URL, e.g.
subscriptioncheck?listname
- )
- _p %q(
- If the domain is not included, it is assumed to be @apache.org
- )
- _p do
- _ 'The default list is:'
- _ DEFAULT_LISTS
- end
- }
- ) do
- _p "Checking: #{listnames}"
- listnames.split(',') do |entry|
- listname,domain = entry.split('@')
- domain ||= 'apache.org'
- listid = listname + '@' + domain
- subscribers, modtime = ASF::MLIST.sub_digest(domain, listname)
- ids = []
- if subscribers.nil?
- _h2 "Could not find mailing list #{listid}"
- else
- _h2 do
- _ "Mailing list"
- _a listid, href: "https://lists.apache.org/list.html?#{listid}"
- _ "(updated #{modtime})"
- end
- maillist = ASF::Mail.list
- subscribers.each do |line|
- person = maillist[line.downcase]
- person ||= maillist[line.downcase.sub(/\+\w+@/,'@')]
- if person
- id = person.id
- id = '*notinavail*' if id == 'notinavail'
- else
- person = ASF::Person.find('notinavail')
- id = '*missing*'
- end
- ids << [id, person, line]
- end
- end
-
- _table_.table do
- _thead do
- _th 'ID'
- _th 'Email'
- _th 'Name'
- _th 'Committee'
- end
- _tbody do
- ids.sort.each do |id, person, email|
- status = member_statuses[person.name]
- next if status
- next if info_chairs.include? person or ldap_chairs.include? person
- _tr_ do
- href = "/roster/committer/#{id}"
- if id.include? '*'
- _td.text_danger id
- else
- _td.text_danger {_a id, href: href}
- end
- _td email
-
- if not id.include? '*'
- _td person.public_name
- else
- icla = ASF::ICLA.find_by_email(id)
- if icla
- _td.text_danger icla.name
- else
- _td.text_danger '*notinavail*'
- end
- end
-
- if info_chairs.include? person
- text = info_chairs[person].uniq.map(&:display_name).join(', ')
- if ldap_chairs.include? person or info_chairs[person].all?
&:nonpmc?
- _td text
- else
- _td.text_danger text
- end
- elsif member_statuses[person.name]
- _td
- elsif ldap_chairs.include? person
- _td.text_danger '***LDAP only***'
- else
- pmcs = person.project_owners.map(&:name)
- if pmcs.length == 0
- _td.text_danger '*** non-member, non-officer, non-pmc ***'
- else
- _td.text_warning "*** non-member, non-officer, pmcs:
#{pmcs.join ','} ***"
- end
- end
- end
- end
- end
- end
- end
- end
- end
-end
+print "Status: 301 Moved Permanently\r\n"
+print "Location: ../officers/subscriptioncheck.cgi\r\n"
+print "\r\n"
+exit
diff --git a/www/officers/calendar.cgi b/www/officers/calendar.cgi
new file mode 100755
index 00000000..7d1a40e6
--- /dev/null
+++ b/www/officers/calendar.cgi
@@ -0,0 +1,105 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift '/srv/whimsy/lib'
+require 'whimsy/asf'
+require 'wunderbar/bootstrap'
+require 'active_support/time'
+require 'date'
+
+calendar = IO.read("#{ASF::SVN['board']}/calendar.txt")
+pattern = /\s*\*\) (.*),/
+
+zones = [
+ TZInfo::Timezone.get('America/Los_Angeles'),
+ TZInfo::Timezone.get('America/New_York'),
+ TZInfo::Timezone.get('Europe/Brussels'),
+ TZInfo::Timezone.get('Asia/Kuala_Lumpur'),
+ TZInfo::Timezone.get('Australia/Sydney')
+]
+
+
+prev = {}
+
+if CGI.new.params['format'] == ['txt']
+ _text do
+ @time ||= '21:30'
+ @zone ||= 'UTC'
+ base = TZInfo::Timezone.get(@zone)
+ rotate = (@rotate || 0).to_i
+
+ calendar.scan(pattern).flatten.each_with_index do |date, index|
+ date = Date.parse(date)
+ next if date <= Date.today
+ time = base.local_to_utc(Time.parse("#{date}T#{@time}"))
+ @time = (base.utc_to_local(time) + rotate.hour).strftime("%H:%M")
+ _ '' unless index == 0
+ _ time.strftime("*) %a, %d %B %Y, %H:%M UTC")
+ end
+ end
+ exit
+end
+
+_html do
+ @time ||= '21:30'
+ @zone ||= 'UTC'
+ base = TZInfo::Timezone.get(@zone)
+ rotate = (@rotate || 0).to_i
+
+ _h2 'Proposed board meeting times'
+
+ _p %{
+ Future meeting times, presuming that the time of the meeting is
+ set to #{@time} #{@zone}, rotating each meeting time by #{rotate} hours.
+ }
+
+ if rotate == 0
+ _p.bg_danger %{
+ This background color indicate a local time change from the previous
+ month.
+ }
+ end
+
+ _table.table do
+ _thead do
+ _tr do
+ _th
+ _th 'UTC'
+ _th 'Los Angeles'
+ _th 'New York'
+ _th 'Brussels'
+ _th 'Kuala Lumpur'
+ _th 'Sydney'
+ end
+ end
+
+ _tbody calendar.scan(pattern).flatten do |date|
+ date = Date.parse(date)
+ next if date <= Date.today
+
+ time = base.local_to_utc(Time.parse("#{date}T#{@time}"))
+ @time = (base.utc_to_local(time) + rotate.hour).strftime("%H:%M")
+ timeurl = 'https://www.timeanddate.com/worldclock/fixedtime.html?iso='
+
+ _tr do
+ _td date
+ _td do
+ _a time.strftime('%H:%M'), href: "#{timeurl}#{time.iso8601}"
+ end
+
+ zones.each do |zone|
+ if zone.to_s.include? 'Asia' or zone.to_s.include? 'Europe'
+ local = time.in_time_zone(zone).strftime("%H:%M")
+ else
+ local = time.in_time_zone(zone).strftime("%-I:%M%P")
+ end
+
+ if prev[zone] != local and prev[zone] and rotate == 0
+ _td.bg_danger local
+ else
+ _td local
+ end
+ prev[zone] = local
+ end
+ end
+ end
+ end
+end
diff --git a/www/board/subscriptioncheck.cgi
b/www/officers/subscriptioncheck.cgi
similarity index 96%
copy from www/board/subscriptioncheck.cgi
copy to www/officers/subscriptioncheck.cgi
index 7f498680..684b1183 100755
--- a/www/board/subscriptioncheck.cgi
+++ b/www/officers/subscriptioncheck.cgi
@@ -7,6 +7,13 @@ require 'wunderbar/bootstrap'
require 'whimsy/asf'
require 'whimsy/asf/mlist'
+user = ASF::Person.new($USER)
+unless user.asf_chair_or_member?
+ print "Status: 401 Unauthorized\r\n"
+ print "WWW-Authenticate: Basic realm=\"ASF Members and Officers\"\r\n\r\n"
+ exit
+end
+
DEFAULT_LISTS =
'board,markpub,members,members-announce,members-notify,operations,press,trademarks,[email protected]'
listnames = ENV['QUERY_STRING']
listnames = DEFAULT_LISTS if listnames == ''