jon         01/06/17 18:09:47

  Modified:    src/java/org/apache/turbine/util/template
                        TemplatePageAttributes.java
  Log:
  added patch by Gary Lawrence Murphy <[EMAIL PROTECTED]>
  
  DESCRIPTION:
  
      The following patch adds two META tags and LINK tag support to
      TemplatePageAttributes.
  
      The new META tags carry the metadata for page authorship and the
      generator, and while we can all use more self-promotion through
      the author tag, I strongly recommend people use the default of the
      setGenerator() method.
  
      PROMOTE TURBINE!
  
      The default setGenerator will list this page as generated by
      "Jakarta Turbine 2.1" -- if this is in your Default layout all
      project pages will be tagged as a Turbine product.  This allows
      the project crew and potential users to search on this string and
      get a sense of how widely Turbine is deployed.
  
      NOTE: If any this already exists in Turbine, please ignore this
            patch!  Also, check the patch carefully as I am not yet set
            up to thoroughly test mods to the core classes.  Your
            mileage may vary. Consult your physician if symptoms
            persist.
  
      The second feature of this _really_ needed patching: This is the
      ability to add arbitrary "link" tags.  Some of you won't know what
      these are or how to use them, but these tags are _essential_ for
      creating pages accessible to blind users or those with physical
      disabilities that frustrate surving with a 2D point/click cursor.
  
      In a nutshell, using link tags lets handicapped visitors jump
      quickly to the guts of your pages, for example
  
         <link rel="NEXT" title="QuickStart" href="#mainpage"/>
         <link rel="INDEX" title="FastTrack" href="#toc"/>
         <link rel="HOME" title="FrontPage" href="http://www.teledyn.com/"/>
  
      sets up three links right at the start of what they see/hear and
      lets them get around the page without having to muddle through
      your front matter.
  
  COPYRIGHT: I hereby assign copyright of this patch to the Apache Software
             Foundation to do with as they please.
  
  Revision  Changes    Path
  1.7       +78 -1     
jakarta-turbine/src/java/org/apache/turbine/util/template/TemplatePageAttributes.java
  
  Index: TemplatePageAttributes.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/template/TemplatePageAttributes.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TemplatePageAttributes.java       2001/05/06 17:06:47     1.6
  +++ TemplatePageAttributes.java       2001/06/18 01:09:45     1.7
  @@ -82,7 +82,7 @@
    * $page.setStyleSheet("/style.css");
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sean Legassick</a>
  - * @version $Id: TemplatePageAttributes.java,v 1.6 2001/05/06 17:06:47 jvanzyl Exp $
  + * @version $Id: TemplatePageAttributes.java,v 1.7 2001/06/18 01:09:45 jon Exp $
    */
   public class TemplatePageAttributes
       implements ApplicationTool
  @@ -181,6 +181,45 @@
       }
   
       /**
  +     * Adds a LINK tag, which is essential for accessibility. these
  +     * tags are _essential_ for creating pages accessible to blind
  +     * users or those with physical disabilities that frustrate
  +     * surving with a 2D point/click cursor.  In a nutshell, using
  +     * link tags lets handicapped visitors jump quickly to the guts of
  +     * your pages, for example
  +     *
  +     * <pre>
  +     * $page.setLink("NEXT","QuickStart","#mainpage")
  +     * $page.setLink("INDEX","Sections","#toc")
  +     * $page.setLink("HOME","HomePage","/")
  +     * </pre>
  +     *
  +     * sets up three links right at the start of what they see/hear
  +     * and lets them get around the page without having to muddle
  +     * through your front matter.  All you need do is add these links
  +     * and then place &lt&a name="mainpage"&gt; (or whatever) at the
  +     * key sections of your template.
  +     *
  +     * There is another link tag, "made" which asks for a mailto
  +     * address, but I am not certain of the syntax; if you find out
  +     * please patch this code.
  +     *
  +     * @param rel a <code>String</code>, one of NEXT,INDEX,HOME,TOC
  +     * @param title a <code>String</code> is the displayed anchor
  +     * @param href a <code>String</code> URL value
  +     * @return A TemplatePageAttributes (self).
  +     */
  +    public TemplatePageAttributes setLink(String rel, 
  +                                        String title, 
  +                                        String href)
  +    {
  +        data.getPage().getHead()
  +          .addElement(new Link()
  +                .setRel(rel).setTitle(title).setHref(href));
  +        return this;
  +    }
  +
  +    /**
        * Set a keywords META tag in the HEAD of the page.
        *
        * @param keywords A String.
  @@ -219,6 +258,44 @@
       {
           data.getPage().getHead().addElement(
                   new Meta().setName("description").setContent(description));
  +        return this;
  +    }
  +
  +    /**
  +     * Add an author META tag to the HEAD of the page.
  +     *
  +     * @param description the author name and email address
  +     * @return A TemplatePageAttributes (self).
  +     */
  +    public TemplatePageAttributes setAuthor(String description)
  +    {
  +        data.getPage().getHead().addElement(
  +                new Meta().setName("author").setContent(description));
  +        return this;
  +    }
  +
  +    /**
  +     * Add the generator META tag to the HEAD of the page
  +     *
  +     * the no-parms option will put a plug for Turbine into your pages
  +     * allowing the project crew to do web-searches that tell them how
  +     * many Turbine sites are listed.
  +     *
  +     * @param description (optional) A String
  +     * @return A TemplatePageAttributes (self).
  +     */
  +    public TemplatePageAttributes setGenerator()
  +    {
  +        return setGenerator("Jakarta Turbine @VERSION@");
  +    }
  +
  +    /**
  +     * Add the generator META tag to the HEAD of the page
  +     */
  +    public TemplatePageAttributes setGenerator(String description)
  +    {
  +        data.getPage().getHead().addElement(
  +                new Meta().setName("generator").setContent(description));
           return this;
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to