Changes between Initial Version and Version 1 of HowTos/HowToUseScaffolds/AddingSpecificEventHandlers

Show
Ignore:
Timestamp:
04/15/09 19:43:29 (17 years ago)
Author:
trac (IP: 127.0.0.1)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTos/HowToUseScaffolds/AddingSpecificEventHandlers

    v1 v1  
     1= Adding Specific Event Handlers = 
     2 
     3By default, the <scaffold> tag adds five event-handlers: ''table''.list, ''table''.view, ''table''.edit, ''table''.commit, ''table''.delete. 
     4 
     5However, you may not want all of these added by default. To adjust the list of scaffolds to automatically create, change the value of the !DefaultScaffolds property of the !ModelGlueConfiguration bean in !ColdSpring.xml. For example, to only automatically create view and list scaffolds, the tag would be changed to the following: 
     6 
     7{{{ 
     8<property name="defaultScaffolds"><value>list,view</value></property> 
     9}}} 
     10 
     11Edit, commit, delete, and delete scaffolds are still available, but would need to be specified in the scaffold tag's TYPE attribute (see below). 
     12 
     13== Using the TYPE attribute == 
     14 
     15For a given scaffold tag, you may specify the list of event-handlers to create by using the TYPE attribute of the scaffold tag. This is especially useful for applying functionality such as security. 
     16 
     17For example, in a given application where anyone can view contacts but only administrators can update contacts, we could use the following XML in !ModelGlue.xml to protect the edit, commit, and delete event handlers from unauthorized access (assuming a message listener for "!UserMustBeAdministrator" performs security functionality and adds a result named "!SecurityViolation" in the event of bad access): 
     18 
     19{{{ 
     20<scaffold object="contact" type="list,view" /> 
     21 
     22<scaffold object="contact" type="edit,commit,delete"> 
     23 
     24<broadcasts> 
     25 
     26<message name="UserMustBeAdministrator" /> 
     27 
     28</broadcasts> 
     29 
     30<results> 
     31 
     32<result name="SecurityViolation" do="SecurityViolation" redirect="true" /> 
     33 
     34</results> 
     35 
     36</scaffold>