[Typo3-dev] Event System in the core / Ease the integration of 3rd party apps
Andy Staudacher
ast at gmx.ch
Thu Sep 2 18:39:58 CEST 2004
Hi
About me:
I'm not a typo3 or phpbb dev, but I'm concerned about the interfaces
between CMS like typo3 and 3rd party applications (3rdPA) as the forum
software phpbb or the gallery software gallery/G2. I'm a fan of projects
like typo3, xaraya, phpbb or G2 and I'm working on the integration of G2
with xaraya as an integration prototype for future G2 integrations with
as many CMS as possible, typo3 and various *nuke forks are on the list.
Why integrate 3rd party software with CMS' that feature a powerful
framework?
Because there are some great projects outhere dedicated for a single
purpose, i.e. creating the best forum software available. A typo3 forum
extension will never be as feature rich, ... as a phpbb or
invisionboard. And forking i.e. a 3rdPA for a specific CMS blocks the
upgrade path of the 3rdPA and needs a lot of work.
The idea is that a well designed CMS and a well designed 3rd party
application can be integrated with each other without changes to the
core of the CMS or the 3rdPA, i.e. by adding the 3rd party application
as a module to the CMS.
One aspect of the integration is the user / group management. Both, the
CMS and the 3rdPA, have their own user/group management. Now we have two
options:
A: Use both user / group / usergroupmap database tables in parallel:
__A user creates an account in the CMS. When he first browses to the
3rdPA module, the module checks if this account already exists and if
not, creates a 3rdPA account for this user.
__Problems: If the user changes his account in the CMS or in the 3rdPA,
the user accounts of CMS/3rdPA get out of sync (i.e. different language
settings, usernames, ...).
__Solution: Both, the CMS and the 3rdPA, need to call an update/delete
function when updating/deleting user accounts. i.e. When the user
changes his account in the CMS, the CMS needs to call
"update3rdPA(updateInfoHash);" which is a function that comes with the
CMS module (extension).
B: Either the 3rdPA uses the user / group / usergroupmap tables of the
CMS or the other way around.
__A user creates an account in the CMS.
__Problem 1: The 3rdPA has to use the database tables of the CMS for
user / group management.
__Solution 1: Translate all database queries in a database abstraction
layer (possible and done in G2).
__Problem 2: The 3rdPA may have more / other user attributes than the
CMS.
__Solution 2: Add these attributes (table columns) to the CMS table,
i.e. in xaraya there's an API function to add columns and I'd use it in
the module (extension) install code.
__Problem 3: The 3rdPA may have different data structures / designs.
i.e. G2 maps each user with each group it belongs to. Xaraya manages a
tree of roles (groups can have subgroups, etc.).
__Solution 3: Replace some core API functions of the 3rdPA to handle
this.
You may have notices that "B" needs a lot more changes to the 3rdPA than
"A". The problem with "A" is that the huge majority of CMS don't feature
an "Event System".
So "B" is the low-tech integration method and "A" the minimally invasive
method.
i.e. A dev of TikiPro (a CMS) managed to integrate phpBB with only 14
really small changes (1 or 2 liners each) with the method "A".
14 changes only, you can patch the newest phpbb version with a few
minutes, almost automatically.
Please forgive me for the long post if typo3 already features an "Event
System", but I can't remember typo3 having one.
What do I mean by an "Event System"?
There should be an API to create events and to listen to events.
i.e. each time a user updates his account data there's an event
triggered "event_type=userUpdate, data=reference_to_user_data/user_id".
The core checks if there are any event listeres listening for the
event_type "userUpdate" and if so, it calls their registered action
(i.e. a function).
Xaraya has an event system (and a hooks system, whatever).
TikiPro doesn't have an event system, but you can register functions for
user account updates.
I'd love to see an event sytem in typo3, as it could be used for all
kinds of things. But the best feature is that there's no need to change
anything in the core code at all. Just register an event listener for a
specific event and the core will execute your user-defined code.
And if you don't see the need for a full-blown event system, please ease
the integration of great 3rd party software by allowing the
registrations of functions that are called when a user changes his
account, deletes his account or logges out (session end).
Remember, this is not a request to ease the integration for a single 3rd
party application. This would ease the integration of most applications,
making both sides very happy.
Thanks in advance - Andy Staudacher
More information about the TYPO3-dev
mailing list