/[Frey]/trunk/lib/App/RoomReservation/Messages.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/App/RoomReservation/Messages.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1153 - (show annotations)
Wed Jul 1 22:39:34 2009 UTC (14 years, 9 months ago) by dpavlin
File size: 1834 byte(s)
fix typo errors
1 package App::RoomReservation::Messages;
2 use Moose::Role;
3
4 sub seat_confirmation_message {
5 my ( $self, $col, $value ) = @_;
6
7 die "wrong column name $col = $value" unless $col =~ m{^(token|email)$};
8
9 $col =~ s{token}{md5(id||email)};
10
11 my $sth = $self->dbh->prepare(qq{
12 select
13 ime||' '||prezime,
14 _seat_number,
15 email,
16 md5(id||email) as token,
17 _confirmed
18 from reservation
19 where
20 $col = ?
21 });
22
23 $sth->execute( $value );
24
25 die "can't find user $col = $value" if $sth->rows == 0;
26
27 my ( $name, $seat, $email, $token, $confirmed ) = $sth->fetchrow_array;
28
29 if ( $confirmed ) {
30
31 my $url = $self->url_for( 'Confirmation/cancel_as_markup?token=' . $token );
32
33 my $html =
34 qq|
35 $name, <em>reservation has been confirmed</em>
36 |
37 . ( $seat
38 ? qq|
39 and seat number <big>$seat</big> is waiting for you.
40 <br>
41 Please print this notice and show it when entering lecture.
42 | : qq|
43 we <big>currently don't have any seats available</big>,
44 but you will be notified if we get some vacancies for this lecture!
45 | )
46 ;
47
48 $self->send( $email,
49 "Lecture confirmation" . $seat ? " [seat $seat]" : " [wating for vacancy]",
50 $html . <<__EMAIL__
51
52 If you wish to cancel your reservation please click on link below:
53
54 $url
55
56 __EMAIL__
57 );
58
59 return $html;
60
61 } else { # not verified
62
63 my $url = $self->url_for( 'Confirmation/verify_as_markup?token=' . $token );
64
65 $self->send( $self->email,
66 'Confirm your reservation for lecture', <<__EMAIL__
67
68 Please click following link to confirm your reservation for lecture
69 and get seat assigned to you.
70
71 $url
72
73 __EMAIL__
74 );
75
76 return qq|
77
78 $name we have accepted your registration!
79
80 <div style="color:red">
81 You have to confirm your e-mail address and registration
82 by clicking on link which should be in your e-mail INBOX shortly
83 </div>
84 |;
85
86 }
87
88 }
89
90 1;

  ViewVC Help
Powered by ViewVC 1.1.26