| 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 |
<!-- Subscriptions Calendar Tree --> |
|---|
| 25 |
<xsl:template name="subscriptionsTree"> |
|---|
| 26 |
<div class="secondaryColHeader"> |
|---|
| 27 |
<h3><xsl:copy-of select="$bwStr-LCol-Calendars"/></h3> |
|---|
| 28 |
</div> |
|---|
| 29 |
<div id="subsTree"> |
|---|
| 30 |
<ul> |
|---|
| 31 |
<xsl:apply-templates select="/bedework/myCalendars/calendars/calendar" mode="subsTree"> |
|---|
| 32 |
<xsl:with-param name="isRoot">true</xsl:with-param> |
|---|
| 33 |
</xsl:apply-templates> |
|---|
| 34 |
</ul> |
|---|
| 35 |
</div> |
|---|
| 36 |
|
|---|
| 37 |
<script type="text/javascript"> |
|---|
| 38 |
$(document).ready(function(){ |
|---|
| 39 |
var openCals = new Array(); |
|---|
| 40 |
<xsl:if test="/bedework/appvar[key='opencals']"> |
|---|
| 41 |
var openCalsRaw = "<xsl:value-of select="/bedework/appvar[key='opencals']/value"/>"; |
|---|
| 42 |
openCals = openCalsRaw.split(","); |
|---|
| 43 |
</xsl:if> |
|---|
| 44 |
$("#subsTree .subsTreeToggle").click(function() { |
|---|
| 45 |
var curItem = $(this).parent("li"); |
|---|
| 46 |
$(curItem).children("ul").slideToggle("fast", function(){ |
|---|
| 47 |
if ($(this).is(":visible")) { |
|---|
| 48 |
$(this).parent("li").children("span.subsTreeToggle").html("-"); |
|---|
| 49 |
openCals.push($(curItem).attr("id")); |
|---|
| 50 |
} else { |
|---|
| 51 |
var itemIndex = $.inArray($(curItem).attr("id"),openCals); |
|---|
| 52 |
$(this).parent("li").children("span.subsTreeToggle").html("+"); |
|---|
| 53 |
openCals.splice(itemIndex,1); |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
$.ajax({ |
|---|
| 57 |
url: '/cal/misc/async.do', |
|---|
| 58 |
data: 'setappvar=opencals(' + openCals.toString() + ')', |
|---|
| 59 |
dataType: 'xml' |
|---|
| 60 |
}); |
|---|
| 61 |
}); |
|---|
| 62 |
|
|---|
| 63 |
}); |
|---|
| 64 |
}); |
|---|
| 65 |
</script> |
|---|
| 66 |
</xsl:template> |
|---|
| 67 |
|
|---|
| 68 |
<xsl:template match="calendar" mode="subsTree"> |
|---|
| 69 |
<xsl:param name="isRoot"/> |
|---|
| 70 |
<xsl:variable name="curPath"><xsl:call-template name="escapeJson"><xsl:with-param name="string"><xsl:value-of select="/bedework/selectionState/collection/virtualpath"/></xsl:with-param></xsl:call-template></xsl:variable> |
|---|
| 71 |
<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> |
|---|
| 72 |
<xsl:variable name="encVirtualPath"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="$virtualPath"/></xsl:call-template></xsl:variable> |
|---|
| 73 |
|
|---|
| 74 |
<xsl:variable name="name" select="name"/> |
|---|
| 75 |
<xsl:variable name="summary" select="summary"/> |
|---|
| 76 |
<xsl:variable name="itemId" select="generate-id(path)"/> |
|---|
| 77 |
<xsl:variable name="folderState"> |
|---|
| 78 |
<xsl:choose> |
|---|
| 79 |
<xsl:when test="contains(/bedework/appvar[key='opencals']/value,$itemId)">open</xsl:when> |
|---|
| 80 |
<xsl:otherwise>closed</xsl:otherwise> |
|---|
| 81 |
</xsl:choose> |
|---|
| 82 |
</xsl:variable> |
|---|
| 83 |
<li id="{$itemId}"> |
|---|
| 84 |
<xsl:if test="calendar and not($isRoot = 'true')"> |
|---|
| 85 |
<xsl:attribute name="class"> |
|---|
| 86 |
<xsl:choose> |
|---|
| 87 |
<xsl:when test="$virtualPath = $curPath">hasChildren selected <xsl:value-of select="$folderState"/></xsl:when> |
|---|
| 88 |
<xsl:when test="contains($curPath,$virtualPath)">hasChildren selectedPath open</xsl:when> |
|---|
| 89 |
<xsl:otherwise>hasChildren <xsl:value-of select="$folderState"/></xsl:otherwise> |
|---|
| 90 |
</xsl:choose> |
|---|
| 91 |
</xsl:attribute> |
|---|
| 92 |
<span class="subsTreeToggle"> |
|---|
| 93 |
<xsl:choose> |
|---|
| 94 |
<xsl:when test="$folderState = 'closed'">+</xsl:when> |
|---|
| 95 |
<xsl:otherwise>-</xsl:otherwise> |
|---|
| 96 |
</xsl:choose> |
|---|
| 97 |
</span> |
|---|
| 98 |
</xsl:if> |
|---|
| 99 |
<xsl:if test="not(calendar) and $virtualPath = $curPath"> |
|---|
| 100 |
<xsl:attribute name="class">selected</xsl:attribute> |
|---|
| 101 |
</xsl:if> |
|---|
| 102 |
<xsl:choose> |
|---|
| 103 |
<xsl:when test="$isRoot = 'true'"> |
|---|
| 104 |
<xsl:attribute name="class">root</xsl:attribute> |
|---|
| 105 |
<a href="{$setSelection}"> |
|---|
| 106 |
<xsl:copy-of select="$bwStr-LCol-All"/> |
|---|
| 107 |
</a> |
|---|
| 108 |
</xsl:when> |
|---|
| 109 |
<xsl:otherwise> |
|---|
| 110 |
<a href="{$setSelection}&virtualPath={$encVirtualPath}&setappvar=curCollection({$name})"> |
|---|
| 111 |
<xsl:value-of select="summary"/> |
|---|
| 112 |
</a> |
|---|
| 113 |
</xsl:otherwise> |
|---|
| 114 |
</xsl:choose> |
|---|
| 115 |
<xsl:if test="calendar[(calType < 2) and (name != 'calendar')]"><!-- the test for "calendar" isn't good --> |
|---|
| 116 |
<ul> |
|---|
| 117 |
<xsl:apply-templates select="calendar[(calType < 2) and (name != 'calendar')]" mode="subsTree"> |
|---|
| 118 |
<xsl:with-param name="isRoot">false</xsl:with-param> |
|---|
| 119 |
</xsl:apply-templates> |
|---|
| 120 |
</ul> |
|---|
| 121 |
</xsl:if> |
|---|
| 122 |
</li> |
|---|
| 123 |
</xsl:template> |
|---|
| 124 |
</xsl:stylesheet> |
|---|