Code Search for Developers
 
 
  

compose.html from AlphaMail at Krugle


Show compose.html syntax highlighted

% # vim: set syntax=mason: 
<%args>
$to => ''
$cc => ''
$bcc => ''
$subject => ''
$message => ''
$forward => ''
$ref => '' # A reference to the message you are forwarding
@attachments => ()
@sizes => ()
$error => 0
$reply => 0
$new => 0
$richtext => 0
</%args>
<& /mail/header.mhtml, message => $error, title => 'Compose', compose => 1 &>
   <form method="post" action="/mail/process_compose.html" 
         id="header" name="compose_form"
         onSubmit="return submitForm();"
         enctype="multipart/form-data">
      <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"> 
      </div>
      <table class="composition_form">
         <tr>
            <td class="composition_field_label">
               <div class="composition_field_label">
                  To:
               </div>
            </td>
            <td>
               <input id="to" type="text" class="addr_field" name="to" value="<% $to |h %>">
%#               <DIV ID="CompletionBox" STYLE="position: relative; width: 640px; background: rgb(200,200,200); top:50; left:0;"></DIV>
            </td>
         </tr><tr>
            <td class="composition_field_label">
               <div class="composition_field_label">
                  Cc:
               </div>
            </td>
            <td>
               <div class="composition_input">
                  <input class="addr_field" type="text" name="cc" size="80" value="<% $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 class="addr_field" type="text" name="bcc" size="80" value="<% $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="<% $subject |h %>" type="text" name="subject" size="80">
               </div>
            </td>
         </tr>
         <tr>
            <td colspan="2">
% if($richtext) {
               <input type="hidden" name="richtext" value="<% $richtext %>">
% my $tmp = $message; $tmp =~ s/['"\x91\x92\x93\x94]/&#39;/g; $tmp =~ s/(?!<br>)[\n\r]+/<br>/g; # '
               <script language="JavaScript" type="text/javascript">
                  <!--
                  function submitForm() {
                     updateRTE('message');
                     return true;
                  }
                  var to_field = document.getElementById('to');
                  if(to_field.offsetWidth > 0) {
                     writeRichText('message', '<% $tmp %>', to_field.offsetWidth, 400, true, false);
                  } else {
                     writeRichText('message', '<% $tmp %>', 800, 400, true, false);
                  }
                  //-->
               </script>
% } else {
               <textarea class="message_field" rows="20" name="message"><% $message |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"> 
         <p>To attach a file, click on Browse to find the file, then press
         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">
         <input type="hidden" name="ref" value="<% $ref |h %>">
         <input type="hidden" name="reply" value="<% $reply |h %>">
% if($forward || @attachments) {
         <input type="hidden" name="forward" value="<% $forward |h %>">
         <table class="attachments">
            <tr>
               <th>
                  Attachment
               </th>
               <th>
                  Size
               </th>
            </tr>
%    if($forward) {
            <tr>
               <td>
                  Forwarded message (complete with attachments)
               </td>
               <td>&nbsp;</td>
            </tr>
%    }
%    my $total = 0;
%    for(my $i =0; $i < $#attachments+1; $i++) { $total += $sizes[$i];
            <tr>
               <td>
                  <% $attachments[$i] %> 
                  <input type="hidden" name="attachments" value="<% $attachments[$i] |h %>">
                  <input type="hidden" name="sizes" value="<% $sizes[$i] |h %>">
               </td>
               <td>
                  <% $sizes[$i] %> bytes
                  <a href="<% build_url('/mail/remove_attachment.html',
                     { attachment => $i }) %>">remove</a>
               </td>
            </tr>
%    }
               <tr>
                  <th>
                     Total
                  </th>
                  <th>
                     <% $total %> (<% $config->get('max_message_size') - $total %> remaining)
                  </th>
               </tr>
% }
         </table>
      </div>
   </form>
% if(!$richtext) {
   <script language="javascript">
      <!--
      // Put the cursor at the beginning of the composition
      document.forms[0].message.selectionStart = 0;
      document.forms[0].message.selectionEnd = 0;
      // -->
   </script>
% }
<& /mail/footer.mhtml &>
<%init>
my $logger = Log::Log4perl->get_logger('alphamail');
my $user = Apache::SiteControl->getCurrentUser($r);
my $folder = $user->getAttribute('lastfolder') || 'inbox';
#my $book = new AlphaMail::AddressBook($user->getUsername(), $user->getAttribute('imap'), $config);
my $sigs = new AlphaMail::Signature($user->getUsername(), $user->getAttribute('imap'), $config);
#my $ab = $book->get;
#my $jsinit;

if($new) { # Force a new composition
   clear_composition($r, $user, $config);
}

# If we have incoming data, clear any old composition and save the new:
if($to || $cc || $bcc || $subject || @attachments || $message || $richtext) {
   # Fix parameter encodings!
   $to = Encode::decode_utf8($to);
   $cc = Encode::decode_utf8($cc);
   $bcc = Encode::decode_utf8($bcc);
   $subject = Encode::decode_utf8($subject);
   $message = Encode::decode_utf8($message);
   my @a = ();
   for my $a (@attachments) {
      push @a, Encode::decode_utf8($a);
   }
   @attachments = @a;

   $logger->debug("Clearing composition");
   clear_composition($r, $user, $config);
   $logger->debug("Saving composition");
   save_composition($r, $user, $to, $cc, $bcc, $subject, $message, 
                    $reply, $forward, $ref, \@attachments, \@sizes, $richtext);
} else { # Load any existing composition
   $logger->debug("Loading composition");
   my $composition = load_composition($r, $user);
   $to = $composition->{to};
   $cc = $composition->{cc};
   $bcc = $composition->{bcc};
   $ref = $composition->{"ref"};
   $forward = $composition->{forwardflag};
   $reply = $composition->{replyflag};
   $subject = $composition->{subject};
   $message = $composition->{message};
   @attachments = @{$composition->{attachments}} if($composition->{attachments});
   @sizes = @{$composition->{sizes}} if($composition->{sizes});
   $richtext = $composition->{richtext};
}

if(!$message) {
   $message = "\n" . $sigs->getSignature;
}

local $" = ", ";

#for my $k (keys %$ab) {
#   $jsinit .= qq("@{$ab->{$k}} ($k)",);
#}
#$jsinit =~ s/,\s*$//;

</%init>
<%once>
use AlphaMail::SessionUtil qw(save_composition load_composition clear_composition);
</%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_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
    take.html
  settings/
    altfolder_update.html
    edit_folders.html
    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
    word.html
    zip.html
  address_mail.html
  addresslist.mhtml
  autohandler
  check_spelling.html
  compose.html
  filevault.html
  first_login.html
  fix_spelling.html
  folderlist.mhtml
  footer.mhtml
  get_attachment.html
  header.mhtml
  index.html
  logout.html
  menu.mhtml
  other_folders.html
  print.html
  process_compose.html
  process_first_login.html
  process_messages.html
  read.html
  remove_attachment.html
  renew_session.html
  share_options.html
  share_upload.html
  verify_password.html
  view_attachment.html