Author: jalkanen
Date: Sun Jun 15 12:15:52 2008
New Revision: 667997

URL: http://svn.apache.org/viewvc?rev=667997&view=rev
Log:
JSPWIKI-208: RSS images are now hidden if RSS is disabled.
Moved "info.rsspagefeed.title" key from default.properties
to CoreResources and renamed to "rss.title".

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/etc/i18n/CoreResources.properties
    incubator/jspwiki/trunk/etc/i18n/templates/default.properties
    incubator/jspwiki/trunk/etc/jspwiki.tld
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/RSSImageLinkTag.java
    incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp
    incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsBottom.jsp

Modified: incubator/jspwiki/trunk/ChangeLog
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun Jun 15 12:15:52 2008
@@ -1,3 +1,12 @@
+2008-06-15  Janne Jalkanen <[EMAIL PROTECTED]>
+
+        * 2.7.0-svn-45
+        
+        * JSPWIKI-208: RSS images are now hidden if RSS is disabled.
+        
+        * Moved "info.rsspagefeed.title" key from default.properties
+        to CoreResources and renamed to "rss.title".
+
 2007-06-15 Dirk Frederickx <[EMAIL PROTECTED]>
 
         * 2.7.0-svn-44 
@@ -13,7 +22,6 @@
         * Change the attachement icon to .gif (iso png), so it gets properly 
rendered on ie6.
         Added a transparent .ico file. (thanks Harry)
 
-
 2008-06-14  Janne Jalkanen <[EMAIL PROTECTED]>
 
         * 2.7.0-svn-43

Modified: incubator/jspwiki/trunk/etc/i18n/CoreResources.properties
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/CoreResources.properties?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/CoreResources.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/CoreResources.properties Sun Jun 15 
12:15:52 2008
@@ -191,4 +191,7 @@
 install.installer.validate.pagedir=You must define the location where the 
files are stored.
 install.installer.validate.appname=You must define the application name.
 install.installer.validate.workdir=You must define a work directory.
-install.installer.validate.logdir=You must define a log directory.
\ No newline at end of file
+install.installer.validate.logdir=You must define a log directory.
+
+# RSSImageLinkTag
+rss.title=RSS feed for page {0}

Modified: incubator/jspwiki/trunk/etc/i18n/templates/default.properties
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/templates/default.properties?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/templates/default.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/templates/default.properties Sun Jun 15 
12:15:52 2008
@@ -178,7 +178,6 @@
 info.feed=Page feed
 
 info.pagediff.title=Show changes of last page update
-info.rsspagefeed.title=RSS feed for page {0}
 
 info.rename.submit=Rename page
 info.updatereferrers=Update referrers?

Modified: incubator/jspwiki/trunk/etc/jspwiki.tld
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/jspwiki.tld?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/jspwiki.tld (original)
+++ incubator/jspwiki/trunk/etc/jspwiki.tld Sun Jun 15 12:15:52 2008
@@ -614,6 +614,10 @@
        <name>title</name>
        <rtexprvalue>true</rtexprvalue>
     </attribute>
+    <attribute>
+       <name>mode</name>
+       <rtexprvalue>true</rtexprvalue>
+    </attribute>
   </tag>
 
   <tag>

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/RSSImageLinkTag.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/RSSImageLinkTag.java?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/RSSImageLinkTag.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/RSSImageLinkTag.java Sun 
Jun 15 12:15:52 2008
@@ -21,13 +21,18 @@
 package com.ecyrd.jspwiki.tags;
 
 import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
 
 import javax.servlet.jsp.JspWriter;
 
+import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.i18n.InternationalizationManager;
+import com.ecyrd.jspwiki.rss.RSSGenerator;
 
 /**
- *  Writes an image link to the global JSPWiki RSS file.  If RSS generation has
+ *  Writes an image link to a JSPWiki RSS file.  If RSS generation has
  *  been turned off in jspwiki.properties, returns an empty string.
  *
  *  @since 2.0
@@ -38,7 +43,9 @@
     private static final long serialVersionUID = 0L;
     
     protected String m_title;
-
+    private   String m_mode;
+    private   String m_pageName;
+    
     /**
      *  [EMAIL PROTECTED]
      */
