Hermes: Convert to new H4 intialization
authorBen Klang <ben@alkaloid.net>
Wed, 26 May 2010 18:27:56 +0000 (14:27 -0400)
committerBen Klang <ben@alkaloid.net>
Wed, 2 Jun 2010 19:22:22 +0000 (15:22 -0400)
hermes/lib/Application.php [new file with mode: 0644]
hermes/lib/Exception.php [new file with mode: 0644]
hermes/lib/version.php [deleted file]

diff --git a/hermes/lib/Application.php b/hermes/lib/Application.php
new file mode 100644 (file)
index 0000000..8083a8c
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+/**
+ * Hermes application interface.
+ *
+ * This file is responsible for initializing the Hermes application.
+ *
+ * Copyright 2001-2007 Robert E. Coyle <robertecoyle@hotmail.com>
+ * 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 <robertecoyle@hotmail.com>
+ * @author  Ben Klang <ben@alkaloid.net>
+ * @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 (file)
index 0000000..814aa15
--- /dev/null
@@ -0,0 +1 @@
+<?php class Hermes_Exception extends Horde_Exception {}
\ No newline at end of file
diff --git a/hermes/lib/version.php b/hermes/lib/version.php
deleted file mode 100644 (file)
index 0bd0620..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<?php define('HERMES_VERSION', 'H4 (2.0-cvs)') ?>