cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: [cforms] Can sendForm or sendPage functions use differnt sitemap which invokes the javascript containing them?
Date Mon, 11 Sep 2006 07:50:06 GMT
Leszek Gawron wrote:
> Rice Yeh wrote:
>> Can sendForm or sendPage functions use the sitemap that is different 
>> from the sitemap which invokes the javascript containing them?
>> Here is my example:
>>
>> directory structure:
>>
>> parties/sitemap.xml
>> parties/flows/MaintainParties.js
>> parties/flows/sitemap.xml
>>
>> A function CretatePerson() in parties/flows/MaintainParties.js is 
>> called from parties/sitemap.xml. But CreatePerson function wants to use
>> the parties/flows/sitemap.xml to render a form, instead of 
>> parties/sitemap.xml. Is this possbile? The reason for me to have 2 
>> sitemap is that I want to separate controller and view concerns; the 
>> parties/sitemap.xml plays the controller and parties/flows/sitemap.xml 
>> plays the view.
>>
>>
>> Regards,
>> Rice

I probably misread it and did not answer your question correctly. If 
parties/sitemap.xmap plays the controller it should contain flow scripts 
too (they are also controller part).

so tweaking it a little bit:

parties/sitemap.xmap
parties/flow/MaintainParties.js
parties/view/sitemap.xmap
parties/view/jx/parties.jx

first of all mount your subsitemap in parties/sitemap.xmap:

<map:match pattern="view/**">
   <map:mount uri-prefix="view" src="view/"/>
</map:match>

then in subsitemap have something that generates the view:

<map:match pattern="jx/*">
   <map:generate type="jx" src="jx/{1}.jx"/>
   <further transformations/>
   <map:serialize/>
</map:match>

then in MaintainParties.js just do:

function maintain() {
   var bizData = obtainBizdata();
   modifyBizdata( bizData );
   persistModifications( bizData );

   cocoon.sendPage( "view/jx/maintainParties", bizData );
}

-- 
Leszek Gawron, IT Manager                          MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Mime
View raw message