@@ -47,6 +54,8 @@
     {
         super.initTag();
         m_title = null;
+        m_mode  = RSSGenerator.MODE_FULL;
+        m_pageName = null;
     }
 
     /**
@@ -59,6 +68,12 @@
         m_title = title;
     }
 
+    public void setMode( String mode )
+    {
+        m_mode = mode;
+    }
+  
+    
     /**
      *  Returns the title.
      *  
@@ -77,15 +92,32 @@
         throws IOException
     {
         WikiEngine engine = m_wikiContext.getEngine();
+        JspWriter out = pageContext.getOut();
+        ResourceBundle rb = m_wikiContext.getBundle( 
InternationalizationManager.CORE_BUNDLE );
 
-        String rssURL = engine.getGlobalRSSURL();
-
-        if( rssURL != null )
+        if( engine.getRSSGenerator().isEnabled() )
         {
-            JspWriter out = pageContext.getOut();
-            out.print("<a class=\"feed\" href=\""+rssURL+"\">&nbsp;</a>");
+            if( RSSGenerator.MODE_FULL.equals(m_mode) )
+            {
+                String rssURL = engine.getGlobalRSSURL();
+
+                if( rssURL != null )
+                {
+                    out.print("<a class=\"feed\" 
href=\""+rssURL+"\">&nbsp;</a>");
+                }
+            }
+            else
+            {
+                String page = m_pageName != null ? m_pageName : 
m_wikiContext.getPage().getName();
+            
+                String params = "page="+page+"&mode="+m_mode;
+                out.print( "<a href='"+m_wikiContext.getURL( WikiContext.NONE, 
"rss.jsp", params ));
+                out.print( "' class='feed'" );
+                out.print( " title='"+MessageFormat.format( rb.getString( 
"rss.title" ), page )+"'>" );
+                out.print( "&nbsp;</a> ");
+            }
         }
-
+        
         return SKIP_BODY;
     }
 }

Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp 
(original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp Sun 
Jun 15 12:15:52 2008
@@ -72,14 +72,7 @@
     <fmt:param><wiki:Author /></fmt:param>
   </fmt:message>
 
-  <a href="<wiki:Link format='url' jsp='rss.jsp'>
-             <wiki:Param name='page' value='<%=wikiPage.getName()%>'/>
-             <wiki:Param name='mode' value='wiki'/>
-           </wiki:Link>"
-    class="feed"
-    title="<fmt:message key='info.rsspagefeed.title'>
-             <fmt:param><wiki:PageName /></fmt:param>
-           </fmt:message>" >&nbsp;</a>
+  <wiki:RSSImageLink mode="wiki"/>
   </p>
 
   <wiki:CheckVersion mode="notfirst">

Modified: 
incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsBottom.jsp
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsBottom.jsp?rev=667997&r1=667996&r2=667997&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsBottom.jsp 
(original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsBottom.jsp 
Sun Jun 15 12:15:52 2008
@@ -31,21 +31,8 @@
       </fmt:message>
     </wiki:CheckVersion>
 
-<%--
-       <wiki:RSSImageLink title="<fmt:message key='info.rsspagefeed.title'>
-               <fmt:param><wiki:PageName /></fmt:param>
-             </fmt:message>"/>
---%>
+   <wiki:RSSImageLink mode="wiki" />
 
-    <a href="<wiki:Link format='url' jsp='rss.jsp'>
-               <wiki:Param name='page' value='<%=wikipage.getName()%>'/>
-               <wiki:Param name='mode' value='wiki'/>
-             </wiki:Link>"
-      class="feed"
-      title="<fmt:message key='info.rsspagefeed.title'>
-               <fmt:param><wiki:PageName /></fmt:param>
-             </fmt:message>" >RSS-feed</a>
-  
   </wiki:PageExists>
 
   <wiki:NoSuchPage><fmt:message key="actions.notcreated"/></wiki:NoSuchPage> 


Reply via email to