Gareth, Interesting use-case. You are right when you say the scaffold tag already has a type attribute. I see what you are trying to do, apply an event type to your code. Your particular code (depending on how your default scaffolds are set up) would put a templatedPage type on the Commit and Delete scaffold types, which they most likely don't need.
There is a way to do this, and I will do a good job of documenting it in the future. I'm in the middle of making a presentation THIS VERY SECOND that shows how to do it so I am not going to be able to be very clear. However, if you feel adventurous, here is what you need to do. (Change all Paths accordingly to suit your environment. Update ModelGlue from SVN. 1) Make a directory in your model directory called scaffoldTemplates 2) Open up /ModelGlue/gesture/modules/scaffold/beans and copy the Edit, View and List cfcs. Put them inside your model/scaffoldTemplates directory. 3) Open Edit, View and List and add the type="templatedPage" to the makeModelGlueXMLFragment method body. 4) Open up your ColdSpring.xml and add the following Config (being sure to update the paths in the class attribute to your paths) <bean id="modelglue.scaffoldType.Edit" class="coldspring.beans.factory.config.MapFactoryBean"> <property name="SourceMap"> <map> <entry key="class"><value>mgpost.model.scaffoldTemplates.Edit</value></entry> <event key="hasXMLGeneration"><value>true</value></event> <event key="hasViewGeneration"><value>true</value></event> <entry key="prefix"><value>edit</value></entry> <entry key="suffix"><value>.cfm</value></entry> </map> </property> </bean> <bean id="modelglue.scaffoldType.List" class="coldspring.beans.factory.config.MapFactoryBean"> <property name="SourceMap"> <map> <entry key="class"><value>mgpost.model.scaffoldTemplates.List</value></entry> <event key="hasXMLGeneration"><value>true</value></event> <event key="hasViewGeneration"><value>true</value></event> <entry key="prefix"><value></value></entry> <entry key="suffix"><value>.cfm</value></entry> </map> </property> </bean> 5) Regenerate your scaffolds. WARNING: Once generated, you need to turn off rescaffolding of that object, else you'll get an error about the type. This happens due to the order of event types and is probably going to end up as a feature, not a bug. Lemme know if this worked out for you. DW On Thu, Aug 6, 2009 at 1:51 PM, Gareth Cole <[email protected]> wrote: > Hi, > > > > I've been trying out the event types in MG3. > > I got the following code to work: > > <event-handler name="page.index" > type="templatedPage"> > > <broadcasts /> > > <results /> > > <views> > > <include name="body" > template="pages/index.cfm" /> > > </views> > > </event-handler> > > > > However, when I tried this: > > <scaffold object="test" type="templatedPage" /> > > > > I got an error message, and I realised that the 'type' attribute is already > used by scaffolds. > > > > I can work around this, as I normally copy the generated scaffold xml into > my ModelGlue.xml anyway. I'm not really sure of any solution other than > renaming one of the 'type' attributes. > > > > Thanks, > > > > Gareth > > > > > > -- “Come to the edge, he said. They said: We are afraid. Come to the edge, he said. They came. He pushed them and they flew.” Guillaume Apollinaire quotes --~--~---------~--~----~------------~-------~--~----~ Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en -~----------~----~----~----~------~----~------~--~---
