From 7553290b245b7ba155195c0cf49b969ff2ba04e1 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Wed, 26 May 2010 14:27:56 -0400 Subject: [PATCH] Hermes: Convert to new H4 intialization --- hermes/lib/Application.php | 90 ++++++++++++++++++++++++++++++++++++++++++++++ hermes/lib/Exception.php | 1 + hermes/lib/version.php | 1 - 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 hermes/lib/Application.php create mode 100644 hermes/lib/Exception.php delete mode 100644 hermes/lib/version.php diff --git a/hermes/lib/Application.php b/hermes/lib/Application.php new file mode 100644 index 000000000..8083a8cf9 --- /dev/null +++ b/hermes/lib/Application.php @@ -0,0 +1,90 @@ + + * Copyright 2010 Alkaloid Networks (http://projects.alkaloid.net/) + * + * See the enclosed file LICENSE for license information (BSD). If you + * did not receive this file, see http://www.horde.org/licenses/bsdl.php. + * + * @author Robert E. Coyle + * @author Ben Klang + * @package Hermes + */ + +if (!defined('HERMES_BASE')) { + define('HERMES_BASE', dirname(__FILE__). '/..'); +} + +if (!defined('HORDE_BASE')) { + /* If horde does not live directly under the app directory, the HORDE_BASE + * constant should be defined in config/horde.local.php. */ + if (file_exists(HERMES_BASE. '/config/horde.local.php')) { + include HERMES_BASE . '/config/horde.local.php'; + } else { + define('HORDE_BASE', HERMES_BASE . '/..'); + } +} + +/* Load the Horde Framework core (needed to autoload + * Horde_Registry_Application::). */ +require_once HORDE_BASE . '/lib/core.php'; + +class Hermes_Application extends Horde_Registry_Application +{ + /** + * The application's version. + * + * @var string + */ + public $version = 'H4 (2.0-cvs)'; + + /** + * Driver object for reading/writing time entries + */ + static protected $driver = null; + + /** + * TODO + */ + static protected $_perms = array(); + + /** + * Initialization function. + * + * Global variables defined: + */ + protected function _init() + { + try { + $this->driver = Hermes::getDriver(); + } catch (Hermes_Exception $e) { + $GLOBALS['notification']->push($e); + return false; + } + } + + /** + * Interface to define settable permissions within Horde + */ + public function perms() + { + if (!empty(self::$_perms)) { + return self::$_perms; + } + + self::$_perms = array(); + self::$_perms['tree']['hermes']['review'] = array(); + self::$_perms['title']['hermes:review'] = _("Time Review Screen"); + self::$_perms['tree']['hermes']['deliverables'] = array(); + self::$_perms['title']['hermes:deliverables'] = _("Deliverables"); + self::$_perms['tree']['hermes']['invoicing'] = array(); + self::$_perms['title']['hermes:invoicing'] = _("Invoicing"); + + return self::$_perms; + } + +} diff --git a/hermes/lib/Exception.php b/hermes/lib/Exception.php new file mode 100644 index 000000000..814aa1548 --- /dev/null +++ b/hermes/lib/Exception.php @@ -0,0 +1 @@ + -- 2.11.0