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 => ()
</%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) {
   $logger->debug("Deleting entry with key $k");
   $book->remove($k);
}

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

# Merge new entries
for($k=0; $k <= $#newalias; $k++) {
   # Skip entries that have blank fields
   $newalias[$k] = Encode::decode_utf8($newalias[$k]);
   $newaddress[$k] = Encode::decode_utf8($newaddress[$k]);
   next if $newalias[$k] =~ m/^\s*$/ || $newaddress[$k] =~ m/^\s*$/;
   @a = map { encode_utf8mimewords($_) } split(/,/, $newaddress[$k]);
   $book->merge(encode_utf8mimewords($newalias[$k]), [ @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);
use AlphaMail::MailTool qw(encode_utf8mimewords mimewords_to_utf8);

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

  edit.mhtml
  import.mhtml
  import_alias.html
  import_complete.html
  import_csv.html
  import_csv_save.html
  import_fname.html
  import_imho.html
  import_lname.html
  index.html
  process_edit.html
  process_take.html
  take.html