Give notification feedback on auto-draft save
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 26 Jun 2009 16:59:52 +0000 (10:59 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 26 Jun 2009 17:20:04 +0000 (11:20 -0600)
imp/compose-dimp.php
imp/js/src/compose-dimp.js
imp/lib/Views/Compose.php
imp/templates/javascript_defs_dimp.php

index d779c68..9d4f258 100644 (file)
@@ -105,7 +105,9 @@ if (count($_POST)) {
             /* Delete existing draft. */
             _removeAutoSaveDraft($old_index);
 
-            if ($action != 'auto_save_draft') {
+            if ($action == 'auto_save_draft') {
+                $notification->push(_("Draft automatically saved."), 'horde.message');
+            } else {
                 $notification->push($res);
             }
         } catch (IMP_Compose_Exception $e) {
index 497f1c4..0cc3a2e 100644 (file)
@@ -437,14 +437,12 @@ var DimpCompose = {
         }
 
         // Set auto-save-drafts now if not already active.
-        if (DIMP.conf_compose.auto_save_interval_val && !this.auto_save_interval) {
+        if (DIMP.conf_compose.auto_save_interval_val &&
+            !this.auto_save_interval) {
             this.auto_save_interval = new PeriodicalExecuter(function() {
-                var cur_msg;
-                if (this.editor_on) {
-                    cur_msg = FCKeditorAPI.GetInstance('message').GetHTML();
-                } else {
-                    cur_msg = $F(msgval);
-                }
+                var cur_msg = this.editor_on
+                    ? FCKeditorAPI.GetInstance('message').GetHTML()
+                    : $F(msgval);
                 cur_msg = cur_msg.replace(/\r/g, '');
                 if (!cur_msg.empty() && this.last_msg != cur_msg) {
                     this.uniqueSubmit('auto_save_draft');
index a029c86..51b6800 100644 (file)
@@ -80,7 +80,6 @@ class IMP_Views_Compose
         }
 
         $result['js'] = array(
-            'DIMP.conf_compose.auto_save_interval_val = ' . intval($GLOBALS['prefs']->getValue('auto_save_drafts')),
             'DIMP.conf_compose.identities = ' . Horde_Serialize::serialize($identities, Horde_Serialize::JSON)
         );
 
index 77ab16b..721ea05 100644 (file)
@@ -129,6 +129,7 @@ if ($compose_mode) {
     /* Variables used in compose page. */
     $code['conf_compose'] = array_filter(array(
         'attach_limit' => ($GLOBALS['conf']['compose']['attach_count_limit'] ? intval($GLOBALS['conf']['compose']['attach_count_limit']) : -1),
+        'auto_save_interval_val' => intval($GLOBALS['prefs']->getValue('auto_save_drafts')),
         'bcc' => intval($GLOBALS['prefs']->getValue('compose_bcc')),
         'cc' => intval($GLOBALS['prefs']->getValue('compose_cc')),
         'close_draft' => intval($GLOBALS['prefs']->getValue('close_draft')),