interception points that are actual events and others, like rendering of entries or content.

He Luis and others, I had been playing around with creating a module and looking at the interceptors some. Problem is tha I see some short falls to this, and wondering if this is the way I am approaching it or something else.

When an entry or blog page is displayed, it seems to run two type of controllers ( I think this is what you might call them) or helpers. The problem is that with multiple entries the interceptor is fire only once, this is a problem because it really isn’t an interceptor it’s an event that is being called.

Now my view or how I see it is this, when the rendering of these entries is done. They are done with a collection in the helper, but there is no way to intercept each one or the base call with the collection. This raises a problem because it makes it hard to modify the data, before it is rendered. I could use the render data interception but I am not sure that is a wise choice. As it would apply to all widgets on the page.

I would like to know why some are like #cb.event()# when in a view rather than an interception point, and how would the best way to go about doing proper interception on these?

I really don’t understand what you are saying, sorry Andrew.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

In your views you have event('cbui_preEntry"); this calls a handler and the interceptor is never fired.

Andrew,

What is in the views is this:

cb.event(“cbui_preEntryDisplay”)

cb is a reference to the CBHelper object. The CBHelper has an event function defined as:

function event(required state,struct data=structNew()) output=“true” {announceInterception(arguments.state,arguments.data);}

Therefore, what you are seeing in the views is announcing an interception and not calling handler event.

Michael

Right,

Now do this create an interceptor that will listen to that

public void function cbui_preEntryDisplay(event, interceptData) {
writeDump(arguments);
abort;
}

Now according to you this should work, but it doesn’t.

Trust me I spent 8 hours trying to find out why.

And the other problem I noticed is that if you have a collection, the event is on the outer. Which means if you need to modify each individual collection you can’t.

I created an interceptor and it works.

My steps:

  1. Create interceptor called EntryInterceptor and drop into modules/contentbox-ui/interceptors

EntryInterceptor.cfc

component {

void function configure(){

}

public void function cbui_preEntryDisplay(event, interceptData) {

savecontent variable=“mydump” {

$dump(arguments, false);

}

appendToBuffer(mydump);

log.info(“EntryInterceptor: cbui_preEntryDisplay interception received”);

}

}

  1. Register Interceptor in the contentbox-ui ModuleConfig.cfc interceptors section

{class="#moduleMapping#.interceptors.EntryInterceptor",name=“EntryInterceptor@cb”}

  1. Reinit the app.

  2. Click on an entry title to view a specific entry and you will see the dump inserted into content exactly where it was announced. If you are debugMode, you will see a log message in the ColdBox Tracer Messages panel: “EntryInterceptor: cbui_preEntryDisplay interception received

I created the interceptor and registered it within the contentbox-ui module but it could have been created and registered in any module or the parent app.

Michael

Now create your own module to be used in the Admin section.

Is the interceptor working for you now?

No it never has… And this as I stated was in a module, as that is where I need it.

Also Luis if you’re reading this, I think the event / announce should be in things like

#cb.quickEntries()#

The reason being, is that people writing this stuff have to worry about announcing the event. So when I look at index.cfm view for default layout, there is no event for. Which means one has to go an modify other peoples layouts to make changes that they may not even know.

Secondly as I stated quickEntries() will not fire for each iteration, where as if it was announced inside the quickEntries one could pass the data across as this is where it is being loaded.

The example interceptor I gave was also created in a module, the contentbox-ui module and worked. It could have been created and registered in any module, including a module managed by the contentbox admin. To test, I just created a interceptors folder within the Hello example admin module. Then dropped the example interceptor code I gave in that folder. Then for step 2 register it within the Hello ModuleConfig.cfc instead.

  1. Register Interceptor in the contentbox-ui ModuleConfig.cfc interceptors section

{class="#moduleMapping#.interceptors.EntryInterceptor",name=“EntryInterceptor@hello”}

Then followed with steps 3 and 4 and it still works. The tracer panel even shows the message coming from the Hello module.

No I mean the user defined modules Michael… I don’t get it then as it will not work here, I even restarted CF everytime I made changes.

Ok I found out what the problem is, and I do not know why.

But if you put html in this Before A Blog Entry: then the interceptor will not fire, but when I restarted ColdFusion then it went the other way around and the interceptor fires but the html will not get outputted.

Andrew,

Not quite following. Exactly where were you trying to put the HTML when it didn’t work? In the view where the interception is announced or in the interceptor listening for the event?

Can you supply the sample code of what didn’t work?

Michael

ContentBox allows you to do this as a setting, it wasn’t done via programming.

Which setting is that?

Read a previous post that mentions it.

I apologize. I have been using and testing contentbox from the beginning and don’t know what setting you are referring to.

Can you elaborate on what setting you used or what it was that you were doing that didn’t work? I am curious now.

You know Michael if you don’t know that setting, I’ll talk to Luis or someone else.

The people that reply are trying to help answer your questions. I know contentbox very well and have been participating in the development and testing since the beginning. However, it is very possible that I missed a feature that Luis added. He is hard to keep up with. I personally don’t think he sleeps :slight_smile:

I do not know of a setting that responds to interceptions. The thread began with interceptors not being fired, then it was within custom contentbox modules. In each case I took time to write example code, test it to make sure it worked and then reply with exact steps to duplicate. If there is a feature I missed, I was hoping you would reciprocate and share what it is.

Can anyone else share with me then what contentbox setting responds to interception points?

Michael McKellip