Make encrypt.js an all-purpose dialog script.
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 12 Dec 2008 06:47:51 +0000 (23:47 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 12 Dec 2008 06:47:51 +0000 (23:47 -0700)
imp/config/prefs.php.dist
imp/index-dimp.php
imp/js/src/dialog.js [new file with mode: 0644]
imp/js/src/encrypt.js [deleted file]
imp/lib/IMP.php

index 287bd9e..08df891 100644 (file)
@@ -137,8 +137,7 @@ if (!$is_pop3) {
         'column' => _("Message Options"),
         'label' => _("Fetch Mail"),
         'desc' => _("Customize accounts for fetching mail from other accounts."),
-        'members' => array('fetchmail_link', 'fetchmail_popup',
-                           'fetchmail_menu')
+        'members' => array('fetchmail_link', 'fetchmail_menu')
     );
 }
 
@@ -1090,14 +1089,6 @@ $_prefs['fetchmail_link'] = array(
     'img' => 'fetchmail.png',
     'desc' => _("Edit your preferences for accessing other mail accounts."));
 
-// Fetch mail on separate window?
-$_prefs['fetchmail_popup'] = array(
-    'value' => 0,
-    'locked' => false,
-    'shared' => false,
-    'type' => 'checkbox',
-    'desc' => _("Fetch Mail in a separate window?"));
-
 // Show the Fetch mail icon on the menubar?
 $_prefs['fetchmail_menu'] = array(
     'value' => 1,
index 28fb0ea..d9d5e31 100644 (file)
@@ -29,7 +29,7 @@ if ((!empty($GLOBALS['conf']['utils']['gnupg']) &&
      $GLOBALS['prefs']->getValue('use_pgp')) ||
     ($GLOBALS['prefs']->getValue('use_smime') &&
      Util::extensionExists('openssl'))) {
-    $scripts[] = array('encrypt.js', 'imp', true);
+    $scripts[] = array('dialog.js', 'imp', true);
 }
 
 /* Get site specific menu items. */
diff --git a/imp/js/src/dialog.js b/imp/js/src/dialog.js
new file mode 100644 (file)
index 0000000..043ef77
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ * Javascript code used to display a RedBox dialog.
+ *
+ * Copyright 2008 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.
+ *
+ * @author Michael Slusarz <slusarz@curecanti.org>
+ */
+
+var IMPDialog = {
+
+    display: function(data)
+    {
+        data = decodeURIComponent(data).evalJSON(true);
+        this.action = data.action;
+        this.params = data.params;
+        this.uri = data.uri;
+
+        var n = new Element('FORM', { action: '#', id: 'RB_confirm' }).insert(
+                    new Element('P').insert(data.text)
+                ).insert(
+                    new Element('INPUT', { type: 'text', size: 15 })
+                ).insert(
+                    new Element('INPUT', { type: 'button', className: 'button', value: data.ok_text }).observe('click', this._onClick.bind(this))
+                ).insert(
+                    new Element('INPUT', { type: 'button', className: 'button', value: data.cancel_text }).observe('click', this._close.bind(this))
+                ).observe('keydown', function(e) { if ((e.keyCode || e.charCode) == Event.KEY_RETURN) { e.stop(); this._onClick(e); } }.bind(this));
+
+        RedBox.overlay = true;
+        RedBox.onDisplay = Form.focusFirstElement.curry(n);
+        RedBox.showHtml(n);
+    },
+
+    _close: function()
+    {
+        var c = RedBox.getWindowContents();
+        [ c, c.descendants()].flatten().compact().invoke('stopObserving');
+        RedBox.close();
+    },
+
+    _onClick: function(e)
+    {
+        params = this.params || {};
+        params.passphrase = $F(e.findElement('form').down('input'));
+
+        new Ajax.Request(this.uri, { parameters: params, onSuccess: this._onSuccess.bind(this), onFailure: this._onFailure.bind(this) });
+    },
+
+    _onSuccess: function(r)
+    {
+        try {
+            r = r.responseText.evalJSON(true);
+        } catch (e) {}
+
+        if (r.response.success) {
+            this._close();
+            if (this.action) {
+                this.action();
+            } else {
+                location.reload();
+            }
+        } else if (r.response.error) {
+            alert(r.response.error);
+        }
+    },
+
+    _onFailure: function(r)
+    {
+    }
+
+};
diff --git a/imp/js/src/encrypt.js b/imp/js/src/encrypt.js
deleted file mode 100644 (file)
index ab7ce68..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Javascript code used to display a RedBox pasphrase dialog.
- *
- * Copyright 2008 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.
- *
- * @author Michael Slusarz <slusarz@curecanti.org>
- */
-
-var IMPEncrypt = {
-
-    display: function(data)
-    {
-        data = decodeURIComponent(data).evalJSON(true);
-        this.action = data.action;
-        this.params = data.params;
-        this.uri = data.uri;
-
-        var n = new Element('FORM', { action: '#', id: 'RB_confirm' }).insert(
-                    new Element('P').insert(data.text)
-                ).insert(
-                    new Element('INPUT', { type: 'text', size: 15 })
-                ).insert(
-                    new Element('INPUT', { type: 'button', className: 'button', value: data.ok_text }).observe('click', this._onClick.bind(this))
-                ).insert(
-                    new Element('INPUT', { type: 'button', className: 'button', value: data.cancel_text }).observe('click', this._close.bind(this))
-                ).observe('keydown', function(e) { if ((e.keyCode || e.charCode) == Event.KEY_RETURN) { e.stop(); this._onClick(e); } }.bind(this));
-
-        RedBox.overlay = true;
-        RedBox.onDisplay = Form.focusFirstElement.curry(n);
-        RedBox.showHtml(n);
-    },
-
-    _close: function()
-    {
-        var c = RedBox.getWindowContents();
-        [ c, c.descendants()].flatten().compact().invoke('stopObserving');
-        RedBox.close();
-    },
-
-    _onClick: function(e)
-    {
-        params = this.params || {};
-        params.passphrase = $F(e.findElement('form').down('input'));
-
-        new Ajax.Request(this.uri, { parameters: params, onSuccess: this._onSuccess.bind(this), onFailure: this._onFailure.bind(this) });
-    },
-
-    _onSuccess: function(r)
-    {
-        try {
-            r = r.responseText.evalJSON(true);
-        } catch (e) {}
-
-        if (r.response.success) {
-            this._close();
-            if (this.action) {
-                this.action();
-            } else {
-                location.reload();
-            }
-        } else if (r.response.error) {
-            alert(r.response.error);
-        }
-    },
-
-    _onFailure: function(r)
-    {
-    }
-
-};
index 7fc0a8b..bcaf801 100644 (file)
@@ -1952,7 +1952,7 @@ class IMP
     {
         Horde::addScriptFile('prototype.js', 'horde', true);
         Horde::addScriptFile('effects.js', 'horde', true);
-        Horde::addScriptFile('encrypt.js', 'imp', true);
+        Horde::addScriptFile('dialog.js', 'imp', true);
         Horde::addScriptFile('redbox.js', 'imp', true);
 
         switch ($type) {
@@ -1978,6 +1978,6 @@ class IMP
             'cancel_text' => _("Cancel")
         );
 
-        return 'IMPEncrypt.display(\'' . IMP::escapeJSON($js_params) . '\')';
+        return 'IMPDialog.display(\'' . IMP::escapeJSON($js_params) . '\')';
     }
 }