/[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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1151  
changed lines
  Added in v.1152

  ViewVC Help
Powered by ViewVC 1.1.26