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

Last change on this file was 37705, checked in by davidb, 12 months ago

Needed to change how the delUser id is formed, as the newer support for Google verified email accounts as the GS username includes characters that are not valid HTML/CSS id fields

  • Property svn:executable set to *
File size: 26.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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:gslib="http://www.greenstone.org/skinning"
6 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util">
9
10 <!-- use the 'main' layout -->
11 <xsl:import href="layouts/main.xsl"/>
12 <xsl:output method="html"/>
13
14 <!-- add recaptcha js to the head -->
15 <xsl:template name="additionalHeaderContent-page">
16 <script src='https://www.google.com/recaptcha/api.js?hl={/page/@lang}'><xsl:text> </xsl:text></script>
17 </xsl:template>
18
19 <!-- set page title -->
20 <xsl:template name="pageTitle">
21 <xsl:choose>
22 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'AddUser'">
23 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.add_a_new_user_title')"/>
24 </xsl:when>
25 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'Register'">
26 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.register')"/>
27 </xsl:when>
28 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'EditUser'">
29 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.edit_user_information')"/>
30 </xsl:when>
31 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'AccountSettings'">
32 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.account_settings')"/>
33 </xsl:when>
34 <xsl:otherwise>
35 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.authentication')"/>
36 </xsl:otherwise>
37 </xsl:choose>
38 </xsl:template>
39
40 <!-- set page breadcrumbs -->
41 <xsl:template name="breadcrumbs">
42 <gslib:siteLink/><xsl:if test="/page/pageResponse/authenticationNode/service/@operation = 'ListUsers' or /page/pageResponse/authenticationNode/service/@operation = 'EditUser' or /page/pageResponse/authenticationNode/service/@operation = 'PerformEdit' or /page/pageResponse/authenticationNode/service/@operation = 'AddUser' or /page/pageResponse/authenticationNode/service/@operation = 'PerformAdd' or /page/pageResponse/authenticationNode/service/@operation = 'PerformDeleteUser'"><gslib:rightArrow/><a href="{$library_name}/admin/ListUsers"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.authentication')"/></a></xsl:if>
43 </xsl:template>
44
45 <xsl:template match="/page">
46 <xsl:if test="/page/pageResponse/error">
47 <div id="gs_error" class="ui-state-error ui-corner-all">
48 <span class="ui-icon ui-icon-alert" style="float: left;"><xsl:text> </xsl:text></span><xsl:value-of select="/page/pageResponse/error"/>
49 </div>
50 <br/>
51 </xsl:if>
52 <div id="main">
53 <xsl:choose>
54 <!-- ********** -->
55 <!-- LOGIN PAGE: this page is used when the user has been directed to Login by trying to access a restricted page when they are not already logged in
56 If they click the login button, then the login.xsl is used -->
57 <!-- ********** -->
58 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'Login'">
59
60 <xsl:call-template name="loginForm">
61 <xsl:with-param name="action-url">
62 <xsl:value-of select="$library_name"/>
63 <xsl:text>/admin/</xsl:text>
64 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.authpage']/@value" />
65 </xsl:with-param>
66 </xsl:call-template>
67 </xsl:when>
68
69 <!-- *************** -->
70 <!-- LIST USERS PAGE -->
71 <!-- *************** -->
72 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'ListUsers'">
73 <table id="userListTable">
74 <tr class="ui-widget-header">
75 <td colspan="7"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.list_of_current_users_title')"/></td>
76 </tr>
77 <tr class="ui-state-default">
78 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/></td>
79 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.account_status')"/></td>
80 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.groups')"/></td>
81 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.comment')"/></td>
82 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.email')"/></td>
83 <td><xsl:text> </xsl:text></td>
84 <td><xsl:text> </xsl:text></td>
85 </tr>
86 <xsl:for-each select="/page/pageResponse/authenticationNode/service/userNodeList/userNode">
87 <tr class="ui-widget-content">
88 <td><xsl:value-of select="@username"/></td>
89 <td>
90 <xsl:choose>
91 <xsl:when test="@status = 'true'">
92 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/>
96 </xsl:otherwise>
97 </xsl:choose>
98 </td>
99 <td><xsl:value-of select='util:replace(@groups, ",", " ")'/></td>
100 <td><xsl:value-of select="@comment"/></td>
101 <td><xsl:value-of select="@email"/></td>
102 <td><a href="{$library_name}/admin/EditUser?s1.username={@username}"><button><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.edit')"/></button></a></td>
103 <td>
104 <xsl:variable name="user-pos">username<xsl:number value="position()"/></xsl:variable>
105 <xsl:variable name="message-pos">confirmMessage<xsl:number value="position()"/></xsl:variable>
106 <form method="GET" action="{$library_name}/admin/PerformDeleteUser">
107 <input type="hidden" name="s1.username" value="{@username}"/>
108 <input id="delUser{$user-pos}" type="submit" value="{util:getInterfaceText($interface_name, /page/@lang, 'authen.delete')}"/>
109 <script type="text/javascript">
110 <xsl:text disable-output-escaping="yes">
111 {
112 var </xsl:text><xsl:value-of select="$user-pos"/><xsl:text disable-output-escaping="yes"> = "</xsl:text><xsl:value-of select="@username"/><xsl:text disable-output-escaping="yes">";
113 var </xsl:text><xsl:value-of select="$message-pos"/><xsl:text disable-output-escaping="yes"> = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.delete_warning')"/><xsl:text disable-output-escaping="yes">" + </xsl:text><xsl:value-of select="$user-pos"/><xsl:text disable-output-escaping="yes"> + "?";
114 var button = $("#delUser" + '</xsl:text><xsl:value-of select="$user-pos"/><xsl:text disable-output-escaping="yes">');
115 button.on("click", function()
116 {
117 if(confirm(</xsl:text><xsl:value-of select="$message-pos"/><xsl:text disable-output-escaping="yes">))
118 {
119 return true;
120 }
121 else
122 {
123 return false;
124 }
125 });
126 }
127 </xsl:text>
128 </script>
129 </form>
130 </td>
131 </tr>
132 </xsl:for-each>
133 </table>
134 <div id="auth_navbar">
135 <!-- Add User link-->
136 <span class="ui-state-default ui-corner-all">
137 <a href="{$library_name}/admin/AddUser"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.add_a_new_user')"/></a>
138 </span>
139 </div>
140 </xsl:when>
141
142 <!-- ********************************* -->
143 <!-- EDIT USER / ACCOUNT SETTINGS PAGE -->
144 <!-- ********************************* -->
145 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'EditUser' or /page/pageResponse/authenticationNode/service/@operation = 'AccountSettings'">
146 <form id="editForm" method="POST">
147 <xsl:attribute name="action">
148 <xsl:choose>
149 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'EditUser'">
150 <xsl:value-of select="$library_name"/><xsl:text>/admin/PerformEdit</xsl:text>
151 </xsl:when>
152 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'AccountSettings'">
153 <xsl:value-of select="$library_name"/><xsl:text>/admin/PerformAccEdit</xsl:text>
154 </xsl:when>
155 </xsl:choose>
156 </xsl:attribute>
157 <input type="hidden" name="s1.prevUsername" value="{/page/pageResponse/authenticationNode/service/userNodeList/userNode/@username}"/>
158 <table>
159 <tr>
160 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/><xsl:text>: </xsl:text></td>
161 <td>
162 <input type="text" name="s1.newUsername" value="{/page/pageResponse/authenticationNode/service/userNodeList/userNode/@username}"/>
163 </td>
164 </tr>
165 <tr>
166 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.email')"/><xsl:text>: </xsl:text></td>
167 <td>
168 <input type="text" name="s1.newEmail" value="{/page/pageResponse/authenticationNode/service/userNodeList/userNode/@email}"/>
169 </td>
170 </tr>
171 <xsl:choose>
172 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'EditUser'">
173 <tr>
174 <td id="passwordLabelCell">
175 <button id="changePasswordButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password')"/>...</button>
176 <script type="text/javascript">
177 <xsl:text disable-output-escaping="yes">
178 var passwordLabelText = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password')"/><xsl:text disable-output-escaping="yes">";
179 var changePasswordButton = document.getElementById("changePasswordButton");
180 changePasswordButton.onclick = function()
181 {
182 changePasswordButton.parentNode.removeChild(changePasswordButton);
183
184 var passwordLabel = document.createTextNode(passwordLabelText + ": ");
185 document.getElementById("passwordLabelCell").appendChild(passwordLabel);
186
187 var passwordInput = document.createElement("INPUT");
188 passwordInput.setAttribute("name", "s1.password");
189 passwordInput.setAttribute("type", "password");
190 document.getElementById("passwordInputCell").appendChild(passwordInput);
191 }
192 </xsl:text>
193 </script>
194 </td>
195 <td id="passwordInputCell">
196 <xsl:text> </xsl:text>
197 </td>
198 </tr>
199 </xsl:when>
200 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'AccountSettings'">
201 <tr>
202 <xsl:if test="not(/page/pageResponse/error/@type = 'INCORRECT_PASSWORD')">
203 <td><button id="changePasswordButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.change_password')"/>...</button></td>
204 <script type="text/javascript">
205 <xsl:text disable-output-escaping="yes">
206 var oldPasswordLabelText = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.old_password')"/><xsl:text disable-output-escaping="yes">";
207 var newPasswordLabelText = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.new_password')"/><xsl:text disable-output-escaping="yes">";
208 var rtNewPasswordLabelText = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.retype_password')"/><xsl:text disable-output-escaping="yes">";
209
210 var changePasswordButton = document.getElementById("changePasswordButton");
211 changePasswordButton.onclick = function()
212 {
213 changePasswordButton.parentNode.removeChild(changePasswordButton);
214
215 var names = ["s1.oldPassword", "s1.newPassword", ""];
216 var ids = ["oldPassword", "passwordOne", "passwordTwo"];
217 var labels = [oldPasswordLabelText, newPasswordLabelText, rtNewPasswordLabelText];
218 var parents = ["oldPassword", "password", "retypePassword"];
219
220 for(var i = 0; i &lt; names.length; i++)
221 {
222 $("#" + parents[i] + "LabelCell").append(labels[i] + ": ");
223
224 var input = $("&lt;input&gt;");
225 input.attr("name", names[i]);
226 input.attr("type", "password");
227 input.attr("id", ids[i]);
228
229 $("#" + parents[i] + "InputCell").append(input);
230 }
231 }
232 </xsl:text>
233 </script>
234 </xsl:if>
235 </tr>
236
237 <xsl:choose>
238 <xsl:when test="not(/page/pageResponse/error/@type = 'INCORRECT_PASSWORD')">
239 <tr>
240 <td id="oldPasswordLabelCell"><xsl:text> </xsl:text></td>
241 <td id="oldPasswordInputCell"><xsl:text> </xsl:text></td>
242 </tr>
243 <tr>
244 <td id="passwordLabelCell"><xsl:text> </xsl:text></td>
245 <td id="passwordInputCell"><xsl:text> </xsl:text></td>
246 </tr>
247 <tr>
248 <td id="retypePasswordLabelCell"><xsl:text> </xsl:text></td>
249 <td id="retypePasswordInputCell"><xsl:text> </xsl:text></td>
250 </tr>
251 </xsl:when>
252 <xsl:otherwise>
253 <tr>
254 <td id="oldPasswordLabelCell"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.old_password')"/></td>
255 <td id="oldPasswordInputCell"><input id="oldPassword" name="s1.oldPassword" type="password"/></td>
256 </tr>
257 <tr>
258 <td id="passwordLabelCell"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.new_password')"/></td>
259 <td id="passwordInputCell"><input id="passwordOne" name="s1.newPassword" type="password"/></td>
260 </tr>
261 <tr>
262 <td id="retypePasswordLabelCell"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.retype_password')"/></td>
263 <td id="retypePasswordInputCell"><input id="passwordTwo" type="password"/></td>
264 </tr>
265 </xsl:otherwise>
266 </xsl:choose>
267 </xsl:when>
268 </xsl:choose>
269 <xsl:if test="/page/pageResponse/authenticationNode/service/@operation = 'EditUser'">
270 <!-- if you want to add a group by default to a user, so that it shows up automatically in the edit user page, use this instead of the following
271 <xsl:call-template name="addGroupInputField"><xsl:with-param name="default_value"><xsl:call-template name="addDefaultGroupToExistingGroups"/></xsl:with-param></xsl:call-template> -->
272 <xsl:call-template name="addGroupInputField"><xsl:with-param name="default_value"><xsl:value-of select="/page/pageResponse/authenticationNode/service/userNodeList/userNode/@groups"/></xsl:with-param></xsl:call-template>
273 <tr>
274 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.comment')"/><xsl:text>: </xsl:text></td>
275 <td>
276 <textarea name="s1.comment" style="width:100%;"><xsl:value-of select="/page/pageResponse/authenticationNode/service/userNodeList/userNode/@comment"/></textarea>
277 </td>
278 </tr>
279 <tr>
280 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.status')"/><xsl:text>: </xsl:text></td>
281 <td>
282 <input type="radio" name="s1.status" value="true">
283 <xsl:if test="/page/pageResponse/authenticationNode/service/userNodeList/userNode/@status = 'true'">
284 <xsl:attribute name="checked">true</xsl:attribute>
285 </xsl:if>
286 </input>
287 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/><xsl:text> </xsl:text>
288
289 <input type="radio" name="s1.status" value="false">
290 <xsl:if test="/page/pageResponse/authenticationNode/service/userNodeList/userNode/@status = 'false'">
291 <xsl:attribute name="checked">true</xsl:attribute>
292 </xsl:if>
293 </input>
294 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/><xsl:text> </xsl:text>
295 </td>
296 </tr>
297 </xsl:if>
298 <xsl:call-template name="addRecaptcha">
299 <xsl:with-param name="formName">editForm</xsl:with-param>
300 </xsl:call-template>
301 <tr>
302 <td>
303 <input id="submitButton" type="submit" value="{util:getInterfaceText($interface_name, /page/@lang, 'authen.submit')}"/>
304 <xsl:if test="/page/pageResponse/authenticationNode/service/@operation = 'AccountSettings'">
305 <xsl:call-template name="addPasswordCheckJavascript"/>
306 </xsl:if>
307 </td>
308 </tr>
309 <!--<tr>
310 <td style="font-size:0.6em;"><a href="{$library_name}/admin/PerformResetPassword?s1.username={/page/pageResponse/authenticationNode/service/userNodeList/userNode/@username}"><br/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.reset_password')"/>...</a></td>
311 </tr>-->
312 </table>
313 </form>
314 </xsl:when>
315
316 <!-- ************************ -->
317 <!-- ADD USER / REGISTER PAGE -->
318 <!-- ************************ -->
319 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'AddUser' or /page/pageResponse/authenticationNode/service/@operation = 'Register'">
320 <div id="errorArea"><xsl:text> </xsl:text></div>
321 <form method="POST" id="registerForm">
322 <xsl:attribute name="action">
323 <xsl:choose>
324 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'AddUser'">
325 <xsl:value-of select="$library_name"/><xsl:text>/admin/PerformAdd</xsl:text>
326 </xsl:when>
327 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'Register'">
328 <xsl:value-of select="$library_name"/><xsl:text>/admin/PerformRegister</xsl:text>
329 </xsl:when>
330 </xsl:choose>
331 </xsl:attribute>
332 <table>
333 <tr>
334 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/><xsl:text>: </xsl:text></td>
335 <td>
336 <input type="text" name="s1.username" autocomplete="off" />
337 </td>
338 </tr>
339 <tr>
340 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.password')"/><xsl:text>: </xsl:text></td>
341 <td>
342 <input id="passwordOne" type="password" name="s1.password" autocomplete="off" />
343 </td>
344 </tr>
345 <tr>
346 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.retype_password')"/><xsl:text>: </xsl:text></td>
347 <td>
348 <input id="passwordTwo" type="password" autocomplete="off" />
349 </td>
350 </tr>
351 <tr>
352 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.email')"/><xsl:text>: </xsl:text></td>
353 <td>
354 <input type="text" name="s1.email" autocomplete="off" />
355 </td>
356 </tr>
357 <xsl:if test="/page/pageResponse/authenticationNode/service/@operation = 'AddUser'">
358 <!-- if you want to add a default group to the groups field with AdddUser, then use this instead, replacing xxx with the default group/s
359 <xsl:call-template name="addGroupInputField"><xsl:with-param name="default_value">xxx</xsl:with-param></xsl:call-template>-->
360 <xsl:call-template name="addGroupInputField"/>
361 <tr>
362 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.comment')"/><xsl:text>: </xsl:text></td>
363 <td>
364 <textarea name="s1.comment" style="width:100%;"><xsl:text> </xsl:text></textarea>
365 </td>
366 </tr>
367 <tr>
368 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.status')"/><xsl:text>: </xsl:text></td>
369 <td>
370 <input type="radio" name="s1.status" value="true" checked="true"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.enabled')"/><xsl:text> </xsl:text>
371 <input type="radio" name="s1.status" value="false"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.disabled')"/><xsl:text> </xsl:text>
372 </td>
373 </tr>
374 </xsl:if>
375 <xsl:call-template name="addRecaptcha">
376 <xsl:with-param name="formName">registerForm</xsl:with-param>
377 </xsl:call-template>
378 <tr>
379 <td>
380 <input id="submitButton" type="submit" value="{util:getInterfaceText($interface_name, /page/@lang, 'authen.submit')}"/>
381 <xsl:call-template name="addPasswordCheckJavascript"/>
382 </td>
383 </tr>
384 </table>
385 </form>
386 </xsl:when>
387
388 <!-- ********************** -->
389 <!-- REGISTER RESPONSE PAGE -->
390 <!-- ********************** -->
391 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'PerformRegister'">
392 <xsl:choose>
393 <!-- don't think we ever get here, as we revert back to Register if there was an error with PerformRegister -->
394 <xsl:when test="/page/pageResponse/error">
395 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.error_failed_to_add')"/>
396 </xsl:when>
397
398 <xsl:otherwise>
399 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.user_added_success')"/>
400 <meta http-equiv="refresh" content="2; url={/page/pageRequest/@baseURL}{$library_name}"/>
401 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:when>
404
405 <xsl:when test="/page/pageResponse/authenticationNode/service/@operation = 'Info'">
406 <!-- do nothing -->
407 </xsl:when>
408 <xsl:otherwise>
409 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.page_not_found')"/>
410 </xsl:otherwise>
411 </xsl:choose>
412 </div>
413 </xsl:template>
414
415 <xsl:template name="addGroupInputField">
416 <xsl:param name="default_value"/>
417 <tr>
418 <td><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.groups')"/><xsl:text>: </xsl:text></td>
419 <td>
420 <input id="groupsInput" size="50" type="text" name="s1.groups" value="{$default_value}"/>
421 </td>
422 <td>
423 <select id="groupSelector">
424 <option>COLLNAME-collection-editor</option>
425 <option>personal-collections-editor</option>
426 <option>all-collections-editor</option>
427 <option>administrator</option>
428 </select>
429 </td>
430 <td>
431 <button id="addGroupButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.add_group')"/></button>
432 <script type="text/javascript">
433 <xsl:text disable-output-escaping="yes">
434 var addGroupButton = document.getElementById("addGroupButton");
435 addGroupButton.onclick = function()
436 {
437 var groupsInput = document.getElementById("groupsInput");
438 var groupSelector = document.getElementById("groupSelector");
439 var options = groupSelector.getElementsByTagName("OPTION");
440 var selectedGroup = options[groupSelector.selectedIndex].innerHTML;
441 var currentValue = groupsInput.value;
442
443 if(currentValue &amp;&amp; currentValue.search(/\w/) != -1)
444 {
445 groupsInput.value = currentValue + "," + selectedGroup;
446 }
447 else
448 {
449 groupsInput.value = selectedGroup;
450 }
451 return false;
452 }
453 </xsl:text>
454 </script>
455 </td>
456 </tr>
457 <tr><td colspan="4"><xsl:value-of select="util:getInterfaceText('default', /page/@lang, 'authen.group_desc')"/><ul><li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.admin_desc')"/></li><li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.all_coll_edit_desc')"/> </li> <li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.pers_coll_edit_desc')"/></li><li><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.single_coll_edit_desc')"/> </li></ul></td></tr>
458
459 </xsl:template>
460
461 <!-- replace xxx here with the group/s you want added by default -->
462 <xsl:template name="addDefaultGroupToExistingGroups"><xsl:variable name="default">xxx</xsl:variable><xsl:variable name="current_groups"><xsl:value-of select="/page/pageResponse/authenticationNode/service/userNodeList/userNode/@groups"/></xsl:variable><xsl:if test="not(contains($current_groups, $default))"><xsl:value-of select="$default"/>,</xsl:if><xsl:value-of select="$current_groups"/></xsl:template>
463
464 <xsl:template name="addPasswordCheckJavascript">
465 <script type="text/javascript">
466 <xsl:text disable-output-escaping="yes">
467 $("#submitButton").on("click", function()
468 {
469 var passwordOne = $("#passwordOne");
470 var passwordTwo = $("#passwordTwo");
471
472 if(passwordOne.val() != passwordTwo.val())
473 {
474 alert("The passwords you have entered do not match");
475 passwordOne.val("");
476 passwordTwo.val("");
477 return false;
478 }
479 else
480 {
481 return true;
482 }
483 });
484 </xsl:text>
485 </script>
486
487 </xsl:template>
488
489 <!-- adds in recaptcha box if the recaptcha_key attribute is set for authenticationNode/service - this is determined by operations element in Authentication serviceRack -->
490 <xsl:template name="addRecaptcha">
491 <xsl:param name="formName"/>
492 <xsl:variable name="recaptcha_key"><xsl:value-of select="/page/pageResponse/authenticationNode/service/@recaptcha_key"/></xsl:variable>
493 <xsl:if test="$recaptcha_key">
494 <tr>
495 <td colspan="2">
496 <div class="g-recaptcha" data-sitekey="{$recaptcha_key}"><xsl:text> </xsl:text></div>
497 <!-- need to add s1. to the name of g-recaptcha-response, so that it gets passed to the service -->
498 <script type="text/javascript">
499 <xsl:text disable-output-escaping="yes">
500 $( "#</xsl:text><xsl:value-of select="$formName"/><xsl:text disable-output-escaping="yes">").submit(function( event ) {
501 var captchaelem = $("#g-recaptcha-response");
502 captchaelem.attr("name", "s1.g-recaptcha-response");
503 return true;
504 });
505
506 </xsl:text>
507 </script>
508 </td></tr>
509 </xsl:if>
510 </xsl:template>
511</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.