[vhffs-dev] [913] localizes accepted and refused mails |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 913
Author: gradator
Date: 2007-09-11 08:09:17 +0000 (Tue, 11 Sep 2007)
Log Message:
-----------
localizes accepted and refused mails
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Object.pm
Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm 2007-09-11 07:43:14 UTC (rev 912)
+++ trunk/vhffs-api/src/Vhffs/Object.pm 2007-09-11 08:09:17 UTC (rev 913)
@@ -400,16 +400,21 @@
# Accept this object
sub moderate_accept
{
- use Vhffs::User;
-
my $self = shift;
my $vhffs = $self->{main};
- my $user = Vhffs::User::get_by_uid( $vhffs , $self->get_owner_uid );
+ my $user = $self->get_user;
$self->set_status( Vhffs::Constants::WAITING_FOR_CREATION );
$self->set_refuse_reason( '' );
+ # TODO: write a beautiful module for INTL
+ bindtextdomain('vhffs', $vhffs->get_config->get_intldir);
+ textdomain('vhffs');
+
+ my $prevlocale = setlocale( LC_ALL );
+ setlocale( LC_ALL , $user->get_lang );
+
my $mail = sprintf(
gettext( "Hello,\n\nYour request for a %s (%s) on %s was accepted.\nPlease wait while we are creating your object.\n\nCheers,\nThe moderator team\n\n---------\n%s\n%s" ) ,
Vhffs::Functions::type_string_from_type_id( $self->get_type ),
@@ -428,6 +433,8 @@
Vhffs::Functions::send_mail( $vhffs->get_config->get_moderator_mail , $user->get_mail , $vhffs->get_config->get_mailtag , $subject , $mail );
+ setlocale( LC_ALL , $prevlocale );
+
$user->set_note( $user->get_note +1 );
$user->commit;
@@ -438,17 +445,22 @@
# Refuse this object
sub moderate_refuse
{
- use Vhffs::User;
-
my $self = shift;
my $reason = shift;
my $vhffs = $self->{main};
- my $user = Vhffs::User::get_by_uid( $vhffs , $self->get_owner_uid );
+ my $user = $self->get_user;
$self->set_status( Vhffs::Constants::VALIDATION_REFUSED );
$self->set_refuse_reason( $reason );
+ # TODO: write a beautiful module for INTL
+ bindtextdomain('vhffs', $vhffs->get_config->get_intldir);
+ textdomain('vhffs');
+
+ my $prevlocale = setlocale( LC_ALL );
+ setlocale( LC_ALL , $user->get_lang );
+
my $mail = sprintf(
gettext( "Hello,\n\nYour request for a %s (%s) on %s was refused.\n\nThe reason of refusal given by moderators is:\n%s\n\nYou can change the description and submit it again for moderation on the\npanel. You can delete this object on the panel if you have made\na mistake. Don't be upset, if you don't understand why your request has\nbeen refused, just reply to this email !\n\nCheers,\nThe moderator team\n\n---------\n%s\n%s" ) ,
Vhffs::Functions::type_string_from_type_id( $self->get_type ),
@@ -468,6 +480,8 @@
Vhffs::Functions::send_mail( $vhffs->get_config->get_moderator_mail , $user->get_mail , $vhffs->get_config->get_mailtag , $subject , $mail );
+ setlocale( LC_ALL , $prevlocale );
+
$user->set_note( $user->get_note -1 );
$user->commit;