Changeset 2583

Show
Ignore:
Timestamp:
12/29/09 16:22:13
Author:
johnsa
Message:

feeder: validate and clean RSS

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/list-html.xsl

    r2558 r2583  
    4646  <!-- Provides category filter templates --> 
    4747  <xsl:include href="./xsl/htmlCategoryFiltering.xsl"/> 
    48    
     48 
    4949 
    5050  <!--  global variables --> 
     
    6262        <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> 
    6363        <link rel="stylesheet" href="{$resourcesRoot}/css/blue.css"/> 
    64         <link rel="stylesheet" href="{$resourceCommons}/default/default/subColors.css"/> 
    6564        <link rel="stylesheet" type="text/css" media="print" href="{$resourcesRoot}/css/print.css" /> 
    6665        <!-- load javascript --> 
     
    105104          <xsl:otherwise> 
    106105            <xsl:for-each select="event"> 
    107                    
    108                        <xsl:choose> 
    109                              <xsl:when test="/bedework/appvar/key = 'filter'"> 
    110                                <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/> 
    111                                <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/> 
    112                                <!-- Define filters here: --> 
    113                                <xsl:choose> 
    114                                  <xsl:when test="$filterName = 'grpAndCats'"> 
    115                                    <xsl:call-template name="preprocessCats"> 
    116                                      <xsl:with-param name="allCats" select="$filterVal"/> 
    117                                    </xsl:call-template> 
    118                                  </xsl:when> 
    119                                  <xsl:otherwise> 
    120                                    <!-- Filter name not defined? Turn off filtering. --> 
    121                                    <xsl:call-template name="processListEvent" /> 
    122                                  </xsl:otherwise> 
    123                                </xsl:choose> 
    124                              </xsl:when> 
    125                              <xsl:otherwise> 
    126                                <xsl:call-template name="processListEvent" /> 
    127                              </xsl:otherwise> 
    128                            </xsl:choose> 
    129          
     106 
     107              <xsl:choose> 
     108            <xsl:when test="/bedework/appvar/key = 'filter'"> 
     109              <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/> 
     110              <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/> 
     111              <!-- Define filters here: --> 
     112              <xsl:choose> 
     113                <xsl:when test="$filterName = 'grpAndCats'"> 
     114                  <xsl:call-template name="preprocessCats"> 
     115                    <xsl:with-param name="allCats" select="$filterVal"/> 
     116                  </xsl:call-template> 
     117                </xsl:when> 
     118                <xsl:otherwise> 
     119                  <!-- Filter name not defined? Turn off filtering. --> 
     120                  <xsl:call-template name="processListEvent" /> 
     121                </xsl:otherwise> 
     122              </xsl:choose> 
     123            </xsl:when> 
     124            <xsl:otherwise> 
     125              <xsl:call-template name="processListEvent" /> 
     126            </xsl:otherwise> 
     127          </xsl:choose> 
     128 
    130129            </xsl:for-each> 
    131130          </xsl:otherwise> 
     
    157156  </xsl:template> 
    158157 
    159 <xsl:template name="processListEvent">  
     158<xsl:template name="processListEvent"> 
    160159 <xsl:variable name="id" select="id"/> 
    161160 <xsl:variable name="calPath" select="calendar/encodedPath"/> 
  • trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/list-rss.xsl

    r2559 r2583  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    3   <xsl:output method="xml" omit-xml-declaration="no" indent="yes"  
    4     doctype-public="'-//Netscape Communications//DTD RSS 0.91//EN' 'http://my.netscape.com/public/formats/rss-0.91.dtd'" 
     3  <xsl:output method="xml" omit-xml-declaration="no" indent="yes" 
    54    media-type="text/xml" encoding="UTF-8" /> 
     5 
    66   <!-- ========================================================= 
    77 
     
    1717     Optional parameters that may be added to the query string: 
    1818 
    19      days=n    To return n days from today into the future add this to the paramater list: &days=5  
     19     days=n    To return n days from today into the future add this to the paramater list: &days=5 
    2020 
    2121     ===============================================================  --> 
     
    4848   <xsl:include href="./xsl/categoryFiltering.xsl"/> 
    4949 
     50   <xsl:include href="globals.xsl"/> 
     51   <xsl:include href="../strings.xsl"/> 
     52 
    5053   <xsl:template match="/"> 
    5154     <rss version="2.0"> 
    5255      <channel> 
    5356        <title>Bedework Events Calendar</title> 
    54         <link><xsl:value-of select="/bedework/urlprefix"/></link> 
     57        <link><xsl:value-of select="substring-before($urlPrefix,$feeder)"/><xsl:value-of select="$publicCal"/></link> 
    5558        <description> 
    5659          <xsl:choose> 
     
    6669        <language>en-US</language> 
    6770        <copyright>Copyright <xsl:value-of select="substring(/bedework/now/utc,1,4)"/>, Bedework</copyright> 
    68         <managingEditor>editor@mysite.edu, Editor Name</managingEditor> 
     71        <managingEditor>editor@mysite.edu (Editor Name)</managingEditor> 
    6972        <xsl:choose> 
    70           <xsl:when test="/bedework/page='searchResult'"> 
    71             <xsl:apply-templates select="/bedework/searchResults/searchResult"/> 
    72           </xsl:when> 
    73           <xsl:otherwise>            
    74                 <xsl:choose> 
    75                          <xsl:when test="/bedework/appvar/key = 'filter'"> 
    76                                <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/> 
    77                                <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/> 
    78                                <!-- Define filters here: --> 
    79                                <xsl:choose> 
    80                              <xsl:when test="$filterName = 'grpAndCats'"> 
    81                                        <xsl:call-template name="preprocessCats"> 
    82                                          <xsl:with-param name="allCats" select="$filterVal"/> 
    83                                        </xsl:call-template> 
    84                              </xsl:when> 
    85                                  <xsl:otherwise> 
    86                                        <!-- Filter name not defined? Turn off filtering. --> 
    87                                        <xsl:apply-templates select="event"/> 
    88                              </xsl:otherwise> 
    89                            </xsl:choose> 
    90                          </xsl:when> 
    91                          <xsl:otherwise> 
    92                                <xsl:apply-templates select="event"/> 
    93                          </xsl:otherwise> 
    94                         </xsl:choose> 
    95           </xsl:otherwise> 
     73          <xsl:when test="/bedework/page='searchResult'"> 
     74            <xsl:apply-templates select="/bedework/searchResults/searchResult" /> 
     75          </xsl:when> 
     76          <xsl:otherwise> 
     77            <xsl:choose> 
     78              <xsl:when test="/bedework/appvar/key = 'filter'"> 
     79                <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')" /> 
     80                <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')" /> 
     81                <!-- Define filters here: --> 
     82                <xsl:choose> 
     83                  <xsl:when test="$filterName = 'grpAndCats'"> 
     84                    <xsl:call-template name="preprocessCats"> 
     85                      <xsl:with-param name="allCats" select="$filterVal" /> 
     86                    </xsl:call-template> 
     87                  </xsl:when> 
     88                  <xsl:otherwise> 
     89                    <!-- Filter name not defined? Turn off filtering. --> 
     90                    <xsl:apply-templates select="/bedework/events/event" /> 
     91                  </xsl:otherwise> 
     92                </xsl:choose> 
     93              </xsl:when> 
     94              <xsl:otherwise> 
     95                <xsl:apply-templates select="/bedework/events/event" /> 
     96              </xsl:otherwise> 
     97            </xsl:choose> 
     98          </xsl:otherwise> 
    9699        </xsl:choose> 
    97100      </channel> 
     
    101104  <xsl:template match="event"> 
    102105    <item> 
    103       <title><xsl:if test="status = 'CANCELLED'">CANCELED: </xsl:if><xsl:value-of select="summary"/> - <xsl:value-of select="substring(start/dayname,1,3)"/>, <xsl:value-of select="start/longdate"/></title> 
    104       <link><xsl:value-of select="/bedework/urlprefix"/>/event/eventView.do?calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:value-of select="guid"/>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/></link> 
     106      <title><xsl:if test="status = 'CANCELLED'">CANCELED: </xsl:if><xsl:value-of select="summary"/></title> 
     107      <link><xsl:value-of select="substring-before($urlPrefix,$feeder)"/><xsl:value-of select="$publicCal"/>/event/eventView.do?calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:value-of select="guid"/>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/></link> 
     108      <guid><xsl:value-of select="substring-before($urlPrefix,$feeder)"/><xsl:value-of select="$publicCal"/>/event/eventView.do?calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:value-of select="guid"/>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/></guid> 
    105109      <pubDate><!-- takes the form: 11 Jan 2008 17:00:00 UT (note - do not output dayname - we only provide dayname in local time). 
    106110        --><xsl:value-of select="substring(start/utcdate,7,2)"/><xsl:text> </xsl:text><!-- 
     
    108112        --><xsl:value-of select="substring(start/utcdate,1,4)"/><xsl:text> </xsl:text><!-- 
    109113        --><xsl:value-of select="substring(start/utcdate,10,2)"/>:<xsl:value-of select="substring(start/utcdate,11,2)"/>:00 UT</pubDate> 
    110       <description><!-- 
    111         --><xsl:value-of select="substring(start/dayname,1,3)"/>,<xsl:text> </xsl:text><!-- 
    112         --><xsl:value-of select="start/longdate"/><!-- 
    113         --><xsl:text> </xsl:text><!-- 
    114         --><xsl:value-of select="start/time"/><!-- 
    115         --><xsl:if test="end/time != ''"> - </xsl:if><!-- 
    116         --><xsl:if test="end/dayname != start/dayname"><xsl:value-of select="substring(end/dayname,1,3)"/>, </xsl:if><!-- 
    117         --><xsl:if test="end/longdate != start/longdate"><xsl:value-of select="end/longdate"/>, </xsl:if><!-- 
    118         --><xsl:if test="end/time != ''"><xsl:value-of select="end/time"/></xsl:if><!-- 
    119         --><xsl:text> </xsl:text><!-- 
    120         --><xsl:value-of select="location/address"/>.<!-- 
    121         --><xsl:text> </xsl:text><!-- 
    122         --><xsl:if test="cost!=''"><xsl:value-of select="cost"/>.</xsl:if><!-- 
    123         --><xsl:text> </xsl:text><!-- 
    124         --><xsl:value-of select="description"/><!-- 
    125         --><xsl:text> </xsl:text><xsl:if test="status = 'CANCELLED'">(CANCELED)</xsl:if><!-- 
    126       --></description> 
     114      <description> 
     115        <xsl:value-of select="start/dayname" />, 
     116        <xsl:value-of select="start/longdate" /> 
     117        <xsl:text> </xsl:text> 
     118        <xsl:if test="start/allday = 'false'"> 
     119          <xsl:value-of select="start/time" /> 
     120        </xsl:if> 
     121        <xsl:if 
     122          test="(end/longdate != start/longdate) or 
     123                ((end/longdate = start/longdate) and (end/time != start/time))"> 
     124          - 
     125        </xsl:if> 
     126        <xsl:if test="end/longdate != start/longdate"> 
     127          <xsl:value-of select="substring(end/dayname,1,3)" /> 
     128          , 
     129          <xsl:value-of select="end/longdate" /> 
     130          <xsl:text> </xsl:text> 
     131        </xsl:if> 
     132        <xsl:choose> 
     133          <xsl:when test="start/allday = 'true'"> 
     134            <xsl:copy-of select="$bwStr-SgEv-AllDay"/> 
     135          </xsl:when> 
     136          <xsl:when test="end/longdate != start/longdate"> 
     137            <xsl:value-of select="end/time" /> 
     138          </xsl:when> 
     139          <xsl:when test="end/time != start/time"> 
     140 
     141              <xsl:value-of select="end/time" /> 
     142 
     143          </xsl:when> 
     144        </xsl:choose> 
     145        <!-- if timezones are not local, or if floating add labels: --> 
     146        <xsl:if test="start/timezone/islocal = 'false' or end/timezone/islocal = 'false'"> 
     147          <xsl:text> </xsl:text> 
     148          -- 
     149          <xsl:choose> 
     150            <xsl:when test="start/floating = 'true'"> 
     151              <xsl:copy-of select="$bwStr-SgEv-FloatingTime"/> 
     152            </xsl:when> 
     153            <xsl:otherwise> 
     154              <xsl:copy-of select="$bwStr-SgEv-LocalTime"/> 
     155            </xsl:otherwise> 
     156          </xsl:choose> 
     157        </xsl:if> 
     158        <!-- display in timezone if not local or floating time) --> 
     159        <xsl:if test="(start/timezone/islocal = 'false' or end/timezone/islocal = 'false') and start/floating = 'false'"> 
     160          <xsl:choose> 
     161            <xsl:when test="start/timezone/id != end/timezone/id"> 
     162              <!-- need to display both timezones if they differ from start to end --> 
     163              <div class="tzdates"> 
     164                <xsl:copy-of select="$bwStr-SgEv-Start"/><xsl:text> </xsl:text> 
     165                <xsl:choose> 
     166                  <xsl:when test="start/timezone/islocal='true'"> 
     167                    <xsl:value-of select="start/dayname"/>, 
     168                    <xsl:value-of select="start/longdate"/> 
     169                    <xsl:text> </xsl:text> 
     170                    <xsl:value-of select="start/time"/> 
     171                  </xsl:when> 
     172                  <xsl:otherwise> 
     173                    <xsl:value-of select="start/timezone/dayname"/>, 
     174                    <xsl:value-of select="start/timezone/longdate"/> 
     175                    <xsl:text> </xsl:text> 
     176                    <xsl:value-of select="start/timezone/time"/> 
     177                  </xsl:otherwise> 
     178                </xsl:choose> 
     179                -- 
     180                <strong><xsl:value-of select="start/timezone/id"/></strong> 
     181                <xsl:copy-of select="$bwStr-SgEv-End"/><xsl:text> </xsl:text> 
     182                <xsl:choose> 
     183                  <xsl:when test="end/timezone/islocal='true'"> 
     184                    <xsl:value-of select="end/dayname"/>, 
     185                    <xsl:value-of select="end/longdate"/> 
     186                    <xsl:text> </xsl:text> 
     187                    <xsl:value-of select="end/time"/> 
     188                  </xsl:when> 
     189                  <xsl:otherwise> 
     190                    <xsl:value-of select="end/timezone/dayname"/>, 
     191                    <xsl:value-of select="end/timezone/longdate"/> 
     192                    <xsl:text> </xsl:text> 
     193                    <xsl:value-of select="end/timezone/time"/> 
     194                  </xsl:otherwise> 
     195                </xsl:choose> 
     196                -- 
     197                <strong><xsl:value-of select="end/timezone/id"/></strong> 
     198              </div> 
     199            </xsl:when> 
     200            <xsl:otherwise> 
     201              <!-- otherwise, timezones are the same: display as a single line  --> 
     202              <xsl:value-of select="start/timezone/dayname"/>, <xsl:value-of select="start/timezone/longdate"/><xsl:text> </xsl:text> 
     203              <xsl:if test="start/allday = 'false'"> 
     204                <xsl:value-of select="start/timezone/time"/> 
     205              </xsl:if> 
     206              <xsl:if test="(end/timezone/longdate != start/timezone/longdate) or 
     207                            ((end/timezone/longdate = start/timezone/longdate) and (end/timezone/time != start/timezone/time))"> - </xsl:if> 
     208              <xsl:if test="end/timezone/longdate != start/timezone/longdate"> 
     209                <xsl:value-of select="substring(end/timezone/dayname,1,3)"/>, <xsl:value-of select="end/timezone/longdate"/><xsl:text> </xsl:text> 
     210              </xsl:if> 
     211              <xsl:choose> 
     212                <xsl:when test="start/allday = 'true'"> 
     213                   <xsl:copy-of select="$bwStr-SgEv-AllDay"/> 
     214                </xsl:when> 
     215                <xsl:when test="end/timezone/longdate != start/timezone/longdate"> 
     216                  <xsl:value-of select="end/timezone/time"/> 
     217                </xsl:when> 
     218                <xsl:when test="end/timezone/time != start/timezone/time"> 
     219                  <xsl:value-of select="end/timezone/time"/> 
     220                </xsl:when> 
     221              </xsl:choose> 
     222              <xsl:text> </xsl:text> 
     223              -- 
     224              <strong><xsl:value-of select="start/timezone/id"/></strong> 
     225            </xsl:otherwise> 
     226          </xsl:choose> 
     227        </xsl:if> 
     228 
     229        <![CDATA[ 
     230          <br/> 
     231        ]]> 
     232 
     233        <xsl:copy-of select="$bwStr-SgEv-Where"/><xsl:text> </xsl:text> 
     234        <xsl:choose> 
     235          <xsl:when test="location/link=''"> 
     236            <xsl:value-of select="location/address" /> 
     237            <xsl:text> </xsl:text> 
     238            <xsl:if test="location/subaddress!=''"> 
     239              <xsl:text> </xsl:text> 
     240              <xsl:value-of select="location/subaddress" /> 
     241            </xsl:if> 
     242          </xsl:when> 
     243          <xsl:otherwise> 
     244            <a> 
     245              <xsl:attribute name="href"><xsl:value-of select="location/link"/></xsl:attribute> 
     246              <xsl:value-of select="location/address"/> 
     247              <xsl:if test="location/subaddress!=''"> 
     248                <xsl:text> </xsl:text> 
     249                <xsl:value-of select="location/subaddress" /> 
     250              </xsl:if> 
     251            </a> 
     252          </xsl:otherwise> 
     253        </xsl:choose> 
     254 
     255        <![CDATA[ 
     256          <br/> 
     257        ]]> 
     258 
     259        <xsl:if test="cost!=''"> 
     260          <xsl:copy-of select="$bwStr-SgEv-Cost"/><xsl:text> </xsl:text> 
     261          <xsl:value-of select="cost" /> 
     262          <![CDATA[ 
     263            <br/> 
     264          ]]> 
     265        </xsl:if> 
     266 
     267        <xsl:copy-of select="$bwStr-SgEv-Description"/><xsl:text> </xsl:text> 
     268        <xsl:value-of select="description"/> 
     269 
     270        <![CDATA[ 
     271          <br/> 
     272        ]]> 
     273 
     274        <xsl:if test="status !='' and status != 'CONFIRMED'"> 
     275          <xsl:copy-of select="$bwStr-SgEv-STATUS"/><xsl:text> </xsl:text> 
     276          <xsl:value-of select="status" /> 
     277          <![CDATA[ 
     278            <br/> 
     279          ]]> 
     280        </xsl:if> 
     281 
     282        <xsl:if test="contact/name!='None'"> 
     283          <xsl:copy-of select="$bwStr-SgEv-Contact"/><xsl:text> </xsl:text> 
     284          <xsl:value-of select="contact/name" /> 
     285          <xsl:if test="contact/phone!=''"> 
     286            <xsl:text> </xsl:text> 
     287            <xsl:value-of select="contact/phone" /> 
     288          </xsl:if> 
     289          <![CDATA[ 
     290            <br/> 
     291          ]]> 
     292        </xsl:if> 
     293 
     294        <xsl:if test="categories[1]/category"> 
     295          <xsl:copy-of select="$bwStr-SgEv-Categories"/><xsl:text> </xsl:text> 
     296          <xsl:for-each select="categories/category"> 
     297            <xsl:value-of select="value"/><xsl:if test="position() != last()">, </xsl:if> 
     298          </xsl:for-each> 
     299          <![CDATA[ 
     300            <br/> 
     301          ]]> 
     302        </xsl:if> 
     303      </description> 
    127304    </item> 
    128305  </xsl:template> 
  • trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/xsl/config.xsl

    r2557 r2583  
    2929    Institute, nor the authors of the software are liable for any indirect, 
    3030    special, consequential, or incidental damages related to the software, 
    31     to the maximum extent the law permits.  
     31    to the maximum extent the law permits. 
    3232  --> 
    3333 
     
    4747  <!-- URL of the XSL template directory --> 
    4848  <xsl:variable name="appRoot" select="/bedework/approot"/> 
    49   
     49 
    5050  <xsl:variable name="bwCacheHostUrl">http://localhost:3000</xsl:variable> 
    5151  <xsl:variable name="bwCalendarHostURL">http://localhost:8080</xsl:variable> 
     
    6262  <xsl:variable name="export" select="/bedework/urlPrefixes/misc/export"/> 
    6363  <xsl:variable name="mailEvent" select="/bedework/urlPrefixes/mail/mailEvent"/> 
    64    
     64 
    6565 
    6666  <!-- URL of the web application - includes web context --> 
    6767  <xsl:variable name="urlPrefix" select="/bedework/urlprefix"/> 
    6868 
    69    
     69 
    7070</xsl:stylesheet>