};
/**
- * 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.
*/
IMP.unblockImages = function(e)
if (($mask && self::SUMMARY_IMAGE_SAVE) &&
$GLOBALS['registry']->hasMethod('images/selectGalleries') &&
($mime_part->getPrimaryType() == 'image')) {
- $part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'saveImgAtc', null, IMP::popupIMPString('saveimage.php', array('index' => ($this->_index . IMP::IDX_SEP . $this->_mailbox), 'id' => $id), 450, 200) . "return false;") . '</a>';
+ $part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'saveImgAtc', null, Horde::popupJs(Horde::applicationUrl('saveimage.php'), array('params' => array('index' => ($this->_index . IMP::IDX_SEP . $this->_mailbox), 'id' => $id), 'height' => 200, 'width' => 450)) . 'return false;') . '</a>';
}
/* Strip Attachment? Allow stripping of base parts other than the
$options['jstext'] = sprintf(_("View %s"), $mime_part->getDescription(true));
}
- $url = IMP::popupIMPString('view.php', $this->_urlViewParams($mime_part, $actionID, isset($options['params']) ? $options['params'] : array())) . 'return false;';
+ $url = Horde::popupJs(Horde::applicationUrl('view.php'), array('params' => $this->_urlViewParams($mime_part, $actionID, isset($options['params']) ? $options['params'] : array()))) . 'return false;';
return empty($options['widget'])
? Horde::link('#', $options['jstext'], empty($options['css']) ? null : $options['css'], null, $url) . $text . '</a>'
'uid' => $uid,
'mime_id' => $id
);
- return IMP::popupIMPString('pgp.php', $params, 450, 200);
+ return Horde::popupJs(Horde::applicationUrl('pgp.php'), array('params' => $params, 'height' => 200, 'width' => 450));
}
/**
'uid' => $uid,
'mime_id' => $id
);
- return IMP::popupIMPString('smime.php', $params, 450, 200);
+ return Horde::popupJs(Horde::applicationUrl('smime.php'), array('params' => $params, 'height' => 200, 'width' => 450));
}
/**
if (($view != 'mimp') &&
$GLOBALS['prefs']->getValue('compose_popup') &&
$GLOBALS['browser']->hasFeature('javascript')) {
- Horde::addScriptFile('imp.js', 'imp', true);
if (isset($args['to'])) {
$args['to'] = addcslashes($args['to'], '\\"');
}
- return "javascript:" . self::popupIMPString('compose.php', $args);
+ return "javascript:" . Horde::popupJs(Horde::applicationUrl('compose.php'), array('params' => $args, 'urlencode' => true));
}
return Horde_Util::addParameter(Horde::applicationUrl(($view == 'mimp') ? 'compose-mimp.php' : 'compose.php'), $args);
}
/**
- * 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.
- * @param integer $width The width of the popup window.
- * @param integer $height The height of the popup window.
- *
- * @return string The javascript needed to call the popup code.
- */
- static public function popupIMPString($url, $params = array(),
- $width = 700, $height = 650)
- {
- return "IMP.popup('" . Horde::applicationUrl($url) . "'," . $width . "," . $height . ",'" . $GLOBALS['browser']->escapeJSCode(str_replace('+', '%20', substr(Horde_Util::addParameter('', $params, null, false), 1))) . "');";
- }
-
- /**
* Returns a Horde_Cache object (if configured) and handles any errors
* associated with creating the object.
*
if (!isset($options)) {
$options = array();
}
- Horde::addScriptFile('imp.js', 'imp', true);
- $notification->push(IMP::popupIMPString('compose.php', array_merge(array('popup' => 1), $options, IMP::getComposeArgs())), 'javascript');
+ Horde::addInlineScript(Horde::popupJs(Horde::applicationUrl('compose.php'), array('params' => array_merge(array('popup' => 1), $options, IMP::getComposeArgs()))), 'dom');
}
if (!empty($newmsgs)) {
}
/* Newmail alert. */
if ($prefs->getValue('nav_popup')) {
- $notification->push(IMP::getNewMessagePopup($newmsgs), 'javascript');
+ Horde::addInlineScript(IMP::getNewMessagePopup($newmsgs), 'dom');
}
}
}
$t->set('no_source', !$GLOBALS['prefs']->getValue('add_source'));
if (!$t->get('no_source')) {
$cacheSess = Horde_SessionObjects::singleton();
- $t->set('public_import_url', Horde_Util::addParameter(Horde_Util::addParameter($selfURL, 'actionID', 'import_public_key'), 'reload', $cacheSess->storeOid($selfURL, false)));
+ $t->set('public_import_url', Horde::popupJs($selfURL, array('params' => array('actionID' => 'import_public_key', 'reload' => $cacheSess->storeOid($selfURL, false)), 'height' => 275, 'width' => 750, 'urlencode' => true)));
$t->set('import_pubkey-help', Horde_Help::link('imp', 'pgp-import-pubkey'));
}
}
$t->set('personalkey-create-keylength-help', Horde_Help::link('imp', 'pgp-personalkey-create-keylength'));
$t->set('personalkey-create-passphrase-help', Horde_Help::link('imp', 'pgp-personalkey-create-passphrase'));
$t->set('keygen', addslashes(_("Key generation may take a long time to complete. Continue with key generation?")));
- $t->set('personal_import_url', Horde_Util::addParameter($selfURL, 'actionID', 'import_personal_public_key'));
+ $t->set('personal_import_url', Horde::popupJs($selfURL, array('params' => array('actionID' => 'import_personal_public_key'), 'height' => 275, 'width' => 750, 'urlencode' => true)));
$t->set('personalkey-create-actions-help', Horde_Help::link('imp', 'pgp-personalkey-create-actions'));
}
}
$t->set('no_source', !$GLOBALS['prefs']->getValue('add_source'));
if (!$t->get('no_source')) {
$cacheSess = Horde_SessionObjects::singleton();
- $t->set('public_import_url', Horde_Util::addParameter(Horde_Util::addParameter($selfURL, 'actionID', 'import_public_key'), 'reload', $cacheSess->storeOid($selfURL, false)));
+ $t->set('public_import_url', Horde::popupJs($selfURL, array('params' => array('actionID' => 'import_public_key', 'reload' => $cacheSess->storeOid($selfURL, false)), 'height' => 275, 'width' => 750, 'urlencode' => true)));
$t->set('import_pubkey-help', Horde_Help::link('imp', 'smime-import-pubkey'));
}
}
$t->set('deletekeypair', addslashes(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")));
$t->set('personalkey-delete-help', Horde_Help::link('imp', 'smime-delete-personal-certs'));
} else {
- $t->set('personal_import_url', Horde_Util::addParameter($selfURL, 'actionID', 'import_personal_certs'));
+ $t->set('personal_import_url', Horde::popupJs($selfURL, array('params' => array('actionID' => 'import_personal_certs'), 'height' => 275, 'width' => 750, 'urlencode' => true)));
$t->set('import-cert-help', Horde_Help::link('imp', 'smime-import-personal-certs'));
}
}
'of' => _("of"),
'ok' => _("Ok"),
'onlogout' => _("Logging Out..."),
- 'popup_block' => _("A popup window could not be opened. Your browser may be blocking popups."),
'portal' => ("Portal"),
'prefs' => _("User Options"),
'rename_prompt' => _("Rename folder to:"),
<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="IMP.popup('<tag:public_import_url />',750,275); return false;" value="<gettext>Import Public Key</gettext>" />
+ <br /><input type="submit" name="save" class="button" onclick="<tag:public_import_url />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="IMP.popup('<tag:personal_import_url />',750,275);return false;" value="<gettext>Import Keypair</gettext>" />
+ <input type="submit" name="save" class="button" onclick="<tag:personal_import_url />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="IMP.popup('<tag:public_import_url />',750,275); return false;" value="<gettext>Import Public Key</gettext>" />
+ <p><input type="submit" name="save" class="button" onclick="<tag:public_import_url />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="IMP.popup('<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="<tag:personal_import_url />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>