Skip to Content.
Sympa Menu

en - Adding a delivery type - html_summary - patches for 4.0b2

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Mark Valiukas <address@concealed>
  • To: address@concealed
  • Subject: Adding a delivery type - html_summary - patches for 4.0b2
  • Date: Tue, 10 Feb 2004 16:52:29 +1100

I finally got around to looking at the 4 code this morning.
This afternoon, here are diffs against List.pm and wwslib.pm
from 4.0b2 for this feature.

The version I posted yesterday relies on separate templates,
and code to construct a multi-part message. This one does it
the same way digests are constructed in V4, using a single
template.

--
Mark Valiukas
301c301
< 'available_user_options' => {'format' => {'reception' =>
{'format' =>
['mail','notice','digest','summary','nomail','txt','html','urlize','not_me'],
---
> 'available_user_options' => {'format' => {'reception' =>
> {'format' =>
> ['mail','notice','digest','summary','html_summary','nomail','txt','html','urlize','not_me'],
304c304
<
'default' => 'mail,notice,digest,summary,nomail,txt,html,urlize,not_me',
---
>
> 'default' =>
> 'mail,notice,digest,summary,html_summary,nomail,txt,html,urlize,not_me',
415c415
< 'default_user_options' => {'format' => {'reception' => {'format'
=>
['digest','mail','nomail','summary','notice','txt','html','urlize','not_me'],
---
> 'default_user_options' => {'format' => {'reception' => {'format'
> =>
> ['digest','mail','nomail','summary','html_summary','notice','txt','html','urlize','not_me'],
2201c2201
< if ($user->{'reception'} =~ /^digest|summary|nomail$/i) {
---
> if ($user->{'reception'} =~ /^digest|summary|html_summary|nomail$/i) {
2470c2470
< ## Send a digest message to the subscribers with reception digest or summary
---
> ## Send a digest message to the subscribers with reception digest or
> summary or html summary
2473d2472
<
2494a2494,2495
> my @tabrcpthtmlsummary;
>
2511c2512,2516
< return if (($#tabrcptsummary == -1) and ($#tabrcpt == -1));
---
> ## Create the list of subscribers in html_summary mode
> for (my $user = $self->get_first_user(); $user; $user =
> $self->get_next_user()) {
> push @tabrcpthtmlsummary, $user->{'email'}
> if $user->{'reception'} eq "html_summary";
> }
2512a2518,2519
> return if (($#tabrcpthtmlsummary == -1) and ($#tabrcptsummary == -1)
> and ($#tabrcpt == -1));
>
2576c2583,2618
< ## Clean up Message-ID
---
> ## need html-friendly and mailto-friendly subject lines in param
> hash
> ## must escape ", <, and >
> ## must replace & and ? in mailto as both are delimiters
> my $subject_temp = $subject;
> my $subject_mailto_temp = $subject;
> ##
> #$subject_temp =~ s/&/%26/gs; # do first, so we don't kill "&lt"
> etc...
> $subject_temp =~ s/&/&amp;/gs; # do first, so we don't kill "&lt"
> etc...
> $subject_temp =~ s/#/&#35;/gs;
> $subject_temp =~ s/%/&#37;/gs;
> $subject_temp =~ s/\</&#60;/gs;
> $subject_temp =~ s/\>/&#62;/gs;
> $subject_temp =~ s/"/&#34;/gs;
> $subject_temp =~ s/!/&#33;/gs;
> $subject_temp =~ s/@/&#64;/gs;
> ##
> $subject_mailto_temp =~ s/&/\[and]/gs; # do first, so doesn't kill
> "&lt" etc...
> #$subject_mailto_temp =~ s/#/&#35;/gs; # do first, so we don't kill
> "&lt" etc...
> $subject_mailto_temp =~ s/\</&#60;/gs;
> $subject_mailto_temp =~ s/\>/&#62;/gs;
> $subject_mailto_temp =~ s/"/&#34;/gs;
> $subject_mailto_temp =~ s/%/%25;/gs;
> #$subject_mailto_temp =~ s/\?/\[question\]/gs; # no question marks
> either.
> ##
> $msg->{'htmlised_subject'} = $subject_temp;
> $msg->{'mailto_subject'} = $subject_mailto_temp;
>
> ## Some mail clients might baulk at 'mailto:"Joe Blow"
> <address@concealed>?subject:Foo"
> ## so extract an email address only to use as bare_from in param hash
> my $sender_line = $msg->{'from'};
> my @sender_hdr = Mail::Address->parse($sender_line);
> my $extracted_email = @sender_hdr[0];
> $msg->{'bare_from'} = $extracted_email->address;
>
>
> ## Clean up Message-ID
2606a2649,2663
>
>
> ## send html summary
> ## Note: multi-language template support may make it necessary to
> ## move all of this into send_file and do this the same way as "send
> summary",
> ## or make this a lot more complicated. This version will only work for
> ## one language. - mjv
> ##
>
> if (@tabrcpthtmlsummary) {
> $param->{'subject'} = sprintf Msg(8, 31, 'Summary of list %s'),
> $self->{'name'};
>
> $self->send_file('html_summary', \@tabrcpthtmlsummary, $robot,
> $param);
> }
>
46c46,47
< 'not_me' => 'not_me');
---
> 'not_me' => 'not_me',
> 'html_summary' =>'html_summary');
From: [from]
To: [to]
Reply-to: [reply]
Subject: Summary for list [list->name]
Mime-version: 1.0
Content-Type: multipart/alternative; boundary="[boundary1]"


This is a multi-part message in MIME format...

--[boundary1]
Content-Type: multipart/related; boundary="[boundary2]"
Content-transfer-encoding: binary

This is a multi-part message in MIME format...

--[boundary2]--

--[boundary1]
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Description: TEXT summary

Plain-text version:
You are seeing this because your email program is either
incapable of displaying HTML messages, or is set to only
display the plain-text part of the message.

Here is a message summary for the

[list->subject]

mailing list. Please click on the relevant links to
read the messages. To access some features, you may
need to log in first.

Messages received today:

[FOREACH m IN msg_list]
[m->id]. [m->subject] - [m->from]
[END]


--------------------------------------------------------
You are receiving this because you are subscribed to the

[list->subject]

mailing list.

For information regarding this list, please visit:
[conf->wwsympa_url]/info/[list->name]

To modify your subscription options for this list, please visit:
[conf->wwsympa_url]/suboptions/[list->name]

You may need to log in to access the messages or change your
subscription settings. To do so, please visit:
[conf->wwsympa_url]/nomenu/loginrequest/home

--[boundary1]
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Description: HTML Summary
Mime-Version: 1.0

<HTML>
<HEAD>
<TITLE>[list->subject]</TITLE>
</HEAD>
<BODY>
<P>Here is a message summary for the <b>[list->subject]</b>
mailing list. Please click on the relevant links to read the messages.
Some features may require you to log in first.</P>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=3 >
<TR>
<TD COLSPAN=3 WIDTH=100% BGCOLOR="#6666cc">
<center>
<font face="Arial,Helvetica"><font color="#FFFFFF"><font size=+2>
[list->subject]</font>
</center>
</TD>
</TR>
<TBODY>
<TR VALIGN=TOP>
<TD ROWSPAN=255 WIDTH=15% BGCOLOR="#ffffcc">
<font face="Arial,Helvetica"><font size=-2>
[IF conf->wwsympa_url]
<!-- START LEFT MENU -->
<TABLE bgcolor=#ffffcc cellspacing="0" cellpadding="0">
<TR><TD rowspan=50 width=10>&nbsp;</TD>
<TD bgcolor="#ffcc00" height=1></TD>
<TD rowspan=50 width=10>&nbsp;</TD><td width="1" bgcolor="#FFCC00"
rowspan="50">
</TD></TR>
<TR><TD><font size=-2><A
HREF="[conf->wwsympa_url]/nomenu/loginrequest/home">Log in to the groups
server</TD></TR>
<TR><TD bgcolor="#ffcc00" height=1></TD></TR>
<TR><TD><font size=-2><A HREF="[conf->wwsympa_url]/arc/[list->name]">View
archives for this group</A></TD></TR>
<TR><TD bgcolor="#ffcc00" height=1></TD></TR>

<TR><TD><font size=-2><A
HREF="[conf->wwsympa_url]/suboptions/[list->name]">Change your subscription
options</A></TD></TR>
<TR><TD bgcolor="#ffcc00" height=1></TD></TR>

<TR><TD><font size=-2><A
HREF="[conf->wwsympa_url]/info/[list->name]">Information regarding this
list</A></TD></TR>
<TR><TD bgcolor="#ffcc00" height=1></TD></TR>
</TABLE>
<!-- END MENU -->
[ENDIF]
</TD>
</TR>
[FOREACH m IN msg_list]

<TR VALIGN=TOP>
<TD WIDTH=85%>
<font face="Arial,Helvetica">
[IF conf->wwsympa_url]
<a href
="[conf->wwsympa_url]/arcsearch_id/[list->name]/[m->month]/[m->message_id]">
[m->htmlised_subject]</a><br>
&nbsp;&nbsp;<i>sent by </i><A
HREF="mailto:[m->bare_from]?subject=Re:[m->mailto_subject]">[m->from]</a>
[ENDIF]
</TD>
</TR>
[END]

<TR bgcolor="#ffffcc">
<TD colspan=3 WIDTH=100% BGCOLOR="#ffffcc">
<FONT FACE="Arial,Helvetica"><font size=-2>
<center>
Powered by Sympa
</center>
</TD>
</TR>
</TBODY>
</TABLE>
<P><BR><BR>
</P>
</BODY>
</HTML>

--[boundary1]--




Archive powered by MHonArc 2.6.19+.

Top of Page