ui-lib conversion of view mail page, plus re-factoring

This commit is contained in:
Jamie Cameron
2008-10-01 19:20:43 +00:00
parent e0e31e4b19
commit f6788682b3
6 changed files with 385 additions and 168 deletions
+17 -9
View File
@@ -68,15 +68,23 @@ else {
# Just output the attachment
print "X-no-links: 1\n";
@download = split(/\t+/, $config{'download'});
if (&indexof($attach->{'type'}, @download) >= 0) {
# Force download in IE
print "Content-Disposition: Attachment\n";
}
if ($attach->{'type'} eq 'message/delivery-status') {
print "Content-type: text/plain\n\n";
}
else {
print "Content-type: $attach->{'type'}\n\n";
if ($in{'type'}) {
# Display as a specific MIME type
print "Content-type: $in{'type'}\n\n";
print $attach->{'data'};
}
else {
# Auto-detect type
if ($in{'save'}) {
# Force download
print "Content-Disposition: Attachment\n";
}
if ($attach->{'type'} eq 'message/delivery-status') {
print "Content-type: text/plain\n\n";
}
else {
print "Content-type: $attach->{'type'}\n\n";
}
}
if ($attach->{'type'} =~ /^text\/html/i) {
print &safe_urls(&filter_javascript($attach->{'data'}));
+64
View File
@@ -0,0 +1,64 @@
#!/usr/local/bin/perl
# Download all attachments in a ZIP file
require './mailboxes-lib.pl';
&ReadParse();
&error_setup($text{'detachall_err'});
&can_user($in{'user'}) || &error($text{'mail_ecannot'});
@folders = &list_user_folders($in{'user'});
$folder = $folders[$in{'folder'}];
@mail = &mailbox_list_mails($in{'idx'}, $in{'idx'}, $folder);
$mail = $mail[$in{'idx'}];
&parse_mail($mail);
@sub = split(/\0/, $in{'sub'});
foreach $s (@sub) {
# We are looking at a mail within a mail ..
local $amail = &extract_mail($mail->{'attach'}->[$s]->{'data'});
&parse_mail($amail);
$mail = $amail;
}
# Save each attachment to a temporary directory
@attach = @{$mail->{'attach'}};
@attach = &remove_body_attachments($mail, \@attach);
@attach = &remove_cid_attachments($mail, \@attach);
$temp = &transname();
&make_dir($temp, 0755) || &error(&text('detachall_emkdir', $!));
$n = 0;
foreach $a (@attach) {
# Work out a filename
if (!$a->{'type'} || $a->{'type'} eq 'message/rfc822') {
$fn = "mail".(++$n).".txt";
}
elsif ($a->{'filename'}) {
$fn = &decode_mimewords($a->{'filename'});
}
else {
$fn = "file".(++$n).".".&type_to_extension($a->{'type'});
}
# Write the file
&open_tempfile(FILE, ">$temp/$fn", 0, 1);
&print_tempfile(FILE, $a->{'data'});
&close_tempfile(FILE);
}
# Make and output the zip
$zip = &transname("$$.zip");
$out = &backquote_command(
"cd ".quotemeta($temp)." && zip ".quotemeta($zip)." * 2>&1");
if ($?) {
&error(&text('detachall_ezip', "<tt>".&html_escape($out)."</tt>"));
}
# Output the ZIP
print "Content-type: application/zip\n\n";
open(ZIP, $zip);
while(read(ZIP, $buf, 1024) > 0) {
print $buf;
}
close(ZIP);
&unlink_file($zip);
&unlink_file($temp);
+130
View File
@@ -3099,5 +3099,135 @@ for(my $i=0; $i<scalar(@rv); $i++) {
return wantarray ? @rv : $rv[0];
}
# show_delivery_status(&dstatus)
# Show the delivery status HTML for some email
sub show_delivery_status
{
local ($dstatus) = @_;
local $ds = &parse_delivery_status($dstatus->{'data'});
$dtxt = $ds->{'status'} =~ /^2\./ ? $text{'view_dstatusok'}
: $text{'view_dstatus'};
print &ui_table_start($dtxt, "width=100%", 2, [ "width=10% nowrap" ]);
foreach $dsh ('final-recipient', 'diagnostic-code',
'remote-mta', 'reporting-mta') {
if ($ds->{$dsh}) {
$ds->{$dsh} =~ s/^\S+;//;
print &ui_table_row($text{'view_'.$dsh},
&html_escape($ds->{$dsh}));
}
}
print &ui_table_end();
}
# attachments_table(&attach, folder, view-url, detach-url, [show-checkboxes])
# Prints an HTML table of attachments. Returns a list of those that can be
# server-side detached.
sub attachments_table
{
local ($attach, $folder, $viewurl, $detachurl, $cbs) = @_;
local %typemap = map { $_->{'type'}, $_->{'desc'} } &list_mime_types();
local $qid = &urlize($id);
local $rv;
local (@files, @actions, @detach, @sizes, @titles, @links);
foreach my $a (@$attach) {
local $fn;
local $size = &nice_size(length($a->{'data'}));
local $cb;
if (!$a->{'type'}) {
# An actual email
push(@files, &text('view_sub2', $a->{'header'}->{'from'}));
$fn = "mail.txt";
$size = &nice_size($a->{'size'});
}
elsif ($a->{'type'} eq 'message/rfc822') {
# Attached email
local $amail = &extract_mail($a->{'data'});
if ($amail && $amail->{'header'}->{'from'}) {
push(@files, &text('view_sub2',
$amail->{'header'}->{'from'}));
}
else {
push(@files, &text('view_sub'));
}
$fn = "mail.txt";
}
elsif ($a->{'filename'}) {
# Known filename
push(@files, &decode_mimewords($a->{'filename'}));
$fn = &decode_mimewords($a->{'filename'});
push(@detach, [ $a->{'idx'}, $fn ]);
}
else {
# No filename
push(@files, "<i>$text{'view_anofile'}</i>");
$fn = "file.".&type_to_extension($a->{'type'});
push(@detach, [ $a->{'idx'}, $fn ]);
}
push(@sizes, $size);
push(@titles, $files[$#files]."<br>".$size);
if ($a->{'error'}) {
$titles[$#titles] .= "<br><font size=-1>($a->{'error'})</font>";
}
$fn =~ s/ /_/g;
$fn =~ s/\#/_/g;
$fn = &html_escape($fn);
local @a;
local $detachfile = $detachurl;
$detachfile =~ s/\?/\/$fn\?/;
if (!$a->{'type'}) {
# Complete email for viewing
local $qmid = &urlize($a->{'id'});
push(@links, "view_mail.cgi?id=$qmid&folder=$folder->{'index'}");
}
elsif ($a->{'type'} eq 'message/rfc822') {
# Attached sub-email
push(@links, $viewurl."&sub=$a->{'idx'}");
}
else {
# Regular attachment
push(@links, $detachfile."&attach=$a->{'idx'}");
}
push(@a, "<a href='$links[$#links]'>$text{'view_aview'}</a>");
push(@a, "<a href='$links[$#links]' target=_new>$text{'view_aopen'}</a>");
if ($a->{'type'}) {
push(@a, "<a href='$detachfile&attach=$a->{'idx'}&save=1'>$text{'view_asave'}</a>");
}
if ($a->{'type'} eq 'message/rfc822') {
push(@a, "<a href='$detachfile&attach=$a->{'idx'}&type=text/plain$subs'>$text{'view_aplain'}</a>");
}
push(@actions, \@a);
}
local @tds = ( "width=50%", "width=25%", "width=10%", "width=15% nowrap" );
if ($cbs) {
unshift(@tds, "width=5");
}
print &ui_columns_start([
$cbs ? ( "" ) : ( ),
$text{'view_afile'},
$text{'view_atype'},
$text{'view_asize'},
$text{'view_aactions'},
], 100, 0, \@tds);
for(my $i=0; $i<@files; $i++) {
local $type = $attach[$i]->{'type'} || "message/rfc822";
local $typedesc = $typemap{lc($type)} || $type;
local @cols = (
"<a href='$links[$i]'>$files[$i]</a>",
$typedesc,
$sizes[$i],
&ui_links_row($actions[$i]),
);
if ($cbs) {
print &ui_checked_columns_row(\@cols, \@tds,
$cbs, $attach->[$i]->{'idx'}, 1);
}
else {
print &ui_columns_row(\@cols, \@tds);
}
}
print &ui_columns_end();
return @detach;
}
1;
+32 -36
View File
@@ -167,55 +167,51 @@ if ($config{'arrows'} && @mail) {
&show_arrows();
}
@grid = ( );
if (@mail) {
print &ui_hr();
print "<table width=100%><tr>\n";
# Show simple search form
print "<form action=mail_search.cgi><td width=30%>\n";
print "<input type=hidden name=user value='$in{'user'}'>\n";
print "<input type=hidden name=folder value='$folder->{'index'}'>\n";
print "<input type=hidden name=simple value=1>\n";
print "<input type=submit value='$text{'mail_search2'}'>\n";
print "<input name=search size=20></td></form>\n";
push(@grid, &ui_form_start("mail_search.cgi").
&ui_hidden("user", $in{'user'}).
&ui_hidden("folder", $folder->{'index'}).
&ui_hidden("simple", 1).
&ui_submit($text{'mail_search2'})." ".
&ui_textbox("search", undef, 20).
&ui_form_end());
# Show advanced search button
print "<form action=search_form.cgi>\n";
print "<input type=hidden name=user value='$in{'user'}'>\n";
print "<input type=hidden name=folder value='$folder->{'index'}'>\n";
print "<td width=20% align=center><input type=submit name=advanced ",
"value='$text{'mail_advanced'}'></td>\n";
print "</form>\n";
push(@grid, &ui_form_start("search_form.cgi").
&ui_hidden("user", $in{'user'}).
&ui_hidden("folder", $folder->{'index'}).
&ui_submit($text{'mail_advanced'}, "advanced").
&ui_form_end());
# Show delete all button
print "<form action=delete_all.cgi>\n";
print "<input type=hidden name=user value='$in{'user'}'>\n";
print "<input type=hidden name=folder value='$folder->{'index'}'>\n";
print "<td width=20% align=center><input type=submit ",
"value='$text{'mail_delall'}'></td>\n";
print "</form>\n";
push(@grid, &ui_form_start("delete_all.cgi").
&ui_hidden("user", $in{'user'}).
&ui_hidden("folder", $folder->{'index'}).
&ui_submit($text{'mail_delall'}).
&ui_form_end());
}
# Show page jump form
$jumpform = (@mail > $perpage);
if ($jumpform) {
print "<form action=list_mail.cgi>\n";
print "<input type=hidden name=user value='$in{'user'}'>\n";
print "<input type=hidden name=folder value='$folder->{'index'}'>\n";
print "<td width=30% align=right>\n";
print "<input type=submit value='$text{'mail_jump'}'>\n";
printf "<input name=jump size=3 value='%s'> %s %s\n",
int($in{'start'} / $perpage)+1, $text{'mail_of'},
int(@mail / $perpage)+1;
print "</td></form>\n";
}
elsif (@mail) {
print "<td width=30% align=right></td>\n";
push(@grid, &ui_form_start("list_mail.cgi").
&ui_hidden("user", $in{'user'}).
&ui_hidden("folder", $folder->{'index'}).
&ui_submit($text{'mail_jump'})." ".
&ui_textbox("jump", int($in{'start'} / $perpage)+1, 3)." ".
$text{'mail_of'}." ".(int(@mail / $perpage)+1).
&ui_form_end());
}
if (@mail) {
print "</tr>\n";
print "</table>\n";
# Show the buttons, if any
if (@grid) {
print &ui_hr();
print &ui_grid_table(\@grid, 4, 100,
[ "align=left width=25%", "align=center width=25%",
"align=center width=25%", "align=right width=25%" ],
"cellpadding=0 cellspacing=0");
}
if ($config{'log_read'}) {
+62
View File
@@ -0,0 +1,62 @@
#!/usr/local/bin/perl
# Show a page containing all image attachments
require './mailboxes-lib.pl';
# Get the mail
&ReadParse();
&can_user($in{'user'}) || &error($text{'mail_ecannot'});
@folders = &list_user_folders($in{'user'});
$folder = $folders[$in{'folder'}];
@mail = &mailbox_list_mails($in{'idx'}, $in{'idx'}, $folder);
$mail = $mail[$in{'idx'}];
&parse_mail($mail);
@sub = split(/\0/, $in{'sub'});
$subs = join("", map { "&sub=".&urlize($_) } @sub);
foreach $s (@sub) {
# We are looking at a mail within a mail ..
local $amail = &extract_mail($mail->{'attach'}->[$s]->{'data'});
&parse_mail($amail);
$mail = $amail;
}
# Find image attachments
@attach = @{$mail->{'attach'}};
@attach = &remove_body_attachments($mail, \@attach);
@attach = &remove_cid_attachments($mail, \@attach);
@iattach = grep { $_->{'type'} =~ /^image\// } @attach;
&popup_header($text{'slide_title'});
$n = 0;
foreach $a (@iattach) {
# Navigation links
print "<hr>" if ($n > 0);
print "<a name=image$n></a>\n";
@links = ( );
if ($a eq $iattach[0]) {
push(@links, $text{'slide_prev'});
}
else {
push(@links, "<a href='#image".($n-1)."'>".
"$text{'slide_prev'}</a>");
}
if ($a eq $iattach[$#iattach]) {
push(@links, $text{'slide_next'});
}
else {
push(@links, "<a href='#image".($n+1)."'>".
"$text{'slide_next'}</a>");
}
push(@links, "<b>$a->{'filename'}</b>") if ($a->{'filename'});
print &ui_links_row(\@links),"<br>\n";
# Actual image
print "<img src='detach.cgi?idx=$in{'idx'}".
"&folder=$in{'folder'}&attach=$a->{'idx'}&user=".
&urlize($in{'user'})."$subs'><br>\n";
$n++;
}
&popup_footer();
+80 -123
View File
@@ -67,13 +67,14 @@ if ($body && $body eq $htmlbody) {
print &check_clicks_function();
&show_arrows();
print "<form action=reply_mail.cgi>\n";
print "<input type=hidden name=user value='$in{'user'}'>\n";
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
print "<input type=hidden name=folder value='$in{'folder'}'>\n";
print "<input type=hidden name=mod value=",&modification_time($folder),">\n";
# Start of the form
print &ui_form_start("reply_mail.cgi");
print &ui_hidden("user", $in{'user'});
print &ui_hidden("idx", $in{'idx'});
print &ui_hidden("folder", $in{'folder'});
print &ui_hidden("mod", &modification_time($folder));
foreach $s (@sub) {
print "<input type=hidden name=sub value='$s'>\n";
print &ui_hidden("sub", $s);
}
# Find any delivery status attachment
@@ -88,51 +89,52 @@ if ($config{'top_buttons'} == 2 && &editable_mail($mail)) {
print "<p>\n";
}
print "<table width=100% border=1>\n";
print "<tr> <td $tb><table width=100% cellpadding=0 cellspacing=0><tr>",
"<td><b>$text{'view_headers'}</b></td> <td align=right>\n";
# Start of headers section
$hbase = "view_mail.cgi?idx=$in{'idx'}&body=$in{'body'}&".
"folder=$in{'folder'}&user=$uuser$subs";
if ($in{'headers'}) {
print "<a href='view_mail.cgi?idx=$in{'idx'}&body=$in{'body'}&folder=$in{'folder'}&user=$uuser&headers=0$subs'>$text{'view_noheaders'}</a>\n";
push(@hmode, "<a href='$hbase&headers=0'>$text{'view_noheaders'}</a>");
}
else {
print "<a href='view_mail.cgi?idx=$in{'idx'}&body=$in{'body'}&folder=$in{'folder'}&user=$uuser&headers=1$subs'>$text{'view_allheaders'}</a>\n";
push(@hmode, "<a href='$hbase&headers=1'>$text{'view_allheaders'}</a>");
}
print "&nbsp;&nbsp;<a href='view_mail.cgi?idx=$in{'idx'}&folder=$in{'folder'}&user=$uuser&raw=1$subs'>$text{'view_raw'}</a></td>\n";
print "</tr></table></td> </tr>\n";
push(@hmode, "<a href='$hbase&raw=1'>$text{'view_raw'}</a>");
print &ui_table_start($text{'view_headers'},
"width=100%", 2, [ "width=10% nowrap" ],
&ui_links_row(\@hmode));
print "<tr> <td $cb><table width=100%>\n";
if ($in{'headers'}) {
# Show all the headers
if ($mail->{'fromline'}) {
print "<tr> <td><b>$text{'mail_rfc'}</b></td>",
"<td>",&eucconv_and_escape($mail->{'fromline'}),
"</td> </tr>\n";
print &ui_table_row($text{'mail_rfc'},
&eucconv_and_escape($mail->{'fromline'}));
}
foreach $h (@{$mail->{'headers'}}) {
print "<tr> <td><b>$h->[0]:</b></td> ",
"<td>",&eucconv_and_escape(&decode_mimewords($h->[1])),
"</td> </tr>\n";
print &ui_table_row($h->[0].":",
&eucconv_and_escape(&decode_mimewords($h->[1])));
}
}
else {
# Just show the most useful headers
print "<tr> <td><b>$text{'mail_from'}</b></td> ",
"<td>",&address_link($mail->{'header'}->{'from'}),"</td> </tr>\n";
print "<tr> <td><b>$text{'mail_to'}</b></td> ",
"<td>",&address_link($mail->{'header'}->{'to'}),"</td> </tr>\n";
print "<tr> <td><b>$text{'mail_cc'}</b></td> ",
"<td>",&address_link($mail->{'header'}->{'cc'}),"</td> </tr>\n"
if ($mail->{'header'}->{'cc'});
print "<tr> <td><b>$text{'mail_date'}</b></td> ",
"<td>",&eucconv_and_escape($mail->{'header'}->{'date'}),
"</td> </tr>\n";
print "<tr> <td><b>$text{'mail_subject'}</b></td> ",
"<td>",&eucconv_and_escape(&decode_mimewords(
$mail->{'header'}->{'subject'})),"</td> </tr>\n";
print &ui_table_row($text{'mail_from'},
&address_link($mail->{'header'}->{'from'}));
print &ui_table_row($text{'mail_to'},
&address_link($mail->{'header'}->{'to'}));
if ($mail->{'header'}->{'cc'}) {
print &ui_table_row($text{'mail_cc'},
&address_link($mail->{'header'}->{'cc'}));
}
print &ui_table_row($text{'mail_date'},
&eucconv_and_escape(
&simplify_date($mail->{'header'}->{'date'})));
print &ui_table_row($text{'mail_subject'},
&eucconv_and_escape(&decode_mimewords(
$mail->{'header'}->{'subject'})));
}
print "</table></td></tr></table><p>\n";
print &ui_table_end();
# Show body attachment, with properly linked URLs
@bodyright = ( );
if ($body && $body->{'data'} =~ /\S/) {
if ($body eq $textbody) {
# Show plain text
@@ -144,7 +146,8 @@ if ($body && $body->{'data'} =~ /\S/) {
}
$bodycontents .= "</pre>";
if ($htmlbody) {
$bodyright = "<a href='view_mail.cgi?idx=$in{'idx'}&headers=$in{'headers'}&folder=$in{'folder'}&user=$uuser&body=2$subs'>$text{'view_ashtml'}</a>";
push(@bodyright,
"<a href='$hbase&body=2'>$text{'view_ashtml'}</a>");
}
}
elsif ($body eq $htmlbody) {
@@ -153,106 +156,58 @@ if ($body && $body->{'data'} =~ /\S/) {
$bodycontents = &fix_cids($bodycontents, \@attach,
"detach.cgi?user=$uuser&idx=$in{'idx'}&folder=$in{'folder'}$subs");
if ($textbody) {
$bodyright = "<a href='view_mail.cgi?idx=$in{'idx'}&headers=$in{'headers'}&folder=$in{'folder'}&user=$uuser&body=1$subs'>$text{'view_astext'}</a>";
push(@bodyright,
"<a href='$hbase&body=1'>$text{'view_ashtml'}</a>");
}
}
}
if ($bodycontents) {
print "<table width=100% border=1>\n";
print "<tr $tb> <td><table width=100% cellpadding=0 cellspacing=0><tr>",
"<td><b>$text{'view_body'}</b></td> ",
"<td align=right>$bodyright</td> </tr></table></td> </tr>\n";
print "<tr $cb> <td>\n";
print $bodycontents;
print "</pre></td></tr></table><p>\n";
print &ui_table_start($text{'view_body'}, "width=100%", 1,
undef, &ui_links_row(\@bodyright));
print &ui_table_row(undef, $bodycontents);
print &ui_table_end();
}
# Show delivery status
if ($dstatus) {
print "<table width=100% border=1>\n";
print "<tr> <td $tb><b>$text{'view_dstatus'}</b></td> </tr>\n";
print "<tr> <td $cb><table>\n";
local $ds = &parse_delivery_status($dstatus->{'data'});
foreach $dsh ('final-recipient', 'diagnostic-code',
'remote-mta', 'reporting-mta') {
if ($ds->{$dsh}) {
$ds->{$dsh} =~ s/^\S+;//;
print "<tr> <td nowrap valign=top><b>",
$text{'view_'.$dsh},"</b></td>\n";
print "<td>",&html_escape($ds->{$dsh}),"</td> </tr>\n";
}
}
print "</table></td></tr></table><p>\n";
&show_delivery_status($dstatus);
}
# Display other attachments
if (@attach) {
print "<table width=100% border=1>\n";
print "<tr> <td $tb><b>$text{'view_attach'}</b></td> </tr>\n";
print "<tr> <td $cb>\n";
foreach $a (@attach) {
local $fn;
$size = (int(length($a->{'data'})/1000)+1)." Kb";
local $cb;
if ($a->{'type'} eq 'message/rfc822') {
push(@titles, "$text{'view_sub'}<br>$size");
}
elsif ($a->{'filename'}) {
push(@titles, &decode_mimewords($a->{'filename'}).
"<br>$size");
$fn = &decode_mimewords($a->{'filename'});
push(@detach, [ $a->{'idx'}, $fn ]);
}
else {
push(@titles, "$a->{'type'}<br>$size");
$a->{'type'} =~ /\/(\S+)$/;
$fn = "file.$1";
push(@detach, [ $a->{'idx'}, $fn ]);
}
if ($a->{'error'}) {
$titles[$#titles] .= "<br><font size=-1>($a->{'error'})</font>";
}
$fn =~ s/ /_/g;
$fn =~ s/\#/_/g;
$fn = &html_escape($fn);
if ($a->{'type'} eq 'message/rfc822') {
push(@links, "view_mail.cgi?idx=$in{'idx'}&folder=$in{'folder'}&user=$uuser$subs&sub=$a->{'idx'}");
}
else {
push(@links, "detach.cgi/$fn?idx=$in{'idx'}&folder=$in{'folder'}&user=$uuser&attach=$a->{'idx'}$subs");
}
if ($config{'thumbnails'} &&
($a->{'type'} =~ /image\/gif/i && &has_command("giftopnm")&&
&has_command("pnmscale") && &has_command("cjpeg") ||
$a->{'type'} =~ /image\/jpeg/i && &has_command("djpeg") &&
&has_command("pnmscale") && &has_command("cjpeg"))) {
# Can show an image icon
push(@icons, "detach.cgi?scale=1&idx=$in{'idx'}&folder=$in{'folder'}&attach=$a->{'idx'}$subs");
$imgicons++;
}
else {
push(@icons, "images/boxes.gif");
}
# Table of attachments
$viewurl = "view_mail.cgi?idx=$in{'idx'}&folder=$in{'folder'}&".
"user=$uuser$subs";
$detachurl = "detach.cgi?idx=$in{'idx'}&folder=$in{'folder'}&".
"user=$uuser$subs";
@detach = &attachments_table(\@attach, $folder, $viewurl, $detachurl);
# Links to download all / slideshow
@links = ( );
if (@attach > 1) {
push(@links, "<a href='detachall.cgi/attachments.zip?folder=$in{'folder'}&idx=$in{'idx'}&user=$uuser$subs'>$text{'view_aall'}</a>");
}
&icons_table(\@links, \@titles, \@icons, 6, undef,
$imgicons ? ( 0, 0 ) : ( ));
@iattach = grep { $_->{'type'} =~ /^image\// } @attach;
if (@iattach > 1) {
push(@links, "<a href='slideshow.cgi?folder=$in{'folder'}&idx=$in{'idx'}&user=$uuser$subs'>$text{'view_aslideshow'}</a>");
}
print &ui_links_row(\@links) if (@links);
# Show form to detact to server, if enabled
if ($access{'candetach'} && @detach && defined($uinfo[2])) {
print "<input type=submit name=detach value='$text{'view_detach'}'>\n";
print "<input type=hidden name=bindex value='$body->{'idx'}'>\n" if ($body);
print "<select name=attach>\n";
print "<option value=*>$text{'view_dall'}\n";
foreach $a (@detach) {
printf "<option value=%s>%s\n",
$a->[0], $a->[1];
}
print "</select>\n";
print "<b>$text{'view_dir'}</b>\n";
print "<input name=dir size=40> ",
&file_chooser_button("dir", 1),"\n";
}
print "</td></tr></table><p>\n";
print &ui_table_start($text{'view_dheader'}, "width=100%", 1);
$dtach = &ui_submit($text{'view_detach'}, 'detach');
$dtach .= &ui_hidden("bindex", $body->{'idx'}) if ($body);
$dtach .= &ui_hidden("sindex", $sindex) if (defined($sindex));
$dtach .= &ui_select("attach", undef,
[ [ '*', $text{'view_dall'} ],
@detach ]);
$dtach .= "<b>$text{'view_dir'}</b>\n";
$dtach .= &ui_textbox("dir", undef, 60)." ".
&file_chooser_button("dir", 1);
print &ui_table_row(undef, $dtach);
print &ui_table_end();
}
}
&show_mail_buttons(2, scalar(@sub)) if (&editable_mail($mail));
@@ -263,12 +218,14 @@ print "</form>\n";
dbmclose(%read);
# Footer with backlinks
local @sr = !@sub ? ( ) :
( "view_mail.cgi?idx=$in{'idx'}", $text{'view_return'} ),
$s = int((@mail - $in{'idx'} - 1) / $config{'perpage'}) *
$config{'perpage'};
&mail_page_footer(@sub ? ( "view_mail.cgi?idx=$in{'idx'}&folder=$in{'folder'}&user=$uuser",
$text{'view_return'} ) : ( ),
&mail_page_footer(
@sub ? ("view_mail.cgi?idx=$in{'idx'}&folder=$in{'folder'}&user=$uuser",
$text{'view_return'}) : ( ),
"list_mail.cgi?folder=$in{'folder'}&user=$uuser", $text{'mail_return'},
"", $text{'index_return'});