Code Search for Developers
 
 
  

process_edit.html from AlphaMail at Krugle


Show process_edit.html syntax highlighted

% # vim:set syntax=mason:
<%args>
@newalias => ()
@newaddress => ()
@delete => ()
@oldalias => ()
@oldaddress => ()
@renamedalias => ()
@take => ()
@takealias => ()
@takealiaskey => ()
@takeaddress => ()
</%args>
<%init>
my $user = Apache::SiteControl->getCurrentUser($r);
my $book = new AlphaMail::AddressBook($user->getUsername(), $user->getAttribute('imap'), $config);
my $k;
my @a;

# Order: Delete, rename, then add (avoids collisions)
for $k (@delete) {
   $book->remove($k);
}

for($k=0; $k <= $#oldalias; $k++) {
   # ignore edits on deleted rows:
   next if grep(/^\Q$oldalias[$k]\E$/, @delete);
   @a = split(/,/, $oldaddress[$k]);
   # Rename?
   if($oldalias[$k] ne $renamedalias[$k]) {
      $book->remove($oldalias[$k]);
      $book->set($renamedalias[$k], [ @a ]);
   } else { # Make sure addresses are updated
      $book->set($renamedalias[$k], [ @a ]);
   }
}

# Merge new entries
for($k=0; $k <= $#newalias; $k++) {
   # Skip entries that have blank fields
   next if $newalias[$k] =~ m/^\s*$/ || $newaddress[$k] =~ m/^\s*$/;
   @a = split(/,/, $newaddress[$k]);
   $book->merge($newalias[$k], [ @a ]);
}

my %take = ();
# Merge new "take" entries
for($k=0; $k <= $#takealias; $k++) {
   $take{$takealiaskey[$k]} = [ $takealias[$k], $takeaddress[$k] ];
}
for($k=0; $k <= $#take; $k++) {
   # Skip entries that have blank fields
   my $alias = $take{$take[$k]}[0];
   my $addr = $take{$take[$k]}[1];
   next if $alias =~ m/^\s*$/ || $addr =~ m/^\s*$/;
   @a = split(/,/, $addr);
   $book->merge($alias, [ @a ]);
}

$m->redirect(build_url('/mail/addressbook/index.html', {selected => 'Contacts', message => 'Your contacts were updated.' }));
</%init>
<%once>
use Carp;
use AlphaMail::AddressBook;
use AlphaMail::HTMLHelper qw(build_url);

our $logger = Log::Log4perl->get_logger('alphamail');
</%once>




See more files for this project here

AlphaMail

AlphaMail is an accelerated web mail interface with a C++ middleware layer that is more effective than an IMAP proxy which is a highly scalable (10k+ users). The interface includes modern features, Section 508 compliance, and universal browser support.

Project homepage: http://sourceforge.net/projects/alphamail
Programming language(s): C++,Java,JavaScript,Perl
License: other

  autohandler
  edit.mhtml
  import.mhtml
  import_csv.html
  import_imho.html
  index.html
  process_edit.html
  take.html