Add priority setting to DIMP
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 4 Dec 2009 20:25:12 +0000 (13:25 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 4 Dec 2009 20:31:44 +0000 (13:31 -0700)
imp/compose-dimp.php
imp/docs/CHANGES
imp/js/compose-dimp.js
imp/templates/chunks/compose.php
imp/templates/javascript_defs_dimp.php
imp/themes/screen-dimp.css

index 962b1f1..69c8f0c 100644 (file)
@@ -149,6 +149,7 @@ if (count($_POST)) {
         $imptree->eltDiffStart();
 
         $options = array(
+            'priority' => Horde_Util::getFormData('priority'),
             'readreceipt' => Horde_Util::getFormData('request_read_receipt'),
             'save_attachments' => Horde_Util::getFormData('save_attachments_select'),
             'save_sent' => (($prefs->isLocked('save_sent_mail'))
index 73a1676..ddcbc9f 100644 (file)
@@ -2,6 +2,7 @@
 v5.0-git
 --------
 
+[mms] Add priority setting to DIMP.
 [mms] Simplify and improve priority header generation/display.
 [mms] Add Face: header support to IMP.
 [mms] Add splitbar to resize sidebar in DIMP.
index e501f8c..84250f1 100644 (file)
@@ -10,7 +10,7 @@
 var DimpCompose = {
     // Variables defaulting to empty/false:
     //   auto_save_interval, button_pressed, compose_cursor, dbtext,
-    //   drafts_mbox, editor_on, is_popup, knl, mp_padding, resizebcc,
+    //   drafts_mbox, editor_on, is_popup, knl_sm, knl_p, mp_padding, resizebcc,
     //   resizecc, resizeto, row_height, rte, sbtext, skip_spellcheck,
     //   spellcheck, uploading
     last_msg: '',
@@ -154,10 +154,28 @@ var DimpCompose = {
         $('sent_mail_folder_label').writeAttribute('title', l.escapeHTML()).setText(l.truncate(15)).up(1).show();
 
         if (DIMP.conf_compose.flist && sel) {
-            this.knl.setSelected(s);
+            this.knl_sm.setSelected(s);
         }
     },
 
+    setPriorityLabel: function(s, l)
+    {
+        var label = $('priority_label');
+
+        if (!label) {
+            return;
+        }
+
+        if (!l) {
+            l = DIMP.conf_compose.priority.find(function(f) {
+                return f.v == s;
+            });
+        }
+
+        $('priority').setValue(s);
+        $('priority_label').setText(l.l);
+    },
+
     getIdentity: function(id, editor_on)
     {
         editor_on = Object.isUndefined(editor_on) ? this.editor_on : editor_on;
@@ -812,13 +830,24 @@ var DimpCompose = {
 
         /* Create folderlist. */
         if (DIMP.conf_compose.flist) {
-            this.knl = new KeyNavList('save_sent_mail', {
+            this.knl_sm = new KeyNavList('save_sent_mail', {
                 esc: true,
                 list: DIMP.conf_compose.flist,
                 onChoose: this.setSentMailLabel.bind(this)
             });
-            this.knl.setSelected(this.getIdentity($F('identity'))[3]);
-            $('sent_mail_folder_label').insert({ after: new Element('SPAN', { className: 'popdownImg' }).observe('click', function(e) { this.knl.show(); this.knl.ignoreClick(e); e.stop(); }.bindAsEventListener(this)) });
+            this.knl_sm.setSelected(this.getIdentity($F('identity'))[3]);
+            $('sent_mail_folder_label').insert({ after: new Element('SPAN', { className: 'popdownImg' }).observe('click', function(e) { this.knl_sm.show(); this.knl_sm.ignoreClick(e); e.stop(); }.bindAsEventListener(this)) });
+        }
+
+        /* Create priority list. */
+        if (DIMP.conf_compose.priority) {
+            this.knl_p = new KeyNavList('priority_label', {
+                esc: true,
+                list: DIMP.conf_compose.priority,
+                onChoose: this.setPriorityLabel.bind(this)
+            });
+            this.setPriorityLabel('normal');
+            $('priority_label').insert({ after: new Element('SPAN', { className: 'popdownImg' }).observe('click', function(e) { this.knl_p.show(); this.knl_p.ignoreClick(e); e.stop(); }.bindAsEventListener(this)) });
         }
 
         $('dimpLoading').hide();
index e859900..22fb6c5 100644 (file)
@@ -70,6 +70,12 @@ $compose_disable = !IMP::canCompose();
     <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; ?>
   </div>
   <table>
    <tr>
index 90c92fe..d56523f 100644 (file)
@@ -166,10 +166,6 @@ if ($compose_mode) {
         'spellcheck' => intval($GLOBALS['prefs']->getValue('compose_spellcheck')),
     ));
 
-    if ($GLOBALS['registry']->hasMethod('contacts/search')) {
-        $code['conf_compose']['URI_ABOOK'] = (string) Horde::applicationUrl('contacts.php');
-    }
-
     /* Gettext strings used in compose page. */
     $code['text_compose'] = array(
         'atc_limit' => _("The attachment limit has been reached."),
@@ -182,6 +178,28 @@ if ($compose_mode) {
         'toggle_html' => _("Really discard all formatting information? This operation cannot be undone."),
         'uploading' => _("Uploading..."),
     );
+
+    if ($GLOBALS['registry']->hasMethod('contacts/search')) {
+        $code['conf_compose']['URI_ABOOK'] = (string) Horde::applicationUrl('contacts.php');
+    }
+
+    if ($GLOBALS['prefs']->getValue('set_priority')) {
+        $code['conf_compose']['priority'] = array(
+            array(
+                'l' => _("High"),
+                'v' => 'high'
+            ),
+            array(
+                'l' => _("Normal"),
+                's' => true,
+                'v' => 'normal'
+            ),
+            array(
+                'l' => _("Low"),
+                'v' => 'low'
+            )
+        );
+    }
 }
 
 Horde::addInlineScript(array(
index 865dbe0..8b96a9a 100644 (file)
@@ -400,6 +400,11 @@ div.vpRowVert.flagUnseen {
     text-decoration: underline;
 }
 
+#priority_label {
+    cursor: default;
+    font-weight: bold;
+}
+
 /* Actions */
 .dimpActions {
     background: #efefef;