Code Search for Developers
 
 
  

first_login.html from AlphaMail at Krugle


Show first_login.html syntax highlighted

% # vim: set syntax=mason:
<& /mail/header.mhtml, hide_controls=>1, title => "Initial Preferences" &>
% if($js) {
<script type="text/javascript" language="JavaScript">
   <!--
      function check_all()
      {
         document.folders.subscribed.checked=1;
         for(var i=0; i<document.folders.subscribed.length; i++)
            document.folders.subscribed[i].checked=1;
      }
      function uncheck_all()
      {
         document.folders.subscribed.checked=0;
         for(var i=0; i<document.folders.subscribed.length; i++)
            document.folders.subscribed[i].checked=0;
      }
      function invert_checks()
      {
         document.folders.subscribed.checked=!document.folders.subscribed.checked;
         for(var i=0; i<document.folders.subscribed.length; i++)
            document.folders.subscribed[i].checked=!document.folders.subscribed[i].checked;
      }
   // -->
</script>
% }
<div class="heading">Initial Preferences</div>
<p>You do not have any preferences set yet. Please choose the following and
select "Save":</p>
<form name="folders" class="foldereditor" method="post" 
      action="<% $base_uri %>/mail/process_first_login.html">
   <div class="subheading">Addressing</div>
   <div class="section">
      <p>Your full name:
         <input type="text" size="40" value="<% $p->get('fullname') |h %>"
                name="fullname">
      </p>
   </div>
   <div class="subheading">Utility Folders</div>
   <div class="section">
      <p>The following is a list of special folders. Changing the
         selections will modify how the mail system behaves.
      <p>Sent mail folder:
      <select name="sent_folder">
         <option value="none">None (don't save sent messages)</option>
% for(my $i=0; $i <= $#alt_folders; $i++) { 
%     my $displayname = decode('utf8', $tr->decode($alt_folders[$i]));
         <option <% $alt_folders[$i] eq $sent ? "SELECTED":"" %> value="<% $alt_folders[$i] |h %>"><% $displayname |h %></option>
% }
% for(my $i=0; $i <= $#$list; $i++) {
%     my $displayname = decode('utf8', $tr->decode($list->[$i]));
         <option <% ("$prefix" . $list->[$i]) eq $sent ? "SELECTED":"" %> value="<% "$prefix" . $list->[$i] |h %>"><% $displayname |h %></option>
% }
      </select>
      <p>Trash Folder:
      <select name="trash_folder">
         <option value="none">None (delete messages on purge)</option>
% for(my $i=0; $i <= $#alt_folders; $i++) { 
%     my $displayname = decode('utf8', $tr->decode($alt_folders[$i]));
         <option <% $alt_folders[$i] eq $trash ? "SELECTED":"" %> value="<% $alt_folders[$i] |h %>"><% $displayname |h %></option>
% }
% for(my $i=0; $i <= $#$list; $i++) {
%     my $displayname = decode('utf8', $tr->decode($list->[$i]));
         <option <% ("$prefix" . $list->[$i]) eq $trash ? "SELECTED":"" %> value="<% "$prefix" . $list->[$i] |h %>"><% $displayname |h %></option>
% }
      </select>
      <p>Drafts Folder:
      <select name="drafts_folder">
         <option value="none">None (you won't be able to save draft messages)</option>
% for(my $i=0; $i <= $#alt_folders; $i++) { 
%     my $displayname = decode('utf8', $tr->decode($alt_folders[$i]));
         <option <% $alt_folders[$i] eq $drafts ? "SELECTED":"" %> value="<% $alt_folders[$i] |h %>"><% $displayname |h %></option>
% }
% for(my $i=0; $i <= $#$list; $i++) {
%     my $displayname = decode('utf8', $tr->decode($list->[$i]));
         <option <% ("$prefix" . $list->[$i]) eq $drafts ? "SELECTED":"" %> value="<% "$prefix" . $list->[$i] |h %>"><% $displayname |h %></option>
% }
      </select>
      <p><input type="checkbox" name="delete_drafts" value="1" <% $delete_drafts ? "checked":"" |h %>>Automatically delete drafts once they are sent.
   </div>
   <div class="subheading">Subscribed Folders</div>
   <div class="section">
      <p>The following is a list of all available mail folders in your
      account. The checkbox indicates whether or not that folder will
      appear in your primary folder list along the left edge of the
      interface.</p>
% 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="foldereditor">
            <tr>
% my $ccnt = 0;
% for(my $i=0; $i <= $#$list; $i++) { 
%     my $displayname = decode('utf8', $tr->decode($list->[$i]));
               <td>
                  <input checked type="checkbox" name="subscribed" value="<% $list->[$i] |h %>">
                  <% $displayname |h %>
               </td>
%    if($ccnt % 3 == 2) {
            </tr><tr>
%    }
%        $ccnt++;
% }
            </tr>
         </table>
         <div class="control">
            <input type="submit" name="save" value="Save Changes">
         </div>
   </div>
</form>

<& /mail/footer.mhtml &>

<%init>
my $user = Apache2::SiteControl->getCurrentUser($r);
if(!$user || !$user->isa('Apache2::SiteControl::User')) {
   $logger->error("Unable to find a user for the given session key. r, m:" . Dumper($r, $m));
   $m->redirect("/");
}
my $js;
my $tr;
my $list;
my $slist;
my $c;
my $p;
my ($trash, $sent, $drafts, $altfolders, $delete_drafts);
my @alt_folders = ();
my ($prefix, $separator) = $config->getFolderPrefix($user);
$prefix .= $separator;

$delete_drafts = 1;

eval {
   $js = defined($user->getAttribute('credential_4')) ? $user->getAttribute('credential_4'):0;
   $tr = Unicode::IMAPUtf7->new();
   $c = new AlphaMail::Middleware($user->getAttribute('imap'), 
                               $user->getUsername(), 
                               $user->getAttribute('password'), $config);
   $p = new AlphaMail::Preferences($user, 
                                $user->getAttribute('mx'), $config);
   # Set reasonable defaults for stuff:
   $p->set('signature_on_top', $config->get('default_signature_on_top', 0));
   $p->set('icon_preview', $config->get('default_icon_preview', 1));
   $p->set('linkify', $config->get('default_linkify', 0));
   $p->set('messages_per_page', $config->get('default_messages_per_page', 10));
   $p->set('quicknav', $config->get('default_quicknav', 1));
   $p->set('delete_drafts', 1);

   $trash = $prefix . $p->get('trash_folder', $config->get("default_trash", 'none'));
   $sent = $prefix . $p->get('sent_folder', $config->get("default_sent", 'none'));
   $drafts = $prefix . $p->get('drafts_folder', $config->get("default_drafts", 'Drafts'));
   $altfolders = $p->get('alt_folders', '');
   @alt_folders = split /,/, $altfolders if($altfolders);

   # make sure the "defaults" at least exist.
   if($trash ne 'none') {
      eval {
         $c->makeFolder($trash);
      };
   }
   if($sent ne 'none') {
      eval {
         $c->makeFolder($sent);
      };
   }
   if($drafts ne 'none') {
      eval {
         $c->makeFolder($drafts);
      };
   }

   $list = $c->getFolderList($prefix);
   $slist = $c->getSubscribedFolderList($prefix);
   $logger->debug($user->getUsername() . ": Got folderlist: @$list");
   $logger->debug($user->getUsername() . ": Got subscribed folderlist: @$slist");

   # Remove the prefix for display
   map { s/^\Q$prefix\E//; } @$slist;
   map { s/^\Q$prefix\E//; } @$list;

   # Remove certain dot files
   @$slist = grep !/^\.im(ap|hoprefs)$/, @$slist;
   @$list = grep !/^\.im(ap|hoprefs)$/, @$list;

   # Sort them:
   @$slist = sort { lc($a) cmp lc($b) } @$slist;
   @$list = sort { lc($a) cmp lc($b) } @$list;
   @alt_folders = sort { lc($a) cmp lc($b) } @alt_folders;

   $c->close();
};
if($@) {
   my $error_msg = $@;
   my $log_entry = "Problem processing first login ";
   if($user && ref($user) eq 'SiteControl::User') {
      $log_entry .= "for user " . $user->getUsername() . ".\n";
   }
   $log_entry .= "Error was: $error_msg";
   $logger->error($user->getUsername() . ":" . $log_entry) if($logger);
   $m->redirect($base_uri); # Retry login
}
</%init>
<%once>
use Data::Dumper;
use Encode;
our $logger = Log::Log4perl->get_logger('alphamail');
our $base_uri = $config->get('base_uri');
</%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

  addressbook/
    edit.mhtml
    import.mhtml
    import_complete.html
    import_csv.html
    import_csv_save.html
    import_fname.html
    import_imho.html
    import_lname.html
    index.html
    lists.mhtml
    process_edit.html
    process_lists.html
    process_take.html
    take.html
  admin/
    autohandler
    guide.html
    index.html
    quotas.jpg
    show_stats.mhtml
    test.mhtml
  docs/
    faq/
      attach1.gif
      attach2.gif
      attach3.gif
      colors.gif
      dates1.gif
      drafts.gif
      filter.gif
      index.html
      notrash1.gif
      notrash2.gif
      notrash3.gif
      other.html
      sort.gif
      timeout.gif
    index.html
    new_features.html
  settings/
    add_filter.html
    altfolder_update.html
    altprefix_update.html
    edit_folders.html
    export.mhtml
    export_mail.html
    filters.mhtml
    folders.mhtml
    general.mhtml
    index.html
    share.mhtml
    sharing_agree.html
    signatures.mhtml
    update_folderlist.html
    update_general.html
    update_signatures.html
  viewers/
    excel.html
    html.html
    targz.html
    text.html
    word.html
    zip.html
  address_mail.html
  addresslist.html
  autohandler
  check_spelling.html
  compose.html
  feedback.html
  first_login.html
  fix_spelling.html
  folderlist.mhtml
  footer.mhtml
  get_attachment.html
  header.mhtml
  help.html
  index.html
  logout.html
  menu.mhtml
  other_folders.html
  process_compose.html
  process_first_login.html
  process_messages.html
  process_read_message.html
  process_search.html
  quota.html
  quota_graph.html
  raw.html
  read.html
  remove_attachment.html
  renew_session.html
  resume_compose.html
  sanitized.html
  share_options.html
  share_upload.html
  verify_password.html
  view_attachment.html