Project

General

Profile

metacat / lib / style / skins / sanparks / workflowAccess.xsl @ 6124

1
<?xml version="1.0"?>
2
<!--
3
	*  '$RCSfile$'
4
	*      Authors: Michael Daigle
5
	*    Copyright: 2009 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: 2009-04-02 14:20:05 -0800 (Thu, 02 Apr 2009) $'
11
	* '$Revision: 4893 $'
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 showing the resultset of a query
29
	* into an HTML format suitable for rendering with modern web browsers.
30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32

    
33
	<xsl:output method="html" />
34
	<xsl:param name="sessid" />
35
	<xsl:param name="qformat">default</xsl:param>
36
	<xsl:param name="enableediting">false</xsl:param>
37
	<xsl:param name="contextURL" />
38
	<xsl:param name="servletURL" />
39
	<xsl:param name="workflowname" />
40
	<xsl:param name="docid" />
41
	
42
	<xsl:template match="/">  
43
 	
44
		<div class="content-subsection">
45
			<div class="content-subsection-header">Access Rules</div>
46
			<div class="row row-header" >
47
				<div class="col access_order_col">Access Order</div>
48
				<div class="col access_type_col">Access Type</div>
49
				<div class="col principal_col">Principal</div>
50
				<div class="col permissions_col">Permission</div>
51
			</div>
52
			<xsl:choose>
53
			<xsl:when test="/access/@order = 'denyFirst'">
54
				<xsl:for-each select="/access/allow | /acc:access/deny">
55
					<div>
56
						<xsl:attribute name="class">
57
							<xsl:choose>
58
								<xsl:when test="position() mod 2 = 1">row row-odd</xsl:when>
59
								<xsl:when test="position() mod 2 = 0">row row-even</xsl:when>
60
							</xsl:choose>
61
						</xsl:attribute>
62
						<div class="col access_order_col">
63
							<xsl:value-of select="../@order" />
64
						</div>
65
						<div class="col access_type_col">
66
							<xsl:value-of select="local-name(../)" />
67
						</div>
68
						<div class="col principal_col">
69
							<xsl:value-of select="./principal"/>
70
						</div>	
71
						<div class="col permissions_col">
72
							<xsl:for-each select="./permission">
73
								<div class="permission_element">
74
									<xsl:if test=". != 'all'">
75
										<xsl:value-of select="."/>
76
									</xsl:if>
77
								</div>
78
							</xsl:for-each>
79
						</div>
80
					</div>
81
				</xsl:for-each>			
82
			</xsl:when>
83

    
84
			<xsl:when test="acl/resource/@order = 'allowFirst'">
85
				<xsl:for-each select="acl/resource/*/principal">
86
					<div>
87
						<xsl:attribute name="class">
88
							<xsl:choose>
89
								<xsl:when test="position() mod 2 = 1">row row-odd</xsl:when>
90
								<xsl:when test="position() mod 2 = 0">row row-even</xsl:when>
91
							</xsl:choose>
92
						</xsl:attribute>
93
						<div class="col access_order_col">denyFirst</div>
94
						<div class="col access_type_col">
95
							<xsl:value-of select="local-name(../)" />
96
						</div>
97
						<div class="col principal_col">
98
							<xsl:value-of select="."/>
99
						</div>	
100
						<div class="col permissions_col">
101
							<xsl:for-each select="../permission">
102
								<div class="permission_element">
103
									<xsl:if test=". != 'all'">
104
										<xsl:value-of select="."/>
105
									</xsl:if>
106
								</div>
107
							</xsl:for-each>
108
						</div>
109
					</div>
110
				</xsl:for-each>			
111
			</xsl:when>
112
			</xsl:choose>	
113
		</div><br/>
114
		<div class="content-subsection">
115
			<div class="content-subsection-header">Add Access Rule</div>
116
			<div class="change-access-row">
117
				<div class="col_label change_access_order_col">Access Order</div>
118
				<div class="col_label change_access_type_col">Access Type</div>
119
				<div class="col_label change_principal_col">Principal</div>
120
				<div class="col_label change_permissions_col">Permission</div>
121
			</div>
122
						
123
			<div class="change-access-row">
124
				<form name="addAccess" action="{$servletURL}" id="addAccess" onsubmit="setPermission(this)">
125
					<input name="action" value="setaccess" type="hidden" />  
126
					<input name="qformat" value="sanparks" type="hidden" />
127
					<input name="forwardto" value="workflowAccess.jsp" type="hidden" />
128
					<input name="permission" id="permission" type="hidden" />
129
					<input name="docid" value="{$docid}" type="hidden" />
130
					<input name="workflowid" value="{$docid}" type="hidden" />
131
					<input name="workflowname" value="{$workflowname}" type="hidden" />
132

    
133
					<xsl:choose>
134
					<xsl:when test="acl/resource/@order = 'allowFirst'">
135
						<input name="permOrder" value="allowFirst" type="hidden" />
136
						<div class="change_access_order_col access_info_text" name="permOrder" id="permOrder">allowFirst</div>
137
					</xsl:when>
138
					<xsl:when test="acl/resource/@order = 'denyFirst'">
139
						<input name="permOrder" value="denyFirst" type="hidden" />
140
						<div class="change_access_order_col access_info_text" name="permOrder" id="permOrder">denyFirst</div>
141
					</xsl:when>
142
					<xsl:otherwise>
143
						<select class="change_access_order_col" name="permOrder" id="permOrder">
144
							<option value="allowFirst">Allow First</option>
145
							<option value="denyFirst">Deny First</option>
146
						</select>  
147
					</xsl:otherwise>
148
					</xsl:choose> 
149
					<select class="change_access_type_col" name="permType" id="permType">
150
						<option value="allow">Allow</option>
151
						<option value="deny">Deny</option>
152
					</select>   
153
					<input class="change_principal_col" name="principal" id="principal" type="text" /> 
154
       				<div class="change_permissions_col">
155
       					<input type="checkbox" name="permission_read_checkbox" id="permission_read_checkbox">Read</input>
156
       					<input type="checkbox" name="permission_write_checkbox" id="permission_write_checkbox">Write</input>
157
       					<input type="checkbox" name="permission_chmod_checkbox" id="permission_chmod_checkbox">Chmod</input>
158
       					<!-- input type="checkbox" name="permission_all_checkbox" id="permission_all_checkbox">All</input -->
159
       				</div>
160
       		
161
       				<br/>
162
       				<input class="access-submit-button" value="Add" type="submit"/>
163

    
164
				</form>
165
			</div>
166
		</div>
167
		
168
	</xsl:template>
169

    
170
</xsl:stylesheet>