1 | {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} |
---|
2 | |
---|
3 | {combine_script id='jquery.dataTables' load='footer' path='themes/default/js/plugins/jquery.dataTables.js'} |
---|
4 | {combine_css path="themes/default/js/plugins/datatables/css/jquery.dataTables.css"} |
---|
5 | |
---|
6 | {footer_script} |
---|
7 | var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}"; |
---|
8 | var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}"; |
---|
9 | var selectedMessage_all = "{'All %d photos are selected'|@translate}"; |
---|
10 | var applyOnDetails_pattern = "{'on the %d selected users'|@translate}"; |
---|
11 | var newUser_pattern = "✔ {'User %s added'|translate}"; |
---|
12 | var missingConfirm = "{'You need to confirm deletion'|translate}"; |
---|
13 | var missingUsername = "{'Please, enter a login'|translate}"; |
---|
14 | |
---|
15 | var allUsers = [{$all_users}]; |
---|
16 | var selection = [{$selection}]; |
---|
17 | var pwg_token = "{$PWG_TOKEN}"; |
---|
18 | |
---|
19 | var truefalse = { |
---|
20 | true:"{'Yes'|translate}", |
---|
21 | false:"{'No'|translate}", |
---|
22 | }; |
---|
23 | {/footer_script} |
---|
24 | |
---|
25 | {footer_script}{literal} |
---|
26 | jQuery(document).ready(function() { |
---|
27 | /** |
---|
28 | * Add user |
---|
29 | */ |
---|
30 | jQuery("#addUser").click(function() { |
---|
31 | jQuery("#addUserForm").toggle(); |
---|
32 | jQuery("#showAddUser .infos").hide(); |
---|
33 | jQuery("input[name=username]").focus(); |
---|
34 | return false; |
---|
35 | }); |
---|
36 | |
---|
37 | jQuery("#addUserClose").click(function() { |
---|
38 | jQuery("#addUserForm").hide(); |
---|
39 | return false; |
---|
40 | }); |
---|
41 | |
---|
42 | jQuery("#addUserForm").submit(function() { |
---|
43 | jQuery.ajax({ |
---|
44 | url: "ws.php?format=json&method=pwg.users.add", |
---|
45 | type:"POST", |
---|
46 | data: jQuery(this).serialize(), |
---|
47 | beforeSend: function() { |
---|
48 | jQuery("#addUserForm .errors").hide(); |
---|
49 | |
---|
50 | if (jQuery("input[name=username]").val() == "") { |
---|
51 | jQuery("#addUserForm .errors").html('✘ '+missingUsername).show(); |
---|
52 | return false; |
---|
53 | } |
---|
54 | |
---|
55 | jQuery("#addUserForm .loading").show(); |
---|
56 | }, |
---|
57 | success:function(data) { |
---|
58 | oTable.fnDraw(); |
---|
59 | jQuery("#addUserForm .loading").hide(); |
---|
60 | |
---|
61 | var data = jQuery.parseJSON(data); |
---|
62 | if (data.stat == 'ok') { |
---|
63 | jQuery("#addUserForm input[type=text], #addUserForm input[type=password]").val(""); |
---|
64 | |
---|
65 | var new_user = data.result.users[0]; |
---|
66 | allUsers.push(parseInt(new_user.id)); |
---|
67 | jQuery("#showAddUser .infos").html(sprintf(newUser_pattern, new_user.username)).show(); |
---|
68 | checkSelection(); |
---|
69 | |
---|
70 | jQuery("#addUserForm").hide(); |
---|
71 | } |
---|
72 | else { |
---|
73 | jQuery("#addUserForm .errors").html('✘ '+data.message).show(); |
---|
74 | } |
---|
75 | }, |
---|
76 | error:function(XMLHttpRequest, textStatus, errorThrows) { |
---|
77 | jQuery("#addUserForm .loading").hide(); |
---|
78 | } |
---|
79 | }); |
---|
80 | |
---|
81 | return false; |
---|
82 | }); |
---|
83 | |
---|
84 | /** |
---|
85 | * Table with users |
---|
86 | */ |
---|
87 | /* Formating function for row details */ |
---|
88 | function fnFormatDetails(oTable, nTr) { |
---|
89 | var userId = oTable.fnGetData(nTr)[0]; |
---|
90 | console.log("userId = "+userId); |
---|
91 | var sOut = null; |
---|
92 | |
---|
93 | jQuery.ajax({ |
---|
94 | url: "ws.php?format=json&method=pwg.users.getList", |
---|
95 | type:"POST", |
---|
96 | data: { |
---|
97 | user_id: userId, |
---|
98 | display: "all", |
---|
99 | }, |
---|
100 | success:function(data) { |
---|
101 | jQuery("#user"+userId+" .loading").hide(); |
---|
102 | |
---|
103 | var data = jQuery.parseJSON(data); |
---|
104 | if (data.stat == 'ok') { |
---|
105 | var user = data.result.users[0]; |
---|
106 | |
---|
107 | var userDetails = '<input type="hidden" name="user_id" value="'+user.id+'">'; |
---|
108 | userDetails += '<fieldset><legend>{/literal}{'Properties'|translate}{literal}</legend>'; |
---|
109 | userDetails += '<div class="userProperty"><strong>{/literal}{'Username'|translate}{literal}</strong>'; |
---|
110 | userDetails += '<br>'+user.username+'</div>'; |
---|
111 | |
---|
112 | userDetails += '<div class="userProperty"><strong>{/literal}{'Email address'|translate}{literal}</strong>'; |
---|
113 | userDetails += '<br><input name="email" type="text" value="'+user.email+'"></div>'; |
---|
114 | |
---|
115 | userDetails += '<div class="userProperty"><strong>{/literal}{'Status'|translate}{literal}</strong>'; |
---|
116 | userDetails += '<br><select name="status">'; |
---|
117 | jQuery("#action select[name=status] option").each(function() { |
---|
118 | var selected = ''; |
---|
119 | if (user.status == jQuery(this).val()) { |
---|
120 | selected = ' selected="selected"'; |
---|
121 | } |
---|
122 | userDetails += '<option value="'+jQuery(this).val()+'"'+selected+'>'+jQuery(this).html()+'</option>'; |
---|
123 | }); |
---|
124 | userDetails += '</select></div>'; |
---|
125 | |
---|
126 | /* |
---|
127 | userDetails += '<div class="userProperty"><strong>{/literal}{'Groups'|translate}{literal}</strong>'; |
---|
128 | userDetails += '<br><select multiple class="chzn-select" style="width:200px;">'; |
---|
129 | jQuery("#action select[name=associate] option").each(function() { |
---|
130 | var selected = ''; |
---|
131 | if (user.groups.indexOf(jQuery(this).val()) != -1) { |
---|
132 | selected = ' selected="selected"'; |
---|
133 | } |
---|
134 | userDetails += '<option value="'+jQuery(this).val()+'"'+selected+'>'+jQuery(this).html()+'</option>'; |
---|
135 | }); |
---|
136 | userDetails += '</select></div>'; |
---|
137 | // userDetails += '<br>'+user.groups.join(",")+'</div>'; |
---|
138 | */ |
---|
139 | |
---|
140 | userDetails += '<div class="userProperty"><strong>{/literal}{'Privacy level'|translate}{literal}</strong>'; |
---|
141 | userDetails += '<br><select name="level">'; |
---|
142 | jQuery("#action select[name=level] option").each(function() { |
---|
143 | var selected = ''; |
---|
144 | if (user.level == jQuery(this).val()) { |
---|
145 | selected = ' selected="selected"'; |
---|
146 | } |
---|
147 | userDetails += '<option value="'+jQuery(this).val()+'"'+selected+'>'+jQuery(this).html()+'</option>'; |
---|
148 | }); |
---|
149 | userDetails += '</select></div>'; |
---|
150 | |
---|
151 | userDetails += '<div class="userProperty"><strong>{/literal}{'High definition enabled'|translate}{literal}</strong>'; |
---|
152 | userDetails += '<br>'; |
---|
153 | jQuery.each(truefalse, function(value, label) { |
---|
154 | var checked = ''; |
---|
155 | if (user.enabled_high == value) { |
---|
156 | checked = ' checked="checked"'; |
---|
157 | } |
---|
158 | userDetails += '<label><input type="radio" name="enabled_high" value="'+value+'"'+checked+'>'+label+'</label>'; |
---|
159 | }); |
---|
160 | userDetails += '</div>'; |
---|
161 | |
---|
162 | userDetails += '</fieldset><fieldset><legend>{/literal}{'Preferences'|translate}{literal}</legend>'; |
---|
163 | |
---|
164 | userDetails += '<div class="userProperty"><strong>{/literal}{'Number of photos per page'|translate}{literal}</strong>'; |
---|
165 | userDetails += '<br>'+user.nb_image_page+'</div>'; |
---|
166 | |
---|
167 | userDetails += '<div class="userProperty"><strong>{/literal}{'Theme'|translate}{literal}</strong>'; |
---|
168 | userDetails += '<br><select name="theme">'; |
---|
169 | jQuery("#action select[name=theme] option").each(function() { |
---|
170 | var selected = ''; |
---|
171 | if (user.theme == jQuery(this).val()) { |
---|
172 | selected = ' selected="selected"'; |
---|
173 | } |
---|
174 | userDetails += '<option value="'+jQuery(this).val()+'"'+selected+'>'+jQuery(this).html()+'</option>'; |
---|
175 | }); |
---|
176 | userDetails += '</select></div>'; |
---|
177 | |
---|
178 | userDetails += '<div class="userProperty"><strong>{/literal}{'Language'|translate}{literal}</strong>'; |
---|
179 | userDetails += '<br><select name="language">'; |
---|
180 | jQuery("#action select[name=language] option").each(function() { |
---|
181 | var selected = ''; |
---|
182 | if (user.language == jQuery(this).val()) { |
---|
183 | selected = ' selected="selected"'; |
---|
184 | } |
---|
185 | userDetails += '<option value="'+jQuery(this).val()+'"'+selected+'>'+jQuery(this).html()+'</option>'; |
---|
186 | }); |
---|
187 | userDetails += '</select></div>'; |
---|
188 | |
---|
189 | userDetails += '<div class="userProperty"><strong>{/literal}{'Recent period'|translate}{literal}</strong>'; |
---|
190 | userDetails += '<br>'+user.recent_period+'</div>'; |
---|
191 | |
---|
192 | userDetails += '<div class="userProperty"><strong>{/literal}{'Expand all albums'|translate}{literal}</strong>'; |
---|
193 | userDetails += '<br>'; |
---|
194 | jQuery.each(truefalse, function(value, label) { |
---|
195 | var checked = ''; |
---|
196 | if (user.expand == value) { |
---|
197 | checked = ' checked="checked"'; |
---|
198 | } |
---|
199 | userDetails += '<label><input type="radio" name="expand" value="'+value+'"'+checked+'>'+label+'</label>'; |
---|
200 | }); |
---|
201 | userDetails += '</div>'; |
---|
202 | |
---|
203 | userDetails += '<div class="userProperty"><strong>{/literal}{'Show number of comments'|translate}{literal}</strong>'; |
---|
204 | userDetails += '<br>'; |
---|
205 | jQuery.each(truefalse, function(value, label) { |
---|
206 | var checked = ''; |
---|
207 | if (user.show_nb_comments == value) { |
---|
208 | checked = ' checked="checked"'; |
---|
209 | } |
---|
210 | userDetails += '<label><input type="radio" name="show_nb_comments" value="'+value+'"'+checked+'>'+label+'</label>'; |
---|
211 | }); |
---|
212 | userDetails += '</div>'; |
---|
213 | |
---|
214 | userDetails += '<div class="userProperty"><strong>{/literal}{'Show number of hits'|translate}{literal}</strong>'; |
---|
215 | userDetails += '<br>'; |
---|
216 | jQuery.each(truefalse, function(value, label) { |
---|
217 | var checked = ''; |
---|
218 | if (user.show_nb_hits == value) { |
---|
219 | checked = ' checked="checked"'; |
---|
220 | } |
---|
221 | userDetails += '<label><input type="radio" name="show_nb_hits" value="'+value+'"'+checked+'>'+label+'</label>'; |
---|
222 | }); |
---|
223 | userDetails += '</div>'; |
---|
224 | userDetails += '</fieldset>'; |
---|
225 | |
---|
226 | userDetails += '<input type="submit" value="{/literal}{'Submit'|translate}{literal}" data-user_id="'+userId+'">'; |
---|
227 | userDetails += '<img class="submitWait" src="themes/default/images/ajax-loader-small.gif" style="display:none">' |
---|
228 | |
---|
229 | jQuery("#user"+userId).append(userDetails); |
---|
230 | } |
---|
231 | else { |
---|
232 | console.log('error loading user details'); |
---|
233 | } |
---|
234 | }, |
---|
235 | error:function(XMLHttpRequest, textStatus, errorThrows) { |
---|
236 | console.log('technical error loading user details'); |
---|
237 | } |
---|
238 | }); |
---|
239 | |
---|
240 | return '<div id="user'+userId+'" class="userProperties"><img class="loading" src="themes/default/images/ajax-loader-small.gif"></div>'; |
---|
241 | } |
---|
242 | |
---|
243 | jQuery(document).on('click', '.userProperties input[type=submit]', function() { |
---|
244 | var userId = jQuery(this).data('user_id'); |
---|
245 | |
---|
246 | jQuery.ajax({ |
---|
247 | url: "ws.php?format=json&method=pwg.users.setInfo", |
---|
248 | type:"POST", |
---|
249 | data: jQuery('#user'+userId).find('select, input').serialize(), |
---|
250 | beforeSend: function() { |
---|
251 | jQuery('#user'+userId+' .submitWait').show(); |
---|
252 | }, |
---|
253 | success:function(data) { |
---|
254 | jQuery('#user'+userId+' .submitWait').hide(); |
---|
255 | }, |
---|
256 | error:function(XMLHttpRequest, textStatus, errorThrows) { |
---|
257 | jQuery('#user'+userId+' .submitWait').hide(); |
---|
258 | } |
---|
259 | }); |
---|
260 | |
---|
261 | return false; |
---|
262 | }); |
---|
263 | |
---|
264 | /* Add event listener for opening and closing details |
---|
265 | * Note that the indicator for showing which row is open is not controlled by DataTables, |
---|
266 | * rather it is done here |
---|
267 | */ |
---|
268 | jQuery(document).on('click', '#userList tbody td img', function() { |
---|
269 | var nTr = this.parentNode.parentNode; |
---|
270 | if ( this.src.match('details_close') ) { |
---|
271 | /* This row is already open - close it */ |
---|
272 | this.src = "admin/themes/default/icon/details_open.png"; |
---|
273 | oTable.fnClose( nTr ); |
---|
274 | } |
---|
275 | else { |
---|
276 | /* Open this row */ |
---|
277 | this.src = "admin/themes/default/icon/details_close.png"; |
---|
278 | oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' ); |
---|
279 | } |
---|
280 | }); |
---|
281 | |
---|
282 | |
---|
283 | /* first column must be prefixed with the open/close icon */ |
---|
284 | var aoColumns = [ |
---|
285 | { |
---|
286 | 'bVisible':false |
---|
287 | }, |
---|
288 | { |
---|
289 | "mRender": function(data, type, full) { |
---|
290 | return '<img src="admin/themes/default/icon/details_open.png"> <label><input type="checkbox" data-user_id="'+full[0]+'"> '+data+'</label>'; |
---|
291 | } |
---|
292 | } |
---|
293 | ]; |
---|
294 | |
---|
295 | for (i=2; i<jQuery("#userList thead tr th").length; i++) { |
---|
296 | aoColumns.push(null); |
---|
297 | } |
---|
298 | |
---|
299 | var oTable = jQuery('#userList').dataTable({ |
---|
300 | "iDisplayLength": 10, |
---|
301 | "bDeferRender": true, |
---|
302 | "bProcessing": true, |
---|
303 | "bServerSide": true, |
---|
304 | "sAjaxSource": "admin/user_list_backend.php", |
---|
305 | "fnDrawCallback": function( oSettings ) { |
---|
306 | jQuery("#userList input[type=checkbox]").each(function() { |
---|
307 | var user_id = jQuery(this).data("user_id"); |
---|
308 | jQuery(this).prop('checked', (selection.indexOf(user_id) != -1)); |
---|
309 | }); |
---|
310 | }, |
---|
311 | "aoColumns": aoColumns |
---|
312 | }); |
---|
313 | |
---|
314 | /** |
---|
315 | * Selection management |
---|
316 | */ |
---|
317 | function checkSelection() { |
---|
318 | if (selection.length > 0) { |
---|
319 | jQuery("#forbidAction").hide(); |
---|
320 | jQuery("#permitAction").show(); |
---|
321 | |
---|
322 | jQuery("#applyOnDetails").text( |
---|
323 | sprintf( |
---|
324 | applyOnDetails_pattern, |
---|
325 | selection.length |
---|
326 | ) |
---|
327 | ); |
---|
328 | |
---|
329 | if (selection.length == allUsers.length) { |
---|
330 | jQuery("#selectedMessage").text( |
---|
331 | sprintf( |
---|
332 | selectedMessage_all, |
---|
333 | allUsers.length |
---|
334 | ) |
---|
335 | ); |
---|
336 | } |
---|
337 | else { |
---|
338 | jQuery("#selectedMessage").text( |
---|
339 | sprintf( |
---|
340 | selectedMessage_pattern, |
---|
341 | selection.length, |
---|
342 | allUsers.length |
---|
343 | ) |
---|
344 | ); |
---|
345 | } |
---|
346 | } |
---|
347 | else { |
---|
348 | jQuery("#forbidAction").show(); |
---|
349 | jQuery("#permitAction").hide(); |
---|
350 | |
---|
351 | jQuery("#selectedMessage").text( |
---|
352 | sprintf( |
---|
353 | selectedMessage_none, |
---|
354 | allUsers.length |
---|
355 | ) |
---|
356 | ); |
---|
357 | } |
---|
358 | |
---|
359 | jQuery("#applyActionBlock .infos").hide(); |
---|
360 | } |
---|
361 | |
---|
362 | jQuery(document).on('change', '#userList input[type=checkbox]', function() { |
---|
363 | var user_id = jQuery(this).data("user_id"); |
---|
364 | |
---|
365 | array_delete(selection, user_id); |
---|
366 | |
---|
367 | if (jQuery(this).is(":checked")) { |
---|
368 | selection.push(user_id); |
---|
369 | } |
---|
370 | |
---|
371 | checkSelection(); |
---|
372 | }); |
---|
373 | |
---|
374 | jQuery("#selectAll").click(function () { |
---|
375 | selection = allUsers; |
---|
376 | jQuery("#userList input[type=checkbox]").prop('checked', true); |
---|
377 | checkSelection(); |
---|
378 | return false; |
---|
379 | }); |
---|
380 | |
---|
381 | jQuery("#selectNone").click(function () { |
---|
382 | selection = []; |
---|
383 | jQuery("#userList input[type=checkbox]").prop('checked', false); |
---|
384 | checkSelection(); |
---|
385 | return false; |
---|
386 | }); |
---|
387 | |
---|
388 | jQuery("#selectInvert").click(function () { |
---|
389 | var newSelection = []; |
---|
390 | for(var i in allUsers) |
---|
391 | { |
---|
392 | if (selection.indexOf(allUsers[i]) == -1) { |
---|
393 | newSelection.push(allUsers[i]); |
---|
394 | } |
---|
395 | } |
---|
396 | selection = newSelection; |
---|
397 | |
---|
398 | jQuery("#userList input[type=checkbox]").each(function() { |
---|
399 | var user_id = jQuery(this).data("user_id"); |
---|
400 | jQuery(this).prop('checked', (selection.indexOf(user_id) != -1)); |
---|
401 | }); |
---|
402 | |
---|
403 | checkSelection(); |
---|
404 | return false; |
---|
405 | }); |
---|
406 | |
---|
407 | /** |
---|
408 | * Action management |
---|
409 | */ |
---|
410 | jQuery("[id^=action_]").hide(); |
---|
411 | |
---|
412 | jQuery("select[name=selectAction]").change(function () { |
---|
413 | jQuery("#applyActionBlock .infos").hide(); |
---|
414 | |
---|
415 | jQuery("[id^=action_]").hide(); |
---|
416 | |
---|
417 | jQuery("#action_"+$(this).prop("value")).show(); |
---|
418 | |
---|
419 | if (jQuery(this).val() != -1) { |
---|
420 | jQuery("#applyActionBlock").show(); |
---|
421 | } |
---|
422 | else { |
---|
423 | jQuery("#applyActionBlock").hide(); |
---|
424 | } |
---|
425 | }); |
---|
426 | |
---|
427 | jQuery("#permitAction input, #permitAction select").click(function() { |
---|
428 | jQuery("#applyActionBlock .infos").hide(); |
---|
429 | }); |
---|
430 | |
---|
431 | jQuery("#applyAction").click(function() { |
---|
432 | var action = jQuery("select[name=selectAction]").prop("value"); |
---|
433 | var method = 'pwg.users.setInfo'; |
---|
434 | var data = { |
---|
435 | user_id: selection |
---|
436 | }; |
---|
437 | |
---|
438 | switch (action) { |
---|
439 | case 'delete': |
---|
440 | if (!jQuery("input[name=confirm_deletion]").is(':checked')) { |
---|
441 | alert(missingConfirm); |
---|
442 | return false; |
---|
443 | } |
---|
444 | method = 'pwg.users.delete'; |
---|
445 | data.pwg_token = pwg_token; |
---|
446 | break; |
---|
447 | case 'group_associate': |
---|
448 | method = 'pwg.groups.addUser'; |
---|
449 | data.group_id = jQuery("select[name=associate]").prop("value"); |
---|
450 | break; |
---|
451 | case 'group_dissociate': |
---|
452 | method = 'pwg.groups.deleteUser'; |
---|
453 | data.group_id = jQuery("select[name=dissociate]").prop("value"); |
---|
454 | break; |
---|
455 | case 'status': |
---|
456 | data.status = jQuery("select[name=status]").prop("value"); |
---|
457 | break; |
---|
458 | case 'enabled_high': |
---|
459 | data.enabled_high = jQuery("input[name=enabled_high]:checked").val(); |
---|
460 | break; |
---|
461 | case 'level': |
---|
462 | data.level = jQuery("select[name=level]").val(); |
---|
463 | break; |
---|
464 | case 'nb_image_page': |
---|
465 | data.nb_image_page = jQuery("input[name=nb_image_page]").val(); |
---|
466 | break; |
---|
467 | case 'theme': |
---|
468 | data.theme = jQuery("select[name=theme]").val(); |
---|
469 | break; |
---|
470 | case 'language': |
---|
471 | data.language = jQuery("select[name=language]").val(); |
---|
472 | break; |
---|
473 | case 'recent_period': |
---|
474 | data.recent_period = jQuery("input[name=recent_period]").val(); |
---|
475 | break; |
---|
476 | case 'expand': |
---|
477 | data.expand = jQuery("input[name=expand]:checked").val(); |
---|
478 | break; |
---|
479 | case 'show_nb_comments': |
---|
480 | data.show_nb_comments = jQuery("input[name=show_nb_comments]:checked").val(); |
---|
481 | break; |
---|
482 | case 'show_nb_hits': |
---|
483 | data.show_nb_hits = jQuery("input[name=show_nb_hits]:checked").val(); |
---|
484 | break; |
---|
485 | default: |
---|
486 | alert("Unexpected action"); |
---|
487 | return false; |
---|
488 | } |
---|
489 | |
---|
490 | jQuery.ajax({ |
---|
491 | url: "ws.php?format=json&method="+method, |
---|
492 | type:"POST", |
---|
493 | data: data, |
---|
494 | beforeSend: function() { |
---|
495 | jQuery("#applyActionLoading").show(); |
---|
496 | }, |
---|
497 | success:function(data) { |
---|
498 | oTable.fnDraw(); |
---|
499 | jQuery("#applyActionLoading").hide(); |
---|
500 | jQuery("#applyActionBlock .infos").show(); |
---|
501 | |
---|
502 | if (action == 'delete') { |
---|
503 | var allUsers_new = []; |
---|
504 | for(var i in allUsers) |
---|
505 | { |
---|
506 | if (selection.indexOf(allUsers[i]) == -1) { |
---|
507 | allUsers_new.push(allUsers[i]); |
---|
508 | } |
---|
509 | } |
---|
510 | allUsers = allUsers_new; |
---|
511 | console.log('allUsers_new.length = '+allUsers_new.length); |
---|
512 | selection = []; |
---|
513 | checkSelection(); |
---|
514 | } |
---|
515 | }, |
---|
516 | error:function(XMLHttpRequest, textStatus, errorThrows) { |
---|
517 | jQuery("#applyActionLoading").hide(); |
---|
518 | } |
---|
519 | }); |
---|
520 | |
---|
521 | return false; |
---|
522 | }); |
---|
523 | |
---|
524 | }); |
---|
525 | {/literal}{/footer_script} |
---|
526 | |
---|
527 | {literal} |
---|
528 | <style> |
---|
529 | .dataTables_wrapper, .dataTables_info {clear:none;} |
---|
530 | table.dataTable {clear:right;padding-top:10px;} |
---|
531 | .dataTable td img {margin-bottom: -6px;margin-left: -6px;} |
---|
532 | .bulkAction {margin-top:10px;} |
---|
533 | #addUserForm p {margin-left:0;} |
---|
534 | #applyActionBlock .actionButtons {margin-left:0;} |
---|
535 | span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border-radius:5px;} |
---|
536 | |
---|
537 | .userProperties {max-width:850px;} |
---|
538 | .userProperties fieldset {border-width:0; border-top-width:1px;} |
---|
539 | .userProperties fieldset legend {margin-left:-20px;padding-left:0;} |
---|
540 | .userProperty {width:220px;float:left;margin-bottom:15px;} |
---|
541 | </style> |
---|
542 | {/literal} |
---|
543 | |
---|
544 | <div class="titrePage"> |
---|
545 | <h2>{'User list'|@translate}</h2> |
---|
546 | </div> |
---|
547 | |
---|
548 | <p class="showCreateAlbum" id="showAddUser"> |
---|
549 | <a href="#" id="addUser">{'Add a user'|translate}</a> |
---|
550 | <span class="infos" style="display:none"></span> |
---|
551 | </p> |
---|
552 | |
---|
553 | <form id="addUserForm" style="display:none" method="post" name="add_user" action="{$F_ADD_ACTION}"> |
---|
554 | <fieldset> |
---|
555 | <legend>{'Add a user'|@translate}</legend> |
---|
556 | |
---|
557 | <p> |
---|
558 | <strong>{'Username'|translate}</strong><br> |
---|
559 | <input type="text" name="username" maxlength="50" size="20"> |
---|
560 | </p> |
---|
561 | |
---|
562 | <p> |
---|
563 | <strong>{'Password'|translate}</strong><br> |
---|
564 | <input type="{if $Double_Password}password{else}text{/if}" name="password"> |
---|
565 | </p> |
---|
566 | |
---|
567 | {if $Double_Password} |
---|
568 | <p> |
---|
569 | <strong>{'Confirm Password'|@translate}</strong><br> |
---|
570 | <input type="password" name="password_confirm"> |
---|
571 | </p> |
---|
572 | {/if} |
---|
573 | |
---|
574 | <p> |
---|
575 | <strong>{'Email address'|@translate}</strong><br> |
---|
576 | <input type="text" name="email"> |
---|
577 | </p> |
---|
578 | |
---|
579 | <p> |
---|
580 | <label><input type="checkbox" name="send_password_by_mail"> <strong>{'Send connection settings by email'|@translate}</strong></label> |
---|
581 | </p> |
---|
582 | |
---|
583 | <p class="actionButtons"> |
---|
584 | <input class="submit" name="submit_add" type="submit" value="{'Submit'|@translate}"> |
---|
585 | <a href="#" id="addUserClose">{'Cancel'|@translate}</a> |
---|
586 | <span class="loading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span> |
---|
587 | <span class="errors" style="display:none"></span> |
---|
588 | </p> |
---|
589 | </fieldset> |
---|
590 | </form> |
---|
591 | |
---|
592 | <form method="post" name="preferences" action=""> |
---|
593 | |
---|
594 | <table id="userList"> |
---|
595 | <thead> |
---|
596 | <tr> |
---|
597 | <th>id</th> |
---|
598 | <th>{'Username'|@translate}</th> |
---|
599 | <th>{'Status'|@translate}</th> |
---|
600 | <th>{'Email address'|@translate}</th> |
---|
601 | </tr> |
---|
602 | </thead> |
---|
603 | </table> |
---|
604 | |
---|
605 | <div style="clear:right"></div> |
---|
606 | |
---|
607 | <p class="checkActions"> |
---|
608 | {'Select:'|@translate} |
---|
609 | <a href="#" id="selectAll">{'All'|@translate}</a>, |
---|
610 | <a href="#" id="selectNone">{'None'|@translate}</a>, |
---|
611 | <a href="#" id="selectInvert">{'Invert'|@translate}</a> |
---|
612 | |
---|
613 | <span id="selectedMessage"></span> |
---|
614 | </p> |
---|
615 | |
---|
616 | <fieldset id="action"> |
---|
617 | <legend>{'Action'|@translate}</legend> |
---|
618 | |
---|
619 | <div id="forbidAction"{if count($selection) != 0} style="display:none"{/if}>{'No user selected, no action possible.'|@translate}</div> |
---|
620 | <div id="permitAction"{if count($selection) == 0} style="display:none"{/if}> |
---|
621 | |
---|
622 | <select name="selectAction"> |
---|
623 | <option value="-1">{'Choose an action'|@translate}</option> |
---|
624 | <option disabled="disabled">------------------</option> |
---|
625 | <option value="delete" class="icon-trash">{'Delete selected users'|@translate}</option> |
---|
626 | <option value="status">{'Status'|@translate}</option> |
---|
627 | <option value="group_associate">{'associate to group'|translate}</option> |
---|
628 | <option value="group_dissociate">{'dissociate from group'|@translate}</option> |
---|
629 | <option value="enabled_high">{'High definition enabled'|@translate}</option> |
---|
630 | <option value="level">{'Privacy level'|@translate}</option> |
---|
631 | <option value="nb_image_page">{'Number of photos per page'|@translate}</option> |
---|
632 | <option value="theme">{'Interface theme'|@translate}</option> |
---|
633 | <option value="language">{'Language'|@translate}</option> |
---|
634 | <option value="recent_period">{'Recent period'|@translate}</option> |
---|
635 | <option value="expand">{'Expand all albums'|@translate}</option> |
---|
636 | {if $ACTIVATE_COMMENTS} |
---|
637 | <option value="show_nb_comments">{'Show number of comments'|@translate}</option> |
---|
638 | {/if} |
---|
639 | <option value="show_nb_hits">{'Show number of hits'|@translate}</option> |
---|
640 | </select> |
---|
641 | |
---|
642 | {* delete *} |
---|
643 | <div id="action_delete" class="bulkAction"> |
---|
644 | <p><label><input type="checkbox" name="confirm_deletion" value="1"> {'Are you sure?'|@translate}</label></p> |
---|
645 | </div> |
---|
646 | |
---|
647 | {* status *} |
---|
648 | <div id="action_status" class="bulkAction"> |
---|
649 | <select name="status"> |
---|
650 | {html_options options=$pref_status_options selected=$pref_status_selected} |
---|
651 | </select> |
---|
652 | </div> |
---|
653 | |
---|
654 | {* group_associate *} |
---|
655 | <div id="action_group_associate" class="bulkAction"> |
---|
656 | {html_options name=associate options=$association_options selected=$associate_selected} |
---|
657 | </div> |
---|
658 | |
---|
659 | {* group_dissociate *} |
---|
660 | <div id="action_group_dissociate" class="bulkAction"> |
---|
661 | {html_options name=dissociate options=$association_options selected=$dissociate_selected} |
---|
662 | </div> |
---|
663 | |
---|
664 | {* enabled_high *} |
---|
665 | <div id="action_enabled_high" class="bulkAction"> |
---|
666 | <label><input type="radio" name="enabled_high" value="true">{'Yes'|@translate}</label> |
---|
667 | <label><input type="radio" name="enabled_high" value="false" checked="checked">{'No'|@translate}</label> |
---|
668 | </div> |
---|
669 | |
---|
670 | {* level *} |
---|
671 | <div id="action_level" class="bulkAction"> |
---|
672 | <select name="level" size="1"> |
---|
673 | {html_options options=$level_options selected=$level_selected} |
---|
674 | </select> |
---|
675 | </div> |
---|
676 | |
---|
677 | {* nb_image_page *} |
---|
678 | <div id="action_nb_image_page" class="bulkAction"> |
---|
679 | <input size="4" maxlength="3" type="text" name="nb_image_page" value="{$NB_IMAGE_PAGE}"> |
---|
680 | </div> |
---|
681 | |
---|
682 | {* theme *} |
---|
683 | <div id="action_theme" class="bulkAction"> |
---|
684 | <select name="theme" size="1"> |
---|
685 | {html_options options=$theme_options selected=$theme_selected} |
---|
686 | </select> |
---|
687 | </div> |
---|
688 | |
---|
689 | {* language *} |
---|
690 | <div id="action_language" class="bulkAction"> |
---|
691 | <select name="language" size="1"> |
---|
692 | {html_options options=$language_options selected=$language_selected} |
---|
693 | </select> |
---|
694 | </div> |
---|
695 | |
---|
696 | {* recent_period *} |
---|
697 | <div id="action_recent_period" class="bulkAction"> |
---|
698 | <input type="text" size="3" maxlength="2" name="recent_period" value="{$RECENT_PERIOD}"> |
---|
699 | </div> |
---|
700 | |
---|
701 | {* expand *} |
---|
702 | <div id="action_expand" class="bulkAction"> |
---|
703 | <label><input type="radio" name="expand" value="true">{'Yes'|@translate}</label> |
---|
704 | <label><input type="radio" name="expand" value="false" checked="checked">{'No'|@translate}</label> |
---|
705 | </div> |
---|
706 | |
---|
707 | {* show_nb_comments *} |
---|
708 | <div id="action_show_nb_comments" class="bulkAction"> |
---|
709 | <label><input type="radio" name="show_nb_comments" value="true">{'Yes'|@translate}</label> |
---|
710 | <label><input type="radio" name="show_nb_comments" value="false" checked="checked">{'No'|@translate}</label> |
---|
711 | </div> |
---|
712 | |
---|
713 | {* show_nb_hits *} |
---|
714 | <div id="action_show_nb_hits" class="bulkAction"> |
---|
715 | <label><input type="radio" name="show_nb_hits" value="true">{'Yes'|@translate}</label> |
---|
716 | <label><input type="radio" name="show_nb_hits" value="false" checked="checked">{'No'|@translate}</label> |
---|
717 | </div> |
---|
718 | |
---|
719 | <p id="applyActionBlock" style="display:none" class="actionButtons"> |
---|
720 | <input id="applyAction" class="submit" type="submit" value="{'Apply action'|@translate}" name="submit"> <span id="applyOnDetails"></span> |
---|
721 | <span id="applyActionLoading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span> |
---|
722 | <span class="infos" style="display:none">✔ Users modified</span> |
---|
723 | </p> |
---|
724 | |
---|
725 | </div> {* #permitAction *} |
---|
726 | </fieldset> |
---|
727 | |
---|
728 | </form> |
---|