// Link to add a Firefox 3 mailto: handler
$_prefs['mailto_handler'] = array(
- 'type' => 'link',
- 'img' => 'compose.png',
- 'xurl' => 'javascript:if(typeof navigator.registerProtocolHandler==\'undefined\')alert(\''
- . addslashes(_("Your browser does not support this feature."))
- . '\');else navigator.registerProtocolHandler(\'mailto\',\''
- . Horde::url('compose.php', true)->setRaw(true)->add(array('actionID' => 'mailto_link', 'to' => ''))
- . '%s\',\'' . $GLOBALS['registry']->get('name') . '\');',
- 'desc' => sprintf(_("Click here to open all mailto: links in %s."), $GLOBALS['registry']->get('name'))
+ 'type' => 'special'
);
// Show Cc: field?
case 'initialpageselect':
return $this->_initialPage();
+ case 'mailto_handler':
+ return $this->_mailtoHandler();
+
case 'pgpprivatekey':
return $this->_pgpPrivateKey($ui);
return $t->fetch(IMP_TEMPLATES . '/prefs/initialpage.html');
}
+ /* Mailto: handler. */
+
+ /**
+ * Create code for the mailto handler link.
+ *
+ * @return string HTML UI code.
+ */
+ protected function _mailtoHandler()
+ {
+ Horde::addInlineScript(array(
+ 'if (!Object.isUndefined(navigator.registerProtocolHandler))' .
+ '$("mailto_handler").show().down("A").observe("click", function() {' .
+ 'navigator.registerProtocolHandler("mailto","' .
+ Horde::url('compose.php', true)->setRaw(true)->add(array(
+ 'actionID' => 'mailto_link',
+ 'to' => ''
+ )) .
+ '%s","' . $GLOBALS['registry']->get('name') . '");' .
+ '})'
+ ), 'dom');
+
+ $t = $GLOBALS['injector']->createInstance('Horde_Template');
+ $t->setOption('gettext', true);
+
+ $t->set('desc', sprintf(_("Click here to open all mailto: links using %s."), $GLOBALS['registry']->get('name')));
+ $t->set('img', Horde::img('compose.png'));
+
+ return $t->fetch(IMP_TEMPLATES . '/prefs/mailto.html');
+ }
+
/* PGP Private Key management. */
/**