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.

Index: TemplatePageAttributes.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/util/template/TemplatePageAttributes.java,v
retrieving revision 1.6
diff -c -r1.6 TemplatePageAttributes.java
*** TemplatePageAttributes.java 2001/05/06 17:06:47 1.6
--- TemplatePageAttributes.java 2001/06/13 16:31:36
***************
*** 181,186 ****
--- 181,225 ----
      }
  
      /**
+    * 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,224 ****
--- 258,297 ----
      {
          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 2.1");
+   }
+ 
+     public TemplatePageAttributes setGenerator(String description)
+     {
+         data.getPage().getHead().addElement(
+                 new Meta().setName("generator").setContent(description));
          return this;
      }


-- 
Gary Lawrence Murphy <[EMAIL PROTECTED]> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless.  They can only give you answers."(Pablo Picasso)


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

Reply via email to