Commit e3182997 authored by sikeda's avatar sikeda
Browse files

[-dev] (r10623) Kill unneccessary dependencies on Sympa::Language.

ToDo: Formatting Unix time values as native date would be done in templates on demand.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@10628 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 3d7447a7
......@@ -34,7 +34,6 @@ use Commands;
use Conf;
use Auth;
use SympaSession;
use Language;
use Log;
use mail;
use MIME::QuotedPrint;
......
......@@ -40,7 +40,6 @@ use List;
use mail;
use Conf;
use Log;
use Language;
use sympasoap;
## WWSympa librairies
......
......@@ -43,7 +43,6 @@ my @EXPORT = ();
use Conf;
use Log;
use Auth;
use Language;
## Define types of SOAP type listType
my %types = ('listType' => {'listAddress' => 'string',
......
......@@ -37,18 +37,19 @@ package Family;
use strict;
use Term::ProgressBar;
use XML::LibXML;
use List;
use Conf;
use Language;
use Sympa::Language;
use Log;
use admin;
use Config_XML;
use File::Copy;
use Sympa::Constants;
use Term::ProgressBar;
my $language = Sympa::Language->instance;
my %list_of_families;
my @uncompellable_param = ('msg_topic.keywords','owner_include.source_parameters', 'editor_include.source_parameters');
......@@ -394,7 +395,9 @@ sub add_list {
# info parameters
$list->{'admin'}{'latest_instantiation'}{'email'} = "listmaster\@$host";
$list->{'admin'}{'latest_instantiation'}{'date'} = gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$list->{'admin'}{'latest_instantiation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'latest_instantiation'}{'date_epoch'} = time;
$list->save_config("listmaster\@$host");
$list->{'family'} = $self;
......@@ -671,7 +674,9 @@ sub modify_list {
my $host = &Conf::get_robot_conf($self->{'robot'}, 'host');
$list->{'admin'}{'latest_instantiation'}{'email'} = "listmaster\@$host";
$list->{'admin'}{'latest_instantiation'}{'date'} = gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$list->{'admin'}{'latest_instantiation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'latest_instantiation'}{'date_epoch'} = time;
$list->save_config("listmaster\@$host");
$list->{'family'} = $self;
......@@ -2640,7 +2645,9 @@ sub _end_update_list {
my $host = &Conf::get_robot_conf($self->{'robot'}, 'host');
$list->{'admin'}{'latest_instantiation'}{'email'} = "listmaster\@$host";
$list->{'admin'}{'latest_instantiation'}{'date'} = gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$list->{'admin'}{'latest_instantiation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'latest_instantiation'}{'date_epoch'} = time;
$list->save_config("listmaster\@$host");
$list->{'family'} = $self;
......
......@@ -39,13 +39,15 @@ use strict;
use List;
use Conf;
use Language;
use Sympa::Language;
use Log;
use tools;
use Sympa::Constants;
use File::Copy;
use Data::Dumper;
my $language = Sympa::Language->instance;
=pod
=head1 SUBFUNCTIONS
......@@ -114,8 +116,6 @@ Creates a list. Used by the create_list() sub in sympa.pl and the do_create_list
=item * Conf::get_robot_conf
=item * Language::gettext_strftime
=item * List::create_shared
=item * List::has_include_data_sources
......@@ -270,7 +270,9 @@ sub create_list_old{
## Creation of the config file
my $host = &Conf::get_robot_conf($robot, 'host');
$param->{'creation'}{'date'} = gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$param->{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$param->{'creation'}{'date_epoch'} = time;
$param->{'creation_email'} = "listmaster\@$host" unless ($param->{'creation_email'});
$param->{'status'} = 'open' unless ($param->{'status'});
......@@ -533,7 +535,9 @@ sub create_list{
$list->create_shared();
}
$list->{'admin'}{'creation'}{'date'} = gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'creation'}{'date_epoch'} = time;
if ($param->{'creation_email'}) {
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'};
......@@ -627,8 +631,10 @@ sub update_list{
&Log::do_log('err','admin::create_list : unable to create list %s', $param->{'listname'});
return undef;
}
############## ? update
$list->{'admin'}{'creation'}{'date'} = gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'creation'}{'date_epoch'} = time;
if ($param->{'creation_email'}) {
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'};
......@@ -1015,7 +1021,9 @@ sub clone_list_as_empty {
$new_list->{'admin'}{'serial'} = 0 ;
$new_list->{'admin'}{'creation'}{'email'} = $email if ($email);
$new_list->{'admin'}{'creation'}{'date_epoch'} = time;
$new_list->{'admin'}{'creation'}{'date'} = gettext_strftime("%d %b %y at %H:%M:%S", localtime time);
##FIXME:should be unneccessary
$new_list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %y at %H:%M:%S", localtime time);
$new_list->save_config($email);
return $new_list;
}
......
......@@ -26,7 +26,6 @@ package report;
use strict;
use Language;
use Log;
use List;
......@@ -105,7 +104,7 @@ sub reject_report_msg {
chomp($param->{'msg_id'});
$param ||= {};
$param->{'error'} = &gettext($error);
$param->{'error'} = $error;
$param->{'who'} = $user;
$param->{'action'} = 'message diffusion';
$param->{'msg_id'} = $param->{'msg_id'};
......@@ -381,7 +380,7 @@ sub global_report_cmd {
if ($robot){
my $param = $data;
$param ||= {};
$param->{'error'} = &gettext($error);
$param->{'error'} = $error;
$param->{'who'} = $sender;
$param->{'action'} = 'Command process';
......@@ -456,7 +455,7 @@ sub reject_report_cmd {
my $param = $data;
$param ||= {};
$param->{'error'} = &gettext($error);
$param->{'error'} = $error;
$param->{'cmd'} = $cmd;
$param->{'listname'} = $listname;
$param->{'who'} = $sender;
......@@ -749,9 +748,8 @@ sub reject_report_web {
## Notify listmaster for internal or system errors
if ($type eq 'intern'|| $type eq 'system') {
if ($robot){
my $param = $data;
$param ||= {};
$param->{'error'} = &gettext($error);
my $param = $data || {};
$param->{'error'} = $error;
$param->{'list'} = $list if (defined $list);
$param->{'who'} = $user;
$param->{'action'} ||= 'Command process';
......
......@@ -3,7 +3,7 @@
<tr> <th>[%|loc%]last hit date[%END%]</th><th>[%|loc%]start date[%END%]</th><th>[%|loc%]hit count[%END%]</th><th>[%|loc%]remote address[%END%]</th><th>[%|loc%]robot[%END%]</th><th>[%|loc%]User email[%END%]</th></tr>
[% FOREACH session = sessions %]
[% IF dark == '1' %]<tr>[% SET dark = '0' %][% ELSE %]<tr class="color0">[% SET dark = '1' %][% END %]
<td>[% session.formated_date %]</td><td>[% session.formated_start_date %]</td><td>[% session.hit_session %]</td><td>[% session.remote_addr_session %]</td><td>[% session.robot_session %]</td><td>[% session.email_session %]</td>
<td>[% session.date %]</td><td>[% session.start_date %]</td><td>[% session.hit_session %]</td><td>[% session.remote_addr_session %]</td><td>[% session.robot_session %]</td><td>[% session.email_session %]</td>
</tr>
[% END %]
</table>
......
......@@ -24,8 +24,8 @@
package Auth;
use Digest::MD5;
use POSIX qw();
use Language;
use Log;
use Conf;
use List;
......@@ -433,7 +433,9 @@ sub get_one_time_ticket {
}
my $result;
my $printable_date = gettext_strftime("%d %b %Y at %H:%M:%S", localtime($ticket->{'date'}));
my $printable_date = POSIX::strftime(
"%d %b %Y at %H:%M:%S", localtime($ticket->{'date'})
);
if ($ticket->{'status'} ne 'open') {
$result = 'closed';
......
......@@ -28,7 +28,6 @@ use strict;
use Carp;
use Language;
use Log;
use tools;
......@@ -87,7 +86,6 @@ sub new {
## Date
my @info = stat $document->{'absolute_path'};
$document->{'date'} = gettext_strftime("%d %b %Y", localtime $info[9]);
$document->{'date_epoch'} = $info[9];
# Size of the doc
......
......@@ -30,6 +30,7 @@ use POSIX;
use CGI::Cookie;
use Time::Local;
use Sympa::Language;
use Log;
use Conf;
......@@ -566,7 +567,8 @@ sub list_sessions {
my $statement = sprintf
q{SELECT remote_addr_session, email_session, robot_session,
date_session, start_date_session, hit_session
date_session AS date_epoch,
start_date_session AS start_date_epoch, hit_session
FROM session_table
WHERE %s},
$condition;
......@@ -578,10 +580,6 @@ sub list_sessions {
}
while (my $session = ($sth->fetchrow_hashref('NAME_lc'))) {
$session->{'formated_date'} = Language::gettext_strftime("%d %b %Y at %H:%M:%S", localtime($session->{'date_session'}));
$session->{'formated_start_date'} = Language::gettext_strftime("%d %b %Y at %H:%M:%S", localtime($session->{'start_date_session'}));
push @sessions, $session;
}
......
......@@ -5879,7 +5879,19 @@ sub do_show_sessions {
 
$in{'session_delay'} = 10 unless ($in{'session_delay'});
my $delay = 60 * $in{'session_delay'};
$param->{'sessions'} = &SympaSession::list_sessions($delay,$robot,$in{'connected_only'});
my $sessions =
SympaSession::list_sessions($delay, $robot, $in{'connected_only'});
foreach my $session (@$sessions) {
$session->{'date'} = $language->gettext_strftime(
"%d %b %Y at %H:%M:%S", localtime($session->{'date_epoch'}));
$session->{'start_date'} = $language->gettext_strftime(
"%d %b %Y at %H:%M:%S",
localtime($session->{'start_date_epoch'}));
# Compatibility for misspelling.
$session->{'formated_date'} = $session->{'date'};
$session->{'formated_start_date'} = $session->{'start_date'}
}
$param->{'sessions'} = $sessions;
return '1';
}
 
......@@ -17766,7 +17778,8 @@ sub new_d_read {
my $ref_access = $document->{'access'}; my %access = %{$ref_access};
$param->{'doc_owner'} = $document->{'owner'};
$param->{'doc_title'} = $document->{'title'};
$param->{'doc_date'} = $document->{'date'};
$param->{'doc_date'} = $language->gettext_strftime("%d %b %Y",
localtime $document->{'date_epoch'});
 
### Access control
unless ($access{'may'}{'read'}) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment