phpBB 3.1. provides extensions system, which doesn't allow admins to change extension events order.
IMO, the ability to change the events order should be a part of extension system.
I have alreadyprepered a mockup on my localhost, which works fine.
Some explanations how it works:
The extensions events are stored in DB, so they can be move up/down and activate/deactivate.
Click "Mange events order" move us to page, where are displayed all events stored in DB. By clicking the event location, it moves us to management page.
The only problem is how to add events to DB. I think the best option for it, is adding events via migration - that will require extensions developers to define all events, which are used by their extension.
What do you think about that?
Sortable extension events
- nickvergessen
- Former Team Member
- Posts: 733
- Joined: Sun Oct 07, 2007 11:54 am
- Location: Stuttgart, Germany
- Contact:
Re: Sortable extension events
How do you think to implement this into the template engine?
Member of the Development-Team — No Support via PM
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: Sortable extension events
The finder would need to be modified to sort properly. The template engine uses the finder to grab the listeners (I think).
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: Sortable extension events
I like the concept, but we'll need to figure out the best implementation. Note that it should also be possible to disable an event from being triggered.
Should this work for both PHP events and Template events or just Template events? It makes sense to want to reorder template events because that affects visual position. But it might also be helpful to order PHP events because you might have two extensions that act on an event and need one to perform an action before or after another.
Should this work for both PHP events and Template events or just Template events? It makes sense to want to reorder template events because that affects visual position. But it might also be helpful to order PHP events because you might have two extensions that act on an event and need one to perform an action before or after another.
Re: Sortable extension events
I think each template events should have small descriotion for what it is responsible for and which pages are affected.
The core event also can be sortable.
It can contain 2 headres: Core events and Template events.
I can tell that template events doesn't require so much changes but only problem is how to add them to DB.
In my mockup, when an event is disabled, the twig doesn't put its code to cache file.
The core event also can be sortable.
It can contain 2 headres: Core events and Template events.
I can tell that template events doesn't require so much changes but only problem is how to add them to DB.
In my mockup, when an event is disabled, the twig doesn't put its code to cache file.
My mods:
Auto Backup [MODDB] | Reputation System [RC]
Auto Backup [MODDB] | Reputation System [RC]
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: Sortable extension events
What would need to be done is:
1. Find all template events
2. Find all template files included in a particular event
3. Store sorting in the database for any which are moved
4. Fetch the entire table per page (cached) and pass it to whatever is going to find/sort the events (not sure if this should/could be the finder or the template engine).
1. Find all template events
2. Find all template files included in a particular event
3. Store sorting in the database for any which are moved
4. Fetch the entire table per page (cached) and pass it to whatever is going to find/sort the events (not sure if this should/could be the finder or the template engine).
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: Sortable extension events
Another thing I just thought of, a template event can be on separate pages and in a different page in different styles. In fact, an event could theoretically even be in the same file twice, though we should probably avoid this, and I'm not sure the best way to handle it.
On the event management page, we'll need be to able to select which style's events we are working with, and we'll need to account for that in the database when we store the event, so we'll need two tables, one to hold events and one to hold extensions' uses of the events.
Or something like that. I haven't actually thought it through very far.
On the event management page, we'll need be to able to select which style's events we are working with, and we'll need to account for that in the database when we store the event, so we'll need two tables, one to hold events and one to hold extensions' uses of the events.
Code: Select all
CREATE TABLE phpbb_event_locations (
event_id int(8) not null auto_increment,
event_name varchar(255) not null,
event_description text,
event_template_filename varchar(255) not null # should be full path from ./styles/ directory so we can differentiate between events in different styles.
);
Code: Select all
CREATE TABLE phpbb_extension_events (
extension_event_id int(8) not null auto_increment,
extension_event_ext_name varchar(255) default '' not null, # relates this to the ext_name in phpbb_ext
extension_event_order int(8) not null, # events with the same order should be served in the order they are found
extension_event_active int(1) default 1 not null # allow event location to be disabled
);
Re: Sortable extension events
ATM I used such table
EDIT:
I will make a PR at the weekend.
Code: Select all
CREATE TABLE IF NOT EXISTS `phpbb_ext_events` (
`event_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`event_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`event_active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`event_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ext_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`event_id`),
);
I will make a PR at the weekend.
My mods:
Auto Backup [MODDB] | Reputation System [RC]
Auto Backup [MODDB] | Reputation System [RC]
Re: Sortable extension events
I don't think anything ever happened with this. I really don't think this should be based on the database. Instead we should allow extensions to specify other extensions that they have to run before/after and if they should default to the end or beginning, I think that should be enough to sort them sufficiently for extensions to work correctly.