Dear Jan, Here is sent-mail selection for dimp. Sincerely, Michael
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 20 Oct 2009 04:37:36 +0000 (22:37 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 20 Oct 2009 05:26:30 +0000 (23:26 -0600)
imp/docs/CHANGES
imp/js/compose-dimp.js
imp/lib/Views/Compose.php
imp/templates/chunks/compose.php
imp/themes/screen-dimp.css

index 5b97aaf..53af983 100644 (file)
@@ -2,6 +2,7 @@
 v5.0-git
 --------
 
+[mms] Add ability to select sent-mail mailbox when composing in DIMP.
 [mms] Add ability to save drafts in MIMP.
 [mms] Add spam reporting in MIMP.
 [mms] Added contextmenu support in DIMP for Opera.
index c5bdacc..bc82852 100644 (file)
@@ -10,8 +10,8 @@
 var DimpCompose = {
     // Variables defaulting to empty/false:
     //   auto_save_interval, button_pressed, compose_cursor, dbtext,
-    //   drafts_mbox, editor_on, mp_padding, resizebcc, resizecc, resizeto,
-    //   row_height, sbtext, skip_spellcheck, spellcheck, uploading
+    //   drafts_mbox, editor_on, knl, mp_padding, resizebcc, resizecc,
+    //   resizeto, row_height, sbtext, skip_spellcheck, spellcheck, uploading
     last_msg: '',
     textarea_ready: true,
 
@@ -77,7 +77,7 @@ var DimpCompose = {
             next = this.get_identity(id),
             ssm = $('save_sent_mail');
 
-        $('sent_mail_folder_label').setText(next.id[5]);
+        this.setSentMailLabel(next.id[5]);
         $('bcc').setValue(next.id[6]);
         if (ssm) {
             ssm.writeAttribute('checked', next.id[4]);
@@ -121,6 +121,14 @@ var DimpCompose = {
         }
     },
 
+    setSentMailLabel: function(s)
+    {
+        var label = $('sent_mail_folder_label');
+        if (label) {
+            $('sent_mail_folder_label').writeAttribute('title', s.escapeHTML()).setText('"' + s.truncate(15) + '"');
+        }
+    },
+
     get_identity: function(id, editor_on)
     {
         editor_on = Object.isUndefined(editor_on) ? this.editor_on : editor_on;
@@ -428,7 +436,7 @@ var DimpCompose = {
 
     fillForm: function(msg, header, focus, noupdate)
     {
-        // On IE, this can get loaded before DOM;loaded. Check for an init
+        // On IE, this can get loaded before DOM:loaded. Check for an init
         // value and don't load until it is available.
         if (!this.resizeto) {
             this.fillForm.bind(this, msg, header, focus, noupdate).defer();
@@ -479,6 +487,7 @@ var DimpCompose = {
         if (DIMP.conf_compose.cc) {
             this.toggleCC('cc');
         }
+        this.setSentMailLabel(identity.id[5]);
         if (header.bcc) {
             $('bcc').setValue(header.bcc);
             this.resizebcc.resizeNeeded();
@@ -766,6 +775,16 @@ var DimpCompose = {
                 a.down('TD.label SPAN').addClassName('composeAddrbook');
             });
         }
+
+        /* Create folderlist. */
+        if (DIMP.conf_compose.flist) {
+            this.knl = new KeyNavList('save_sent_mail', {
+                esc: true,
+                list: DIMP.conf_compose.flist,
+                onChoose: this.setSentMailLabel.bind(this)
+            });
+            $('sent_mail_folder_label').insert({ after: new Element('SPAN', { className: 'popdownImg', id: 'compose_flist_popdown' }).observe('click', function(e) { this.knl.show(); e.stop(); }.bindAsEventListener(this)) });
+        }
     }
 
 },
index e1d133a..eb17d24 100644 (file)
@@ -39,10 +39,6 @@ class IMP_Views_Compose
         /* Load Identity. */
         $identity = Identity::singleton(array('imp', 'imp'));
         $selected_identity = $identity->getDefault();
-        $sent_mail_folder = $identity->getValue('sent_mail_folder');
-        if (!empty($sent_mail_folder)) {
-            $sent_mail_folder = htmlspecialchars('"' . IMP::displayFolder($sent_mail_folder) . '"');
-        }
 
         /* Get user identities. */
         $all_sigs = $identity->getAllSignatures();
@@ -95,6 +91,17 @@ class IMP_Views_Compose
             $result['jsappend'] .= $imp_ui->initRTE('dimp');
         }
 
+        /* Create list for sent-mail selection. */
+        if (!empty($GLOBALS['conf']['user']['select_sentmail_folder']) &&
+            !$GLOBALS['prefs']->isLocked('sent_mail_folder')) {
+            $imp_folder = IMP_Folder::singleton();
+            $flist = array();
+            foreach ($imp_folder->flist() as $val) {
+                $flist[] = array('l' => $val['abbrev'], 'v' => $val['val']);
+            }
+            $result['js'][] = 'DIMP.conf_compose.flist = ' . Horde_Serialize::serialize($flist, Horde_Serialize::JSON);
+        }
+
         // Buffer output so that we can return a string from this function
         ob_start();
         require IMP_TEMPLATES . '/chunks/compose.php';
index dfb5028..f3323a9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Variables passed in from calling code:
  *   $compose_html, $from, $id, $identity, $composeCache, $rte,
- *   $selected_identity, $sent_mail_folder
+ *   $selected_identity
  *
  * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
  *
@@ -60,7 +60,7 @@ function _createDAcompose($text, $image, $id)
    <label><input name="request_read_receipt" type="checkbox" class="checkbox"<?php if ($d_read != 'ask') echo ' checked="checked"' ?> /> <?php echo _("Read Receipt") ?></label>
 <?php endif; ?>
 <?php if ($GLOBALS['conf']['user']['allow_folders'] && !$GLOBALS['prefs']->isLocked('save_sent_mail')): ?>
-   <label><input id="save_sent_mail" name="save_sent_mail" type="checkbox" class="checkbox"<?php if ($identity->saveSentmail()) echo ' checked="checked"' ?> /> <?php echo _("Save in ") ?><span id="sent_mail_folder_label"><?php echo $sent_mail_folder ?></span></label>
+   <label><input id="save_sent_mail" name="save_sent_mail" type="checkbox" class="checkbox"<?php if ($identity->saveSentmail()) echo ' checked="checked"' ?> /> <?php echo _("Save in ") ?><span id="sent_mail_folder_label"></span></label>
 <?php endif; ?>
   </div>
   <table cellspacing="0">
index 1488b19..2d2d8fa 100644 (file)
@@ -688,6 +688,10 @@ div.dimpActionsCompose, div.dimpActionsMsg {
     left: 0;
 }
 
+#compose_flist_popdown {
+    margin-top: -1px;
+}
+
 /* attachment file list */
 #attach_list {
     padding-top: 5px;
@@ -862,7 +866,7 @@ a.address:hover img {
 }
 
 /* Images */
-div.msgStatus div, #msgHeadersContent .subject span, span.iconImg, span.contextImg, span.spellcheckPopdownImg, #qsearch_icon, #qsearch_close {
+div.msgStatus div, #msgHeadersContent .subject span, span.iconImg, span.contextImg, span.spellcheckPopdownImg, #qsearch_icon, #qsearch_close, #compose_flist_popdown {
     display: -moz-inline-stack;
     display: inline-block;
     height: 16px;