Project

General

Profile

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

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
  <xsl:import href="../../common/util.xsl"/>
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
	<xsl:variable name="karDocid">
42
              <xsl:call-template name="extractDocidFromLsid">
43
                <xsl:with-param name="lsidString" select="$docid" />
44
              </xsl:call-template>
45
   </xsl:variable>
46
	
47
	<xsl:template match="/">  
48
 	
49
		<div class="content-subsection">
50
			<div class="content-subsection-header">Access Rules</div>
51
			<div class="row row-header" >
52
				<div class="col access_order_col_header">Access Order</div>
53
				<div class="col access_type_col_header">Access Type</div>
54
				<div class="col principal_col_header">Principal</div>
55
				<div class="col permissions_col_header">Permission</div>
56
			</div>
57
			<xsl:choose>
58
			<xsl:when test="/access/@order = 'denyFirst'">
59
				<xsl:for-each select="/access/allow | /access/deny">
60
					<div>
61
						<xsl:attribute name="class">
62
							<xsl:choose>
63
								<xsl:when test="position() mod 2 = 1">row row-odd</xsl:when>
64
								<xsl:when test="position() mod 2 = 0">row row-even</xsl:when>
65
							</xsl:choose>
66
						</xsl:attribute>
67
						<div class="col access_order_col">
68
							<xsl:value-of select="../@order" />
69
						</div>
70
						<div class="col access_type_col">
71
							<xsl:value-of select="local-name(.)" />
72
						</div>
73
						<div class="col principal_col">
74
							<xsl:value-of select="./principal"/>
75
						</div>	
76
						<div class="col permissions_col">
77
							<xsl:for-each select="./permission">
78
								<div class="permission_element">
79
									<xsl:if test=". != 'all'">
80
										<xsl:value-of select="."/>
81
									</xsl:if>
82
								</div>
83
							</xsl:for-each>
84
						</div>
85
					</div>
86
				</xsl:for-each>			
87
			</xsl:when>
88

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

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

    
169
				</form>
170
			</div>
171
		</div>
172
		
173
	</xsl:template>
174

    
175
</xsl:stylesheet>