cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <o...@vip.net.pl>
Subject Re: Nested actions in action-sets
Date Sun, 06 Apr 2003 21:36:50 GMT
On nie, kwi 06, 2003 at 10:46:45 +0200, Sylvain Wallez wrote:
> Leszek Gawron wrote:
> 
> >Has anyone tried lately to use action set with nested action? This is a 
> >piece
> >of code I use: 
> ><map:action-sets>
> >   <map:action-set name="process-route">
> >       <map:act type="form-validator" action="show-route"/>
> >       <map:act type="form-validator" action="route-change">
> >	        <map:act type="serverpages" src="action/route-change.xsp"/>
> >       </map:act>
> >       <map:act type="form-validator" action="route-add-contractor">
> >           <map:act type="serverpages" 
> >           src="action/route-add-contractor.xsp"/>
> >       </map:act>
> >       <map:act type="form-validator" action="route-close">
> >           <map:act type="serverpages" src="action/route-close.xsp"/>
> >       </map:act>
> >   </map:action-set>
> ></map:action-sets>
> > 
> >
> 
> Nested actions in action-sets aren't allowed, and I'm suprised the 
> sitemap engine accepted the above. I'll take a look at it so that it 
> refuses this kind of construct.
Not to look far: 
cocoon-home/src/blocks/databases/samples/tutorial/sitemap.xmap:
 <map:action-sets>
  <map:action-set name="process">
   <map:act type="form" action="Create Department">
     <map:parameter name="validate-set" value="add"/>
     <map:act type="dbAdd"/>
   </map:act>
   <map:act type="form" action="Update Department">
     <map:parameter name="validate-set" value="update"/>
     <map:act type="dbUpd"/>
   </map:act>
   <map:act type="dbDel" action="Delete Department"/>
   <map:act type="form" action="Create Employee">
     <map:parameter name="validate-set" value="add"/>
     <map:act type="dbAdd"/>
   </map:act>
   <map:act type="form" action="Update Employee">
     <map:parameter name="validate-set" value="update"/>
     <map:act type="dbUpd"/>
   </map:act>
   <map:act type="dbDel" action="Delete Employee"/>
  </map:action-set>
 </map:action-sets>

In my case the solution wouldn't be nice but is quite simple: 
I make 2 action sets. One is just a form validator with different rules for
each action. The second is the actual action (route change, route add, route
close). I call the first action set and then nest in the second call to the
second action set. Every action in my case contains of validation and actual
action but the problem is: just a little more complicated thing and this wouldn't
work. So either I create unmaintainable mess in the sitemap with
request-parameter selectors and a lot of code duplication or I wait till flow
gets stabilized. One worse than another.

Wouldn't it be possible to allow nested actions in action sets? Of course the
problem is passing parameters but having no such opportunity is worse than
having all nested actions sharing the same parameters.

	LG
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Mime
View raw message