Changeset 2542

Show
Ignore:
Timestamp:
12/23/09 13:50:03
Author:
bleibson
Message:

o catch up this skin to reflect replacement of group creator with special purpose categories.

Files:

Legend:

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

    r2520 r2542  
    2929  --> 
    3030 
    31   <!-- DEFINE INCLUDES --> 
    32   <!-- util.xsl belongs in bedework-common on your application server for use 
    33        by all stylesheets: 
    34   --> 
    35   <xsl:include href="../../../bedework-common/default/default/util.xsl"/> 
     31  <!-- Bring in settings and included xsl --> 
     32  <xsl:include href="./config.xsl"/> 
     33 
     34  <!--  global variables -->  
    3635  <xsl:variable name="urlprefix" select="/bedework/urlprefix"/> 
    3736  <xsl:variable name="eventView" select="/bedework/urlPrefixes/event/eventView"/> 
     
    5352  </xsl:template> 
    5453 
    55   <xsl:template name="processGrpAndCats"> 
    56     <xsl:param name="list" /> 
    57     <xsl:variable name="group" select="substring-before($list, '~')" /> 
    58     <xsl:variable name="remaining" select="substring-after($list, '~')" /> 
    59     <xsl:call-template name="processCategories"> 
    60     <xsl:with-param name="group" select="$group" /> 
    61       <xsl:with-param name="list" select="$remaining" /> 
     54  <xsl:template name="preprocessCats"> 
     55    <xsl:param name="allCats" /> 
     56    <xsl:variable name="andCat" select="substring-before($allCats, '~')" /> 
     57    <xsl:variable name="orList" select="substring-after($allCats, '~')" /> 
     58    <xsl:call-template name="processCats"> 
     59      <xsl:with-param name="andCat" select="$andCat" /> 
     60      <xsl:with-param name="orList" select="$orList" /> 
    6261    </xsl:call-template> 
    6362  </xsl:template> 
    6463 
    65   <xsl:template name="processCategories"> 
    66   <xsl:param name="group" /> 
    67     <xsl:param name="list" /> 
     64  <xsl:template name="processCats"> 
     65    <xsl:param name="andCat" /> 
     66    <xsl:param name="orList" /> 
    6867    <xsl:choose> 
    69     <xsl:when test="contains($list, '~')"> 
    70     <!-- Grab the first off the list and process --> 
    71       <xsl:variable name="catid" select="substring-before($list, '~')" /> 
    72       <xsl:variable name="remaining" select="substring-after($list, '~')" /> 
    73       <xsl:choose> 
    74       <xsl:when test="$group = 'all'"> 
    75           <xsl:apply-templates select="event[categories/category/id = $catid]" /> 
    76         </xsl:when> 
    77         <xsl:otherwise> 
    78           <xsl:apply-templates select="event[categories/category/id = $catid]" /> 
    79         </xsl:otherwise> 
    80       </xsl:choose> 
    81  
    82     <!-- now use recursion to process the remaining categories --> 
    83       <xsl:call-template name="processCategories"> 
    84         <xsl:with-param name="list" select="$remaining" /> 
    85       </xsl:call-template> 
    86     </xsl:when> 
    87     <xsl:otherwise> 
    88       <!-- No more tildes, so this is the last category.  Process it --> 
    89     <xsl:choose> 
    90       <xsl:when test="$group = 'all'"> 
    91       <xsl:choose> 
    92         <xsl:when test="$list = 'all'"> 
    93               <xsl:apply-templates select="event" /> 
    94             </xsl:when> 
    95             <xsl:otherwise> 
    96             <xsl:apply-templates select="event[categories/category/id = $list]" /> 
     68         
     69      <xsl:when test="contains($orList, '~')">    
     70        <!-- There are 2 or more on the "or" list.  --> 
     71        <xsl:variable name="orCat" select="substring-before($orList, '~')" /> 
     72        <xsl:variable name="remainingOrList" select="substring-after($orList, '~')" /> 
     73        <!-- Process the first one --> 
     74        <xsl:call-template name="processAndOr"> 
     75              <xsl:with-param name="andCat" select="$andCat"/> 
     76              <xsl:with-param name="orCat" select="$orCat"/> 
     77            </xsl:call-template> 
     78        <!-- and use recursion to process the remaining categories --> 
     79        <xsl:call-template name="processCats"> 
     80              <xsl:with-param name="andCat" select="$andCat"/> 
     81          <xsl:with-param name="orList" select="$remainingOrList" /> 
     82        </xsl:call-template> 
     83      </xsl:when> 
     84 
     85      <xsl:otherwise> 
     86        <!-- No more tildes, so this is the last or only "or" category.  Call processAndOr to process it --> 
     87        <xsl:call-template name="processAndOr"> 
     88              <xsl:with-param name="andCat" select="$andCat"/> 
     89              <xsl:with-param name="orCat" select="$orList"/> 
     90            </xsl:call-template> 
     91      </xsl:otherwise> 
     92 
     93    </xsl:choose> 
     94  </xsl:template> 
     95 
     96  <xsl:template name="processAndOr"> 
     97        <xsl:param name="andCat"/> 
     98    <xsl:param name="orCat" /> 
     99        <xsl:choose> 
     100      <xsl:when test="$andCat = 'all'"> 
     101        <xsl:choose> 
     102          <xsl:when test="$orCat = 'all'"> 
     103          <!-- all categories should be displayed --> 
     104            <xsl:apply-templates select="event" /> 
     105          </xsl:when> 
     106          <xsl:otherwise> 
     107            <!-- nothing being anded; display event if it matches "or" category--> 
     108            <xsl:apply-templates select="event[categories/category/uid = $orCat]" /> 
    97109          </xsl:otherwise> 
    98           </xsl:choose> 
    99         </xsl:when> 
    100         <xsl:otherwise> 
     110        </xsl:choose> 
     111      </xsl:when> 
     112      <xsl:otherwise> 
    101113        <xsl:choose> 
    102         <xsl:when test="$list = 'all'"> 
    103               <xsl:apply-templates select="event[creator = $group]" /> 
    104             </xsl:when> 
    105             <xsl:otherwise> 
     114          <xsl:when test="$orCat = 'all'"> 
     115            <!-- no or's; display if it matches "and" category --> 
     116            <xsl:apply-templates select="event[categories/category/uid = $andCat]" /> 
     117          </xsl:when> 
     118          <xsl:otherwise> 
    106119            <xsl:choose> 
    107               <xsl:when test="event/creator = $group"> 
    108                 <xsl:apply-templates select="event[categories/category/id = $list]" /> 
     120              <!-- an "and" and an "or", so display if they are both present --> 
     121              <xsl:when test="event/category/uid = $andCat"> 
     122                <xsl:apply-templates select="event[categories/category/uid = $orCat]" /> 
    109123              </xsl:when> 
    110124            </xsl:choose> 
    111125          </xsl:otherwise> 
    112       </xsl:choose> 
    113         </xsl:otherwise> 
    114       </xsl:choose> 
    115     </xsl:otherwise> 
    116   </xsl:choose> 
     126        </xsl:choose> 
     127          </xsl:otherwise> 
     128    </xsl:choose>        
    117129  </xsl:template> 
    118130 
     
    141153            <xsl:choose> 
    142154            <xsl:when test="filler = 'true'"> 
    143         "filler" : "<xsl:value-of select='filler'/>" 
     155            "filler" : "<xsl:value-of select='filler'/>" 
    144156            </xsl:when> 
    145157            <xsl:otherwise> 
    146         "filler" : "<xsl:value-of select='filler'/>", 
     158            "filler" : "<xsl:value-of select='filler'/>", 
    147159            "value" : "<xsl:value-of select='value'/>", 
    148160            "name" : "<xsl:value-of select='name'/>", 
     
    158170                  <xsl:choose> 
    159171                    <xsl:when test="$filterName = 'grpAndCats'"> 
    160                       <xsl:call-template name="processGrpAndCats"><xsl:with-param name="list" select="$filterVal"/></xsl:call-template> 
     172                      <xsl:call-template name="preprocessCats"> 
     173                            <xsl:with-param name="allCats" select="$filterVal"/> 
     174                          </xsl:call-template> 
    161175                    </xsl:when> 
    162176                    <xsl:otherwise>