root/main/trunk/greenstone3/web/interfaces/default/transform/authen.xsl @ 24082

Revision 24082, 31.2 KB (checked in by ak19, 8 years ago)

Sam worked out a better way to express in XLST some the changes I had committed for the List Users bugfix.

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{@umun}" bgcolor="#eeeeee">   
392        <script type="text/javascript">
393          <xsl:text disable-output-escaping="yes">
394        var status="</xsl:text><xsl:value-of select="@umas"/><xsl:text disable-output-escaping="yes">";
395        if (status=="true"){
396          document.getElementById("status"+username).innerHTML="enabled";
397        }
398        if (status=="false"){
399          document.getElementById("status"+username).innerHTML="disabled";
400        }
401          </xsl:text>       
402        </script>
403      </td>
404      <td id="group{@umun}" bgcolor="#eeeeee">
405        <script type="text/javascript">
406          <xsl:text disable-output-escaping="yes">
407        var groups="</xsl:text><xsl:value-of select="@umgp"/><xsl:text disable-output-escaping="yes">";
408        var split_groups= groups.split(",");
409        var new_groups="";
410        for (j=0; j &lt; split_groups.length ; j++){
411          new_groups+=split_groups[j]+" &lt;br /&gt; ";
412        }
413        document.getElementById('group'+username).innerHTML=new_groups;
414          </xsl:text>       
415        </script>
416      </td>
417      <td bgcolor="#eeeeee"><xsl:value-of select="@umc"/></td>
418      <td bgcolor="#eeeeee">
419        <form name="ListUsersForm" method="get" action="{$library_name}">
420          <input type='hidden' name='a' value='g'/>
421          <input type='hidden' name='sa' value='authen'/>
422          <input type='hidden' name='s' value='Authentication'/>
423          <input type='hidden' name='rt' value='r'/>
424          <input type='hidden' name='s1.asn' value='1'/>
425          <input type='hidden' name='s1.uan' value='1'/>
426
427          <input type='hidden'><xsl:attribute name="name">s1.oumun</xsl:attribute><xsl:attribute name="value"><xsl:value-of select="@umun"/></xsl:attribute></input>
428          <input type='hidden'><xsl:attribute name="name">s1.umun</xsl:attribute><xsl:attribute name="value"><xsl:value-of select="@umun"/></xsl:attribute></input>
429          <input type='hidden' name='s1.cm' value=''/>
430
431          <input type="submit"><xsl:attribute name="name">s1.aup</xsl:attribute><xsl:attribute name="value">EditUser</xsl:attribute></input>
432          <input type="submit"><xsl:attribute name="name">s1.aup</xsl:attribute><xsl:attribute name="value">DeleteUser</xsl:attribute></input>
433        </form>
434      </td>
435    </tr>
436      </xsl:for-each>
437    </table>
438  </xsl:template>
439
440  <!--template name="modifypassword"-->
441  <xsl:template name="modifypassword" >
442    <xsl:param name="sub_action"/>
443    <xsl:param name="authen_service"/>
444    <xsl:param name="pro_action"/>
445    <xsl:param name="un_s"/>
446    <xsl:param name="pw_s"/>
447    <xsl:param name="asn"/>
448    <div>
449      <form id="modifyForm" method="get" action="{$library_name}">
450    <input type='hidden' name='a' value='g'/>
451    <input type='hidden' name='sa' value='{$sub_action}'/>
452    <input type='hidden' name='s' value='{$authen_service}'/>
453    <input type='hidden' name='rt' value='r'/>
454    <input type='hidden' name='s1.un' value='{$un_s}'/>
455    <input type='hidden' name='s1.pw' value='{$pw_s}'/>
456    <input type='hidden' name='s1.asn' value='{$asn}'/>
457    <input type='hidden' name='s1.uan' value='1'/>
458    <input type='hidden' name='s1.aup' value='{$pro_action}'/>
459   
460    <table align="center"><tr><td align="right">
461          <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>
462      <tr><td align="right">
463          <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>
464      <tr><td align="right">
465          <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>
466      <tr><td></td><td>
467          <input type="submit" value="submit"></input></td>
468      </tr>
469    </table>
470      </form>
471    </div>
472  </xsl:template>
473
474  <!--template name="deleteuser"-->
475  <xsl:template name="deleteuser">
476    <xsl:param name="sub_action"/>
477    <xsl:param name="authen_service"/>
478    <xsl:param name="pro_action"/>
479    <xsl:param name="un_s"/>
480    <xsl:param name="umun_s"/>
481    <xsl:param name="asn"/>
482    <div >
483      <form id="deleteForm" method="get" action="{$library_name}">
484    <input type='hidden' name='a' value='g'/>
485    <input type='hidden' name='sa' value='{$sub_action}'/>
486    <input type='hidden' name='s' value='{$authen_service}'/>
487    <input type='hidden' name='rt' value='r'/>
488    <input type='hidden' name='s1.aup' value='{$pro_action}'/>
489    <input type='hidden' name='s1.asn' value='{$asn}'/>
490    <input type='hidden' name='s1.uan' value='1'/>
491    <input type='hidden' name='s1.umun' value='{$umun_s}'/>
492    <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>
493    <input type="submit" value="yes"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
494    <input type="submit" value="no"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
495      </form>
496    </div>
497  </xsl:template>
498 
499  <!--template name="edituser"-->
500  <xsl:template name="edituser" >
501    <xsl:param name="sub_action"/>
502    <xsl:param name="authen_service"/>
503    <xsl:param name="pro_action"/>
504    <xsl:param name="un_s"/>
505    <xsl:param name="pw_s"/>
506    <xsl:param name="umun_s"/>
507    <xsl:param name="umpw_s"/>
508    <xsl:param name="umas_s"/>
509    <xsl:param name="umgp_s"/>
510    <xsl:param name="umc_s"/>
511    <xsl:param name="oumun_s"/>
512    <xsl:param name="asn"/>
513    <div>
514      <form id="editForm" method="get" action="{$library_name}">
515    <input type='hidden' name='a' value='g'/>
516    <input type='hidden' name='sa' value='{$sub_action}'/>
517    <input type='hidden' name='s' value='{$authen_service}'/>
518    <input type='hidden' name='rt' value='r'/>
519    <input type='hidden' name='s1.asn' value='{$asn}'/>
520    <input type='hidden' name='s1.uan' value='1'/>
521    <input type='hidden' name='s1.aup' value='{$pro_action}'/>
522    <input type='hidden' name='s1.un' value='{$un_s}'/>
523    <input type='hidden' name='s1.pw' value='{$pw_s}'/>
524   
525    <table align="left" ><tr><td>
526          <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>
527      <tr><td>
528          <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>
529      <tr><td>
530          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.account_status')"/></td><td>   
531          <select name="s1.umas">
532        <xsl:if test="$umas_s=''">
533          <option value="true" selected="selected"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/></option>
534          <option value="false"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/></option>
535        </xsl:if>
536        <xsl:if test="$umas_s='true'">
537          <option value="true" selected="selected"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/></option>
538          <option value="false"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/></option>
539        </xsl:if>
540        <xsl:if test="$umas_s='false'">
541          <option value="true"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/></option>
542          <option value="false" selected="selected"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/></option>
543        </xsl:if>
544          </select></td><td></td></tr>
545      <tr><td>
546          <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>
547      <tr>
548        <td></td>
549        <td  align="right"> <select id="groups" size="0">
550        <script type="text/javascript">
551          <xsl:text disable-output-escaping="yes">
552            var group_arr=Array("administrator","all-collections-editor","personal-collections-editor");
553            var group_string=document.getElementById("group").value;
554            var split_group_string=group_string.split(",");
555            var find=0;
556            for (i=0; i &lt; group_arr.length; i++){
557              find=0;
558              for (j=0; j &lt; group_arr.length; j++){
559                if (split_group_string[j]==group_arr[i]){
560                  find=1;
561                }
562              }
563              if (find==0){
564                op = document.createElement('option');
565                op.innerHTML = group_arr[i];
566                op.setAttribute("value", group_arr[i]);
567                document.getElementById("groups").appendChild(op);
568              }
569                }
570           
571          </xsl:text>       
572        </script>
573          </select></td><td><input type="button" name="addGroupButton" value="add" onClick="addGroup('groups')"/></td>
574      </tr>
575      <tr>
576        <td></td>
577        <td  align="right">
578          <select  id="collects" size="0">
579        <xsl:for-each select="/page/pageResponse/collectionList/collection">
580          <script type="text/javascript">
581            <xsl:text disable-output-escaping="yes">
582              var group="</xsl:text><xsl:value-of select="@name"/>-collection-editor<xsl:text disable-output-escaping="yes">";
583              var group_string=document.getElementById("group").value;
584              var split_group_string=group_string.split(",");
585              var find=0;
586              for (i=0; i &lt; split_group_string.length; i++){
587                if (split_group_string[i]==group){
588                  find=1;
589                }
590              }
591              if (find==0){
592                op = document.createElement('option');
593                op.innerHTML = group;
594                op.setAttribute("value", group);
595                document.getElementById("collects").appendChild(op);
596              }
597            </xsl:text>     
598          </script>
599        </xsl:for-each>
600          </select>
601        </td>
602        <td><input type="button" name="addGroupButton" value="add" onClick="addGroup('collects')"/></td>
603      </tr>
604      <tr><td>
605          <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"/>
606
607        </textarea></div></td></tr>
608      <tr>
609
610        <td></td><td>
611          <input type="submit" value="submit"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
612          <xsl:if test="$pro_action!='AddUser'">
613        <input type="submit" value="cancel"><xsl:attribute name="name">s1.cm</xsl:attribute></input>
614          </xsl:if>
615        </td><td></td></tr>
616    </table>
617    <input type='hidden' name='s1.oumun' value='{$oumun_s}'/>
618      </form>
619    </div>
620  </xsl:template>
621
622  <!-- addGroup() javascript -->
623  <xsl:template name="addGroup">
624    <script type="text/javascript">
625      <xsl:text disable-output-escaping="yes">
626    function addGroup(g){
627      var itemSelected;
628      var splitGroup;
629      var groupExit;
630
631      if (document.getElementById("editForm")!=null){
632        //itemSelected=document.getElementById("editForm").groups.options.selectedIndex;
633        itemSelected=document.getElementById(g).options.selectedIndex;
634        if (document.getElementById(g).options[itemSelected].text!=""){
635          if (document.getElementById("group").value==""){
636            document.getElementById("group").value=document.getElementById("group").value+document.getElementById(g).options[itemSelected].text;
637          }else{
638            splitGroup=document.getElementById("group").value.split(",");
639            for (var i=0; i &lt; splitGroup.length; i++){
640              if (splitGroup[i]==document.getElementById(g).options[itemSelected].text){
641                alert(document.getElementById(g).options[itemSelected].text + " has been added.");
642                groupExit=1;
643                break;
644              }
645            }
646            if (groupExit!=1) {
647              document.getElementById("group").value=document.getElementById("group").value+","+document.getElementById(g).options[itemSelected].text;
648            }
649          }
650          document.getElementById(g).options[itemSelected]=new Option("",itemSelected);
651        }
652      }
653    }
654      </xsl:text>
655    </script>   
656  </xsl:template>
657 
658</xsl:stylesheet> 
659
Note: See TracBrowser for help on using the browser.