Send notifications and add localizations

master
Daniel Berteaud 11 years ago
parent 1effe36d96
commit ceb3690e97
  1. 7
      lib/Vroom/I18N/en.pm
  2. 7
      lib/Vroom/I18N/fr.pm
  3. 26
      public/vroom.pl
  4. 26
      templates/default/notification.email_html.ep
  5. 13
      templates/default/notification.email_text.ep

@ -82,6 +82,13 @@ our %Lexicon = (
"OWNER_PASSWORD_MAKES_PERSISTENT" => "You can set a manager password. It will make this room persistent", "OWNER_PASSWORD_MAKES_PERSISTENT" => "You can set a manager password. It will make this room persistent",
"OWNER_PASSWORD" => "Manager password", "OWNER_PASSWORD" => "Manager password",
"REMOVE_OWNER_PASSWORD" => "Remove the manager password. The room will become ephemeral", "REMOVE_OWNER_PASSWORD" => "Remove the manager password. The room will become ephemeral",
"ADD_NOTIFICATION" => "Add a notification",
"ADD_THIS_ADDRESS" => "Add this address",
"NOTIFICATION_ON_JOIN" => "You can set a list of email address which will receive a notification each time someone joins this room",
"s_WILL_BE_NOTIFIED" => "%s will receive a notification each time someone joins this room",
"s_WONT_BE_NOTIFIED_ANYMORE" => "%s won't be notified anymore",
"JOIN_NOTIFICATION" => "Someone joined the room",
"SOMEONE_JOINED_A_ROOM" => "Someone joined a vodeo conference room, and your address is configured to receive this notifications",
"AUTH_SUCCESS" => "You are now authenticated", "AUTH_SUCCESS" => "You are now authenticated",
"NOT_ALLOWED" => "You are not allowed to do this", "NOT_ALLOWED" => "You are not allowed to do this",
"WRONG_PASSWORD" => "Wrong password", "WRONG_PASSWORD" => "Wrong password",

@ -88,6 +88,13 @@ our %Lexicon = (
"OWNER_PASSWORD_MAKES_PERSISTENT" => "Vous pouvez ajouter un mot de passe de gestionnaire. Ceci rendra le salon persistant", "OWNER_PASSWORD_MAKES_PERSISTENT" => "Vous pouvez ajouter un mot de passe de gestionnaire. Ceci rendra le salon persistant",
"OWNER_PASSWORD" => "Mot de passe du gestionnaire", "OWNER_PASSWORD" => "Mot de passe du gestionnaire",
"REMOVE_OWNER_PASSWORD" => "Supprimer le mot de passe du gestionnaire. Le salon redeviendra éphémère", "REMOVE_OWNER_PASSWORD" => "Supprimer le mot de passe du gestionnaire. Le salon redeviendra éphémère",
"ADD_NOTIFICATION" => "Ajouter une notification",
"ADD_THIS_ADDRESS" => "Ajouter cette adresse",
"NOTIFICATION_ON_JOIN" => "Vous pouvez ajouter des adresses email qui recevront une notification dès que quelqu'un rejoint ce salon",
"s_WILL_BE_NOTIFIED" => "%s recevra une notification à chaque fois qu'une personne rejoint ce salon",
"s_WONT_BE_NOTIFIED_ANYMORE" => "%s ne recevra plus les notifications pour ce salon",
"JOIN_NOTIFICATION" => "Quelqu'un a rejoint votre salon",
"SOMEONE_JOINED_A_ROOM" => "Quelqu'un a rejoint un salon de vidéo conférence, et votre adresse est configurée pour recevoir ces notifications",
"AUTH_SUCCESS" => "Vous êtes maintenant authentifié", "AUTH_SUCCESS" => "Vous êtes maintenant authentifié",
"NOT_ALLOWED" => "Vous n'êtes pas autorisé à faire ceci", "NOT_ALLOWED" => "Vous n'êtes pas autorisé à faire ceci",
"WRONG_PASSWORD" => "Mauvais mot de passe", "WRONG_PASSWORD" => "Mauvais mot de passe",

@ -597,8 +597,22 @@ get '/(*room)' => sub {
room => $room room => $room
); );
} }
# Send notifications
foreach my $rcpt ($self->get_notification($room)){
$self->email(
header => [
Subject => encode("MIME-Header", $self->l("JOIN_NOTIFICATION")),
To => $rcpt
],
data => [
template => 'notification',
room => $room,
],
);
}
# Now display the room page # Now display the room page
$self->render('join', $self->render('join',
format => 'html',
turnPassword => $data->{token} turnPassword => $data->{token}
); );
}; };
@ -805,24 +819,24 @@ post '/action' => sub {
my $email = $self->param('email'); my $email = $self->param('email');
my $type = $self->param('type'); my $type = $self->param('type');
my $status = 'error'; my $status = 'error';
my $msg = 'ERROR_OCCURED'; my $msg = $self->l('ERROR_OCCURED');
if ($self->session($room)->{role} ne 'owner'){ if ($self->session($room)->{role} ne 'owner'){
$msg = 'NOT_ALLOWED'; $msg = $self->l('NOT_ALLOWED');
} }
elsif ($email !~ m/^\S+@\S+\.\S+$/){ elsif ($email !~ m/^\S+@\S+\.\S+$/){
$msg = 'ERROR_MAIL_INVALID'; $msg = $self->l('ERROR_MAIL_INVALID');
} }
elsif ($type eq 'add' && $self->add_notification($room,$email)){ elsif ($type eq 'add' && $self->add_notification($room,$email)){
$status = 'success'; $status = 'success';
$msg = 's_WILL_BE_NOTIFIED'; $msg = sprintf($self->l('s_WILL_BE_NOTIFIED'), $email);
} }
elsif ($type eq 'remove' && $self->remove_notification($room,$email)){ elsif ($type eq 'remove' && $self->remove_notification($room,$email)){
$status = 'success'; $status = 'success';
$msg = 's_WONT_BE_NOTIFIED_ANYMORE'; $msg = sprintf($self->l('s_WONT_BE_NOTIFIED_ANYMORE'), $email);
} }
return $self->render( return $self->render(
json => { json => {
msg => $self->l($msg), msg => $msg,
status => $status status => $status
} }
); );

@ -0,0 +1,26 @@
<%
my $url = $self->url_for('/')->to_abs;
$url .= ($url =~ m/\/$/) ? '' : '/';
%>
<p>
<%=l 'SOMEONE_JOINED_A_ROOM' %>
</p>
<p>
<%=l 'WHEN_YOU_ARE_READY' %>
<center>
<h1>
<a href="<%= $url . $room %>">
<%= $url . $room %>
</a>
</h1>
</center>
</p>
<br>
<p>
<%=l 'HAVE_A_NICE_MEETING' %>
</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">
&mdash;
<br>
<%=l 'EMAIL_SIGN' %>
</p>

@ -0,0 +1,13 @@
<%
my $url = $self->url_for('/')->to_abs;
$url .= ($url =~ m/\/$/) ? '' : '/';
%>
<%==l 'SOMEONE_JOINED_A_ROOM' %>
<%=l 'WHEN_YOU_ARE_READY' %>
<%== $url . $room %>
<%=l 'HAVE_A_NICE_MEETING' %>
--
<%==l 'EMAIL_SIGN' %>
Loading…
Cancel
Save