Forums / Setup & design / Notification Handler

Notification Handler

Author Message

Mahesh Arvind

Tuesday 23 December 2003 3:44:18 am

Hi,
I am creating a notification handler. I have created the extensions. This the structure of the extension folder

extension/emailuserextension/notification/handler/emailuserextension
extension/emailuserextension/notification/handler/emailuserextension/emailuserextensionhandler.php
extension/emailuserextension/settings/notification.ini.append

I have changed the site.ini as

[ExtensionSettings]
ActiveExtensions[]=emailuserextension
ActiveExtensions[]=myextension

Do I need to change any other files to activate the extension? Plz Help.

 

Thanks & Regards
Mahesh

Paul Forsyth

Tuesday 23 December 2003 3:58:35 am

Your extension setting is fine.

However, i believe the eZ extension system doesn't currently 'see' notification handlers. It does work with notification events but from my experience handlers are not catered for.

You can activate a handler by entering it in the main settings/notification.ini file, ie:

[NotificationEventHandlerSettings]
RepositoryDirectories[]=kernel/classes/notification/handler/;extension/emailuserextension/notification/handler
AvailableNotificationEventTypes[]=emailuserextension

and this will tell eZ to look for a handler at your location you have given.

see:

http://ez.no/developer/ez_publish_3/bug_reports/stabilise_extension_system

for other extension issues.

paul

Mahesh Arvind

Tuesday 23 December 2003 5:13:00 am

Hi,

Thanks Paul for your answer. I have added

[NotificationEventHandlerSettings]
RepositoryDirectories[]=kernel/classes/notification/handler/;extension/emailuserextension/notification/handler
AvailableNotificationEventTypes[]=emailuserextension
in notification.ini.append in the settings/override directory.

To brief on what i am doing now, I am creating a notification handler which works on object publish events. I want to track when a new user is created and send him a registration mail.

I am creating users in the content section through admin interface. Each time when I create a new user, the register.tpl is not called. It calls user_group.tpl and then ezstring.tpl. Is it possible to call register.tpl after user_group.tpl?

I have created a emailuserhandler.php which is the handler. But, when I turn on debug and see, the notification handler I created is not called. Can anyone tell me how to call this handler.

Can the above mentioned can be done with events?

Thanx.

Thanks & Regards
Mahesh

Paul Forsyth

Tuesday 23 December 2003 5:56:02 am

The handler should be called automatically if it is declared. I should say this is a grey area for me...

But, take a look at this file:

kernel/classes/notification/eznotificationeventfilter.php

It contains two functions of interest.

process() is where the handler is associated with the event.

availableHandlers() picks up the available handlers from the ini file. Notice the lack of an extension setting here, which is why i believe handlers are picked up from extensions.

have you printed out event values from your handlers event function? take a look at a current one like:

kernel/classes/notification/handler/ezgeneraldigest/ezgeneraldigesthandler.php

paul

Mahesh Arvind

Tuesday 23 December 2003 7:13:20 am

Hi,
I have looked at kernel/classes/notification/eznotificationeventfilter.php. Maybe its coming from $repositoryDirectories, which we have mentioned in settings/override/notification.ini.append file.
RepositoryDirectories[]=kernel/classes/notification/handler/;extension/emailuserextension/notification/handler.

I have moved the above in settings/notification.ini.

Its not searching the handler now. But, I get an error message like this if I put them in AvailableNotificationEventTypes. Maybe you are right "However, i believe the eZ extension system doesn't currently 'see' notification handlers."

But have a look at /kernel/classes/notification/handler/. This contains the default notification handlers ezcollaborationnotification, ezgeneraldigest, ezsubtree. I have created a new directory here and put the handler here. But, its not calling it now also. If you notic that default handler directories contain another php file. Do I need to create a similar file for my handler to make it active?

Mahesh

Thanks & Regards
Mahesh

Paul Forsyth

Wednesday 24 December 2003 4:18:05 am

You shouldn't need the extra file. If you look closely you will see that the other file isnt named consistently, and is included by each handler to do something specific for that event. When i looked i saw routines to handle some database tables.

I would look at the php within: kernel/classes/notification/eznotificationeventfilter.php

Try to add some debug/print statments to find the available handlers on line 58. You need to get your hands dirty a little here im afraid :) If you print out the returned availableHandlers you can tell if you handler is being seen or not.

paul

Mahesh Arvind

Wednesday 24 December 2003 5:25:23 am

Hi Paul,

I tested the output from kernel/classes/notification/eznotificationeventfilter.php
It does not refer to the handler. It produces the following error.

Error: eZNotificationEventFilter::loadHandler() Dec 24 2003 05:06:23
Notification handler does not exist: $handlerString

One more strange thing :)
If i change the handler directory from kernel/notification... to extensions then I get four lines of the above error message.
So, I guess in both cases it is not calling the handler.

Mahesh

Thanks & Regards
Mahesh

Paul Forsyth

Wednesday 24 December 2003 5:40:35 am

Just had a thought. The format of the notification.ini file may be wrong. Try this instead:

[NotificationEventHandlerSettings]
RepositoryDirectories[]=kernel/classes/notification/handler/
RepositoryDirectories[]=extension/emailuserextension/notification/handler
AvailableNotificationEventTypes[]=emailuserextension

paul

Mahesh Arvind

Wednesday 24 December 2003 6:07:34 am

Hi Paul,

I have tested with the changed notification.ini file. But, it's again the same problem. It just doesnt seems to be recognizing another notification. There is an extra notification.ini.append in extension/emailuserextension/settings/notification.ini.append. I have removed that file since we have specified them in the main notification.ini. Is this required?

Mahesh

Thanks & Regards
Mahesh

Paul Forsyth

Wednesday 24 December 2003 6:17:20 am

Only for new events.

Im not sure what to suggest next.

When i hit a problem like this i look at the PHP code, so take a closer look at the files i mentioned. Some of the eventfilter code is very simple and a few print statements in the right places will tell you why the ini file is not being read properly.

paul

Mahesh Arvind

Thursday 25 December 2003 8:46:27 pm

Hi Paul,
I debugged the PHP code. I had actually made a mistake in specifying the Repository Directories. Now it's calling the handler.
Thanks.

Thanks & Regards
Mahesh

eZ debug

Timing: Jan 19 2025 04:44:15
Script start
Timing: Jan 19 2025 04:44:15
Module start 'content'
Timing: Jan 19 2025 04:44:16
Module end 'content'
Timing: Jan 19 2025 04:44:16
Script end

Main resources:

Total runtime0.7980 sec
Peak memory usage4,096.0000 KB
Database Queries218

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 590.0625180.8438
Module start 'content' 0.00640.6296 770.9063647.1250
Module end 'content' 0.63600.1620 1,418.0313348.4453
Script end 0.7980  1,766.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.5092210.0002
Check MTime0.00150.1868210.0001
Mysql Total
Database connection0.00090.108210.0009
Mysqli_queries0.703888.18962180.0032
Looping result0.00230.29242160.0000
Template Total0.769396.420.3846
Template load0.00190.236820.0009
Template processing0.767496.156420.3837
Template load and register function0.00010.012010.0001
states
state_id_array0.00070.089910.0007
state_identifier_array0.00080.101120.0004
Override
Cache load0.00200.2448980.0000
Sytem overhead
Fetch class attribute can translate value0.00170.207530.0006
Fetch class attribute name0.00110.1350120.0001
XML
Image XML parsing0.00090.111630.0003
class_abstraction
Instantiating content class attribute0.00000.0046170.0000
General
dbfile0.00170.2156270.0001
String conversion0.00000.001130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
18content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 47
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs