if (!isset($options)) {
$options = array();
}
- Horde::addScriptFile('popup.js', 'imp', true);
+ Horde::addScriptFile('imp.js', 'imp', true);
IMP::addInlineScript(IMP::popupIMPString('compose.php', array_merge(array('popup' => 1), $options, IMP::getComposeArgs())));
}
array('redbox.js', 'horde', true),
array('mailbox-dimp.js', 'imp', false),
array('DimpSlider.js', 'imp', true),
- array('unblockImages.js', 'imp', true),
- array('popup.js', 'imp', true),
+ array('imp.js', 'imp', true),
array('dialog.js', 'imp', true)
);
-if(!IMP){var IMP={}}IMP.menuFolderSubmit=function(a){var b=$("menuform");if((!this.menufolder_load||a)&&$F(b.down('SELECT[name="mailbox"]'))){this.menufolder_load=true;b.submit()}};document.observe("dom:loaded",function(){$("menuform").observe("change",IMP.menuFolderSubmit.bind(IMP));$("openfoldericon").down().observe("click",IMP.menuFolderSubmit.bind(IMP,true))});
\ No newline at end of file
+var IMP=window.IMP||{};IMP.menuFolderSubmit=function(a){var b=$("menuform");if((!this.menufolder_load||a)&&$F(b.down('SELECT[name="mailbox"]'))){this.menufolder_load=true;b.submit()}};IMP.popup=function(d,e,a,c){var f,g,h=$H(),b=new Date().getTime();a=Math.min(screen.height-75,a||500);e=Math.min(screen.width-75,e||600);f=d.indexOf("?");if(f!=-1){h=$H(d.toQueryParams());d=d.substring(0,f)}if(c){$H(c.toQueryParams()).each(function(i){h.set(i.key,unescape(i.value))})}h.set("uniq",b);g=window.open(d+"?"+h.toQueryString(),b,"toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width="+e+",height="+a+",left=0,top=0");if(!g){alert(IMP.text.popup_block)}else{if(Object.isUndefined(g.name)){g.name=b}if(Object.isUndefined(g.opener)){g.opener=self}g.focus()}};IMP.unblockImages=function(c,b){var a;if(!c){return true}$(c).select("[blocked]").each(function(d){var e=decodeURIComponent(d.readAttribute("blocked"));if(d.hasAttribute("src")){d.writeAttribute("src",e)}else{if(d.hasAttribute("background")){d.writeAttribute("background",e)}else{if(d.style.backgroundImage){d.setStyle({backgroundImage:"url("+e+")"})}}}});b=$(b);if(b){a=b.up();b.remove();if(!a.childElements().size()){a=a.up("TABLE.mimeStatusMessage");if(a){a.remove()}}}return false};document.observe("dom:loaded",function(){var a=$("menuform");if(a){a.observe("change",IMP.menuFolderSubmit.bind(IMP));$("openfoldericon").down().observe("click",IMP.menuFolderSubmit.bind(IMP,true))}});
\ No newline at end of file
+++ /dev/null
-function popup_imp(d,e,a,c){var f,g,h=$H(),b=new Date().getTime();a=Math.min(screen.height-75,a||500);e=Math.min(screen.width-75,e||600);f=d.indexOf("?");if(f!=-1){h=$H(d.toQueryParams());d=d.substring(0,f)}if(c){$H(c.toQueryParams()).each(function(i){h.set(i.key,unescape(i.value))})}h.set("uniq",b);g=window.open(d+"?"+h.toQueryString(),b,"toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width="+e+",height="+a+",left=0,top=0");if(!g){alert(IMP.text.popup_block)}else{if(Object.isUndefined(g.name)){g.name=b}if(Object.isUndefined(g.opener)){g.opener=self}g.focus()}};
\ No newline at end of file
/**
- * Provides basic IMP javascript.
+ * Provides basic IMP javascript functions.
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-if (!IMP) {
- var IMP = {};
-}
+var IMP = window.IMP || {};
IMP.menuFolderSubmit = function(clear)
{
}
};
+/**
+ * Open a popup window.
+ *
+ * @param string $url The URL to open in the popup window.
+ * @param integer $width The width of the popup window. (Default: 600 px)
+ * @param integer $height The height of the popup window. (Default: 500 px)
+ * @param string $args Any additional args to pass to the script.
+ * (Default: no args)
+ */
+IMP.popup = function(url, width, height, args)
+{
+ var q, win,
+ params = $H(),
+ name = new Date().getTime();
+
+ height = Math.min(screen.height - 75, height || 500);
+ width = Math.min(screen.width - 75, width || 600);
+
+ q = url.indexOf('?');
+ if (q != -1) {
+ params = $H(url.toQueryParams());
+ url = url.substring(0, q);
+ }
+
+ if (args) {
+ $H(args.toQueryParams()).each(function(a) {
+ params.set(a.key, unescape(a.value));
+ });
+ }
+ params.set('uniq', name);
+
+ win = window.open(url + '?' + params.toQueryString(), name, 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ',left=0,top=0');
+ if (!win) {
+ alert(IMP.text.popup_block);
+ } else {
+ if (Object.isUndefined(win.name)) {
+ win.name = name;
+ }
+ if (Object.isUndefined(win.opener)) {
+ win.opener = self;
+ }
+ win.focus();
+ }
+};
+
+/**
+ * Use DOM manipulation to un-block images that had been redirected.
+ */
+IMP.unblockImages = function(p, message)
+{
+ var tmp;
+
+ if (!p) {
+ return true;
+ }
+
+ $(p).select('[blocked]').each(function(elt) {
+ var src = decodeURIComponent(elt.readAttribute('blocked'));
+ if (elt.hasAttribute('src')) {
+ elt.writeAttribute('src', src);
+ } else if (elt.hasAttribute('background')) {
+ elt.writeAttribute('background', src);
+ } else if (elt.style.backgroundImage) {
+ elt.setStyle({ backgroundImage: 'url(' + src + ')' });
+ }
+ });
+
+ message = $(message);
+ if (message) {
+ tmp = message.up();
+ message.remove();
+ if (!tmp.childElements().size()) {
+ tmp = tmp.up('TABLE.mimeStatusMessage');
+ if (tmp) {
+ tmp.remove();
+ }
+ }
+ }
+
+ // On success return false to stop event propagation.
+ return false;
+};
+
document.observe('dom:loaded', function() {
- $('menuform').observe('change', IMP.menuFolderSubmit.bind(IMP));
- $('openfoldericon').down().observe('click', IMP.menuFolderSubmit.bind(IMP, true));
+ // If menu is present, attach event handlers to folder switcher.
+ var tmp = $('menuform');
+ if (tmp) {
+ tmp.observe('change', IMP.menuFolderSubmit.bind(IMP));
+ $('openfoldericon').down().observe('click', IMP.menuFolderSubmit.bind(IMP, true));
+ }
});
+++ /dev/null
-/**
- * IMP Popup JavaScript.
- *
- * Provides the javascript to open popup windows.
- * This file should be included via Horde::addScriptFile().
- * Requires prototypejs 1.6.0.2+
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- */
-
-/**
- * Open a popup window.
- *
- * @param string $url The URL to open in the popup window.
- * @param integer $width The width of the popup window. (Default: 600 px)
- * @param integer $height The height of the popup window. (Default: 500 px)
- * @param string $args Any additional args to pass to the script.
- * (Default: no args)
- */
-function popup_imp(url, width, height, args)
-{
- var q, win,
- params = $H(),
- name = new Date().getTime();
-
- height = Math.min(screen.height - 75, height || 500);
- width = Math.min(screen.width - 75, width || 600);
-
- q = url.indexOf('?');
- if (q != -1) {
- params = $H(url.toQueryParams());
- url = url.substring(0, q);
- }
-
- if (args) {
- $H(args.toQueryParams()).each(function(a) {
- params.set(a.key, unescape(a.value));
- });
- }
- params.set('uniq', name);
-
- win = window.open(url + '?' + params.toQueryString(), name, 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ',left=0,top=0');
- if (!win) {
- alert(IMP.text.popup_block);
- } else {
- if (Object.isUndefined(win.name)) {
- win.name = name;
- }
- if (Object.isUndefined(win.opener)) {
- win.opener = self;
- }
- win.focus();
- }
-}
+++ /dev/null
-/**
- * Use DOM manipulation to un-block images that had been redirected.
- */
-
-var IMP = window.IMP || {};
-
-IMP.unblockImages = function(parent, message)
-{
- var tmp;
-
- if (!parent) {
- return true;
- }
-
- $(parent).select('[blocked]').each(function(elt) {
- var src = decodeURIComponent(elt.readAttribute('blocked'));
- if (elt.hasAttribute('src')) {
- elt.writeAttribute('src', src);
- } else if (elt.hasAttribute('background')) {
- elt.writeAttribute('background', src);
- } else if (elt.style.backgroundImage) {
- elt.setStyle({ backgroundImage: 'url(' + src + ')' });
- }
- });
-
- message = $(message);
- if (message) {
- tmp = message.up();
- message.remove();
- if (!tmp.childElements().size()) {
- tmp = tmp.up('TABLE.mimeStatusMessage');
- if (tmp) {
- tmp.remove();
- }
- }
- }
-
- // On success return false to stop event propagation.
- return false;
-};
+++ /dev/null
-var IMP=window.IMP||{};IMP.unblockImages=function(b,c){var a;if(!b){return true}$(b).select("[blocked]").each(function(d){var e=decodeURIComponent(d.readAttribute("blocked"));if(d.hasAttribute("src")){d.writeAttribute("src",e)}else{if(d.hasAttribute("background")){d.writeAttribute("background",e)}else{if(d.style.backgroundImage){d.setStyle({backgroundImage:"url("+e+")"})}}}});c=$(c);if(c){a=c.up();c.remove();if(!a.childElements().size()){a=a.up("TABLE.mimeStatusMessage");if(a){a.remove()}}}return false};
\ No newline at end of file
$GLOBALS['prefs']->getValue('compose_popup') &&
$GLOBALS['browser']->hasFeature('javascript')) {
Horde::addScriptFile('prototype.js', 'horde', true);
- Horde::addScriptFile('popup.js', 'imp', true);
+ Horde::addScriptFile('imp.js', 'imp', true);
if (isset($args['to'])) {
$args['to'] = addcslashes($args['to'], '\\"');
}
}
/**
- * Output the javascript needed to call the popup_imp JS function.
+ * Output the javascript needed to call the IMP popup JS function.
*
* @param string $url The IMP page to load.
* @param array $params An array of paramters to pass to the URL.
static public function popupIMPString($url, $params = array(),
$width = 700, $height = 650)
{
- return "popup_imp('" . Horde::applicationUrl($url) . "'," . $width . "," . $height . ",'" . $GLOBALS['browser']->escapeJSCode(str_replace('+', '%20', substr(Util::addParameter('', $params, null, false), 1))) . "');";
+ return "IMP.popup('" . Horde::applicationUrl($url) . "'," . $width . "," . $height . ",'" . $GLOBALS['browser']->escapeJSCode(str_replace('+', '%20', substr(Util::addParameter('', $params, null, false), 1))) . "');";
}
/**
if (!$view_img && !$addr_check) {
$data .= Util::bufferOutput(array('Horde', 'addScriptFile'), 'prototype.js', 'horde', true) .
- Util::bufferOutput(array('Horde', 'addScriptFile'), 'unblockImages.js', 'imp', true);
+ Util::bufferOutput(array('Horde', 'addScriptFile'), 'imp.js', 'imp', true);
$cleanhtml['status'][] = array(
'icon' => Horde::img('mime/image.png'),
/* We need to insert JavaScript code now if S/MIME support is
* active. */
Horde::addScriptFile('prototype.js', 'horde', true);
- Horde::addScriptFile('popup.js', 'imp', true);
+ Horde::addScriptFile('imp.js', 'imp', true);
}
switch ($this->_mimepart->getType()) {
if (!isset($options)) {
$options = array();
}
- Horde::addScriptFile('popup.js', 'imp', true);
+ Horde::addScriptFile('imp.js', 'imp', true);
$notification->push(IMP::popupIMPString('compose.php', array_merge(array('popup' => 1), $options, IMP::getComposeArgs())), 'javascript');
}
array('ContextSensitive.js', 'imp', true),
array('fullmessage-dimp.js', 'imp', true),
array('compose-dimp.js', 'imp', true),
- array('unblockImages.js', 'imp', true),
- array('popup.js', 'imp', true)
+ array('imp.js', 'imp', true)
);
DIMP::header($show_msg_result['subject'], $scripts);
/* Output message page now. */
Horde::addScriptFile('prototype.js', 'horde', true);
-Horde::addScriptFile('popup.js', 'imp', true);
+Horde::addScriptFile('imp.js', 'imp', true);
Horde::addScriptFile('message.js', 'imp', true);
require IMP_TEMPLATES . '/common-header.inc';
if (IMP::$printMode) {
$t->setOption('gettext', true);
if ($prefs->getValue('use_pgp')) {
Horde::addScriptFile('prototype.js', 'horde', true);
- Horde::addScriptFile('popup.js', 'imp', true);
+ Horde::addScriptFile('imp.js', 'imp', true);
$t->set('pgpactive', true);
$t->set('overview-help', Help::link('imp', 'pgp-overview'));
$t->set('attach_pubkey_notlocked', !$prefs->isLocked('pgp_attach_pubkey'));
$t->setOption('gettext', true);
$t->set('use_smime_help', Help::link('imp', 'smime-overview'));
if (!is_a($openssl_check, 'PEAR_Error') && $prefs->getValue('use_smime')) {
- Horde::addScriptFile('popup.js', 'imp', true);
+ Horde::addScriptFile('imp.js', 'imp', true);
$t->set('smimeactive', true);
$t->set('manage_pubkey-help', Help::link('imp', 'smime-manage-pubkey'));
/* Strings used in search.js */
'search_select' => _("Please select at least one folder to search."),
- /* Strings used in popup.js */
+ /* Strings used in imp.js */
'popup_block' => _("A popup window could not be opened. Perhaps you have set your browser to block popup windows?"),
/* Strings used in login.js */
<if:no_source>
<br /><em><gettext>Key import is not available. You have no address book defined to add your contacts.</gettext></em><br />
<else:no_source>
- <br /><input type="submit" name="save" class="button" onclick="popup_imp('<tag:public_import_url />',750,275); return false;" value="<gettext>Import Public Key</gettext>" />
+ <br /><input type="submit" name="save" class="button" onclick="IMP.popup('<tag:public_import_url />',750,275); return false;" value="<gettext>Import Public Key</gettext>" />
<tag:import_pubkey-help />
</else:no_source></if:no_source></else:no_file_upload></if:no_file_upload>
</div>
<p>
<input type="submit" name="save" class="button" onclick="if (confirm('<tag:keygen />')) { document.prefs.actionID.value='generate_key';return true; } else { return false; }" value="<gettext>Create Keys</gettext>" />
<if:no_file_upload><else:no_file_upload>
- <input type="submit" name="save" class="button" onclick="popup_imp('<tag:personal_import_url />',750,275);return false;" value="<gettext>Import Keypair</gettext>" />
+ <input type="submit" name="save" class="button" onclick="IMP.popup('<tag:personal_import_url />',750,275);return false;" value="<gettext>Import Keypair</gettext>" />
</else:no_file_upload></if:no_file_upload>
<tag:personalkey-create-actions-help />
</p>
<if:no_source>
<em><gettext>Key import is not available. You have no address book defined to add your contacts.</gettext></em>
<else:no_source>
- <p><input type="submit" name="save" class="button" onclick="popup_imp('<tag:public_import_url />',750,275); return false;" value="<gettext>Import Public Key</gettext>" />
+ <p><input type="submit" name="save" class="button" onclick="IMP.popup('<tag:public_import_url />',750,275); return false;" value="<gettext>Import Public Key</gettext>" />
<tag:import_pubkey-help /></p>
</else:no_source></if:no_source></else:no_file_upload></if:no_file_upload>
</div>
<if:no_file_upload>
<em style="color:red"><gettext>Certificate import is not available. File upload is not enabled on this server.</gettext></em>
<else:no_file_upload>
- <p><input type="submit" name="save" class="button" onclick="popup_imp('<tag:personal_import_url />',750,275);return false;" value="<gettext>Import Keypair</gettext>" /> <tag:import-cert-help /></p>
+ <p><input type="submit" name="save" class="button" onclick="IMP.popup('<tag:personal_import_url />',750,275);return false;" value="<gettext>Import Keypair</gettext>" /> <tag:import-cert-help /></p>
</else:no_file_upload></if:no_file_upload>
</else:has_key></if:has_key></else:secure_check></if:secure_check>
<else:smimeactive>