{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} {combine_script id='jquery.dataTables' load='footer' path='themes/default/js/plugins/jquery.dataTables.js'} {combine_css path="themes/default/js/plugins/datatables/css/jquery.dataTables.css"} {footer_script} var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}"; var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}"; var selectedMessage_all = "{'All %d photos are selected'|@translate}"; var applyOnDetails_pattern = "{'on the %d selected users'|@translate}"; var missingConfirm = "{'You need to confirm deletion'|translate}"; var allUsers = [{$all_users}]; var selection = [{$selection}]; {/footer_script} {footer_script}{literal} jQuery(document).ready(function() { /* first column must be prefixed with the open/close icon */ var aoColumns = [ { 'bVisible':false }, { "mRender": function(data, type, full) { return ' '+data+''; } } ]; for (i=2; i 0) { jQuery("#forbidAction").hide(); jQuery("#permitAction").show(); jQuery("#applyOnDetails").text( sprintf( applyOnDetails_pattern, selection.length ) ); if (selection.length == allUsers.length) { jQuery("#selectedMessage").text( sprintf( selectedMessage_all, allUsers.length ) ); } else { jQuery("#selectedMessage").text( sprintf( selectedMessage_pattern, selection.length, allUsers.length ) ); } } else { jQuery("#forbidAction").show(); jQuery("#permitAction").hide(); jQuery("#selectedMessage").text( sprintf( selectedMessage_none, allUsers.length ) ); } jQuery("#applyActionBlock .infos").hide(); } jQuery(document).on('change', '#userList input[type=checkbox]', function() { var user_id = jQuery(this).data("user_id"); array_delete(selection, user_id); if (jQuery(this).is(":checked")) { selection.push(user_id); } checkSelection(); }); jQuery("#selectAll").click(function () { selection = allUsers; jQuery("#userList input[type=checkbox]").prop('checked', true); checkSelection(); return false; }); jQuery("#selectNone").click(function () { selection = []; jQuery("#userList input[type=checkbox]").prop('checked', false); checkSelection(); return false; }); jQuery("#selectInvert").click(function () { var newSelection = []; for(var i in allUsers) { if (selection.indexOf(allUsers[i]) == -1) { newSelection.push(allUsers[i]); } } selection = newSelection; jQuery("#userList input[type=checkbox]").each(function() { var user_id = jQuery(this).data("user_id"); jQuery(this).prop('checked', (selection.indexOf(user_id) != -1)); }); checkSelection(); return false; }); /** * Action management */ jQuery("[id^=action_]").hide(); jQuery("select[name=selectAction]").change(function () { jQuery("#applyActionBlock .infos").hide(); jQuery("[id^=action_]").hide(); jQuery("#action_"+$(this).prop("value")).show(); if (jQuery(this).val() != -1) { jQuery("#applyActionBlock").show(); } else { jQuery("#applyActionBlock").hide(); } }); jQuery("#permitAction input, #permitAction select").click(function() { jQuery("#applyActionBlock .infos").hide(); }); jQuery("#applyAction").click(function() { var action = jQuery("select[name=selectAction]").prop("value"); var method = null; var data = { user_id: selection }; switch (action) { case 'delete': if (!jQuery("input[name=confirm_deletion]").is(':checked')) { alert(missingConfirm); return false; } method = 'pwg.users.delete'; break; case 'group_associate': method = 'pwg.groups.addUser'; data.group_id = jQuery("select[name=associate]").prop("value"); break; case 'group_dissociate': method = 'pwg.groups.deleteUser'; data.group_id = jQuery("select[name=dissociate]").prop("value"); break; } jQuery.ajax({ url: "ws.php?format=json&method="+method, type:"POST", data: data, beforeSend: function() { jQuery("#applyActionLoading").show(); }, success:function(data) { oTable.fnDraw(); jQuery("#applyActionLoading").hide(); jQuery("#applyActionBlock .infos").show(); if (action == 'delete') { var allUsers_new = []; for(var i in allUsers) { if (selection.indexOf(allUsers[i]) == -1) { allUsers_new.push(allUsers[i]); } } allUsers = allUsers_new; console.log('allUsers_new.length = '+allUsers_new.length); selection = []; checkSelection(); } }, error:function(XMLHttpRequest, textStatus, errorThrows) { jQuery("#applyActionLoading").hide(); } }); return false; }); }); {/literal}{/footer_script} {literal} {/literal} {'User list'|@translate} {'Add a user'|@translate} {'Username'|@translate} {if $Double_Password} {'Password'|@translate} {'Confirm Password'|@translate} {else} {'Password'|@translate} {/if} {'Email address'|@translate} {'Send connection settings by email'|@translate} id {'Username'|@translate} {'Status'|@translate} {'Email address'|@translate} {'Select:'|@translate} {'All'|@translate}, {'None'|@translate}, {'Invert'|@translate} {'Action'|@translate} {'No user selected, no action possible.'|@translate} {'Choose an action'|@translate} ------------------ {'Delete selected users'|@translate} {'Status'|@translate} {'associate to group'|translate} {'dissociate from group'|@translate} {'High definition enabled'|@translate} {'Privacy level'|@translate} {'Number of photos per page'|@translate} {'Interface theme'|@translate} {'Language'|@translate} {'Recent period'|@translate} {'Expand all albums'|@translate} {if $ACTIVATE_COMMENTS} {'Show number of comments'|@translate} {/if} {'Show number of hits'|@translate} {* delete *} {'Are you sure?'|@translate} {* status *} {html_options options=$pref_status_options selected=$pref_status_selected} {* group_associate *} {html_options name=associate options=$association_options selected=$associate_selected} {* group_dissociate *} {html_options name=dissociate options=$association_options selected=$dissociate_selected} {* enabled_high *} {'Yes'|@translate} {'No'|@translate} {* level *} {html_options options=$level_options selected=$level_selected} {* nb_image_page *} {* theme *} {html_options options=$theme_options selected=$theme_selected} {* language *} {html_options options=$language_options selected=$language_selected} {* recent_period *} {* expand *} {'Yes'|@translate} {'No'|@translate} {* show_nb_comments *} {'Yes'|@translate} {'No'|@translate} {* show_nb_hits *} {'Yes'|@translate} {'No'|@translate} ✔ Users modified {* #permitAction *}
{'Select:'|@translate} {'All'|@translate}, {'None'|@translate}, {'Invert'|@translate}
{'Are you sure?'|@translate}
✔ Users modified