source: main/trunk/greenstone3/web/interfaces/default/transform/authen.xsl@ 24078

Last change on this file since 24078 was 24078, checked in by ak19, 10 years ago

There was a bug in Admin pages when listing users where the list users page could only display status and groups info for the admin user (and this was wrong to: the last user's status and groups would be displayed under the admin user instead). This was because the ids assigned to the status and group cells were identical, and so these got successively overwritten on each pass through the user list for displaying their details. Not sure how this ever worked before, so wasn't too sure of the solution and therefore don't know that the current fix is the most optimal kind: there may be better ways of expressing the same in xslt and javascript.

File size: 31.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <!-- style includes global params interface_name, library_name -->
10 <xsl:include href="style.xsl"/>
11 <xsl:include href="service-params.xsl"/>
12
13 <xsl:output method="html"/>
14
15 <xsl:template name="pageTitle">
16 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.authentication')"/>
17 </xsl:template>
18
19 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
20 <xsl:template name="pageHead">
21 <head>
22 <title>
23 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
24 </title>
25 <xsl:call-template name="globalStyle"/>
26 <xsl:call-template name="pageStyle"/>
27 </head>
28 </xsl:template>
29
30 <xsl:template name="pageStyle"/>
31
32 <xsl:template match="page">
33 <html>
34 <xsl:call-template name="pageHead" />
35 <xsl:call-template name="addGroup" />
36 <body>
37 <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
38 <div id="page-wrapper">
39 <xsl:variable name="authen_service" select="/page/pageRequest/paramList/param[@name='s']/@value"/>
40 <xsl:variable name="sub_action" select="/page/pageRequest/@subaction"/>
41 <xsl:variable name="asn_param" select ="/page/pageRequest/paramList/param[@name='s1.asn']/@value"/>
42 <xsl:variable name="uan" select ="/page/pageRequest/paramList/param[@name='s1.uan']/@value"/>
43 <xsl:variable name="pro_action" select ="/page/pageResponse/authenticationNode/service/@aup"/>
44 <xsl:variable name="au_node" select ="/page/pageResponse/authenticationNode"/>
45 <xsl:variable name="asn" select ="/page/pageResponse/authenticationNode/service/@asn"/>
46 <xsl:variable name="info" select ="/page/pageResponse/authenticationNode/service/@info"/>
47 <xsl:variable name="err" select ="/page/pageResponse/authenticationNode/service/@err"/>
48 <xsl:variable name="rt" select="/page/pageRequest/paramList/param[@name='rt']/@value"/>
49 <xsl:variable name="un_s" select="/page/pageResponse/authenticationNode/service/@un"/>
50 <xsl:variable name="pw_s" select="/page/pageResponse/authenticationNode/service/@pw"/>
51
52 <div align="left" >
53 <table align="left" border="0" width="100%">
54 <tr align="left">
55 <td><h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.authentication')"/></h2></td>
56 <td><xsl:if test="$un_s!=''">
57 <xsl:if test="$asn!='' and $asn!='0'">
58 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/> : <xsl:value-of select="$un_s"/>
59 </xsl:if>
60 </xsl:if></td>
61 </tr>
62 </table>
63 </div>
64
65 <div id="navbar">
66 <ul id="navbarlist">
67 <!--greenstone home-->
68 <li><a href="{$library_name}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.greenstone_home')"/></a></li>
69
70 <!--list users-->
71 <li>
72 <xsl:choose>
73 <xsl:when test="$asn!='' and $asn!='0' and $un_s!=''">
74 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.aup=ListUsers&amp;s1.asn={$asn}&amp;s1.uan=1&amp;s1.un={$un_s}&amp;s1.pw="><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.list_users')"/></a>
75 </xsl:when>
76 <xsl:otherwise>
77 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.asn=&amp;s1.aup=Login"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.list_users')"/></a>
78 </xsl:otherwise>
79 </xsl:choose></li>
80
81 <!--add a new user-->
82 <li>
83 <xsl:choose>
84 <xsl:when test="$asn!='' and $asn!='0' and $un_s!=''">
85 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.aup=AddUser&amp;s1.asn={$asn}&amp;s1.uan=1&amp;s1.un={$un_s}&amp;s1.pw=&amp;s1.umun=&amp;s1.umpw=&amp;s1.umgp=&amp;s1.umas=&amp;s1.umc="><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.add_a_new_user')"/></a>
86 </xsl:when>
87 <xsl:otherwise>
88 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.asn=&amp;s1.aup=Login"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.add_a_new_user')"/></a>
89 </xsl:otherwise>
90 </xsl:choose>
91 </li>
92
93 <!-- change password-->
94 <li>
95 <xsl:choose>
96 <xsl:when test="$asn!='' and $asn!='0' and $un_s!=''">
97 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.aup=ModifyPassword&amp;s1.asn={$asn}&amp;s1.uan=1&amp;s1.un={$un_s}&amp;s1.pw=&amp;s1.umpw1=&amp;s1.umpw2=&amp;s1.umpw="><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password')"/></a>
98 </xsl:when>
99 <xsl:otherwise>
100 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.asn=&amp;s1.aup=Login"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password')"/></a>
101 </xsl:otherwise>
102 </xsl:choose>
103 </li>
104
105 <li>
106 <xsl:choose>
107 <xsl:when test="$un_s!='' and $asn!='' and $asn!='0'">
108 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.asn=&amp;s1.aup=Login&amp;s1.un=&amp;s1.pw="><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.logout')"/></a>
109 </xsl:when>
110 <xsl:otherwise>
111 <a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s=Authentication&amp;s1.asn=&amp;s1.aup=Login"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.login')"/></a>
112 </xsl:otherwise>
113 </xsl:choose>
114 </li>
115 </ul>
116 </div>
117
118 <table align="left" border="0" width="100%">
119 <tr>
120 <td>
121 <div id="content" align="center">
122 <!-- login -->
123 <xsl:if test="$pro_action='Login'">
124 <xsl:choose>
125 <xsl:when test="$asn!='' and $asn!='0'">
126 <p align="left"> <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.login_successfully')"/></p>
127 </xsl:when>
128 <xsl:otherwise>
129
130 <p align="left">
131 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.login_descibe_line_3')"/><br/></p>
132 <xsl:if test="$err='un-pw-err'">
133 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.wrong_password_warning')"/></font></p>
134 </xsl:if>
135 <xsl:if test="$err='no-permission' and $info='Login'">
136 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.no_permission')"/></font></p>
137 </xsl:if>
138 <xsl:if test="$err='as-false'">
139 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.account_status_false')"/></font></p>
140 </xsl:if>
141 <xsl:call-template name="login">
142 <xsl:with-param name="sub_action" select="$sub_action"/>
143 <xsl:with-param name="authen_service" select="$authen_service"/>
144 <xsl:with-param name="pro_action" select="$pro_action"/>
145 </xsl:call-template>
146
147 </xsl:otherwise>
148 </xsl:choose>
149 </xsl:if>
150
151 <!-- list users-->
152 <xsl:if test="$pro_action='ListUsers'">
153
154 <xsl:if test="$asn='1' and $info='all-un'">
155 <xsl:call-template name="listusers" >
156 </xsl:call-template>
157 </xsl:if>
158
159 <xsl:if test="$info='Login'">
160 <p align="left">
161 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.login_descibe_line_2')"/><br/></p>
162 <xsl:if test="$err='no-permission' and $info='Login'">
163 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.no_permission')"/></font></p>
164 </xsl:if>
165 </xsl:if>
166 </xsl:if>
167
168 <!-- add a new user-->
169 <xsl:if test="$pro_action='AddUser'">
170 <xsl:if test="$err!='' and $err!='no-permission' and $err!='un-exist' and $err!='un-err' and $err!='pw-err'">
171 <p align="left"><font color='red'><xsl:value-of select="$err" /></font></p>
172 </xsl:if>
173
174 <xsl:if test="$asn!='1'">
175 <p align="left">
176 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.login_descibe_line_2')"/><br/>
177 </p>
178 <xsl:if test="$err='no-permission'">
179 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.no_permission')"/></font></p>
180 </xsl:if>
181 </xsl:if>
182
183 <xsl:if test="count(/page/pageResponse/authenticationNode/service/userNodeList) = 1">
184 <xsl:call-template name="listusers" >
185 </xsl:call-template>
186 </xsl:if>
187
188 <xsl:if test="$info='adduser_interface'">
189 <h2 align="left"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.add_a_new_user_title')"/></h2>
190 <xsl:if test="$err='pw-err'">
191 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password_err')"/></font></p>
192 </xsl:if>
193 <xsl:if test="$err='un-err'">
194 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.unsername_err')"/></font></p>
195 </xsl:if>
196 <xsl:if test="$err='un-exist'">
197 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.user_has_existed')"/></font></p>
198 </xsl:if>
199 <xsl:call-template name="edituser" >
200 <xsl:with-param name="sub_action" select="$sub_action"/>
201 <xsl:with-param name="authen_service" select="$authen_service"/>
202 <xsl:with-param name="pro_action" select="$pro_action"/>
203 <xsl:with-param name="umun_s" />
204 <xsl:with-param name="umpw_s" />
205 <xsl:with-param name="umas_s" />
206 <xsl:with-param name="umgp_s" />
207 <xsl:with-param name="umc_s" />
208 <xsl:with-param name="oumun_s" />
209 <xsl:with-param name="un_s" select="$un_s"/>
210 <xsl:with-param name="pw_s" select="$pw_s"/>
211 <xsl:with-param name="asn" select="$asn"/>
212 </xsl:call-template>
213
214 </xsl:if>
215 </xsl:if>
216
217 <!-- modify the passwrod of a user-->
218 <xsl:if test="$pro_action='ModifyPassword'">
219
220 <xsl:if test="$err!='' and $err!='umpw1-err' and $err!='umpw2-err' and $err!='pw-umpw-nm-err' and $err!='umpw-null-err' and $err!='umpw1-umpw2-nm-err' and $err!='umpw1-umpw2-null-err'"><p align="left"><font color='red'><xsl:value-of select="$err" /></font></p>
221 </xsl:if>
222
223 <xsl:if test="$err=''">
224 <h2 align="left"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password_title')"/></h2>
225 <p align="left"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password_successed_content')"/></p>
226 </xsl:if>
227
228 <xsl:if test="$asn!='0' and $info='modify_interface'">
229 <h2 align="left"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password_title')"/></h2>
230 <p align="left"><font color="grey"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password_describe_line_1')"/></font></p>
231
232 <xsl:if test="$err='umpw1-err'">
233 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.new_password_invalid')"/></font></p>
234 </xsl:if>
235 <xsl:if test="$err='umpw2-err'">
236 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.retyped_password_invalid')"/></font></p>
237 </xsl:if>
238 <xsl:if test="$err='pw-umpw-nm-err' or $err='umpw-null-err'">
239 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.old_password_warning')"/></font></p>
240 </xsl:if>
241 <xsl:if test="$err='umpw1-umpw2-nm-err'">
242 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.two_password_not_match')"/></font></p>
243 </xsl:if>
244 <xsl:if test="$err='umpw1-umpw2-null-err'">
245 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password_empty_warning')"/></font></p>
246 </xsl:if>
247
248 <xsl:call-template name="modifypassword">
249 <xsl:with-param name="sub_action" select="$sub_action"/>
250 <xsl:with-param name="authen_service" select="$authen_service"/>
251 <xsl:with-param name="pro_action" select="$pro_action"/>
252 <xsl:with-param name="un_s" select="$un_s"/>
253 <xsl:with-param name="pw_s" select="$pw_s"/>
254 <xsl:with-param name="asn" select="$asn"/>
255 </xsl:call-template>
256 </xsl:if>
257 </xsl:if>
258
259 <!-- delete a user -->
260 <xsl:if test="$pro_action='DeleteUser'">
261 <xsl:if test="$err!=''">
262 <p align="left"><font color='red'><xsl:value-of select="$err" /></font></p>
263 </xsl:if>
264
265 <xsl:if test="$info='confirm'">
266 <xsl:call-template name="deleteuser">
267 <xsl:with-param name="sub_action" select="$sub_action"/>
268 <xsl:with-param name="authen_service" select="$authen_service"/>
269 <xsl:with-param name="pro_action" select="$pro_action"/>
270 <xsl:with-param name="un_s" select="$un_s"/>
271 <xsl:with-param name="umun_s" select="/page/pageResponse/authenticationNode/service/@umun"/>
272 <xsl:with-param name="asn" select="$asn"/>
273 </xsl:call-template>
274 </xsl:if>
275 <xsl:if test="count(/page/pageResponse/authenticationNode/service/userNodeList) = 1">
276 <xsl:call-template name="listusers" >
277 </xsl:call-template>
278 </xsl:if>
279 </xsl:if>
280
281 <!-- edit the user's info -->
282 <xsl:if test="$pro_action='EditUser'">
283 <xsl:if test="$err!='' and $err!='umpw-err' and $err!='umun-err' and $err!='ini-umpw-err' and $err!='un-exist'">
284 <p align="left"><font color='red'><xsl:value-of select="$err" /></font></p>
285 </xsl:if>
286
287 <xsl:if test="$info='edituser-interface'">
288 <h2 align="left"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.edit_user_information')"/></h2>
289 <xsl:if test="$err='umpw-err'">
290 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password_err')"/></font></p>
291 </xsl:if>
292 <xsl:if test="$err='umun-err'">
293 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.unsername_err')"/></font></p>
294 </xsl:if>
295 <xsl:if test="$err='ini-umpw-err'">
296 <p align="left"><font color="red"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password_initial')"/></font></p>
297 </xsl:if>
298 <xsl:if test="$err='un-exist'">
299 <p align="left"><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.user_has_existed')"/></font></p>
300 </xsl:if>
301 <xsl:call-template name="edituser" >
302 <xsl:with-param name="sub_action" select="$sub_action"/>
303 <xsl:with-param name="authen_service" select="$authen_service"/>
304 <xsl:with-param name="pro_action" select="$pro_action"/>
305 <xsl:with-param name="umun_s" select="/page/pageResponse/authenticationNode/service/@umun"/>
306 <xsl:with-param name="umpw_s" select="/page/pageResponse/authenticationNode/service/@umpw"/>
307 <xsl:with-param name="umas_s" select="/page/pageResponse/authenticationNode/service/@umas"/>
308 <xsl:with-param name="umgp_s" select="/page/pageResponse/authenticationNode/service/@umgp"/>
309 <xsl:with-param name="umc_s" select="/page/pageResponse/authenticationNode/service/@umc"/>
310 <xsl:with-param name="oumun_s" select="/page/pageResponse/authenticationNode/service/@oumun"/>
311 <xsl:with-param name="un_s" select="$un_s"/>
312 <xsl:with-param name="pw_s" select="$pw_s"/>
313 <xsl:with-param name="asn" select="$asn"/>
314 </xsl:call-template>
315 </xsl:if>
316 <xsl:if test="$info='all-un'">
317 <xsl:if test="count(/page/pageResponse/authenticationNode/service/userNodeList) = 1">
318 <xsl:call-template name="listusers" >
319 </xsl:call-template>
320 </xsl:if>
321 </xsl:if>
322 </xsl:if>
323
324 </div>
325 </td>
326 </tr>
327 </table>
328 <div id="navbar">
329 <xsl:call-template name="greenstoneFooter" />
330 </div>
331 </div>
332 </body>
333 </html>
334 </xsl:template>
335
336 <!--template name="login"-->
337 <xsl:template name="login">
338 <xsl:param name="sub_action"/>
339 <xsl:param name="authen_service"/>
340 <xsl:param name="pro_action"/>
341 <div>
342 <form id="LoginForm" method="get" action="{$library_name}">
343 <input type='hidden' name='a' value='g'/>
344 <input type='hidden' name='sa' value='{$sub_action}'/>
345 <input type='hidden' name='s' value='{$authen_service}'/>
346 <input type='hidden' name='rt' value='r'/>
347 <input type='hidden' name='s1.asn' value='0'/>
348 <input type='hidden' name='s1.uan' value='1'/>
349 <input type='hidden' name='s1.aup' value='{$pro_action}'/>
350 <input type='hidden' name='s1.umpw1' value=''/>
351 <input type='hidden' name='s1.umpw2' value=''/>
352 <input type='hidden' name='s1.umc' value=''/>
353 <input type='hidden' name='s1.umgp' value=''/>
354 <input type='hidden' name='s1.umun' value=''/>
355 <input type='hidden' name='s1.umpw' value=''/>
356 <input type='hidden' name='s1.umas' value=''/>
357
358 <table align="center">
359 <tr>
360 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/></td><td><input type="string" name="s1.un" size="10" value=""/></td><td></td>
361 </tr>
362 <tr>
363 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password')"/></td><td><input type="password" name="s1.pw" size="10" value=""/></td><td>
364 <input type="submit" value="submit"></input></td>
365 </tr>
366 </table>
367 </form>
368 </div>
369 </xsl:template>
370
371 <!--template name="listusers"-->
372 <xsl:template name="listusers" >
373 <h2 align="left"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.list_of_current_users_title')"/></h2>
374
375 <table id='mainTable' align="left" border="0" cellspacing="1" cellpadding="3" width="100%" >
376 <tr>
377 <th bgcolor="#d0d0d0"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/></th>
378 <th bgcolor="#d0d0d0"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.account_status')"/></th>
379 <th bgcolor="#d0d0d0"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.groups')"/></th>
380 <th bgcolor="#d0d0d0"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.comment')"/></th>
381 <th bgcolor="#d0d0d0"></th>
382 </tr>
383 <xsl:for-each select="/page/pageResponse/authenticationNode/service/userNodeList/userNode">
384 <script type="text/javascript">
385 <xsl:text disable-output-escaping="yes">
386 var username="</xsl:text><xsl:value-of select="@umun"/><xsl:text disable-output-escaping="yes">";
387 </xsl:text>
388 </script>
389 <tr>
390 <td bgcolor="#eeeeee"><xsl:value-of select="@umun"/></td>
391 <!--<td id="status" bgcolor="#eeeeee">-->
392 <td bgcolor="#eeeeee"><xsl:attribute name="id">status<xsl:value-of select="@umun"/></xsl:attribute>
393 <script type="text/javascript">
394 <xsl:text disable-output-escaping="yes">
395 var status="</xsl:text><xsl:value-of select="@umas"/><xsl:text disable-output-escaping="yes">";
396 if (status=="true"){
397 document.getElementById("status"+username).innerHTML="enabled";
398 }
399 if (status=="false"){
400 document.getElementById("status"+username).innerHTML="disabled";
401 }
402 </xsl:text>
403 </script>
404 </td>
405 <!--<td id="group" bgcolor="#eeeeee">-->
406 <td bgcolor="#eeeeee"><xsl:attribute name="id">group<xsl:value-of select="@umun"/></xsl:attribute>
407 <script type="text/javascript">
408 <xsl:text disable-output-escaping="yes">
409 var groups="</xsl:text><xsl:value-of select="@umgp"/><xsl:text disable-output-escaping="yes">";
410 var split_groups= groups.split(",");
411 var new_groups="";
412 for (j=0; j &lt; split_groups.length ; j++){
413 new_groups+=split_groups[j]+" &lt;br /&gt; ";
414 }
415 document.getElementById('group'+username).innerHTML=new_groups;
416 </xsl:text>
417 </script>
418 </td>
419 <td bgcolor="#eeeeee"><xsl:value-of select="@umc"/></td>
420 <td bgcolor="#eeeeee">
421 <form name="ListUsersForm" method="get" action="{$library_name}">
422 <input type='hidden' name='a' value='g'/>
423 <input type='hidden' name='sa' value='authen'/>
424 <input type='hidden' name='s' value='Authentication'/>
425 <input type='hidden' name='rt' value='r'/>
426 <input type='hidden' name='s1.asn' value='1'/>
427 <input type='hidden' name='s1.uan' value='1'/>
428
429 <input type='hidden'><xsl:attribute name="name">s1.oumun</xsl:attribute><xsl:attribute name="value"><xsl:value-of select="@umun"/></xsl:attribute></input>
430 <input type='hidden'><xsl:attribute name="name">s1.umun</xsl:attribute><xsl:attribute name="value"><xsl:value-of select="@umun"/></xsl:attribute></input>
431 <input type='hidden' name='s1.cm' value=''/>
432
433 <input type="submit"><xsl:attribute name="name">s1.aup</xsl:attribute><xsl:attribute name="value">EditUser</xsl:attribute></input>
434 <input type="submit"><xsl:attribute name="name">s1.aup</xsl:attribute><xsl:attribute name="value">DeleteUser</xsl:attribute></input>
435 </form>
436 </td>
437 </tr>
438 </xsl:for-each>
439 </table>
440 </xsl:template>
441
442 <!--template name="modifypassword"-->
443 <xsl:template name="modifypassword" >
444 <xsl:param name="sub_action"/>
445 <xsl:param name="authen_service"/>
446 <xsl:param name="pro_action"/>
447 <xsl:param name="un_s"/>
448 <xsl:param name="pw_s"/>
449 <xsl:param name="asn"/>
450 <div>
451 <form id="modifyForm" method="get" action="{$library_name}">
452 <input type='hidden' name='a' value='g'/>
453 <input type='hidden' name='sa' value='{$sub_action}'/>
454 <input type='hidden' name='s' value='{$authen_service}'/>
455 <input type='hidden' name='rt' value='r'/>
456 <input type='hidden' name='s1.un' value='{$un_s}'/>
457 <input type='hidden' name='s1.pw' value='{$pw_s}'/>
458 <input type='hidden' name='s1.asn' value='{$asn}'/>
459 <input type='hidden' name='s1.uan' value='1'/>
460 <input type='hidden' name='s1.aup' value='{$pro_action}'/>
461
462 <table align="center"><tr><td align="right">
463 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.old_password')"/></td><td><input type="password" name="s1.umpw" size="10" value=""/></td></tr>
464 <tr><td align="right">
465 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.new_password')"/></td><td><input type="password" name="s1.umpw1" size="10" value=""/></td></tr>
466 <tr><td align="right">
467 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.retype_new_password')"/></td><td><input type="password" name="s1.umpw2" size="10" value=""/></td></tr>
468 <tr><td></td><td>
469 <input type="submit" value="submit"></input></td>
470 </tr>
471 </table>
472 </form>
473 </div>
474 </xsl:template>
475
476 <!--template name="deleteuser"-->
477 <xsl:template name="deleteuser">
478 <xsl:param name="sub_action"/>
479 <xsl:param name="authen_service"/>
480 <xsl:param name="pro_action"/>
481 <xsl:param name="un_s"/>
482 <xsl:param name="umun_s"/>
483 <xsl:param name="asn"/>
484 <div >
485 <form id="deleteForm" method="get" action="{$library_name}">
486 <input type='hidden' name='a' value='g'/>
487 <input type='hidden' name='sa' value='{$sub_action}'/>
488 <input type='hidden' name='s' value='{$authen_service}'/>
489 <input type='hidden' name='rt' value='r'/>
490 <input type='hidden' name='s1.aup' value='{$pro_action}'/>
491 <input type='hidden' name='s1.asn' value='{$asn}'/>
492 <input type='hidden' name='s1.uan' value='1'/>
493 <input type='hidden' name='s1.umun' value='{$umun_s}'/>
494 <p><font color='red'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.do_you_really_want_to_permanently_remove_user')"/> <xsl:value-of select="$umun_s"/>" ?</font></p>
495 <input type="submit" value="yes"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
496 <input type="submit" value="no"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
497 </form>
498 </div>
499 </xsl:template>
500
501 <!--template name="edituser"-->
502 <xsl:template name="edituser" >
503 <xsl:param name="sub_action"/>
504 <xsl:param name="authen_service"/>
505 <xsl:param name="pro_action"/>
506 <xsl:param name="un_s"/>
507 <xsl:param name="pw_s"/>
508 <xsl:param name="umun_s"/>
509 <xsl:param name="umpw_s"/>
510 <xsl:param name="umas_s"/>
511 <xsl:param name="umgp_s"/>
512 <xsl:param name="umc_s"/>
513 <xsl:param name="oumun_s"/>
514 <xsl:param name="asn"/>
515 <div>
516 <form id="editForm" method="get" action="{$library_name}">
517 <input type='hidden' name='a' value='g'/>
518 <input type='hidden' name='sa' value='{$sub_action}'/>
519 <input type='hidden' name='s' value='{$authen_service}'/>
520 <input type='hidden' name='rt' value='r'/>
521 <input type='hidden' name='s1.asn' value='{$asn}'/>
522 <input type='hidden' name='s1.uan' value='1'/>
523 <input type='hidden' name='s1.aup' value='{$pro_action}'/>
524 <input type='hidden' name='s1.un' value='{$un_s}'/>
525 <input type='hidden' name='s1.pw' value='{$pw_s}'/>
526
527 <table align="left" ><tr><td>
528 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/></td><td><input type="text" name="s1.umun" size="15" value="{$umun_s}"/></td><td><font color="gray"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username_describe')"/></font></td></tr>
529 <tr><td>
530 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password')"/></td><td><input type="password" name="s1.umpw" size="15" value="{$umpw_s}"/></td><td><font color="gray"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password_describe')"/></font></td></tr>
531 <tr><td>
532 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.account_status')"/></td><td>
533 <select name="s1.umas">
534 <xsl:if test="$umas_s=''">
535 <option value="true" selected="selected"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/></option>
536 <option value="false"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/></option>
537 </xsl:if>
538 <xsl:if test="$umas_s='true'">
539 <option value="true" selected="selected"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/></option>
540 <option value="false"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/></option>
541 </xsl:if>
542 <xsl:if test="$umas_s='false'">
543 <option value="true"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/></option>
544 <option value="false" selected="selected"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/></option>
545 </xsl:if>
546 </select></td><td></td></tr>
547 <tr><td>
548 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.groups')"/></td><td><input type="text" id="group" name="s1.umgp" size="70" value="{$umgp_s}"/></td><td><font color="gray"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.groups_describe')"/></font></td></tr>
549 <tr>
550 <td></td>
551 <td align="right"> <select id="groups" size="0">
552 <script type="text/javascript">
553 <xsl:text disable-output-escaping="yes">
554 var group_arr=Array("administrator","all-collections-editor","personal-collections-editor");
555 var group_string=document.getElementById("group").value;
556 var split_group_string=group_string.split(",");
557 var find=0;
558 for (i=0; i &lt; group_arr.length; i++){
559 find=0;
560 for (j=0; j &lt; group_arr.length; j++){
561 if (split_group_string[j]==group_arr[i]){
562 find=1;
563 }
564 }
565 if (find==0){
566 op = document.createElement('option');
567 op.innerHTML = group_arr[i];
568 op.setAttribute("value", group_arr[i]);
569 document.getElementById("groups").appendChild(op);
570 }
571 }
572
573 </xsl:text>
574 </script>
575 </select></td><td><input type="button" name="addGroupButton" value="add" onClick="addGroup('groups')"/></td>
576 </tr>
577 <tr>
578 <td></td>
579 <td align="right">
580 <select id="collects" size="0">
581 <xsl:for-each select="/page/pageResponse/collectionList/collection">
582 <script type="text/javascript">
583 <xsl:text disable-output-escaping="yes">
584 var group="</xsl:text><xsl:value-of select="@name"/>-collection-editor<xsl:text disable-output-escaping="yes">";
585 var group_string=document.getElementById("group").value;
586 var split_group_string=group_string.split(",");
587 var find=0;
588 for (i=0; i &lt; split_group_string.length; i++){
589 if (split_group_string[i]==group){
590 find=1;
591 }
592 }
593 if (find==0){
594 op = document.createElement('option');
595 op.innerHTML = group;
596 op.setAttribute("value", group);
597 document.getElementById("collects").appendChild(op);
598 }
599 </xsl:text>
600 </script>
601 </xsl:for-each>
602 </select>
603 </td>
604 <td><input type="button" name="addGroupButton" value="add" onClick="addGroup('collects')"/></td>
605 </tr>
606 <tr><td>
607 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.comment')"/></td><td colspan="2"><div><textarea cols="40" rows="5" name="s1.umc"><xsl:value-of select="$umc_s"/>
608
609 </textarea></div></td></tr>
610 <tr>
611
612 <td></td><td>
613 <input type="submit" value="submit"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
614 <xsl:if test="$pro_action!='AddUser'">
615 <input type="submit" value="cancel"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
616 </xsl:if>
617 </td><td></td></tr>
618 </table>
619 <input type='hidden' name='s1.oumun' value='{$oumun_s}'/>
620 </form>
621 </div>
622 </xsl:template>
623
624 <!-- addGroup() javascript -->
625 <xsl:template name="addGroup">
626 <script type="text/javascript">
627 <xsl:text disable-output-escaping="yes">
628 function addGroup(g){
629 var itemSelected;
630 var splitGroup;
631 var groupExit;
632
633 if (document.getElementById("editForm")!=null){
634 //itemSelected=document.getElementById("editForm").groups.options.selectedIndex;
635 itemSelected=document.getElementById(g).options.selectedIndex;
636 if (document.getElementById(g).options[itemSelected].text!=""){
637 if (document.getElementById("group").value==""){
638 document.getElementById("group").value=document.getElementById("group").value+document.getElementById(g).options[itemSelected].text;
639 }else{
640 splitGroup=document.getElementById("group").value.split(",");
641 for (var i=0; i &lt; splitGroup.length; i++){
642 if (splitGroup[i]==document.getElementById(g).options[itemSelected].text){
643 alert(document.getElementById(g).options[itemSelected].text + " has been added.");
644 groupExit=1;
645 break;
646 }
647 }
648 if (groupExit!=1) {
649 document.getElementById("group").value=document.getElementById("group").value+","+document.getElementById(g).options[itemSelected].text;
650 }
651 }
652 document.getElementById(g).options[itemSelected]=new Option("",itemSelected);
653 }
654 }
655 }
656 </xsl:text>
657 </script>
658 </xsl:template>
659
660</xsl:stylesheet>
661
Note: See TracBrowser for help on using the repository browser.