Commit f542487d authored by sikeda's avatar sikeda
Browse files

[-dev] Use Sympa::get_url() to generate some list URLs.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12724 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent b38b9b04
......@@ -9599,12 +9599,8 @@ sub add_list_header {
} elsif ($field eq 'archive') {
if (Conf::get_robot_conf($robot, 'wwsympa_url')
and $self->is_web_archived()) {
$message->add_header(
'List-Archive',
sprintf('<%s/arc/%s>',
Conf::get_robot_conf($robot, 'wwsympa_url'),
Sympa::Tools::Text::encode_uri($self->{'name'}))
);
$message->add_header('List-Archive',
sprintf('<%s>', Sympa::get_url($self, 'arc')));
} else {
return 0;
}
......@@ -9619,13 +9615,16 @@ sub add_list_header {
my @now = localtime(time);
my $yyyy = sprintf '%04d', 1900 + $now[5];
my $mm = sprintf '%02d', $now[4] + 1;
my $archived_msg_url =
sprintf '%s/arcsearch_id/%s/%s-%s/%s',
Conf::get_robot_conf($robot, 'wwsympa_url'),
Sympa::Tools::Text::encode_uri($self->{'name'}), $yyyy, $mm,
Sympa::Tools::Text::encode_uri($message_id);
$message->add_header('Archived-At',
sprintf('<%s>', $archived_msg_url));
$message->add_header(
'Archived-At',
sprintf(
'<%s>',
Sympa::get_url(
$self, 'arcsearch_id',
paths => ["$yyyy-$mm", $message_id]
)
)
);
} else {
return 0;
}
......
......@@ -1857,18 +1857,17 @@ sub _urlize_parts {
## Clean up Message-ID
my $dir1 = Sympa::Tools::Text::escape_chars($message_id);
$dir1 = '/' . $dir1;
#XXX$dir1 = '/' . $dir1;
unless (mkdir "$expl/$dir1", 0775) {
$log->syslog('err', 'Unable to create urlized directory %s/%s',
$expl, $dir1);
return 0;
}
my $wwsympa_url = Conf::get_robot_conf($list->{'domain'}, 'wwsympa_url');
my @parts = ();
my $i = 0;
my @parts = ();
my $i = 0;
foreach my $part ($entity->parts) {
my $p = _urlize_one_part($part->dup, $list, $dir1, $i, $wwsympa_url);
my $p = _urlize_one_part($part->dup, $list, $dir1, $i);
if (defined $p) {
push @parts, $p;
$i++;
......@@ -1885,11 +1884,10 @@ sub _urlize_parts {
}
sub _urlize_one_part {
my $entity = shift;
my $list = shift;
my $dir = shift;
my $i = shift;
my $wwsympa_url = shift;
my $entity = shift;
my $list = shift;
my $dir = shift;
my $i = shift;
my $expl = $list->{'dir'} . '/urlized';
my $listname = $list->{'name'};
......@@ -1942,9 +1940,9 @@ sub _urlize_one_part {
}
(my $file_name = $filename) =~ s/\./\_/g;
# do NOT escape '/' chars
my $file_url = "$wwsympa_url/attach/$listname"
. Sympa::Tools::Text::escape_chars("$dir/$filename", '/');
# Do NOT escape '/' chars separating path components.
my $file_url = Sympa::get_url($list, 'attach',
paths => [$dir, Sympa::Tools::Text::escape_chars($filename)]);
my $parser = MIME::Parser->new;
$parser->output_to_core(1);
......
......@@ -97,8 +97,7 @@ sub _twist {
$data->{'available_reception_modeA'} =
[$list->available_reception_mode()];
my $wwsympa_url = Conf::get_robot_conf($list->{'domain'}, 'wwsympa_url');
$data->{'url'} = $wwsympa_url . '/info/' . $list->{'name'};
$data->{'url'} = Sympa::get_url($list, 'info');
unless (Sympa::send_file($list, 'info_report', $sender, $data)) {
$log->syslog('notice', 'Unable to send template "info_report" to %s',
......
......@@ -118,14 +118,10 @@ sub lists {
next unless ($action eq 'do_it');
##building result packet
$result_item->{'listAddress'} =
$listname . '@' . $list->{'admin'}{'host'};
$result_item->{'subject'} = $list->{'admin'}{'subject'};
$result_item->{'listAddress'} = Sympa::get_address($list);
$result_item->{'subject'} = $list->{'admin'}{'subject'};
$result_item->{'subject'} =~ s/;/,/g;
$result_item->{'homepage'} =
Conf::get_robot_conf($robot, 'wwsympa_url')
. '/info/'
. $listname;
$result_item->{'homepage'} = Sympa::get_url($list, 'info');
my $listInfo;
if ($mode eq 'complex') {
......@@ -527,15 +523,13 @@ sub info {
$result_item->{'listAddress'} =
SOAP::Data->name('listAddress')->type('string')
->value($listname . '@' . $list->{'admin'}{'host'});
->value(Sympa::get_address($list));
$result_item->{'subject'} =
SOAP::Data->name('subject')->type('string')
->value($list->{'admin'}{'subject'});
$result_item->{'homepage'} =
SOAP::Data->name('homepage')->type('string')
->value(Conf::get_robot_conf($robot, 'wwsympa_url')
. '/info/'
. $listname);
->value(Sympa::get_url($list, 'info'));
## determine status of user
if ($list->is_admin('owner', $sender)
......@@ -1655,12 +1649,10 @@ sub which {
$action = $result->{'action'} if (ref($result) eq 'HASH');
next unless ($action =~ /do_it/i);
$result_item->{'listAddress'} =
$name . '@' . $list->{'admin'}{'host'};
$result_item->{'subject'} = $list->{'admin'}{'subject'};
$result_item->{'listAddress'} = Sympa::get_address($list);
$result_item->{'subject'} = $list->{'admin'}{'subject'};
$result_item->{'subject'} =~ s/;/,/g;
$result_item->{'homepage'} =
Conf::get_robot_conf($robot, 'wwsympa_url') . '/info/' . $name;
$result_item->{'homepage'} = Sympa::get_url($list, 'info');
## determine status of user
$result_item->{'isOwner'} = 0;
......
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