Show take.html syntax highlighted
% # vim:set syntax=mason:
<%args>
$folder
$uid
$uidv
$sorted_offset
$sortby
$literal => 0
$printable => 0
$full_headers => 0
$n => 0
$addresslist => ''
</%args>
<& /mail/header.mhtml, title => "Address Book Editor", folder => $folder &>
<form method="post" action="<% $base %>/mail/addressbook/process_take.html">
<div class="subheading">New Entries</div>
<div class="section">
<input type="hidden" name="folder" value="<% $folder |h %>">
<input type="hidden" name="uid" value="<% $uid |h %>">
<input type="hidden" name="uidv" value="<% $uidv |h %>">
<input type="hidden" name="sorted_offset" value="<% $sorted_offset |h %>">
<input type="hidden" name="sortby" value="<% $sortby |h %>">
<input type="hidden" name="literal" value="<% $literal |h %>">
<input type="hidden" name="printable" value="<% $printable |h %>">
<input type="hidden" name="full_headers" value="<% $full_headers |h %>">
<input type="hidden" name="n" value="<% $n |h %>">
<input type="submit" name="save" value="Save Changes to Entries">
<table class="addressbookeditor">
<tr><th>Add</th><th>Full Name</th><th>Address</th></tr>
<%perl>
for my $a (@toadd) {
my $phrase = $a->phrase;
$phrase =~ s/^"(.*)"$/$1/;
eval {
$phrase = mimewords_to_utf8($phrase);
};
if($@) {
$logger->error("Error decoding phrase: $@");
}
</%perl>
<tr>
<td><input type="checkbox" checked name="take" value="<% $a->address |h %>"></td>
<td>
<input type="text" name="takename" value="<% $phrase |h %>">
</td>
<td>
<input type="hidden" name="takeaddress" value="<% $a->address |h %>">
<% $a->address |h %>
</td>
</tr>
% }
</table>
</div>
</form>
<div class="subheading">Existing Entries</div>
<div class="section">
<table>
<%perl>
for my $k (sort keys %{$addresses}) {
local $" = ", ";
my $phrase = $addresses->{$k}->phrase;
eval {
$phrase = mimewords_to_utf8($addresses->{$k}->phrase);
};
if($@) {
$logger->error("Error decoding phrase: $@");
}
</%perl>
<tr>
<td>
</td>
<td>
<% $phrase |h %>
</td>
<td>
<% $addresses->{$k}->address |h %>
</td>
</tr>
% }
</table>
</div>
<& /mail/footer.mhtml &>
<%init>
my $user = Apache2::SiteControl->getCurrentUser($r);
my $book = new AlphaMail::AddressBook($user->getUsername(), $user->getAttribute('mx'), $config);
my $addresses = $book->get_all->{addresses};
my @toadd = Email::Address->parse($addresslist);
</%init>
<%once>
use Carp;
use AlphaMail::AddressBook;
use AlphaMail::MailTool qw(mimewords_to_utf8);
our $logger = Log::Log4perl->get_logger('alphamail');
our $base = $config->get('base_uri');
</%once>
See more files for this project here