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

Michael Wechner michael.wechner at wyona.com
Tue Jun 9 10:43:03 CEST 2009


Hello Prabodh

Prabodh Upreti schrieb:
> Hi Michael
>  
> I have the zip file ready. Looks like I need to create an account in 
> bugzilla to create an attachment.
>

yes
> I created an account and it said pw will be forward to email account.  
> It has been around 10 min.  Do you know how long it normally takes?
>

actually it should be instantly, but I need to check. What username did 
you pick?
Otherwise you might want to send me the zip directly in the meantime.

Cheers

Michael
>   Thank you.
>  
> Prabodh
>
> --- On *Mon, 6/8/09, Michael Wechner /<michael.wechner at wyona.com>/* wrote:
>
>
>     From: Michael Wechner <michael.wechner at wyona.com>
>     Subject: Re: [Yanel-dev] Switching the layout/design of the from
>     scratch realm
>     To: yanel-development at wyona.com
>     Date: Monday, June 8, 2009, 5:39 AM
>
>     Prabodh Upreti schrieb:
>     > Thank you.  That clarified the next email I had sent you.
>     >  I tried to check in the resource and not sure if I have the
>     checkin permission.
>     >
>
>     as noted within my previous email please attach a patch to
>
>     http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=7055
>     > Please let me know which directories/files I need to check in
>     for the resource beside the jave file directory.
>     >
>
>     basically everything except the build dir (which we will ignore
>     with SVN ignore).
>     You can also just zip it and attach it to Bugzilla
>     > I will also update the new resource-types.xml in conf and other
>     configuration and xslt.
>     >
>
>     Thanks
>
>     Michael
>     >   Prabodh
>     >
>     > --- On *Fri, 6/5/09, Michael Wechner /<michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>/*
>     wrote:
>     >
>     >
>     >     From: Michael Wechner <michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>
>     >     Subject: Re: [Yanel-dev] Switching the layout/design of the from
>     >     scratch realm
>     >     To: yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     >     Date: Friday, June 5, 2009, 10:43 AM
>     >
>     >     Prabodh Upreti schrieb:
>     >     > Hi Michael
>     >     >  Thank you for the input.  I was doing just that in my
>     original
>     >     Resource where I was modifying the getNode method to get the
>     >     querystring and set the session object etc.  This worked
>     fine.     Then I say reference to /app/images/...  within the
>     global.xsl.  I
>     >     wanted the ability to change that to
>     /app{$xslt-version}/images/...
>     >     >
>     >
>     >     you mean within the XSLT itself, right?
>     >     > To provide this capibility I need to handle the transformation
>     >     where I can pass that as a parameter.
>     >     >
>     >
>     >     I would suggest just to use relative paths inside the XSLT, for
>     >     example
>     >
>     >     images/foo.gif
>     >
>     >     for the moment, instead
>     >
>     >     {$yanel.back2realm}/app{$xslt-version}/images/...
>     >
>     >     which is btw also a relative path, because $yanel.back2realm
>     will
>     >     be relative.
>     >
>     >     This is very important in case one is settting up Yanel behind a
>     >     reverse proxy (for example using Apache mod_proxy), where
>     >     we don't know how the reverse proxy prefix will be set.
>     >     > I believe with the NodeResource the YanelServelet does the
>     >     transformation based the stream from the NodeResource.
>     >     >  Once again, I hope I am not making it more complicated
>     than it
>     >     really is.
>     >     >
>     >
>     >     no, but I would suggest a simple version is sufficient at the
>     >     moment and we can still improve it later on ;-)
>     >
>     >     Cheers
>     >
>     >     Michael
>     >     >   Thank you.
>     >     >  Regards
>     >     >  Prabodh
>     >     >
>     >     > --- On *Fri, 6/5/09, Michael Wechner
>     /<michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>/*
>     >     wrote:
>     >     >
>     >     >
>     >     >     From: Michael Wechner <michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>
>     >     >     Subject: Re: [Yanel-dev] Switching the layout/design
>     of the from
>     >     >     scratch realm
>     >     >     To: yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     >     >     Date: Friday, June 5, 2009, 5:13 AM
>     >     >
>     >     >     Prabodh Upreti schrieb:
>     >     >     > Hi Michael
>     >     >     >  I think I am close to getting this done.
>     >     >     >  I created a new resource to handle the session setting
>     >     and also
>     >     >     changing the path based on the querystring.  For my
>     first step I
>     >     >     to created this Resource similar to the file
>     "NodeResource" to
>     >     >     make sure that it worked as I had expected.  It was
>     working
>     >     fine.
>     >     >     >
>     >     >
>     >     >     great :-)
>     >     >     >  I understand this does not handle passing the param to
>     >     the xsl
>     >     >     to build the correct path.  I then started creating a
>     Resource
>     >     >     similar to the BasicXMLResource so that I can set the
>     parameter
>     >     >     xslt-version for the transformer.  I will then change the
>     >     >     global.xsl to reflect the new passed variable to it
>     resolves to
>     >     >     the correct path.
>     >     >     >
>     >     >
>     >     >     I don' t think you need to build this on the
>     >     BasicXMLResource, but
>     >     >     rather keep extending the NodeResource by overwriting the
>     >     >     getNode() method.
>     >     >
>     >     >     Inside the getNode() method the method
>     >     >     getResourceConfigProperty("src") is called which is
>     getting the
>     >     >     path from
>     >     >
>     >     >       
>     src/realms/from-scratch-realm-template/res-configs/my-global.xsl.yanel-rc
>     >     >
>     >     >     <yanel:property name="src" value="/app/xslt/global.xsl"/>
>     >     >
>     >     >
>     >     >     So I would suggest to introduce a new method called
>     >     >
>     >     >     getNode(String layoutVersion) which shall replace the
>     getNode()
>     >     >     method and also a new resource type property for this new
>     >     >     resource, for example
>     >     >
>     >     >     <yanel:property name="default-layout-version" value="2"/>
>     >     >     <yanel:property name="src"
>     >     >     value="/appTEMPLATE_VERSION/xslt/global.xsl"/>
>     >     >
>     >     >
>     >     >     and the template version can be retrieved from the
>     query string
>     >     >     inside the resource by
>     >     >
>     >     >     String layoutVersion =
>     >     getRequest().getParameter("layout-version");
>     >     >     if (layoutVersion != null) {
>     >     >     
>        getRequest().getSession().setAttribute("layout-version",
>     >     >     layoutVersion)
>     >     >     } else {
>     >     >        if
>     >     (getRequest().getSession().getAttribute("layout-version")) {
>     >     >            layoutVersion =       
>     getRequest().getSession().getAttribute("layout-version");
>     >     >        } else {
>     >     >            layoutVersion =
>     >     >     getResourceConfigProperty("default-layout-version")
>     >     >        }
>     >     >     }
>     >     >
>     >     >
>     >     >     HTH
>     >     >
>     >     >     Michael
>     >     >
>     >     >
>     >     >     >  I just want to make sure I am on the right track. 
>     Please let
>     >     >     me know if anything I am doing here is not correct.  Thank
>     >     you in
>     >     >     advance.
>     >     >     >  Regards
>     >     >     >  Prabodh
>     >     >     >     --- On *Wed, 6/3/09, Michael Wechner
>     >     >     /<michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>/*
>     >     >     wrote:
>     >     >     >
>     >     >     >
>     >     >     >     From: Michael Wechner <michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>
>     >     >     >     Subject: Re: [Yanel-dev] Switching the layout/design
>     >     of the from
>     >     >     >     scratch realm
>     >     >     >     To: yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     >     >     >     Date: Wednesday, June 3, 2009, 3:09 AM
>     >     >     >
>     >     >     >     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
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     >     >     >       
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>/*
>     >     >     >     wrote:
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >     From: Michael Wechner
>     <michael.wechner at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>
>     >     >     >       
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=michael.wechner@wyona.com>>
>     >     >     >     >     Subject: [Yanel-dev] Switching the
>     layout/design of
>     >     >     the from
>     >     >     >     >     scratch realm
>     >     >     >     >     To: yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@wyona.com>
>     >     >     >       
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=yanel-development@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://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@wyona.com>
>     >     >     >       
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@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
>     >     >     >     >
>     >     >     >     >
>     >     >     >
>     >     >     >     -- Yanel-development mailing list
>     >     >     Yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@wyona.com>
>     >     >       
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@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
>     >     >     >
>     >     >     >
>     >     >
>     >     >     -- Yanel-development mailing list
>     >     Yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@wyona.com>
>     > 
>        <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@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
>     >     >
>     >     >
>     >
>     >     -- Yanel-development mailing list
>     Yanel-development at wyona.com
>     <http://us.mc522.mail.yahoo.com/mc/compose?to=Yanel-development@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
>     >
>     >
>
>     -- 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