Code Search for Developers
 
 
  

import_csv.html from AlphaMail at Krugle


Show import_csv.html syntax highlighted

% # vim:set syntax=mason:
<%args>
$import
</%args>
   <& /mail/header.mhtml, title => 'Import from CSV' &>
<p>Click on someones first name (NOT their full name)</p>
<pre>
<%perl>
open DATA, "<$tmploc";
while(<DATA>) {
   my @fields = split /,/;
   for(my $f=0; $f <= $#fields; $f++) {
      $m->print(qq(<a href="/mail/addressbook/import_fname.html?fn=$f&data=$tmploc">$fields[$f]</a>, )) if($fields[$f]);
   }
   $m->print("\n");
}
close DATA;
</%perl>
</pre>
   <& /mail/footer.mhtml &>
<%init>
my $user = Apache::SiteControl->getCurrentUser($r);
my $prefs = new AlphaMail::Preferences($user->getUsername(), 
                                   $user->getAttribute('imap'), $config);
my $username = $user->getUsername();
my $error = 0;
my $folder = $user->getAttribute('lastfolder') || 'inbox';
my $c = new AlphaMail::Middleware($user->getAttribute('imap'), $user->getUsername(), $user->getAttribute('password'), $config);
my $logger = Log::Log4perl->get_logger('alphamail');
my $dir = $config->get('message_tmpdir', '/tmp');
my $book = new AlphaMail::AddressBook($user->getUsername(), $user->getAttribute('imap'), $config);
my $size;
my $tmploc;

eval {
   # Get the file
   my $upload = $r->upload;
   my $filename = $upload->filename;

   die "No file provided." if $filename =~ m/^\s*$/;

   # sanitize the filename
   $filename =~ s!^.*[/\\]([^\\/]*)$!$1!;
   $filename =~ s/^\.+//g;
   $filename =~ s/[^a-z0-9.]/_/ig;
   $tmploc = "$dir/" . $username . "_csv_" . $filename;
   
   if(-f $tmploc) {
      unlink $tmploc;
   }
   $upload->link($tmploc);
   $size = (stat($tmploc))[7];
   die "No (or empty) file provided!" if $size == 0;
};
if($@) {
   $logger->error("Attachment failed: $@");
   $error = "Unable to attach file. Make sure the file exists and has content.";
}
</%init>
<%once>
use MIME::Words;
use Time::Format;
</%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