Changeset 3438
- Timestamp:
- 12/06/11 14:47:36
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/widget-json-cals.xsl
r3430 r3438 30 30 31 31 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. 33 36 34 37 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) 36 39 This usage assigns the json object to a "somename" variable which can be directly referenced. 37 40 … … 53 56 </xsl:choose> 54 57 "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> 56 61 ] 57 62 }} … … 60 65 <!-- output root calendar and all children (recursively) --> 61 66 <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> 62 71 { 63 72 "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"/>", 65 74 "path" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="path"/></xsl:call-template>", 66 75 "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"/>&setappvar=curCollection()", 80 </xsl:when> 81 <xsl:otherwise> 82 "calendarLink" : "<xsl:value-of select="/bedework/appvar[key='setSelectionAction']/value"/>&virtualPath=<xsl:value-of select="$encVirtualPath"/>&setappvar=curCollection(<xsl:value-of select="$summary"/>)", 83 </xsl:otherwise> 84 </xsl:choose> 67 85 "ownerHref" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="ownerHref"/></xsl:call-template>", 68 86 "calType" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="calType"/></xsl:call-template>", … … 80 98 --><xsl:if test="calendar">, 81 99 "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> 83 103 ] 84 104 </xsl:if>
