Author: crossley Date: Thu Apr 5 21:19:49 2007 New Revision: 526047 URL: http://svn.apache.org/viewvc?view=rev&rev=526047 Log: Enhanced the Message of the Day (MOTD) facility to enable specific matches. See skinconf.xml from a "seed" site for configuration details. The @starts-with=true anchors the URI string to the start, otherwise contains. Demonstrate it on the Forrest home page.
Modified: forrest/trunk/main/webapp/resources/schema/dtd/skinconfig-v08-1.dtd forrest/trunk/main/webapp/skins/coat/xslt/html/site-to-xhtml.xsl forrest/trunk/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl forrest/trunk/main/webapp/skins/scales/xslt/html/site-to-xhtml.xsl forrest/trunk/site-author/skinconf.xml forrest/trunk/site-author/status.xml Modified: forrest/trunk/main/webapp/resources/schema/dtd/skinconfig-v08-1.dtd URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/resources/schema/dtd/skinconfig-v08-1.dtd?view=diff&rev=526047&r1=526046&r2=526047 ============================================================================== --- forrest/trunk/main/webapp/resources/schema/dtd/skinconfig-v08-1.dtd (original) +++ forrest/trunk/main/webapp/resources/schema/dtd/skinconfig-v08-1.dtd Thu Apr 5 21:19:49 2007 @@ -118,7 +118,8 @@ to CDATA #IMPLIED> <!ELEMENT motd (motd-option+)> <!ELEMENT motd-option (motd-title?, motd-page?, motd-page-url?)> - <!ATTLIST motd-option pattern CDATA #IMPLIED> + <!ATTLIST motd-option pattern CDATA #IMPLIED + starts-with CDATA #IMPLIED> <!ELEMENT motd-title (#PCDATA)> <!ELEMENT motd-page (#PCDATA)> <!ATTLIST motd-page location CDATA #IMPLIED> Modified: forrest/trunk/main/webapp/skins/coat/xslt/html/site-to-xhtml.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/coat/xslt/html/site-to-xhtml.xsl?view=diff&rev=526047&r1=526046&r2=526047 ============================================================================== --- forrest/trunk/main/webapp/skins/coat/xslt/html/site-to-xhtml.xsl (original) +++ forrest/trunk/main/webapp/skins/coat/xslt/html/site-to-xhtml.xsl Thu Apr 5 21:19:49 2007 @@ -62,13 +62,26 @@ <xsl:value-of select="[EMAIL PROTECTED]'content']/h1"/> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="normalize-space(motd-title) != ''"> - <xsl:text> (</xsl:text> - <xsl:value-of select="motd-title"/> - <xsl:text>)</xsl:text> - </xsl:if> - </xsl:if> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="normalize-space(motd-title) != ''"> + <xsl:text> (</xsl:text> + <xsl:value-of select="motd-title"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="normalize-space(motd-title) != ''"> + <xsl:text> (</xsl:text> + <xsl:value-of select="motd-title"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> </title> @@ -452,22 +465,44 @@ <!-- Message of the day --> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> - <hr /> - <xsl:value-of select="motd-page"/> - <xsl:if test="motd-page-url"> - <xsl:text> (</xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="motd-page-url"/> - </xsl:attribute> - <xsl:text>More</xsl:text> - </a> - <xsl:text>)</xsl:text> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> + <hr /> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> </xsl:if> - </xsl:if> - </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> + <hr /> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> </div> @@ -674,23 +709,46 @@ <xsl:template match="[EMAIL PROTECTED]'skinconf-toc-page']"> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> - <div id="motd-area"> - <xsl:value-of select="motd-page"/> - <xsl:if test="motd-page-url"> - <xsl:text> (</xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="motd-page-url"/> - </xsl:attribute> - <xsl:text>More</xsl:text> - </a> - <xsl:text>)</xsl:text> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> + <div id="motd-area"> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </div> </xsl:if> - </div> - </xsl:if> - </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> + <div id="motd-area"> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </div> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> Modified: forrest/trunk/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl?view=diff&rev=526047&r1=526046&r2=526047 ============================================================================== --- forrest/trunk/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl (original) +++ forrest/trunk/main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl Thu Apr 5 21:19:49 2007 @@ -62,13 +62,26 @@ <xsl:value-of select="[EMAIL PROTECTED]'content']/h1"/> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="normalize-space(motd-title) != ''"> - <xsl:text> (</xsl:text> - <xsl:value-of select="motd-title"/> - <xsl:text>)</xsl:text> - </xsl:if> - </xsl:if> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="normalize-space(motd-title) != ''"> + <xsl:text> (</xsl:text> + <xsl:value-of select="motd-title"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="normalize-space(motd-title) != ''"> + <xsl:text> (</xsl:text> + <xsl:value-of select="motd-title"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> </title> @@ -502,22 +515,44 @@ <!-- Message of the day --> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> - <hr /> - <xsl:value-of select="motd-page"/> - <xsl:if test="motd-page-url"> - <xsl:text> (</xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="motd-page-url"/> - </xsl:attribute> - <xsl:text>More</xsl:text> - </a> - <xsl:text>)</xsl:text> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> + <hr /> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> </xsl:if> - </xsl:if> - </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> + <hr /> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> </div> @@ -722,28 +757,53 @@ </xsl:template> <xsl:template match="[EMAIL PROTECTED]'skinconf-toc-page']"> +<!-- Message of the day --> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> - <div id="motd-area"> - <xsl:value-of select="motd-page"/> - <xsl:if test="motd-page-url"> - <xsl:text> (</xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="motd-page-url"/> - </xsl:attribute> - <xsl:text>More</xsl:text> - </a> - <xsl:text>)</xsl:text> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> + <div id="motd-area"> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </div> </xsl:if> - </div> - </xsl:if> - </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> + <div id="motd-area"> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </div> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> +<!-- Table of Contents ToC --> <xsl:if test="$config/toc"> <xsl:if test="contains($minitoc-location,'page')"> <xsl:if test="(count(//tocitems/tocitem) >= $config/toc/@min-sections) or (//tocitems/@force = 'true')"> Modified: forrest/trunk/main/webapp/skins/scales/xslt/html/site-to-xhtml.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/scales/xslt/html/site-to-xhtml.xsl?view=diff&rev=526047&r1=526046&r2=526047 ============================================================================== --- forrest/trunk/main/webapp/skins/scales/xslt/html/site-to-xhtml.xsl (original) +++ forrest/trunk/main/webapp/skins/scales/xslt/html/site-to-xhtml.xsl Thu Apr 5 21:19:49 2007 @@ -62,13 +62,26 @@ <xsl:value-of select="[EMAIL PROTECTED]'content']/h1"/> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="normalize-space(motd-title) != ''"> - <xsl:text> (</xsl:text> - <xsl:value-of select="motd-title"/> - <xsl:text>)</xsl:text> - </xsl:if> - </xsl:if> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="normalize-space(motd-title) != ''"> + <xsl:text> (</xsl:text> + <xsl:value-of select="motd-title"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="normalize-space(motd-title) != ''"> + <xsl:text> (</xsl:text> + <xsl:value-of select="motd-title"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> </title> @@ -499,22 +512,44 @@ <!-- Message of the day --> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> - <hr /> - <xsl:value-of select="motd-page"/> - <xsl:if test="motd-page-url"> - <xsl:text> (</xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="motd-page-url"/> - </xsl:attribute> - <xsl:text>More</xsl:text> - </a> - <xsl:text>)</xsl:text> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> + <hr /> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> </xsl:if> - </xsl:if> - </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'"> + <hr /> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> </div> @@ -721,23 +756,46 @@ <xsl:template match="[EMAIL PROTECTED]'skinconf-toc-page']"> <xsl:if test="$config/motd"> <xsl:for-each select="$config/motd/motd-option"> - <xsl:if test="contains($path, @pattern)"> - <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> - <div id="motd-area"> - <xsl:value-of select="motd-page"/> - <xsl:if test="motd-page-url"> - <xsl:text> (</xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="motd-page-url"/> - </xsl:attribute> - <xsl:text>More</xsl:text> - </a> - <xsl:text>)</xsl:text> + <xsl:choose> + <xsl:when test="@starts-with='true'"> + <xsl:if test="starts-with($path, @pattern)"> + <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> + <div id="motd-area"> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </div> </xsl:if> - </div> - </xsl:if> - </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($path, @pattern)"> + <xsl:if test="motd-page/@location='page' or motd-page/@location='both'"> + <div id="motd-area"> + <xsl:value-of select="motd-page"/> + <xsl:if test="motd-page-url"> + <xsl:text> (</xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="motd-page-url"/> + </xsl:attribute> + <xsl:text>More</xsl:text> + </a> + <xsl:text>)</xsl:text> + </xsl:if> + </div> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:if> Modified: forrest/trunk/site-author/skinconf.xml URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/skinconf.xml?view=diff&rev=526047&r1=526046&r2=526047 ============================================================================== --- forrest/trunk/site-author/skinconf.xml (original) +++ forrest/trunk/site-author/skinconf.xml Thu Apr 5 21:19:49 2007 @@ -19,6 +19,9 @@ <!-- Skin configuration file. This file contains details of your project, which will be used to configure the chosen Forrest skin. + +Explanation of some elements has been removed from this file. +See main/fresh-site/src/documentation/skinconf.xml for details. --> <!DOCTYPE skinconfig PUBLIC "-//APACHE//DTD Skin Configuration V0.8-1//EN" "http://forrest.apache.org/dtd/skinconfig-v08-1.dtd"> @@ -111,20 +114,17 @@ <!-- Heading types can be clean|underlined|boxed --> <headings type="underlined"/> - <!-- Optional message of the day (MOTD). - Note: This is only implemented in the pelt skin. - If the optional <motd> element is used, then messages will be appended - depending on the URI string pattern. - motd-option : Specifies a pattern to match and provides small text content. - motd-title : This text will be added in brackets after the <html><title> - motd-page : This text will be added in a panel on the face of the page, - with the "motd-page-url" being the hyperlink "More". - Values for the "location" attribute are: - page : on the face of the page, e.g. in the spare space of the toc - alt : at the bottom of the left-hand navigation panel - both : both - --> +<!-- + 16 April 2007 Forrest-0.8 released: Features Locationmap. +--> <motd> + <motd-option pattern="index.html" starts-with="true"> + <motd-title>FIXME</motd-title> + <motd-page location="both"> + 23 June 2005 Forrest-0.7 released: Features architecture for plugins + </motd-page> + <motd-page-url>http://forrest.apache.org/mirrors.cgi</motd-page-url> + </motd-option> <motd-option pattern="docs_0_80"> <motd-title>v0.8-dev</motd-title> <motd-page location="both"> Modified: forrest/trunk/site-author/status.xml URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/status.xml?view=diff&rev=526047&r1=526046&r2=526047 ============================================================================== --- forrest/trunk/site-author/status.xml (original) +++ forrest/trunk/site-author/status.xml Thu Apr 5 21:19:49 2007 @@ -141,7 +141,13 @@ Added document to facilitate <link href="site:upgrading_08">upgrading to v0.8</link> </action> -<!--2007-04--> +<!-- 2007-04 --> + <action dev="DC" type="update" context="code"> + Enhanced the Message of the Day (MOTD) facility to enable specific matches. + See skinconf.xml from a "seed" site for configuration details. + The @starts-with=true anchors the URI string to the start, otherwise contains. + To use it, declare skinconfig-v08-1.dtd in your skinconf.xml file. + </action> <action dev="DC" type="add" context="docs"> Added <link href="site:faq/docs">notes</link> to explain the main documentation, as well as documentation and examples in each plugins and documentation