www/project/icla/views/actions/discuss.json.rb [1:59]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
require 'socket'
require 'net/http'
require 'pathname'
require 'json'
require 'mail'
require 'whimsy/lockfile'

# creates the discussion phase JSON file
# sends an email to the originator with the link

# Called from invite.js.rb POST
# expects the following variables to be set:
#  @pmc
#  @iclaemail
#  @iclaname
#  @proposalText
#  @discussComment
#  @proposer

# returns the following keys:
#  error
#  focus
#  token
#  userEmail
#  pmcEmail
#  subject
#  discussion
#  message

# find pmc and user information
# all ppmcs are also pmcs but not all pmcs are ppmcs

pmc = ASF::Committee.find(@pmc)
ppmc = ASF::Podling.find(@pmc)
pmc_type = if ppmc and ppmc.status == 'current' then 'PPMC' else 'PMC' end

user = ASF::Person.find(env.user)
user_email = user.id + '@apache.org'
subject = params['subject']

if ASF::Person.find_by_email(@iclaemail)
  _error "ICLA already on file for #{@iclaemail}"
  _focus :iclaemail
  return # cannot continue
end

begin
  Socket.getaddrinfo(@iclaemail[/@(.*)/, 1], 'smtp')

rescue
  _error 'Invalid domain name in email address'
  _focus :iclaemail
  return # cannot continue
end

# create the discussion object
timestamp = Time.now.utc.to_s
date = timestamp[0..9] # keep only the date
contributor = {:name => @iclaname, :email => @iclaemail}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



www/project/icla/views/actions/vote.json.rb [1:58]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
require 'socket'
require 'net/http'
require 'pathname'
require 'json'
require 'mail'
require 'whimsy/lockfile'

# creates the vote phase JSON file
# sends an email to the originator with the link

# Called from invite.js.rb POST
# expects the following variables to be set:
#  @pmc
#  @iclaemail
#  @iclaname
#  @proposalText
#  @voteComment
#  @proposer
#  @subject

# returns the following keys:
#  error
#  focus
#  userEmail
#  pmcEmail
#  token
#  subject
#  discussion
#  message

# find pmc and user information
# all ppmcs are also pmcs but not all pmcs are ppmcs

pmc = ASF::Committee.find(@pmc)
ppmc = ASF::Podling.find(@pmc)
pmc_type = if ppmc and ppmc.status == 'current' then 'PPMC' else 'PMC' end
user = ASF::Person.find(env.user)
user_email = user.id + '@apache.org'
subject = params['subject']

if ASF::Person.find_by_email(@iclaemail)
  _error "ICLA already on file for #{@iclaemail}"
  _focus :iclaemail
  return # cannot continue
end

begin
  Socket.getaddrinfo(@iclaemail[/@(.*)/, 1], 'smtp')
rescue
  _error 'Invalid domain name in email address'
  _focus :iclaemail
  return # cannot continue
end

# create the vote object
timestamp = Time.now.utc.to_s # need HMS in order to calculate accurate elapsed times
date = timestamp[0..9] # keep only the date
contributor = {:name => @iclaname, :email => @iclaemail}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



