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

Last change on this file since 14346 was 14346, checked in by qq6, 15 years ago

added a comment

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