Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *      Authors: Matt Jones
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *   '$Author: leinfelder $'
10
  *     '$Date: 2013-07-16 09:02:58 -0700 (Tue, 16 Jul 2013) $'
11
  * '$Revision: 7996 $'
12
  *
13
  * This program is free software; you can redistribute it and/or modify
14
  * it under the terms of the GNU General Public License as published by
15
  * the Free Software Foundation; either version 2 of the License, or
16
  * (at your option) any later version.
17
  *
18
  * This program is distributed in the hope that it will be useful,
19
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
  * GNU General Public License for more details.
22
  *
23
  * You should have received a copy of the GNU General Public License
24
  * along with this program; if not, write to the Free Software
25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
  *
27
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
  * convert an XML file that is valid with respect to the eml-dataset.dtd
29
  * module of the Ecological Metadata Language (EML) into an HTML format
30
  * suitable for rendering with modern web browsers.
31
-->
32
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33

    
34

    
35
  <xsl:output method="html" encoding="iso-8859-1"
36
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
37
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
38
    indent="yes" />  
39
  <xsl:template name="access">
40
    <xsl:param name="accessfirstColStyle"/>
41
    <xsl:param name="accesssubHeaderStyle"/>
42
        <xsl:choose>
43
         <xsl:when test="references!=''">
44
          <xsl:variable name="ref_id" select="references"/>
45
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
46
          <xsl:for-each select="$references">
47
            <xsl:call-template name="accessCommon">
48
             <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
49
             <xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
50
            </xsl:call-template>
51
          </xsl:for-each>
52
        </xsl:when>
53
        <xsl:otherwise>
54
          <xsl:call-template name="accessCommon">
55
             <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
56
             <xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
57
          </xsl:call-template>
58
        </xsl:otherwise>
59
      </xsl:choose>
60

    
61
  </xsl:template>
62
  <xsl:template name="accessCommon">
63
     <xsl:param name="accessfirstColStyle" />
64
     <xsl:param name="accesssubHeaderStyle"/>
65
        <xsl:call-template name="accesssystem">
66
           <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
67
           <xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
68
        </xsl:call-template>
69
        <xsl:if test="normalize-space(./@order)='allowFirst' and (allow)">
70
            <xsl:call-template name="allow_deny">
71
                <xsl:with-param name="permission" select="'allow'"/>
72
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
73
             </xsl:call-template>
74
        </xsl:if>
75
        <xsl:if test="(deny)">
76
           <xsl:call-template name="allow_deny">
77
                <xsl:with-param name="permission" select="'deny'"/>
78
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
79
            </xsl:call-template>
80
        </xsl:if>
81
        <xsl:if test="normalize-space(acl/@order)='denyFirst' and (allow)">
82
            <xsl:call-template name="allow_deny">
83
                <xsl:with-param name="permission" select="'allow'"/>
84
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
85
            </xsl:call-template>
86
        </xsl:if>
87

    
88

    
89
  </xsl:template>
90

    
91

    
92
  <xsl:template name="allow_deny">
93
   <xsl:param name="permission"/>
94
   <xsl:param name="accessfirstColStyle" />
95
   <xsl:choose>
96
       <xsl:when test="$permission='allow'">
97
		<div class="control-group">
98
			<label class="control-label">Allow</label>
99
			<div class="controls controls-well">
100
				<table class="table table-striped">
101
					<thead>
102
						<tr>
103
							<th>Permission</th>
104
							<th>Principal</th>
105
						</tr>
106
					</thead>
107
					<tbody>
108
						<xsl:for-each select="allow">
109
				            <tr>
110
				              <td>
111
				                <xsl:for-each select="./permission">
112
				                  <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
113
				                </xsl:for-each>
114
				              </td>
115
				              <td>
116
				                <xsl:for-each select="principal">
117
				                  <xsl:value-of select="."/><br/>
118
				                </xsl:for-each>
119
				              </td>
120
				            </tr>
121
						</xsl:for-each>
122
					</tbody>
123
				</table>
124
			</div>
125
		</div>	
126
          
127
       </xsl:when>
128
       <xsl:otherwise>
129
			<div class="control-group">
130
		       	<label class="control-label">Deny</label>
131
				<div class="controls controls-well">
132
					<table class="table table-striped">
133
						<thead>
134
							<tr>
135
								<th>Permission</th>
136
								<th>Principal</th>
137
							</tr>
138
						</thead>
139
						<tbody>
140
							<xsl:for-each select="deny">
141
								<tr>
142
					              <td>
143
					                <xsl:for-each select="./permission">
144
					                  <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
145
					                </xsl:for-each>
146
					              </td>
147
					              <td>
148
					                <xsl:for-each select="principal">
149
					                  <xsl:value-of select="."/><br/>
150
					                </xsl:for-each>
151
					              </td>
152
					            </tr>
153
							</xsl:for-each>
154
						</tbody>
155
					</table>
156
				</div>
157
			</div>
158
		</xsl:otherwise>
159
   </xsl:choose>
160

    
161
   </xsl:template>
162

    
163
  <xsl:template name="accesssystem">
164
       <xsl:param name="accessfirstColStyle" />
165
        <h4>Access Control</h4>
166
        <div class="control-group">
167
			<label class="control-label">Auth System</label>
168
			<div class="controls controls-well">
169
				<xsl:value-of select="./@authSystem"/>
170
			</div>
171
        </div>
172
        <div class="control-group">
173
			<label class="control-label">Order</label>
174
          	<div class="controls controls-well">
175
          		<xsl:value-of select="./@order"/>
176
          	</div>
177
        </div>
178
  </xsl:template>
179

    
180
</xsl:stylesheet>
(1-1/27)