[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] listexecute: select all bug

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]> Wed, 22 Jul 2026 13:46:33 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a60c9b9ea8bb_38147f30040042@gitlab-sidekiq-low-urgency-cpu-bound-v2-7d8cd68bcd-9vq8c.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
7b29f055 by Victor Emanouilov at 2026-07-22T13:28:15+00:00
[FIX] listexecute: select all bug
---
* [FIX] listexecute: select all bug - when checking all items on a page but there are more pages (even if hidden), frontend shouldn't send the ALL value, so backend processes only selected items on page and not all the items found via the plugin

See merge request tikiwiki/tiki!10769

- - - - -


3 changed files:

- lib/jquery_tiki/wikiplugin-listexecute.js
- templates/search/list/table.tpl
- templates/wiki-plugins/wikiplugin_listexecute.tpl


Changes:

=====================================
lib/jquery_tiki/wikiplugin-listexecute.js
=====================================
@@ -2,6 +2,8 @@ $.fn.setupListExecute = function (id) {
     const $container = this;
     const iListExecute = $container.attr('id').replace('wplistexecute-', '').replace('listexecute-', '');
 
+    let selectAllClicked = false;
+
     let countChecked = function() {
         if ($container.find('.checkbox_objects').is(':checked')) {
             if($container.find('select.check_submit_select').val()){
@@ -10,12 +12,17 @@ $.fn.setupListExecute = function (id) {
         } else {
             $container.find('input.list_execute_submit').prop('disabled', true);
         }
-        var header_checked = $container.find('.checkbox_objects').not(':checked').length == 0;
-        $container.find('.listexecute-all').val(header_checked ? 'ALL' : '');
+        var $checkboxes = $container.find('.checkbox_objects');
+        var header_checked = $checkboxes.not(':checked').length == 0;
+        var totalCount = parseInt($container.data('count')) || 0;
+        var isPaginated = totalCount > 0 && totalCount > $checkboxes.length;
+        var sendAll = header_checked && (!isPaginated || selectAllClicked);
+        $container.find('.listexecute-all').val(sendAll ? 'ALL' : '');
     };
 
     $container.find('.listexecute-select-all').removeClass('listexecute-select-all')
         .on('click', function (e) {
+            selectAllClicked = true;
             $(this).closest('form').find('tbody :checkbox:not(:disabled), .list li :checkbox:not(:disabled)').each(function () {
                 $(this).prop("checked", ! $(this).prop("checked"));
             }).promise().done(function(){ countChecked(); });
@@ -61,7 +68,10 @@ $.fn.setupListExecute = function (id) {
             }
         });
 
-    $container.find(".checkbox_objects").on("click", countChecked);
+    $container.find(".checkbox_objects").on("click", function() {
+        selectAllClicked = false;
+        countChecked();
+    });
     countChecked();
 
     let submitForm = function() {


=====================================
templates/search/list/table.tpl
=====================================
@@ -43,7 +43,7 @@
         {/if}
 {/if}
 {if $actions}
-<form method="post" action="#{$id}" class="d-flex flex-row flex-wrap align-items-center list-executable" id="listexecute-{$iListExecute}" data-id="{$id}"{if $tsOn} data-page-reload="1"{/if}>
+<form method="post" action="#{$id}" class="d-flex flex-row flex-wrap align-items-center list-executable" id="listexecute-{$iListExecute}" data-id="{$id}" data-count="{$count}"{if $tsOn} data-page-reload="1"{/if}>
 <input type="hidden" name="plugin" value="{$fingerprint}">
 {ticket}
 {/if}


=====================================
templates/wiki-plugins/wikiplugin_listexecute.tpl
=====================================
@@ -1,5 +1,5 @@
 <a name="listexecute_{$iListExecute}"></a>
-<form method="post" action="#listexecute_{$iListExecute}" class="d-flex flex-column flex-wrap list-executable" id="listexecute-{$iListExecute}" data-id="{$id}"{if $tsOn} data-page-reload="1"{/if}>
+<form method="post" action="#listexecute_{$iListExecute}" class="d-flex flex-column flex-wrap list-executable" id="listexecute-{$iListExecute}" data-id="{$id}" data-count="{$count}"{if $tsOn} data-page-reload="1"{/if}>
     <input type="hidden" name="plugin" value="{$fingerprint}">
     <input type="hidden" name="objects{$iListExecute}[]" value="" class="listexecute-all">
     {ticket}



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7b29f055775ea12e8d31ca8de761fbc282b489e2

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7b29f055775ea12e8d31ca8de761fbc282b489e2
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs