[dev] General Linking/Relationship/Reference
j.huinink at wanadoo.nl
j.huinink at wanadoo.nl
Mon Feb 10 22:21:21 PST 2003
Hello List,
This is my attempt at implementing a general Linking/Relationship/Reference
mechanism within Horde. I decided on a classname of Horde_Links. I tried to
follow the coding standards and also stick to other conventions which I thought
that are in place, but I'm sure I must have missed some.
This mechanism allows you to e.g. create links between tasks (follow-up) tasks,
links from tasks to clients or attach a comic to a task, client or specific
meeting.
I tried to generalize the mechanism as much as possible. At the moment an
application that wants to allow incoming links must supply certain API's:
- LinkParameters
- LinkDescription
- addLink
If an application wants to allow outgoing links it must create an instance of
Horde_Links and call the proper function (viewLinks) somewhere in their "view".
The implementation of the Add and Delete routines for links is rather crude and
I am sure that this could be implemented better(efficient, user-friendly,
cleaner coded). I just added them so the principle would be visible.
To activate: apply the patch and unpack the attached zipfile.
Run the scripts/db/links.sql script to create the required database table add
the following to your conf.php file:
---
/**
** Links
**/
// Valid values: 'none', 'sql'. If a value of 'none' is specifed then no
// links are used.
$conf['links']['driver'] = 'sql';
---
The only application with 'outgoing' links is nag. Both nag and klutz
allow 'incoming' links. The nag configuration needs a link parameter to specify
the allowed link_types. Mine looks like this:
---
$this->applications['nag'] = array(
'fileroot' => dirname(__FILE__) . '/../nag',
'webroot' => $this->applications['horde']['webroot'] . '/nag',
'icon' => $this->applications['horde']['webroot'] . '/nag/graphics/nag.gif',
'name' => _("Tasks"),
'allow_guests' => false,
'status' => 'active',
'provides' => 'tasks',
'links' => array(
'follow-up-to' => array(
'provider' => 'tasks',
'description' => _("Follow up task"),
'reverse' => array(
'description'=> _("Previous task"),
'type' => 'follow-up-from',
'readonly' => true,
),
),
'comic' => array(
'provider' => 'comics',
'description' => _("Funny note"),
),
),
);
---
I consider this a prototype, but fit for inclusion into HEAD, if you like the
idea at all. I'll hear your opinions and feedback.
Regards,
Jeroen
__________________________________________________________
http://www.wanadoo.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: horde.zip
Type: application/x-zip-compressed
Size: 19482 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20030210/ea01807d/horde-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: horde_links.diff
Type: application/octet-stream
Size: 4762 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20030210/ea01807d/horde_links-0001.obj
More information about the dev
mailing list