[dev] Patch to add application admin to the horde admin menu
Marcus I. Ryan
marcus@riboflavin.net
Thu, 25 Apr 2002 09:26:32 -0500
This message is in MIME format.
---------------------- multipart/mixed attachment
As discussed on IRC, this patch adds the ability to define
"administration" service(s) for applications, and displays links to them
on the Horde administration menu page. It also adds a function to the
registry that returns a list of the defined applications.
diff -ru horde.head.orig/config/registry.php.dist
horde.head/config/registry.php.dist
--- horde.head.orig/config/registry.php.dist Wed Apr 24 16:02:24 2002
+++ horde.head/config/registry.php.dist Thu Apr 25 09:25:26 2002
@@ -228,6 +228,10 @@
'type' => 'string'
);
+$this->services['jonah']['admin']['update'] = array(
+ 'link' => '%application%/backend.php'
+);
+
$this->services['mnemo']['memos']['list'] = array(
'file' => '%application%/lib/api.php',
'function' => 'mnemoListMemos',
diff -ru horde.head.orig/lib/Registry.php horde.head/lib/Registry.php
--- horde.head.orig/lib/Registry.php Wed Apr 24 16:02:40 2002
+++ horde.head/lib/Registry.php Wed Apr 24 16:14:58 2002
@@ -121,6 +121,17 @@
}
/**
+ * Return a list of the installed and registered applications. If
+ * no applications are defined return a null array.
+ *
+ * @return array List of apps registered with Horde
+ */
+ function listApps()
+ {
+ return array_keys($this->applications);
+ }
+
+ /**
* Determine if guests should be allowed access to the specified
* application. If no application is specified, check the current
* application.
diff -ru horde.head.orig/templates/admin/index/admin.inc
horde.head/templates/admin/index/admin.inc
--- horde.head.orig/templates/admin/index/admin.inc Wed Apr 24
16:02:22 2002
+++ horde.head/templates/admin/index/admin.inc Thu Apr 25 09:14:35 2002
@@ -10,4 +10,20 @@
<?= Horde::link(Horde::applicationUrl('admin/user.php'), _("Users"),
'menuitem') . Horde::img('user.gif') . ' ' . _("Users") ?></a><br />
<?= Horde::link(Horde::applicationUrl('admin/groups.php'), _("Groups"),
'menuitem') . Horde::img('group.gif') . ' ' . _("Groups") ?></a><br />
-<?= Horde::link(Horde::applicationUrl('admin/perms.php'),
_("Permissions"), 'menuitem') . Horde::img('perms.gif') . ' ' .
_("Permissions") ?></a>
+<?= Horde::link(Horde::applicationUrl('admin/perms.php'),
_("Permissions"), 'menuitem') . Horde::img('perms.gif') . ' ' .
_("Permissions") ?></a><br />
+<?php
+
+foreach ($registry->listApps() as $app) {
+ if (isset($registry->services[$app]['admin']) &&
$registry->getParam('show', $app)) {
+ foreach (array_keys($registry->services[$app]['admin']) as
$admin) {
+ $method = "admin/$admin";
+ $args = array('application' => $app);
+ $link = $registry->linkByPackage($app, $method, $args);
+ $name = _($app) . ' ' ._($admin);
+ $img = $registry->getParam('icon', $app);
+ print Horde::link(Horde::applicationUrl($link), $name,
'menuitem') . Horde::img($img,'','','') . ' ' . $name . "</a><br />\n";
+ }
+ }
+}
+
+?>
--
Marcus I. Ryan, marcus@riboflavin.net
-----------------------------------------------------------------------
"Love is a snowmobile racing across the tundra and then suddenly it
flips over, pinning you underneath. At night, the ice weasels come."
-- Matt Groening
-----------------------------------------------------------------------
---------------------- multipart/mixed attachment
A non-text attachment was scrubbed...
Name: PGP Public Key
Type: application/pgp-keys
Size: 995 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/850dc839/PGPPublicKey.bin
---------------------- multipart/mixed attachment--