Changeset 3438

Show
Ignore:
Timestamp:
12/06/11 14:47:36
Author:
johnsa
Message:

feeder: updates to calendar tree json widget

Files:

Legend:

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

    r3430 r3438  
    3030        
    3131       To call the object as pure json:   
    32        /feeder/calendar/fetchPublicCalendars.do?skinName=widget-json-cals 
     32       /feeder/calendar/fetchPublicCalendars.do?skinName=widget-json-cals&setappvar=setSelectionAction(calsuiteSetSelectionAction) 
     33       where the "calsuiteSetSelectionAction" is the path to the setSelection.do action as produced by  
     34       the current calendar suite calling this page.  Different suites will have different contexts, so we  
     35       need to account for that by passing in the server-relative path to setSelection.do.  
    3336        
    3437       To call the object and assign it to a variable: 
    35        /feeder/calendar/fetchPublicCalendars.do?skinName=widget-json-cals&setappvar=objName(somename) 
     38       /feeder/calendar/fetchPublicCalendars.do?skinName=widget-json-cals&setappvar=setSelectionAction(calsuiteSetSelectionAction)&setappvar=objName(somename) 
    3639       This usage assigns the json object to a "somename" variable which can be directly referenced.  
    3740 
     
    5356    </xsl:choose> 
    5457        "calendars": [ 
    55             <xsl:apply-templates select="/bedework/calendars/calendar"/> 
     58            <xsl:apply-templates select="/bedework/calendars/calendar"> 
     59              <xsl:with-param name="isRoot">true</xsl:with-param> 
     60            </xsl:apply-templates> 
    5661        ] 
    5762    }} 
     
    6065  <!-- output root calendar and all children (recursively) --> 
    6166  <xsl:template match="calendar"> 
     67    <xsl:param name="isRoot"/> 
     68    <xsl:variable name="virtualPath"><xsl:call-template name="escapeJson"><xsl:with-param name="string">/user<xsl:for-each select="ancestor-or-self::calendar/name">/<xsl:value-of select="."/></xsl:for-each></xsl:with-param></xsl:call-template></xsl:variable> 
     69    <xsl:variable name="encVirtualPath"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="$virtualPath"/></xsl:call-template></xsl:variable> 
     70    <xsl:variable name="summary"><xsl:call-template name="escapeJson"><xsl:with-param name="string" select="summary"/></xsl:call-template></xsl:variable> 
    6271    { 
    6372      "name" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="name"/></xsl:call-template>", 
    64       "summary" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="summary"/></xsl:call-template>", 
     73      "summary" : "<xsl:value-of select="$summary"/>", 
    6574      "path" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="path"/></xsl:call-template>", 
    6675      "encodedPath" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="encodedPath"/></xsl:call-template>", 
     76      "virtualPath" : "<xsl:value-of select="$virtualPath"/>", 
     77      <xsl:choose> 
     78        <xsl:when test="$isRoot = 'true'"> 
     79      "calendarLink" : "<xsl:value-of select="/bedework/appvar[key='setSelectionAction']/value"/>&amp;setappvar=curCollection()", 
     80        </xsl:when> 
     81        <xsl:otherwise> 
     82      "calendarLink" : "<xsl:value-of select="/bedework/appvar[key='setSelectionAction']/value"/>&amp;virtualPath=<xsl:value-of select="$encVirtualPath"/>&amp;setappvar=curCollection(<xsl:value-of select="$summary"/>)", 
     83        </xsl:otherwise> 
     84      </xsl:choose> 
    6785      "ownerHref" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="ownerHref"/></xsl:call-template>", 
    6886      "calType" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="calType"/></xsl:call-template>", 
     
    8098    --><xsl:if test="calendar">, 
    8199      "children" : [ 
    82         <xsl:apply-templates select="calendar"/> 
     100        <xsl:apply-templates select="calendar"> 
     101          <xsl:with-param name="isRoot">false</xsl:with-param> 
     102        </xsl:apply-templates> 
    83103      ] 
    84104      </xsl:if>