Code Search for Developers
 
 
  

compose.html from AlphaMail at Krugle


Show compose.html syntax highlighted

% # vim: set syntax=mason: 
<%args>
$to => ''
$subject => ''
$new => 0
$message => ''
</%args>
<& /mail/header.mhtml, message => $message, title => 'Compose', compose => 1 &>
% if($user->getAttribute('javascript')) {
   <script type="text/javascript" language="JavaScript">
      <!--
      var collection = [ <% join(",\n", map { qq(") . mimewords_to_utf8($_) . qq(") } @addresses) %> ];

      function checkForm() {
         answer = true;
         if(typeof(siw) != "undefined")
            if(siw && typeof(siw.selectingSomething) != "undefined")
               if(siw.selectingSomething)
                  answer = false;
         return answer;
      }
      // -->
   </script>
% } 
   <form method="post" action="<% $base %>/mail/process_compose.html" 
         id="header" name="compose_form"
         onSubmit="return checkForm()"
         enctype="multipart/form-data">
      <div class="controls">
         <!-- "Invisible" button used to prevent sends when a users hits enter
              in some browsers -->
         <input style="position: absolute; top: -40px; left:-40px; width: 0px; height: 0px;" name="noop" type="submit" value="">
         <input name="send" type="submit" value="Send Message">
         <input type="submit" name="address" value="Use Address Book"> 
         <input type="submit" name="spellcheck" value="Check Spelling"> 
% if($drafts ne 'none') {
         <input type="submit" name="save" value="Save Draft"> 
% }
         <input type="submit" name="cancel" value="Cancel"> 
      </div>
      <table onkeydown="return suppressArrows(event)" class="composition_form">
         <tr>
            <td class="composition_field_label">
               <div class="composition_field_label">
                  To:
               </div>
            </td>
            <td>
               <div class="composition_input">
               <input autocomplete="off" type="text" class="wickEnabled" id="to" name="to" value="<% $composition->{to} |h %>">
               </div>
            </td>
         </tr><tr>
            <td class="composition_field_label">
               <div class="composition_field_label">
                  Cc:
               </div>
            </td>
            <td>
               <div class="composition_input">
                  <input autocomplete="off" type="text" class="wickEnabled" name="cc" value="<% $composition->{cc} |h %>">
               </div>
            </td>
         </tr><tr>
            <td class="composition_field_label">
               <div class="composition_field_label">
                  Bcc:
               </div>
            </td>
            <td>
               <div class="composition_input">
                  <input autocomplete="off" type="text" class="wickEnabled" name="bcc" value="<% $composition->{bcc} |h %>">
               </div>
            </td>
         </tr>
         <tr>
            <td class="composition_field_label">
               <div class="composition_field_label">
                  Subject:
               </div>
            </td>
            <td>
               <div class="composition_input">
                  <input class="addr_field" name="subject" value="<% $composition->getSubject() |h %>" type="text" size="80">
               </div>
            </td>
         </tr>
         <tr>
            <td colspan="2">
               <textarea onfocus="ie_cursorhack()" class="message_field" rows="20" cols="72" name="body" id="body"><% $composition->getBody |h %></textarea>
            </td>
         </tr>
      </table>
      <div class="controls">
         <input name="send" type="submit" value="Send Message">
         <input type="submit" name="address" value="Use Address Book"> 
         <input type="submit" name="spellcheck" value="Check Spelling"> 
% if($drafts ne 'none') {
         <input type="submit" name="save" value="Save Draft"> 
% }
         <input type="submit" name="cancel" value="Cancel"> 
         <p>To attach a file, first choose a file and then
         click Attach. Your total message size is limited to 
         <% $config->get('max_message_size') %> 
         bytes.</p>
         <input type="file" name="file">
         <input type="submit" name="attach" value="Attach">
% if($composition->hasAttachments()) {
         <table class="attachments">
            <tr>
               <th>
                  Attachment
               </th>
               <th>
                  Encoded Size
               </th>
            </tr>
%    for(my $i =0; $i < @{$attachments}; $i++) {
            <tr>
               <td>
                  <% mimewords_to_utf8($attachments->[$i]{filename}) |h %> 
               </td>
               <td>
                  <% $attachments->[$i]{size} %> bytes
                  <a href="<% build_url("$base/mail/remove_attachment.html",
                     { attachment => $i }) %>">remove</a>
               </td>
            </tr>
%    }
               <tr>
                  <th>
                     Total
                  </th>
                  <th>
                     <% $composition->getSize() %> (<% $config->get('max_message_size') - $composition->getSize() %> remaining)
                  </th>
               </tr>
         </table>
% }
      </div>
   </form>
   <script type="text/javascript" language="javascript">
      <!--
      // Put the cursor at the beginning of the composition
      var theBody = document.getElementById('body');
      var firstfld = document.getElementById('to');
      var posset = 0;
      theBody.selectionStart = 0;
      theBody.selectionEnd = 0;
      firstfld.focus();
      firstfld.select();

      function ie_cursorhack()
      {
         if(posset) return;
         posset = 1;

         if(theBody.createTextRange) { 
            var range = theBody.createTextRange();
            range.collapse(true);
            range.select();
         }
      }
      // -->
   </script>
   <script type="text/javascript" language="JavaScript" src="<% $base %>/static/wick.js"></script>
<& /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 $folder = $user->getAttribute('lastfolder') || 'inbox';
my $book = new AlphaMail::AddressBook($user->getUsername(), $user->getAttribute('mx'), $config);
my $addresses = $book->get_all->{addresses};
my $lists = $book->get_all->{lists};
my @addresses;
my $reply_address;
my $prefs = new AlphaMail::Preferences($user->getUsername(), 
                                   $user->getAttribute('mx'), $config);
my ($cc, $bcc);
my $attachments;
my $drafts = $prefs->get('drafts_folder', $config->get("default_drafts", 'none'));
my $composition = new AlphaMail::Message($user, $config);
if($new || $to || $subject) { # Incoming subject/to field. Force a new composition
   $composition->setBody('');
   $composition->setAddresses($to, '', '');
   $composition->setSubject($subject);
   $composition->save();
} else {
   $composition->load();
   $logger->debug("Loading composition");
   ($to, $cc, $bcc) = $composition->getAddresses();
   $subject = $composition->getSubject;
   $attachments = $composition->getAttachments;
} 

if($prefs->get('replyto') =~ m/\@/) {
   $reply_address = $prefs->get('replyto');
} else {
   $reply_address = $user->getUsername() . '@' . $user->getAttribute('mx');
}

for my $k (keys %$addresses) 
{
   push @addresses, $addresses->{$k}->format;
}

for my $k (keys %$lists) {
   push @addresses, $k;
}

map { s/"/\\"/g } @addresses;

</%init>
<%once>
use AlphaMail::MailTool qw(mimewords_to_utf8);
use Encode;
our $logger = Log::Log4perl->get_logger('alphamail');
our $base = $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
    index.html
    show_stats.mhtml
    test.mhtml
  docs/
    faq/
      colors.gif
      dates1.gif
      drafts.gif
      filter.gif
      general.html
      index.html
      notrash1.gif
      notrash2.gif
      notrash3.gif
      other.html
      sort.gif
      timeout.gif
    new_features.html
  settings/
    add_filter.html
    altfolder_update.html
    altprefix_update.html
    edit_folders.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
  error.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