<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/notification/conference_invitation.text.plain.erb</filename>
    </added>
    <added>
      <filename>app/views/people/invite.html.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -80,7 +80,9 @@ class ApplicationController &lt; ActionController::Base
       @user.can_submit_proposals_now? and
         personal.add(_('My proposals'),
                      url_for(:controller=&gt;'/people', :action =&gt; 'proposals')) 
-        
+      @user.conferences.size &gt; 0 and
+        personal.add(_('Invite a friend'),
+                     url_for(:controller=&gt;'/people', :action =&gt; 'invite'))
 
       @menu.add(_('My account'),
                 url_for(:controller =&gt; '/people', :action =&gt; 'account'),</diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -169,6 +169,26 @@ class PeopleController &lt; ApplicationController
     end
   end
 
+  # Invite a friend (to a specific conference)
+  def invite
+    @my_confs = @user.upcoming_conferences
+    return true unless request.post?
+
+    begin
+      conf = Conference.find_by_id(params[:dest_conf_id])
+      Notification.deliver_conference_invitation(@user, params[:email], 
+                                                 conf, params[:body])
+    rescue ActiveRecord::RecordNotFound
+      flash[:error] &lt;&lt; _('Invalid conference requested')
+    rescue Notification::InvalidEmail
+      flash[:error] &lt;&lt; _('The specified e-mail address (%s) is not valid') %
+        params[:email]
+    end
+
+    flash[:notice] &lt;&lt; _('The requested e-mail was successfully sent')
+    redirect_to :action =&gt; 'account'
+  end
+
   ############################################################
   # Internal use...
   protected</diff>
      <filename>app/controllers/people_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 class Notification &lt; ActionMailer::Base
+  class InvalidEmail &lt; Exception; end
   def welcome(person)
     sys_name = SysConf.value_for('title_text')
     recipients person.name_and_email
@@ -47,4 +48,20 @@ class Notification &lt; ActionMailer::Base
                                :controller =&gt; 'people',
                                :action =&gt; 'login')
   end
+
+  def conference_invitation(sender, dest, conference, invitation_text)
+    dest =~ RFC822::EmailAddress or raise InvalidEmail
+
+    recipients dest
+    from SysConf.value_for('mail_from')
+    subject _('Invitation to %s, sent by %s') % [conference.name, sender.name]
+    body :conference =&gt; conference.name,
+         :sender_name =&gt; sender.name,
+         :sender_email =&gt; sender.email,
+         :conference_url =&gt; url_for(:only_path =&gt; false,
+                                    :controller =&gt; 'conferences',
+                                    :action =&gt; 'show',
+                                    :id =&gt; conference),
+         :invitation_text =&gt; invitation_text
+  end
 end</diff>
      <filename>app/models/notification.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6828c31198b9c8644394ce99db138933e5ad8961</id>
    </parent>
  </parents>
  <author>
    <name>Gunnar Wolf</name>
    <email>gwolf@gwolf.org</email>
  </author>
  <url>http://github.com/gwolf/comas/commit/e6411aafec4068eb418075d8c16bd360a4668570</url>
  <id>e6411aafec4068eb418075d8c16bd360a4668570</id>
  <committed-date>2009-02-23T17:52:16-08:00</committed-date>
  <authored-date>2009-02-23T17:52:16-08:00</authored-date>
  <message>Added a person invitation mail form</message>
  <tree>f5c585f913eb763467ece700f64fa061cc1c582a</tree>
  <committer>
    <name>Gunnar Wolf</name>
    <email>gwolf@gwolf.org</email>
  </committer>
</commit>
