root/trunk/deployment/webuser/webapp/resources/demoskins/widgets/json.xsl

Revision 2979 (checked in by johnsa, 3 years ago)

user client:

- complete json widget for returning attendees to scheduling tab
- display attendees returned from the server (and request their free/busy) on each addition of a new attendee

  • Property svn:mime-type set to text/plain
Line 
1 <!--
2     Licensed to Jasig under one or more contributor license
3     agreements. See the NOTICE file distributed with this work
4     for additional information regarding copyright ownership.
5     Jasig licenses this file to you under the Apache License,
6     Version 2.0 (the "License"); you may not use this file
7     except in compliance with the License. You may obtain a
8     copy of the License at:
9    
10     http://www.apache.org/licenses/LICENSE-2.0
11    
12     Unless required by applicable law or agreed to in writing,
13     software distributed under the License is distributed on
14     an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15     KIND, either express or implied. See the License for the
16     specific language governing permissions and limitations
17     under the License.
18 -->
19 <xsl:stylesheet
20   version="1.0"
21   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22   xmlns="http://www.w3.org/1999/xhtml">
23  
24   <xsl:template match="/">
25           <xsl:choose>
26             <xsl:when test="/bedework/page='attendeeWidget'">
27               <!-- generate json list of attendees after modifying the scheduling widget -->
28               {
29                 "attendees" : [
30                 <xsl:apply-templates select="/bedework/attendees/attendee" mode="loadBwGrid">
31                     <xsl:sort select="attendeeUri"/>
32                   </xsl:apply-templates>
33                 ]
34               }
35             </xsl:when>
36             <xsl:otherwise>
37               <!-- not found -->
38               {
39                 "errors" : [ "404" ]
40               }
41             </xsl:otherwise>
42           </xsl:choose>
43         </xsl:template>
44  
45   <!-- Transform the attendees into an array of json objects
46        for use in the BwGrid.  This is called on edit event and after each update to
47        the attendees using xml from the attendee widget.  -->
48   <xsl:template match="attendee" mode="loadBwGrid">
49     {
50       "name" : "<xsl:value-of select="cn"/>",
51       "uid" : "<xsl:value-of select="attendeeUri"/>",
52       "role" : "<xsl:value-of select="role"/>",
53       "status" : "<xsl:value-of select="partstat"/>",
54       "type" : "<xsl:value-of select="cuType"/>"
55     }<xsl:if test="position()!=last()">,</xsl:if>
56   </xsl:template>
57  
58 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.