Move PHP logic out of DIMP templates.
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 1 Oct 2010 08:04:30 +0000 (02:04 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 1 Oct 2010 19:42:06 +0000 (13:42 -0600)
imp/compose-dimp.php
imp/config/hooks.php.dist
imp/js/compose-dimp.js
imp/lib/Views/Compose.php
imp/message-dimp.php
imp/templates/dimp/chunks/compose.php [deleted file]
imp/templates/dimp/chunks/message.php [deleted file]
imp/templates/dimp/compose/compose-base.html [new file with mode: 0644]
imp/templates/dimp/compose/compose.html
imp/templates/dimp/message/message.html [new file with mode: 0644]
imp/themes/dimp/screen.css

index 7b6d7d0..7f8fe8c 100644 (file)
@@ -251,7 +251,7 @@ if (!($prefs->isLocked('default_encrypt')) &&
 
 IMP::status();
 IMP_Dimp::header($title, $scripts);
-echo $t->fetch(IMP_TEMPLATES . '/dimp/compose/compose.html');
+echo $t->fetch(IMP_TEMPLATES . '/dimp/compose/compose-base.html');
 Horde::includeScriptFiles();
 Horde::outputInlineScript();
 echo "</body>\n</html>";
index 3c46f31..e2520ec 100644 (file)
@@ -725,7 +725,7 @@ class IMP_Hooks
     /**
      * DIMP: Allow additional information to be added to the array that is
      * passed to the message text display template:
-     *   imp/templates/dimp/chunks/message.php.
+     *   imp/templates/dimp/message/message.html.
      *
      * @param array $msg  The current entry array (see the showMessage()
      *                    function in lib/Views/ShowMessage.php for the
index daebfec..315540e 100644 (file)
@@ -18,13 +18,21 @@ var DimpCompose = {
 
     confirmCancel: function()
     {
+        var cc,
+            sbd = $('send_button_redirect');
+
         if (window.confirm(DIMP.text_compose.cancel)) {
             if ((this.is_popup || DIMP.conf_compose.popup) &&
                 DimpCore.base &&
                 !DIMP.conf_compose.qreply) {
                 DimpCore.base.focus();
             }
-            DimpCore.doAction(DIMP.conf_compose.auto_save_interval_val ? 'deleteDraft' : 'cancelCompose', { imp_compose: $F('composeCache') }, { ajaxopts: { asynchronous: DIMP.conf_compose.qreply } });
+
+            cc = (sbd && sbd.visible())
+                ? $F('composeCacheRedirect')
+                : $F('composeCache');
+
+            DimpCore.doAction(DIMP.conf_compose.auto_save_interval_val ? 'deleteDraft' : 'cancelCompose', { imp_compose: cc }, { ajaxopts: { asynchronous: DIMP.conf_compose.qreply } });
             this.updateDraftsMailbox();
             return this.closeCompose();
         }
index 701b9c4..07b050f 100644 (file)
@@ -33,31 +33,32 @@ class IMP_Views_Compose
      */
     static public function showCompose($args)
     {
+        global $conf, $injector, $prefs, $registry;
+
         $result = array(
             'html' => '',
             'js' => array(),
             'jsonload' => array()
         );
 
-        $compose_html = $redirect = $rte = false;
+        $t = $injector->createInstance('Horde_Template');
+        $t->setOption('gettext', true);
 
-        if (empty($args['composeCache'])) {
-            $composeCache = null;
-        } else {
-            $imp_compose = $GLOBALS['injector']->getInstance('IMP_Compose')->getOb($args['composeCache']);
-            $composeCache = $args['composeCache'];
+        if (!empty($args['composeCache'])) {
+            $imp_compose = $injector->getInstance('IMP_Compose')->getOb($args['composeCache']);
+            $t->set('composeCache', $args['composeCache']);
         }
 
         if (empty($args['redirect'])) {
             /* Load Identity. */
-            $identity = $GLOBALS['injector']->getInstance('IMP_Identity');
-            $selected_identity = $identity->getDefault();
+            $identity = $injector->getInstance('IMP_Identity');
+            $t->set('selected_identity', intval($identity->getDefault()));
 
             /* Generate identities list. */
-            $imp_ui = $GLOBALS['injector']->getInstance('IMP_Ui_Compose');
+            $imp_ui = $injector->getInstance('IMP_Ui_Compose');
             $result['js'] = array_merge($result['js'], $imp_ui->identityJs());
 
-            if ($composeCache &&
+            if ($t->get('composeCache') &&
                 $imp_compose->numberOfAttachments()) {
                 foreach ($imp_compose->getAttachments() as $num => $atc) {
                     $mime = $atc['part'];
@@ -66,7 +67,7 @@ class IMP_Views_Compose
                         'num' => intval($num),
                         'size' => $mime->getSize(),
                         'type' => $mime->getType()
-                    ), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+                    ), Horde_Serialize::JSON, $registry->getCharset());
                     $result['jsonload'][] = 'DimpCompose.addAttach(' . $opts . ')';
                 }
             }
@@ -76,16 +77,16 @@ class IMP_Views_Compose
             }
 
             if ($_SESSION['imp']['rteavail']) {
-                $compose_html = $GLOBALS['prefs']->getValue('compose_html');
-                $rte = true;
+                $t->set('compose_html', $prefs->getValue('compose_html'));
+                $t->set('rte', true);
 
-                $imp_ui->initRTE(!$compose_html);
+                $imp_ui->initRTE(!$t->get('compose_html'));
             }
 
             /* Create list for sent-mail selection. */
-            if (!empty($GLOBALS['conf']['user']['select_sentmail_folder']) &&
-                !$GLOBALS['prefs']->isLocked('sent_mail_folder')) {
-                $imp_folder = $GLOBALS['injector']->getInstance('IMP_Folder');
+            if (!empty($conf['user']['select_sentmail_folder']) &&
+                !$prefs->isLocked('sent_mail_folder')) {
+                $imp_folder = $injector->getInstance('IMP_Folder');
 
                 /* Check to make sure the sent-mail folders are created - they
                  * need to exist to show up in drop-down list. */
@@ -97,7 +98,7 @@ class IMP_Views_Compose
                 }
 
                 $flist = array();
-                $imaptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree');
+                $imaptree = $injector->getInstance('IMP_Imap_Tree');
 
                 foreach ($imaptree as $val) {
                     $tmp = array(
@@ -114,17 +115,70 @@ class IMP_Views_Compose
                     'DIMP.conf_compose.flist' => $flist
                 ), true));
             }
+
+            $compose_link = Horde::getServiceLink('ajax', 'imp');
+            $compose_link->pathInfo = 'addAttachment';
+            $t->set('compose_link', $compose_link);
+
+            $t->set('send_button', IMP_Dimp::actionButton(array(
+                'icon' => 'Forward',
+                'id' => 'send_button',
+                'title' => _("Send")
+            )));
+            $t->set('spell_button', IMP_Dimp::actionButton(array(
+                'icon' => 'Spellcheck',
+                'id' => 'spellcheck',
+                'title' => _("Check Spelling")
+            )));
+            $t->set('draft_button', IMP_Dimp::actionButton(array(
+                'icon' => 'Drafts',
+                'id' => 'draft_button',
+                'title' => _("Save as Draft")
+            )));
+
+            $d_read = $prefs->getValue('disposition_request_read');
+            if ($conf['compose']['allow_receipts'] &&
+                ($d_read != 'never')) {
+                $t->set('read_receipt', true);
+                $t->set('read_receipt_set', $d_read != 'ask');
+            }
+
+            $t->set('save_sent_mail', ($conf['user']['allow_folders'] && !$prefs->isLocked('save_sent_mail')));
+            $t->set('priority', $prefs->getValue('set_priority'));
+            if (!$prefs->isLocked('default_encrypt') &&
+                ($prefs->getValue('use_pgp') || $prefs->getValue('use_smime'))) {
+                $t->set('encrypt', IMP::ENCRYPT_NONE);
+            }
+
+            $select_list = array();
+            foreach ($identity->getSelectList() as $id => $from) {
+                $select_list[] = array(
+                    'label' => htmlspecialchars($from),
+                    'sel' => ($id == $t->get('selected_identity')),
+                    'val' => htmlspecialchars($id)
+                );
+            }
+            $t->set('select_list', $select_list);
+
+            $save_attach = $prefs->getValue('save_attachments');
+            if (strpos($save_attach, 'prompt') !== false) {
+                $t->set('save_attach', true);
+                $t->set('save_attach_set', strpos($save_attach, 'yes') !== false);
+            }
         } else {
             $result['js'] = array_merge($result['js'], Horde::addInlineJsVars(array(
                 '-DIMP.conf_compose.redirect' => 1
             ), true));
-            $redirect = true;
         }
 
