[Yanel-dev] Switching the layout/design of the from scratch realm

Michael Wechner michael.wechner at wyona.com
Wed Jun 3 09:09:53 CEST 2009


Hi Prabodh

Prabodh Upreti schrieb:
>
>  
>
> Hi Everyone
>
>  
>
> I was tracing through the code to understand how things were working.  
> I see that YanelServlet is calling SourceResolver-à  
> ResourceResolver--à  ResourceManager which in turn is loads map.rc-map 
> file.
>


each realm can have such a file, whereas it is optional, whereas a 
warning is logged nevertheless if a realm does not have one

>  
>
> I understand that one based on map.rc-map setting all *.html calls are 
> being targeted to generic-xhtml-page_yanel-rc.xml setting.
>

this is what's happening in the "from scratch realm". The general chain 
of responsibility is as follows:

URL: http://127.0.0.1:8080/yanel/REALM_ID/foo/bar.html

and then Yanel will first check if a 1-to-1 mapping exists

SRC: REALM_HOME_DIR/res-configs/foo/bar.html.yanel-rc

and if such a 1-to-1 does not exist, then it will check for matching 
patterns within

SRC: REALM_HOME_DIR/res-confgis/map.rc-map

and if no pattern exists, then Yanel will use by default the "file" (aka 
"node") resource type

> Based on the previous setting global.xsl was being called to translate 
> the template. 
>
>  
>
> With the new changes Michael made I understand global.xsl needs to be 
> picked up from app or app2.  A variable needs to be set on the Session 
> based on the previous settings.
>
>  
>
> Listed below are my questions:
>
>  
>
>    1. I can create a resource to perform the above task. Does that
>       mean I can remove the rti “xml” currently set in
>       generic-xhtml-page_yanel-rc.xm and add my new resource?
>

no, you should replace the rti "file" within

src/realms/from-scratch-realm-template/res-configs/my-global.xsl.yanel-rc

by your own resource, because this is where the actual switch of the 
XSLT is happening


>    1. This resource will check the yanelresource:/my-global.xsl  find
>       my-global.xsl then the right template.  I understand most of
>       this logic is in YanelServlet at present.  Should I take that
>       code from there and add it to the new resource and everything
>       should work as usual?  Servlet will automatically pickup the new
>       resource and let me perform the rest of the task.
>
> 2.  Why not pass a value via the querystring so that developer do not 
> need to go and modify my-global.xsl file to find the template.  That 
> way they could have 5-6 templates and they can quickly test them 
> without modifying the my-global.xsl file.
>

that's exactly what your resource should be doing. For example the query 
string could be something like

/foo/bar.html?xslt-version=2

which your resource would read from the request (if set) and then set it 
within the session, such that you don't always have to
attach it to all following URLs. And then your resource would for 
example build the location dynamically

/app{$xslt-version}/xslt/globals.xsl

instead reading it statically from within

src/realms/from-scratch-realm-template/res-configs/my-global.xsl.yanel-rc

as the "file" resource type does. (or something similar along these lines)
>
> It may not be as simple as I am thinking so pls free to point out the 
> flaw with this process
>
>  
>
> Could you please let me know if I am in the right track?
>

I think you are very much on the right track, except which resource type 
to replace (as described above)

Hope my comments help, otherwise please ask again.

Cheers

Michael
>
>   Thank you in advance.
>
>  
>
> Regards
>
>  Prabodh
>
> --- On *Fri, 5/29/09, Michael Wechner /<michael.wechner at wyona.com>/* 
> wrote:
>
>
>     From: Michael Wechner <michael.wechner at wyona.com>
>     Subject: [Yanel-dev] Switching the layout/design of the from
>     scratch realm
>     To: yanel-development at wyona.com
>     Date: Friday, May 29, 2009, 5:07 AM
>
>     Hi
>
>     We have made some progress re switching the layout/design of the
>     from scratch realm dynamically.
>
>     Please update your local SVN version and take a look at the notes at
>
>     svn ci -m "note about switching the layout added" 
>     data-repo/data/de/index.html data-repo/data/en/index.html
>     Sende          data-repo/data/de/index.html
>     Sende          data-repo/data/en/index.html
>     Übertrage Daten ..
>     Revision 43093 übertragen.
>
>     or rather
>
>     http://127.0.0.1:8080/yanel/from-scratch-realm/en/index.html
>     http://127.0.0.1:8080/yanel/from-scratch-realm/de/index.html
>
>     The TODOs are actually create another layout within the
>     data-repo/data/app2 folder and create a resource
>     which is switching between the various folders app1 and app2 as
>     noted within
>
>     res-configs/my-global.xsl.yanel-rc
>
>     (instead of using the static file resource)
>
>     Cheers
>
>     Michael
>     -- Yanel-development mailing list Yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@wyona.com>
>     http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>
>



More information about the Yanel-development mailing list