Changeset 5479


Ignore:
Timestamp:
Nov 8, 2010, 8:33:46 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1546: Publish news as a rss feed

Added possibility to disable the RSS feed by commenting out the servlet definition in web.xml.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/web.xml

    r5478 r5479  
    182182
    183183  <!-- The News feed servlet  -->
     184  <!-- Comment out this servlet to disable the RSS feed -->
    184185  <servlet>
    185186    <servlet-name>news-feed</servlet-name>
     
    187188      net.sf.basedb.clients.web.servlet.RssNewsFeed
    188189    </servlet-class>
     190    <load-on-startup>1</load-on-startup>
    189191  </servlet>
    190192  <servlet-mapping>
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/RssNewsFeed.java

    r5478 r5479  
    6565  private static long lastUpdate;
    6666  private static Date lastReset;
     67  private static boolean enabled;
    6768 
    6869  /**
     
    7677    lastUpdate = 0;
    7778    lastReset = new Date();
    78   }
    79 
     79    enabled = true;
     80  }
     81
     82  /**
     83    Check if the rss servlet has been enabled or not.
     84  */
     85  public static boolean isEnabled()
     86  {
     87    return enabled;
     88  }
    8089 
    8190  private String host;
  • trunk/www/info/news.jsp

    r5478 r5479  
    4141  import="net.sf.basedb.util.formatter.Formatter"
    4242  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     43  import="net.sf.basedb.clients.web.servlet.RssNewsFeed"
    4344  import="java.util.Date"
    4445%>
     
    6768    <tr>
    6869    <td>
    69       <h3>News and announcements <a href="news.rss"
    70         title="Subscribe to news from this BASE server"
    71         ><base:icon image="rss.png" /></a></h3>
     70      <h3>News and announcements
     71      <%
     72      if (RssNewsFeed.isEnabled())
     73      {
     74        %><a href="news.rss"
     75          title="Subscribe to news from this BASE server"
     76          ><base:icon image="rss.png" /></a>
     77        <%
     78      }
     79      %>
     80      </h3>
    7281      <div id="news" class="news">
    7382      <%
  • trunk/www/main.jsp

    r5478 r5479  
    4444  import="net.sf.basedb.util.formatter.Formatter"
    4545  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     46  import="net.sf.basedb.clients.web.servlet.RssNewsFeed"
    4647  import="net.sf.basedb.util.Values"
    4748  import="java.util.Date"
     
    242243      %>
    243244     
    244       <h3>News and announcements <a href="info/news.rss"
    245         title="Subscribe to news from this BASE server"
    246         ><base:icon image="rss.png" /></a>
     245      <h3>News and announcements
     246      <%
     247      if (RssNewsFeed.isEnabled())
     248      {
     249        %>
     250        <a href="info/news.rss"
     251          title="Subscribe to news from this BASE server"
     252          ><base:icon image="rss.png" /></a>
     253        <%
     254      }
     255      %>
    247256      </h3>
    248257      <div id="news" class="news">
  • trunk/www/my_base/index.jsp

    r5478 r5479  
    5454  import="net.sf.basedb.util.formatter.Formatter"
    5555  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     56  import="net.sf.basedb.clients.web.servlet.RssNewsFeed"
    5657  import="net.sf.basedb.util.Values"
    5758  import="java.util.Date"
     
    329330  <td width="50%">
    330331 
    331   <h3 class="light docked"><base:icon image="news.gif" />&nbsp;News and announcements (<%=news.size()%>) <a href="../info/news.rss"
     332  <h3 class="light docked"><base:icon image="news.gif" />&nbsp;News and announcements (<%=news.size()%>)
     333    <%
     334    if (RssNewsFeed.isEnabled())
     335    {
     336      %>
     337      <a href="../info/news.rss"
    332338        title="Subscribe to news from this BASE server"
    333         ><base:icon image="rss.png" /></a></h3>
     339        ><base:icon image="rss.png" /></a>
     340      <%
     341    }
     342    %>
     343  </h3>
    334344    <div id="news" class="news welcomesection" style="height: 400px; overflow: auto;">
    335345    <%
Note: See TracChangeset for help on using the changeset viewer.