/**
*/
protected function _attach($init)
{
global $page_output;
if ($init) {
$page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
$page_output->addScriptFile('passphrase.js', 'imp');
}
$params = isset($this->_params['params']) ? $this->_params['params'] : array();
if (isset($params['reload'])) {
$params['reload'] = strval($params['reload']);
}
switch ($this->_params['type']) {
case 'pgpPersonal':
$text = _("Enter your personal PGP passphrase.");
break;
case 'pgpSymmetric':
$text = _("Enter the passphrase used to encrypt this message.");
break;
case 'smimePersonal':
$text = _("Enter your personal S/MIME passphrase.");
break;
}
$js_params = array('hidden' => array_merge($params, array('type' => $this->_params['type'])), 'text' => $text);
$js = 'ImpPassphraseDialog.display(' . Horde::escapeJson($js_params, array('nodelimit' => true)) . ')';
if (!empty($this->_params['onload'])) {
$page_output->addInlineScript(array($js), true);
return false;
}
return $js;
}