On 2011-04-13 David Crossley <cross...@apache.org> said: > Vicent Mas wrote: > > I've updated my local repo and checked that the 'starts-with' attribute > > stuff of motd is not available with dispatcher. I've customised the > > content-motd- page.contract.xml that comes with dispatcher adding some > > 'starts-with' stuff. I've used > > $FORREST_HOME/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl as a > > guide (not sure if it is the best choice but it has been good enough for > > me). Now the motd contract works as I want. > > > > So again thanks for your help, > > Yes the "pelt" skin is the one that the Forrest project > keeps up-to-date. It is what the Forrest project website uses. > http://forrest.apache.org/docs/dev/status-themes.html > So that is the correct one to base your work upon. > > Are you able to provide a patch for Dispatcher? > > -David
Hi, I've attached the patch to this mail. You can apply it from the FORREST_HOME like this: $ patch -p0 <content-motd-page-contract.diff Please, note that I've not tried to port all motd functionality from $FORREST_HOME/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl to the dispatcher contract. I've just picked what I needed to achieve my goal. That being said, If the patch is fine with you I can attach it to an issue at jira. Hope it helps, Vicent :: Share what you know, learn what you don't
--- whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/content-motd-page.contract.xml 2011-02-19 18:44:54.000000000 +0100 +++ whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/my-content-motd-page.contract.xml 2011-04-14 18:03:33.000000000 +0200 @@ -26,7 +26,8 @@ <br />Each option will match a pattern and apply its text. The "pattern" attribute specifies the pattern to be matched. This can be a specific page, or a general pattern to match a set of pages, e.g. everything in the - "samples" directory.</p> + "samples" directory. + <br />The @starts-with=true anchors the string to the start, otherwise contains.</p> <p>motd-title : <br />This text will be added in brackets after the <html><title> and this can be empty.</p> @@ -44,10 +45,11 @@ <![CDATA[<forrest:contract name="content-motd-page"> <forrest:property name="content-motd-page"> <motd> - <motd-option pattern="samples/sample.html"> + <motd-option pattern="index.html" starts-with="true"> <motd-title>sample</motd-title> - <motd-page location="both"> - This is an example of a Message of the day (MOTD). + <motd-page location="page"> + This is an example of a Message of the day (MOTD) that will be displayed + only in the main index page. </motd-page> <motd-page-url>/samples/faq.html</motd-page-url> </motd-option> @@ -76,6 +78,15 @@ <xsl:comment>+ |start content-motd-page +</xsl:comment> <xsl:if test="$content-motd-page/motd"> <xsl:for-each select="$content-motd-page/motd/motd-option"> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <div class="motd-area"> + <xsl:value-of select="motd-page"/> + </div> + </xsl:if> + </xsl:when> + <xsl:otherwise> <xsl:if test="contains($path, @pattern)"> <div class="motd-area"> <xsl:value-of select="motd-page" /> @@ -95,6 +106,8 @@ </xsl:if> </div> </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> <xsl:comment>+ |end content-motd-page +</xsl:comment>
signature.asc
Description: This is a digitally signed message part.