diff --git a/composer.json b/composer.json
index d27aa11..fb225b8 100644
--- a/composer.json
+++ b/composer.json
@@ -25,6 +25,9 @@
"cp vendor/datatables.net/datatables.net-bs5/css/dataTables.bootstrap5.min.css htdocs/vendor/datatables/",
"cp vendor/datatables.net/datatables.net-bs5/js/dataTables.bootstrap5.min.js htdocs/vendor/datatables/",
"cp vendor/datatables.net/datatables.net-buttons/js/dataTables.buttons.min.js htdocs/vendor/datatables/",
+ "cp vendor/datatables.net/datatables.net-buttons/js/buttons.colVis.min.js htdocs/vendor/datatables/",
+ "cp vendor/datatables.net/datatables.net-buttons/js/buttons.html5.min.js htdocs/vendor/datatables/",
+ "cp vendor/datatables.net/datatables.net-buttons/js/buttons.print.min.js htdocs/vendor/datatables/",
"cp vendor/datatables.net/datatables.net-buttons-bs5/css/buttons.bootstrap5.min.css htdocs/vendor/datatables/",
"cp vendor/datatables.net/datatables.net-buttons-bs5/js/buttons.bootstrap5.min.js htdocs/vendor/datatables/",
"rm -rf vendor/datatables.net",
diff --git a/conf/config.inc.php b/conf/config.inc.php
index 536e1a7..0029fc1 100644
--- a/conf/config.inc.php
+++ b/conf/config.inc.php
@@ -111,6 +111,8 @@
$datatables_page_length_choices = array(10, 25, 50, 100, -1);
$datatables_page_length_default = 10;
+$datatables_print_all = true;
+$datatables_print_page = true;
$datatables_auto_print = true;
$display_items = array('identifier', 'firstname', 'lastname', 'title', 'businesscategory', 'employeenumber', 'employeetype', 'mail', 'mailquota', 'phone', 'mobile', 'fax', 'postaladdress', 'street', 'postalcode', 'l', 'state', 'organizationalunit', 'organization', 'manager', 'secretary' );
diff --git a/docs/search-parameters.rst b/docs/search-parameters.rst
index c9aeae6..022e3bd 100644
--- a/docs/search-parameters.rst
+++ b/docs/search-parameters.rst
@@ -28,6 +28,9 @@ Configure items shown when displaying results:
Datatables
----------
+Pagination
+~~~~~~~~~~
+
Define pagination values in dropdown:
.. code-block:: php
@@ -40,9 +43,22 @@ Set default pagination for results (can also be used to force the length without
$datatables_page_length_default = 10;
-Enable or disable autoPrint feature:
+Print
+~~~~~
+Show "print all" button:
.. code-block:: php
- $datatables_auto_print = true;
+ $datatables_print_all = true;
+
+Show "print page" button:
+
+.. code-block:: php
+ $datatables_print_page = true;
+
+Enable autoPrint feature (will launch print dialog directly when cliking on print buttons):
+
+.. code-block:: php
+
+ $datatables_auto_print = true;
diff --git a/htdocs/index.php b/htdocs/index.php
index a1f6dbb..f7429a7 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -164,9 +164,16 @@ function sha256($string)
$smarty->assign('custom_css',$custom_css);
$smarty->assign('attributes_map',$attributes_map);
$smarty->assign('date_specifiers',$date_specifiers);
-if (is_array($datatables_page_length_choices)) $datatables_page_length_choices = implode(', ', $datatables_page_length_choices);
+if (is_array($datatables_page_length_choices)) {
+ if ( $all = array_search('-1', $datatables_page_length_choices)) {
+ $datatables_page_length_choices[$all] = '{"value":"-1","label":"'.$messages["pager_all"].'"}';
+ }
+ $datatables_page_length_choices = implode(', ', $datatables_page_length_choices);
+}
$smarty->assign('datatables_page_length_choices', $datatables_page_length_choices);
$smarty->assign('datatables_page_length_default', $datatables_page_length_default);
+$smarty->assign('datatables_print_all', $datatables_print_all);
+$smarty->assign('datatables_print_page', $datatables_print_page);
$smarty->assign('datatables_auto_print', $datatables_auto_print);
$smarty->assign('version',$version);
$smarty->assign('display_footer',$display_footer);
diff --git a/templates/footer.tpl b/templates/footer.tpl
index 603b86a..2d05ebb 100644
--- a/templates/footer.tpl
+++ b/templates/footer.tpl
@@ -11,6 +11,9 @@
+
+
+
@@ -21,39 +24,32 @@
{/literal}
{literal}
var itemlist = $('table.dataTable').DataTable({
- "stateSave": true,
- "searching": true,
- "paging": true,
- "info": true,
- "processing": true,
+ layout: {
+ topStart: {
{/literal}
{if $datatables_page_length_choices}
- "lengthMenu": [
- [ {$datatables_page_length_choices} ],
- [ {$datatables_page_length_choices|replace:'-1':($msg_pager_all|string_format:'"%s"') nofilter} ]
- ],
+ pageLength: {
+ menu: [ {$datatables_page_length_choices nofilter} ]
+ }
{/if}
+ },
+ bottom2Start: {
+ buttons: [
+{if $datatables_print_all}
+ { extend: 'print', text: '{$msg_print_all}', autoPrint: {if $datatables_auto_print}true{else}false{/if} },
+{/if}
+{if $datatables_print_page}
+ { extend: 'print', text: '{$msg_print_page}', exportOptions: { modifier: { page: 'current' } }, autoPrint: {if $datatables_auto_print}true{else}false{/if} },
+{/if}
+ ]
+ }
+ },
{if $datatables_page_length_default}
- "pageLength": {$datatables_page_length_default},
+ pageLength: {$datatables_page_length_default},
{/if}
{literal}
- "dom":
- "<'row ft-head'<'col-sm-3'{/literal}{if $datatables_page_length_choices}l{/if}{literal}><'col-sm-3'f><'col-sm-6'p>>" +
- "<'row dt-main'<'col-sm-12'tr>>" +
- "<'row dt-foot'<'col-sm-6'i><'col-sm-6'p>>" +
- "<'row dt-foot'<'col-sm-12'B>>",
- /* "buttons": [
- { extend: 'print', autoPrint: {/literal}{if $datatables_auto_print}true{else}false{/if}{literal}, text: "{/literal} {$msg_print_all}{literal}", className: "btn-info" },
- { extend: 'print', autoPrint: {/literal}{if $datatables_auto_print}true{else}false{/if}{literal}, exportOptions: {modifier:{page: 'current'}}, text: "{/literal} {$msg_print_page}{literal}", className: "btn-info" },
- ],*/
- "order": [
- [ {/literal}{if is_int($listing_sortby)}{$listing_sortby}{else}1{/if}{literal}, "asc" ]
- ],
- "aoColumnDefs": [
- { "bSortable": false, "aTargets": ['nosort'] },
- ],
- "language": {
- "url": "vendor/datatables/i18n/{/literal}{$lang|default:'en'}{literal}.json"
+ language: {
+ url: "vendor/datatables/i18n/{/literal}{$lang|default:'en'}{literal}.json"
}
});
{/literal}