From: Jan Date: Thu, 4 Nov 2010 13:45:22 +0000 (+0000) Subject: Revert "Revert "The Desktop handler is not production ready yet."" X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=05fc92e1578fb6882d7816f113d42eace7356cbb;p=horde.git Revert "Revert "The Desktop handler is not production ready yet."" This reverts commit a333ae254864f2305b5acc46a7f03f814f2d13bf. --- diff --git a/framework/Alarm/lib/Horde/Alarm/Handler/Desktop.php b/framework/Alarm/lib/Horde/Alarm/Handler/Desktop.php deleted file mode 100644 index e5a867d2b..000000000 --- a/framework/Alarm/lib/Horde/Alarm/Handler/Desktop.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @package Horde_Alarm - */ -class Horde_Alarm_Handler_Desktop extends Horde_Alarm_Handler -{ - /** - * A notification callback. - * - * @var callback - */ - protected $_jsNotify; - - /** - * An icon URL. - * - * @var string - */ - protected $_icon; - - /** - * Constructor. - * - * @param array $params Any parameters that the handler might need. - * Required parameter: - * - js_notify: A Horde_Notification_Handler - * instance. - * Optional parameter: - * - icon: URL of an icon to display. - */ - public function __construct(array $params = null) - { - /* - if (!isset($params['js_notify'])) { - throw new InvalidArgumentException('Parameter \'js_notify\' missing.'); - } - if (!is_callable($params['js_notify'])) { - throw new Horde_Alarm_Exception('Parameter \'js_notify\' is not a Horde_Notification_Handler object.'); - } - $this->_jsNotify = $params['jsNotify']; - if (isset($params['icon'])) { - $this->_icon = $params['icon']; - } - */ - $this->_jsNotify = isset($params['js_notify']) - ? $params['js_notify'] - : array('Horde', 'addInlineScript'); - $this->_icon = isset($params['icon']) ? $params['icon'] : (string)Horde_Themes::img('alerts/alarm.png'); - } - - /** - * Notifies about an alarm through javscript. - * - * @param array $alarm An alarm hash. - */ - public function notify(array $alarm) - { - $js = sprintf('if(window.webkitNotifications&&!window.webkitNotifications.checkPermission())(function(){var notify=window.webkitNotifications.createNotification(\'%s\',\'%s\',\'%s\');notify.show();(function(){notify.cancel()}).delay(5)})()', - $this->_icon, - addslashes($alarm['title']), - isset($alarm['text']) ? addslashes($alarm['text']) : ''); - call_user_func($this->_jsNotify($js)); - } - - /** - * Returns a human readable description of the handler. - * - * @return string - */ - public function getDescription() - { - return _("Desktop notification (with certain browsers)"); - } -}