-        // Buffer output so that we can return a string from this function
-        Horde::startBuffer();
-        require IMP_TEMPLATES . '/dimp/chunks/compose.php';
-        $result['html'] .= Horde::endBuffer();
+        $t->set('compose_enable', IMP::canCompose());
+        $t->set('forminput', Horde_Util::formInput());
+        $t->set('redirect_button', IMP_Dimp::actionButton(array(
+            'icon' => 'Forward',
+            'id' => 'send_button_redirect',
+            'title' => _("Redirect")
+        )));
+        $result['html'] = $t->fetch(IMP_TEMPLATES . '/dimp/compose/compose.html');
 
         return $result;
     }
index c88c7ea..6afe93c 100644 (file)
@@ -114,10 +114,85 @@ Horde::addInlineScript(array_filter($js_onload), 'load');
 
 Horde::noDnsPrefetch();
 
+$t = $injector->createInstance('Horde_Template');
+$t->setOption('gettext', true);
+
+$t->set('reply_button', IMP_Dimp::actionButton(array(
+    'class' => 'hasmenu',
+    'icon' => 'Reply',
+    'id' => 'reply_link',
+    'title' => _("Reply")
+)));
+$t->set('forward_button', IMP_Dimp::actionButton(array(
+    'class' => 'hasmenu',
+    'icon' => 'Forward',
+    'id' => 'forward_link',
+    'title' => _("Forward")
+)));
+
+if (!empty($conf['spam']['reporting']) &&
+    (!$conf['spam']['spamfolder'] ||
+     ($vars->folder != IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
+    $t->set('spam_button', IMP_Dimp::actionButton(array(
+        'icon' => 'Spam',
+        'id' => 'button_spam',
+        'title' => _("Spam")
+    )));
+}
+
+if (!empty($conf['notspam']['reporting']) &&
+    (!$conf['notspam']['spamfolder'] ||
+    ($vars->folder == IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
+    $t->set('ham_button', IMP_Dimp::actionButton(array(
+        'icon' => 'Ham',
+        'id' => 'button_ham',
+        'title' => _("Innocent")
+    )));
+}
+
+if (!$readonly) {
+    $t->set('delete_button', IMP_Dimp::actionButton(array(
+        'icon' => 'Delete',
+        'id' => 'button_deleted',
+        'title' => _("Delete")
+    )));
+}
+
+$t->set('view_source', !empty($conf['user']['allow_view_source']));
+$t->set('save_as', $show_msg_result['save_as']);
+$t->set('subject', $show_msg_result['subject']);
+
+$hdrs = array();
+foreach ($show_msg_result['headers'] as $val) {
+    $hdrs[] = array_filter(array(
+        'id' => (isset($val['id']) ? 'msgHeader' . $val['id'] : null),
+        'label' => $val['name'],
+        'val' => $val['value']
+    ));
+}
+$t->set('hdrs', $hdrs);
+
+if (isset($show_msg_result['atc_label'])) {
+    $t->set('atc_label', $show_msg_result['atc_label']);
+    if (isset($show_msg_result['atc_list'])) {
+        $t->set('atc_list', $show_msg_result['atc_list']);
+    }
+    $t->set('atc_download', isset($show_msg_result['atc_download']) ? $show_msg_result['atc_download'] : '');
+}
+
+$t->set('msgtext', $show_msg_result['msgtext']);
+
+if (!$disable_compose) {
+    $t->set('html', $compose_result['html']) {
+    $t->set('reply_list', $show_msg_result['list_info']['exists']);
+    $t->set('forward_select', !$prefs->isLocked('forward_default'));
+}
+
 IMP::status();
 IMP_Dimp::header($show_msg_result['title'], $scripts);
-echo "<body>\n";
-require IMP_TEMPLATES . '/dimp/chunks/message.php';
+
+echo $t->fetch(IMP_TEMPLATES . '/dimp/message/message.html');
+
 Horde::includeScriptFiles();
 Horde::outputInlineScript();
 echo "</body>\n</html>";
diff --git a/imp/templates/dimp/chunks/compose.php b/imp/templates/dimp/chunks/compose.php
deleted file mode 100644 (file)
index dbadbd1..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/**
- * compose.php - Used by IMP_Views_Compose:: to render the compose screen.
- *
- * Variables passed in from calling code:
- *   $compose_html, $from, $id, $identity, $composeCache, $rte,
- *   $selected_identity
- *
- * Copyright 2005-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- */
-
-$d_read = $GLOBALS['prefs']->getValue('disposition_request_read');
-$encrypt_list = (!$GLOBALS['prefs']->isLocked('default_encrypt') && ($GLOBALS['prefs']->getValue('use_pgp') || $GLOBALS['prefs']->getValue('use_smime')));
-$save_attach = $GLOBALS['prefs']->getValue('save_attachments');
-
-/* Determine if compose mode is disabled. */
-$compose_disable = !IMP::canCompose();
-
-$compose_link = Horde::getServiceLink('ajax', 'imp');
-$compose_link->pathInfo = 'addAttachment';
-
-?>
-<?php if (!$redirect): ?>
-<form id="compose" name="compose" enctype="multipart/form-data" action="<?php echo $compose_link ?>" method="post" target="submit_frame">
-<?php echo Horde_Util::formInput() ?>
-<input type="hidden" id="last_identity" name="last_identity" value="<?php echo (int)$selected_identity ?>" />
-<input type="hidden" id="html" name="html" value="<?php echo intval($rte && $compose_html) ?>" />
-<input type="hidden" id="composeCache" name="composeCache" value="<?php echo $composeCache ?>" />
-
-<div class="dimpActions dimpActionsCompose">
-<?php if (!$compose_disable): ?>
- <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Forward', 'id' => 'send_button', 'title' => _("Send"))); ?></div>
-<?php endif; ?>
- <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Spellcheck', 'id' => 'spellcheck', 'title' => _("Check Spelling"))); ?></div>
- <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Drafts', 'id' => 'draft_button', 'title' => _("Save as Draft"))); ?></div>
-</div>
-
-<div id="writemsg">
- <div class="msgwrite">
-  <div class="dimpOptions">
-   <div id="togglecc">
-    <label>
-     <input name="togglecc" type="checkbox" class="checkbox" /> <?php echo _("Show Cc") ?>
-    </label>
-   </div>
-   <div id="togglebcc">
-    <label>
-     <input name="togglebcc" type="checkbox" class="checkbox" /> <?php echo _("Show Bcc") ?>
-    </label>
-  </div>
-<?php if ($rte): ?>
-   <div>
-    <label>
-     <input id="htmlcheckbox" type="checkbox" class="checkbox"<?php if ($compose_html) echo 'checked="checked"' ?> /> <?php echo _("HTML composition") ?>
-    </label>
-   </div>
-<?php endif; ?>
-<?php if ($GLOBALS['conf']['compose']['allow_receipts'] && $d_read != 'never'): ?>
-   <div>
-    <label>
-     <input name="request_read_receipt" type="checkbox" class="checkbox"<?php if ($d_read != 'ask') echo ' checked="checked"' ?> /> <?php echo _("Read Receipt") ?>
-    </label>
-   </div>
-<?php endif; ?>
-<?php if ($GLOBALS['conf']['user']['allow_folders'] && !$GLOBALS['prefs']->isLocked('save_sent_mail')): ?>
-   <div style="display:none">
-    <label>
-     <input id="save_sent_mail" name="save_sent_mail" type="checkbox" class="checkbox" /> <?php echo _("Save in") ?>
-     <span id="sent_mail_folder_label"></span>
-    </label>
-    <input id="save_sent_mail_folder" name="save_sent_mail_folder" type="hidden" />
-   </div>
-<?php endif; ?>
-<?php if ($GLOBALS['prefs']->getValue('set_priority')): ?>
-   <div>
-    <?php echo _("Priority:") ?> <span id="priority_label"></span>
-    <input id="priority" name="priority" type="hidden" value="normal" />
-   </div>
-<?php endif; ?>
-<?php if ($encrypt_list): ?>
-   <div>
-    <?php echo _("Encryption:") ?> <span id="encrypt_label"></span>
-    <input id="encrypt" name="encrypt" type="hidden" value="<?php echo IMP::ENCRYPT_NONE ?>" />
-   </div>
-<?php endif; ?>
-  </div>
-  <table>
-   <tr>
-    <td class="label"><?php echo _("From: ") ?></td>
-    <td>
-     <select id="identity" name="identity">
-<?php foreach ($identity->getSelectList() as $id => $from): ?>
-      <option value="<?php echo htmlspecialchars($id) ?>"<?php if ($id == $selected_identity) echo ' selected="selected"' ?>><?php echo htmlspecialchars($from) ?></option>
-<?php endforeach; ?>
-     </select>
-    </td>
-   </tr>
-   <tr id="sendto">
-    <td class="label"><span><?php echo _("To: ") ?></span></td>
-    <td>
-     <textarea id="to" name="to" rows="1" cols="75"></textarea>
-     <span id="to_loading_img" class="loadingImg" style="display:none"></span>
-    </td>
-   </tr>
-   <tr id="sendcc" style="display:none">
-    <td class="label"><span><?php echo _("Cc: ") ?></span></td>
-    <td>
-     <textarea id="cc" name="cc" rows="1" cols="75"></textarea>
-     <span id="cc_loading_img" class="loadingImg" style="display:none"></span>
-    </td>
-   </tr>
-   <tr id="sendbcc" style="display:none">
-    <td class="label"><span><?php echo _("Bcc: ") ?></span></td>
-    <td>
-     <textarea id="bcc" name="bcc" rows="1" cols="75"></textarea>
-     <span id="bcc_loading_img" class="loadingImg" style="display:none"></span>
-    </td>
-   </tr>
-   <tr>
-    <td class="label"><?php echo _("Subject: ") ?></td>
-    <td class="subject"><input type="text" id="subject" name="subject" /></td>
-   </tr>
-   <tr class="atcrow">
-    <td class="label"><span class="iconImg attachmentImg"></span>: </td>
-    <td id="attach_cell">
-     <span id="upload_limit" style="display:none"><?php echo _("The attachment limit has been reached.") ?></span>
-     <span id="upload_wait" style="display:none"></span>
-     <span>
-      <input type="file" id="upload" name="file_1" />
-     </span>
-<?php if (strpos($save_attach, 'prompt') !== false): ?>
-     <label style="display:none"><input type="checkbox" class="checkbox" name="save_attachments_select"<?php if (strpos($save_attach, 'yes') !== false) echo ' checked="checked"' ?> /> <?php echo _("Save Attachments in sent folder") ?></label><br />
-<?php endif; ?>
-     <ul id="attach_list" style="display:none"></ul>
-    </td>
-   </tr>
-   <tr id="noticerow" style="display:none">
-    <td colspan="2">
-     <ul class="notices">
-      <li id="replyallnotice" style="display:none"><span class="iconImg closeImg"></span><?php echo _("You are currently replying to ALL recipients. Click here to reply to the original sender instead.") ?></li>
-      <li id="replylistnotice" style="display:none"><span class="iconImg closeImg"></span><?php echo _("You are currently replying to the mailing list. Click here to reply to the original sender instead.") ?></li>
-      <li id="fwdattachnotice" style="display:none"><span class="iconImg closeImg"></span><?php echo _("Click here to add the original message text to the body.") ?></li>
-      <li id="fwdbodynotice" style="display:none"><span class="iconImg closeImg"></span><?php echo _("Click here to add the original message as an attachment.") ?></li>
-      <li id="identitychecknotice" style="display:none"><span class="iconImg closeImg"></span><?php echo _("Your identity has been switched to the identity associated with the current recipient address. Click here to revert to the original identity. The identity will not be checked again during this compose action.") ?></li>
-     </ul>
-    </td>
-   </tr>
-  </table>
- </div>
-
- <div id="composeMessageParent">
-  <textarea name="message" rows="20" id="composeMessage" class="fixed"></textarea>
- </div>
-</div>
-</form>
-<?php endif; // !$redirect ?>
-
-<?php if (!$compose_disable): ?>
-<form id="redirect" name="redirect" style="display:none">
- <input type="hidden" id="composeCache" name="composeCache" value="<?php echo $composeCache ?>" />
-<?php echo Horde_Util::formInput() ?>
- <div class="msgwrite">
-  <div class="dimpActions dimpActionsCompose">
-   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Forward', 'id' => 'send_button_redirect', 'title' => _("Redirect"))); ?></div>
-  </div>
- <table>
-  <tr id="redirect_sendto">
-   <td class="label"><span><?php echo _("To: ") ?></span></td>
-   <td>
-    <textarea id="redirect_to" name="redirect_to" rows="1" cols="75"></textarea>
-    <span id="redirect_to_loading_img" class="loadingImg" style="display:none"></span>
-   </td>
-  </tr>
- </table>
- </div>
-</form>
-<?php endif; ?>
-
-<span id="sendingImg" class="loadingImg" style="display:none"></span>
-
-<iframe name="submit_frame" id="submit_frame" style="display:none" src="javascript:false;"></iframe>
diff --git a/imp/templates/dimp/chunks/message.php b/imp/templates/dimp/chunks/message.php
deleted file mode 100644 (file)
index 06637fe..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-/**
- * Dynamic view (dimp) compose template.
- *
- * Copyright 2005-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- */
-?>
-<div id="dimpLoading"><?php echo _("Loading...") ?></div>
-<div id="pageContainer" style="display:none">
- <div id="msgData">
-  <div class="dimpActions dimpActionsMsg">
-   <div class="headercloseimg closeImg" id="windowclose" title="X"></div>
-   <div><?php echo IMP_Dimp::actionButton(array('class' => 'hasmenu', 'icon' => 'Reply', 'id' => 'reply_link', 'title' => _("Reply"))) ?></div>
-   <div><?php echo IMP_Dimp::actionButton(array('class' => 'hasmenu', 'icon' => 'Forward', 'id' => 'forward_link', 'title' => _("Forward"))) ?></div>
-<?php if (!empty($conf['spam']['reporting']) && (!$conf['spam']['spamfolder'] || ($vars->folder != IMP::folderPref($prefs->getValue('spam_folder'), true)))): ?>
-   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Spam', 'id' => 'button_spam', 'title' => _("Spam"))) ?></div>
-<?php endif; ?>
-<?php if (!empty($conf['notspam']['reporting']) && (!$conf['notspam']['spamfolder'] || ($vars->folder == IMP::folderPref($prefs->getValue('spam_folder'), true)))): ?>
-   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Ham', 'id' => 'button_ham', 'title' => _("Innocent"))) ?></div>
-<?php endif; ?>
-<?php if (!$readonly): ?>
-   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Delete', 'id' => 'button_deleted', 'title' => _("Delete"))) ?></div>
-<?php endif; ?>
-  </div>
-
-  <div class="msgfullread">
-   <div class="msgHeaders">
-    <div id="msgHeaders">
-     <div class="dimpOptions">
-<?php if (!empty($conf['user']['allow_view_source'])): ?>
-      <div>
-       <span id="msg_view_source">
-        <span class="iconImg"></span>
-        <a><?php echo _("View Source") ?></a>
-       </span>
-      </div>
-<?php endif; ?>
-      <div>
-       <span>
-        <span class="iconImg saveAsImg"></span>
-        <a href="<?php echo $show_msg_result['save_as'] ?>"><?php echo _("Save") ?></a>
-       </span>
-      </div>
-     </div>
-     <div id="msgHeadersContent">
-      <table>
-       <thead>
-        <tr>
-         <td class="label"><?php echo _("Subject") ?>:</td>
-         <td class="subject"><?php echo $show_msg_result['subject'] ?></td>
-        </tr>
-<?php foreach($show_msg_result['headers'] as $val): ?>
-        <tr<?php if (isset($val['id'])): ?> id="msgHeader<?php echo $val['id'] ?>"<?php endif; ?>>
-         <td class="label"><?php echo $val['name'] ?>:</td>
-         <td><?php echo $val['value'] ?></td>
-        </tr>
-<?php endforeach; ?>
-<?php if (isset($show_msg_result['atc_label'])): ?>
-        <tr id="msgAtc">
-         <td class="label" id="partlist_toggle">
-          <span class="iconImg attachmentImg attachmentImage"></span>
-<?php if ($show_msg_result['atc_list']): ?>
-          <span id="partlist_col" class="iconImg"></span>
-          <span id="partlist_exp" class="iconImg" style="display:none"></span>
-<?php endif; ?>
-         </td>
-         <td>
-          <span class="atcLabel"><?php echo $show_msg_result['atc_label'] ?></span><?php echo isset($show_msg_result['atc_download']) ? $show_msg_result['atc_download'] : '' ?>
-<?php if (isset($show_msg_result['atc_list'])): ?>
-          <div id="partlist" style="display:none">
-           <table>
-            <?php echo $show_msg_result['atc_list'] ?>
-           </table>
-          </div>
-<?php endif; ?>
-         </td>
-        </tr>
-<?php endif; ?>
-        <tr id="msgLogInfo" style="display:none">
-         <td class="label" id="msgloglist_toggle">
-          <span class="iconImg" id="msgloglist_col"></span>
-          <span class="iconImg" id="msgloglist_exp" style="display:none"></span>
-         </td>
-         <td>
-          <div>
-           <span class="msgLogLabel"><?php echo _("Message Log") ?></span>
-          </div>
-          <div id="msgloglist" style="display:none">
-           <ul></ul>
-          </div>
-         </td>
-        </tr>
-       </thead>
-      </table>
-     </div>
-    </div>
-   </div>
-   <div class="messageBody">
-    <?php echo $show_msg_result['msgtext'] ?>
-   </div>
-  </div>
- </div>
-
-<?php if (!$disable_compose): ?>
- <div id="qreply" style="display:none">
-  <div class="header">
-   <div class="headercloseimg" id="compose_close">
-    <span class="closeImg" title="X"></span>
-   </div>
-   <div><?php echo _("Message:") . ' ' . $show_msg_result['subject'] ?></div>
-  </div>
-  <?php echo $compose_result['html']; ?>
- </div>
-</div>
-
-<div class="context" id="ctx_replypopdown" style="display:none">
- <a id="ctx_reply_reply"><span class="contextImg"></span><?php echo _("To Sender") ?></a>
- <a id="ctx_reply_reply_all"><span class="contextImg"></span><?php echo _("To All") ?></a>
-<?php if ($show_msg_result['list_info']['exists']): ?>
- <a id="ctx_reply_reply_list"><span class="contextImg"></span><?php echo _("To List") ?></a>
-<?php endif; ?>
-</div>
-
-<div class="context" id="ctx_forwardpopdown" style="display:none;">
-<?php if (!$prefs->isLocked('forward_default')): ?>
- <a id="ctx_forward_attach"><span class="contextImg"></span><?php echo _("As Attachment") ?></a>
- <a id="ctx_forward_body"><span class="contextImg"></span><?php echo _("In Body Text") ?></a>
- <a id="ctx_forward_both"><span class="contextImg"></span><?php echo _("Attachment and Body Text") ?></a>
- <div class="sep"></div>
-<?php endif; ?>
- <a id="ctx_forward_redirect"><span class="contextImg"></span><?php echo _("Redirect") ?></a>
-</div>
-<?php endif; ?>
-
-<div class="context" id="ctx_contacts" style="display:none">
- <a id="ctx_contacts_new"><span class="contextImg"></span><?php echo _("New Message") ?></a>
- <a id="ctx_contacts_add"><span class="contextImg"></span><?php echo _("Add to Address Book") ?></a>
-</div>
-
-<div style="display:none">
- <span id="largeaddrspan">
-  <span class="largeaddrtoggle">
-   <span class="largeaddrlist">[<?php echo _("Show Addresses - %d recipients") ?>]</span>
-   <span class="largeaddrlist" style="display:none">[<?php echo _("Hide Addresses") ?>]</span>
-  </span>
-  <span class="dispaddrlist" style="display:none"></span>
- </span>
-</div>
diff --git a/imp/templates/dimp/compose/compose-base.html b/imp/templates/dimp/compose/compose-base.html
new file mode 100644 (file)
index 0000000..bb42ada
--- /dev/null
@@ -0,0 +1,9 @@
+<body>
+ <div id="dimpLoading"><gettext>Loading...</gettext></div>
+ <div id="pageContainer" style="display:none">
+  <div class="header">
+   <div class="headercloseimg closeImg" id="compose_close"></div>
+   <tag:title />
+  </div>
+  <tag:compose_html />
+ </div>
index bb42ada..11c1bbb 100644 (file)
@@ -1,9 +1,202 @@
-<body>
- <div id="dimpLoading"><gettext>Loading...</gettext></div>
- <div id="pageContainer" style="display:none">
-  <div class="header">
-   <div class="headercloseimg closeImg" id="compose_close"></div>
-   <tag:title />
-  </div>
-  <tag:compose_html />
+<if:compose_link>
+<form id="compose" name="compose" enctype="multipart/form-data" action="<tag:compose_link />" method="post" target="submit_frame">
+ <tag:forminput />
+ <input type="hidden" id="last_identity" name="last_identity" value="<tag:selected_identity />" />
+ <input type="hidden" id="html" name="html" value="<if:rte><if:compose_html>1</if:compose_html></if:rte>" />
+ <input type="hidden" id="composeCache" name="composeCache" value="<tag:composeCache />" />
+
+ <div class="dimpActions dimpActionsCompose">
+<if:compose_enable>
+  <div>
+   <tag:send_button />
+  </div>
+</if:compose_enable>
+  <div>
+   <tag:spell_button />
+  </div>
+  <div>
+   <tag:draft_button />
+  </div>
+ </div>
+
+ <div id="writemsg">
+  <div class="msgwrite">
+   <div class="dimpOptions">
+    <div id="togglecc">
+     <label>
+      <input name="togglecc" type="checkbox" class="checkbox" /><gettext>Show Cc</gettext>
+     </label>
+    </div>
+    <div id="togglebcc">
+     <label>
+      <input name="togglebcc" type="checkbox" class="checkbox" /><gettext>Show Bcc</gettext>
+     </label>
+    </div>
+<if:rte>
+    <div>
+     <label>
+      <input id="htmlcheckbox" type="checkbox" class="checkbox"<if:compose_html> checked="checked"</if:compose_html> /><gettext>HTML composition</gettext>
+     </label>
+    </div>
+</if:rte>
+<if:read_receipt>
+    <div>
+     <label>
+      <input name="request_read_receipt" type="checkbox" class="checkbox"<if:read_receipt_set> checked="checked"</if:read_receipt_set> /><gettext>Read Receipt</gettext>
+     </label>
+    </div>
+</if:read_receipt>
+<if:save_sent_mail>
+    <div style="display:none">
+     <label>
+      <input id="save_sent_mail" name="save_sent_mail" type="checkbox" class="checkbox" /><gettext>Save in</gettext>
+      <span id="sent_mail_folder_label"></span>
+     </label>
+     <input id="save_sent_mail_folder" name="save_sent_mail_folder" type="hidden" />
+    </div>
+</if:save_sent_mail>
+<if:priority>
+    <div>
+     <gettext>Priority:</gettext><span id="priority_label"></span>
+     <input id="priority" name="priority" type="hidden" value="normal" />
+    </div>
+</if:priority>
+<if:encrypt>
+    <div>
+     <gettext>Encryption:</gettext><span id="encrypt_label"></span>
+     <input id="encrypt" name="encrypt" type="hidden" value="<tag:encrypt />" />
+    </div>
+</if:encrypt>
+   </div>
+
+   <table>
+    <tr>
+     <td class="label">
+      <gettext>From:</gettext>
+     </td>
+     <td>
+      <select id="identity" name="identity">
+<loop:select_list>
+       <option value="<tag:select_list.val />"<if:select_list.sel> selected="selected"</if:select_list.sel>><tag:select_list.label /></option>
+</loop:select_list>
+      </select>
+     </td>
+    </tr>
+    <tr id="sendto">
+     <td class="label">
+      <span><gettext>To:</gettext></span>
+     </td>
+     <td>
+      <textarea id="to" name="to" rows="1" cols="75"></textarea>
+      <span id="to_loading_img" class="loadingImg" style="display:none"></span>
+     </td>
+    </tr>
+    <tr id="sendcc" style="display:none">
+     <td class="label">
+      <span><gettext>Cc:</gettext></span>
+     </td>
+     <td>
+      <textarea id="cc" name="cc" rows="1" cols="75"></textarea>
+      <span id="cc_loading_img" class="loadingImg" style="display:none"></span>
+     </td>
+    </tr>
+    <tr id="sendbcc" style="display:none">
+     <td class="label">
+      <span><gettext>Bcc:</gettext></span>
+     </td>
+     <td>
+      <textarea id="bcc" name="bcc" rows="1" cols="75"></textarea>
+      <span id="bcc_loading_img" class="loadingImg" style="display:none"></span>
+     </td>
+    </tr>
+    <tr>
+     <td class="label">
+      <gettext>Subject:</gettext>
+     </td>
+     <td class="subject">
+      <input type="text" id="subject" name="subject" />
+     </td>
+    </tr>
+    <tr class="atcrow">
+     <td class="label">
+      <span class="iconImg attachmentImg"></span>:
+     </td>
+     <td id="attach_cell">
+      <span id="upload_limit" style="display:none"><gettext>The attachment limit has been reached.</gettext></span>
+      <span id="upload_wait" style="display:none"></span>
+      <span>
+       <input type="file" id="upload" name="file_1" />
+      </span>
+<if:save_attach>
+      <label style="display:none">
+       <input type="checkbox" class="checkbox" name="save_attachments_select"<if:save_attach_set> checked="checked"</if:save_attach_set> /><gettext>Save Attachments in sent folder</gettext>
+      </label>
+      <br />
+</if:save_attach>
+      <ul id="attach_list" style="display:none"></ul>
+     </td>
+    </tr>
+    <tr id="noticerow" style="display:none">
+     <td colspan="2">
+      <ul class="notices">
+       <li id="replyallnotice" style="display:none">
+        <span class="iconImg closeImg"></span>
+        <gettext>You are currently replying to ALL recipients. Click here to reply to the original sender instead.</gettext>
+       </li>
+       <li id="replylistnotice" style="display:none">
+        <span class="iconImg closeImg"></span>
+        <gettext>You are currently replying to the mailing list. Click here to reply to the original sender instead.</gettext>
+       </li>
+       <li id="fwdattachnotice" style="display:none">
+        <span class="iconImg closeImg"></span>
+        <gettext>Click here to add the original message text to the body.</gettext>
+       </li>
+       <li id="fwdbodynotice" style="display:none">
+        <span class="iconImg closeImg"></span>
+        <gettext>Click here to add the original message as an attachment.</gettext>
+       </li>
+       <li id="identitychecknotice" style="display:none">
+        <span class="iconImg closeImg"></span>
+        <gettext>Your identity has been switched to the identity associated with the current recipient address. Click here to revert to the original identity. The identity will not be checked again during this compose action.</gettext>
+       </li>
+      </ul>
+     </td>
+    </tr>
+   </table>
+  </div>
+
+  <div id="composeMessageParent">
+   <textarea name="message" rows="20" id="composeMessage" class="fixed"></textarea>
+  </div>
+ </div>
+</form>
+</if:compose_link>
+
+<if:compose_enable>
+<form id="redirect" name="redirect" style="display:none">
+ <input type="hidden" id="composeCacheRedirect" name="composeCache" value="<tag:composeCache />" />
+ <tag:forminput />
+ <div class="msgwrite">
+  <div class="dimpActions dimpActionsCompose">
+   <div>
+    <tag:redirect_button />
+   </div>
+  </div>
+  <table>
+   <tr id="redirect_sendto">
+    <td class="label">
+     <span><gettext>To:</gettext></span>
+    </td>
+    <td>
+     <textarea id="redirect_to" name="redirect_to" rows="1" cols="75"></textarea>
+     <span id="redirect_to_loading_img" class="loadingImg" style="display:none"></span>
+    </td>
+   </tr>
+  </table>
  </div>
+</form>
+</if:compose_enable>
+
+<span id="sendingImg" class="loadingImg" style="display:none"></span>
+
+<iframe name="submit_frame" id="submit_frame" style="display:none" src="javascript:false;"></iframe>
diff --git a/imp/templates/dimp/message/message.html b/imp/templates/dimp/message/message.html
new file mode 100644 (file)
index 0000000..2ec69f6
--- /dev/null
@@ -0,0 +1,156 @@
+<body>
+ <div id="dimpLoading"><gettext>Loading...</gettext></div>
+ <div id="pageContainer" style="display:none">
+  <div id="msgData">
+   <div class="dimpActions dimpActionsMsg">
+    <div class="headercloseimg closeImg" id="windowclose" title="X"></div>
+    <div>
+     <tag:reply_button />
+    </div>
+    <div>
+     <tag:forward_button />
+    </div>
+<if:spam_button>
+    <div>
+     <tag:spam_button />
+    </div>
+</if:spam_button>
+<if:ham_button>
+    <div>
+     <tag:ham_button />
+    </div>
+</if:ham_button>
+<if:delete_button>
+    <div>
+     <tag:ham_button />
+    </div>
+</if:delete_button>
+   </div>
+
+   <div class="msgfullread">
+    <div class="msgHeaders">
+     <div id="msgHeaders">
+      <div class="dimpOptions">
+<if:view_source />
+       <div>
+        <span id="msg_view_source">
+         <span class="iconImg"></span>
+         <a><gettext>View Source</gettext></a>
+        </span>
+       </div>
+</if:view_source />
+       <div>
+        <span>
+         <span class="iconImg saveAsImg"></span>
+         <a href="<tag:save_as />"><gettext>Save</gettext></a>
+        </span>
+       </div>
+      </div>
+      <div id="msgHeadersContent">
+       <table>
+        <thead>
+         <tr>
+          <td class="label"><gettext>Subject</gettext>:</td>
+          <td class="subject"><tag:subject /></td>
+         </tr>
+<loop:hdrs>
+         <tr<if:hdrs.id> id="<tag:hdrs.id />"</if:hdrs.id>>
+          <td class="label"><tag:hdrs.label />:</td>
+          <td><tag:hdrs.val /></td>
+         </tr>
+</loop:hdrs>
+<if:atc_label>
+         <tr id="msgAtc">
+          <td class="label" id="partlist_toggle">
+           <span class="iconImg attachmentImg attachmentImage"></span>
+<if:atc_list>
+           <span id="partlist_col" class="iconImg"></span>
+           <span id="partlist_exp" class="iconImg" style="display:none"></span>
+</if:atc_list>
+          </td>
+          <td>
+           <span class="atcLabel"><tag:atc_label /></span>
+           <tag:atc_download />
+<if:atc_list>
+           <div id="partlist" style="display:none">
+            <table>
+             <tag:atc_list />
+            </table>
+           </div>
+</if:atc_list>
+          </td>
+         </tr>
+</if:atc_label>
+         <tr id="msgLogInfo" style="display:none">
+          <td class="label" id="msgloglist_toggle">
+           <span class="iconImg" id="msgloglist_col"></span>
+           <span class="iconImg" id="msgloglist_exp" style="display:none"></span>
+          </td>
+          <td>
+           <div>
+            <span class="msgLogLabel"><gettext>Message Log</gettext></span>
+           </div>
+           <div id="msgloglist" style="display:none">
+            <ul></ul>
+           </div>
+          </td>
+         </tr>
+        </thead>
+       </table>
+      </div>
+     </div>
+    </div>
+    <div class="messageBody">
+     <tag:msgtext />
+    </div>
+   </div>
+  </div>
+
+<if:html>
+  <div id="qreply" style="display:none">
+   <div class="header">
+    <div class="headercloseimg" id="compose_close">
+     <span class="closeImg" title="X"></span>
+    </div>
+    <div>
+     <gettext>Message:</gettext>
+     <tag:subject />
+    </div>
+   </div>
+   <tag:html />
+  </div>
+ </div>
+
+ <div class="context" id="ctx_replypopdown" style="display:none">
+  <a id="ctx_reply_reply"><span class="contextImg"></span><gettext>To Sender</gettext></a>
+  <a id="ctx_reply_reply_all"><span class="contextImg"></span><gettext>To All</gettext></a>
+<if:reply_list>
+  <a id="ctx_reply_reply_list"><span class="contextImg"></span><gettext>To List</gettext></a>
+</if:reply_list>
+ </div>
+
+ <div class="context" id="ctx_forwardpopdown" style="display:none;">
+<if:forward_select>
+  <a id="ctx_forward_attach"><span class="contextImg"></span><gettext>As Attachment</gettext></a>
+  <a id="ctx_forward_body"><span class="contextImg"></span><gettext>In Body Text</gettext></a>
+  <a id="ctx_forward_both"><span class="contextImg"></span><gettext>Attachment and Body Text</gettext></a>
+  <div class="sep"></div>
+</if:forward_select>
+  <a id="ctx_forward_redirect"><span class="contextImg"></span><gettext>Redirect</gettext></a>
+ </div>
+</if:html>
+
+ <div class="context" id="ctx_contacts" style="display:none">
+  <a id="ctx_contacts_new"><span class="contextImg"></span><gettext>New Message</gettext></a>
+  <a id="ctx_contacts_add"><span class="contextImg"></span><gettext>Add to Address Book</gettext></a>
+ </div>
+
+ <div style="display:none">
+  <span id="largeaddrspan">
+   <span class="largeaddrtoggle">
+    <span class="largeaddrlist">[<gettext>Show Addresses - %d recipients</gettext>]</span>
+    <span class="largeaddrlist" style="display:none">[<gettext>Hide Addresses</gettext>]</span>
+   </span>
+   <span class="dispaddrlist" style="display:none"></span>
+  </span>
+ </div>
index 2cd7f8a..cd63d1e 100644 (file)
@@ -624,6 +624,14 @@ div.dimpActionsCompose, div.dimpActionsMsg {
     font-weight: bold;
 }
 
+#writemsg input.checkbox {
+    margin-right: 2px;
+}
+
+#priority_label, #encrypt_label {
+    margin-left: 2px;
+}
+
 .msgwrite {
     background: #e2e2e2 url("../graphics/backhead_r.png") repeat-x;
     border: 1px #b9b9b3 solid;