Show import_complete.html syntax highlighted
% # vim:set syntax=mason:
<%args>
$data => ''
$fn => 0
$ln => 0
$em => 0
$al => 0
</%args>
<& /mail/header.mhtml, title => 'Choose email address' &>
% if($js) {
<script type="text/javascript" language="JavaScript">
<!--
function check_all()
{
document.csvimport.line.checked=1;
for(var i=0; i<document.csvimport.line.length; i++)
document.csvimport.line[i].checked=1;
}
function uncheck_all()
{
document.csvimport.line.checked=0;
for(var i=0; i<document.csvimport.line.length; i++)
document.csvimport.line[i].checked=0;
}
function invert_checks()
{
document.csvimport.line.checked=!document.csvimport.line.checked;
for(var i=0; i<document.csvimport.line.length; i++)
document.csvimport.line[i].checked=!document.csvimport.line[i].checked;
}
// -->
</script>
% }
<P>Uncheck any address you don't want to import and click Save.</P>
<form name="csvimport" method="post" action="<% $base %>/mail/addressbook/import_csv_save.html">
<div class="control">
<input type="submit" name="save" value="Save">
<input type="submit" name="cancel" value="Cancel">
</div>
% if($js) {
<div class="quickcheck">
Select:
<a class="control" onClick="check_all();" href="#">All</a>,
<a class="control" onClick="uncheck_all();" href="#">None</a>,
<a class="control" onClick="invert_checks();" href="#">Invert</a>
</div>
% }
<table class="import_verify">
<%perl>
my ($entry, $address, $fname, $lname, @ao);
open DATA, "<$data";
my @lines = <DATA>;
close DATA;
my $line = 0;
for my $n (@lines) {
$logger->debug("Line $n");
$_ = $n;
my @fields = split /,/;
$fname = $fields[$fn];
$lname = $fields[$ln];
$entry = new Email::Address("$fname $lname", $fields[$em]);
if(!$entry) {
</%perl>
<tr>
<td colspan="3">
Skipped entry for: (<% "$fname $lname" |h %>)
</td>
</tr>
<%perl>
next;
}
$address = $entry->format;
</%perl>
<tr>
<th>
<input type="checkbox" name="line" value="<% $line %>" checked>
</th>
<th>
<input type="text" name="entry" size="50" value="<% $address |h %>">
</th>
</tr>
<%perl>
$line++;
}
</%perl>
</table>
% if($js) {
<div class="quickcheck">
Select:
<a class="control" onClick="check_all();" href="#">All</a>,
<a class="control" onClick="uncheck_all();" href="#">None</a>,
<a class="control" onClick="invert_checks();" href="#">Invert</a>
</div>
% }
<div class="control">
<input type="submit" name="save" value="Save">
<input type="submit" name="cancel" value="Cancel">
</div>
</form>
<& /mail/footer.mhtml &>
<%init>
my $user = Apache2::SiteControl->getCurrentUser($r);
my $js = defined($user->getAttribute('credential_4')) ? $user->getAttribute('credential_4'):0;
</%init>
<%once>
our $logger = Log::Log4perl->get_logger('alphamail');
our $base = $config->get('base_uri');
</%once>
See more files for this project here