1: <?php
 2: /**
 3:  * Copyright 2012-2014 Horde LLC (http://www.horde.org/)
 4:  *
 5:  * See the enclosed file COPYING for license information (GPL). If you
 6:  * did not receive this file, see http://www.horde.org/licenses/gpl.
 7:  *
 8:  * @category  Horde
 9:  * @copyright 2012-2014 Horde LLC
10:  * @license   http://www.horde.org/licenses/gpl GPL
11:  * @package   IMP
12:  */
13: 
14: /**
15:  * Special prefs handling for the 'mailto_handler' preference.
16:  *
17:  * @author    Michael Slusarz <slusarz@horde.org>
18:  * @category  Horde
19:  * @copyright 2012-2014 Horde LLC
20:  * @license   http://www.horde.org/licenses/gpl GPL
21:  * @package   IMP
22:  */
23: class IMP_Prefs_Special_Mailto implements Horde_Core_Prefs_Ui_Special
24: {
25:     /**
26:      */
27:     public function init(Horde_Core_Prefs_Ui $ui)
28:     {
29:     }
30: 
31:     /**
32:      */
33:     public function display(Horde_Core_Prefs_Ui $ui)
34:     {
35:         global $page_output, $registry;
36: 
37:         $name = $registry->get('name');
38: 
39:         $page_output->addInlineScript(array(
40:             'if (!Object.isUndefined(navigator.registerProtocolHandler))' .
41:             '$("mailto_handler").show().down("A").observe("click", function() {' .
42:                 'navigator.registerProtocolHandler("mailto","' .
43:                 IMP_Basic_Compose::url(array('full' => true))->setRaw(true)->add(array(
44:                     'actionID' => 'mailto_link',
45:                     'to' => ''
46:                 )) .
47:                 '=%s","' . $name . '");' .
48:             '})'
49:         ), true);
50: 
51:         $view = new Horde_View(array(
52:             'templatePath' => IMP_TEMPLATES . '/prefs'
53:         ));
54:         $view->addHelper('Horde_Core_View_Helper_Image');
55: 
56:         $view->name = $name;
57: 
58:         return $view->render('mailto');
59:     }
60: 
61:     /**
62:      */
63:     public function update(Horde_Core_Prefs_Ui $ui)
64:     {
65:         return false;
66:     }
67: 
68: }
69: