Plugin Directory

Changeset 3350770


Ignore:
Timestamp:
08/27/2025 03:45:42 AM (6 months ago)
Author:
tlloancy
Message:

Select and switch maitrises de facon definitive en mode bulk edit. Mais le probleme n etait peut etre pas dinclure un champs cache pour les switch mais plutot d essayer de comprendre a nouveau comment le nom a ete genere ce qui provoque un no find dans . Pourquoi cette exception pour les switches ?

Location:
bulk-content-toolkit
Files:
6 edited
4 copied

Legend:

Unmodified
Added
Removed
  • bulk-content-toolkit/tags/1.2.7/bulk-content-toolkit.php

    r3350483 r3350770  
    33Plugin Name: Bulk Content Toolkit
    44Description: A comprehensive toolkit for efficiently managing bulk actions on various types of content in WordPress, including posts, pages, and custom post types.
    5 Version: 1.2.5
     5Version: 1.2.7
    66Requires at least: 5.0
    77Tested up to: 6.8
     
    157157                continue;
    158158            }
     159            // select et checkbox sont les deux seuls a ne pas avoir de select prealable
     160            if ($input_type === 'select' && isset($_REQUEST[$custom_field_key]) && $_REQUEST[$custom_field_key] === '') {
     161                bulkedittoolkit_debug_log("Skipping field $field_name due to 'No Change' selection", $GLOBALS["bulkedittoolkit_is_debug_active"]);
     162                continue;
     163            }
    159164
    160165            // Handle checkboxes specifically
    161             if ($input_type === 'checkbox') {
     166        if ($input_type === 'checkbox') {
     167        $custom_field_key = 'custom_' . $custom_field_key;
    162168                if (isset($_REQUEST[$custom_field_key])) {
    163169                    $value = sanitize_text_field($_REQUEST[$custom_field_key]);
  • bulk-content-toolkit/tags/1.2.7/includes/admin/quick-edit.php

    r3349434 r3350770  
    143143
    144144function bulkedittoolkit_generate_switch_html($field_name, $context) {
    145     return '<input type="checkbox" name="' . esc_attr('custom_' . $field_name) . '" id="bulk_edit_custom_' . esc_attr($field_name) . '_' . esc_attr($context) . '" value="yes" data-initial-state="mixed" />' .
     145           $html = '';
     146           if ($context === 'bulk') $html = '<input type="hidden" name="' . esc_attr('custom_' . $field_name) . '" value="yes"' . ' id="hidden_bulk_edit_custom_' . esc_attr($field_name) . '_' . esc_attr($context) . '" />';
     147    return $html .= '<input type="checkbox" name="' . esc_attr('custom_' . $field_name) . '" id="bulk_edit_custom_' . esc_attr($field_name) . '_' . esc_attr($context) . '" value="yes" data-initial-state="mixed" />' .
    146148           '<div class="slider"></div>';
    147149}
  • bulk-content-toolkit/tags/1.2.7/js/user.js

    r3350006 r3350770  
    5353                const bulkEditSwitch = document.querySelector('#' + bulkEditId + '[type="checkbox"]');
    5454                const bulkEditSelect = document.querySelector('#' + bulkEditId + '[type="select"]');
     55                const hiddenSwitchInput = document.querySelector('#hidden_' + bulkEditId);
    5556
    5657                if (bulkEditSwitch) {
     
    7980                                    bulkEditSwitch.removeAttribute('data-indeterminate');
    8081                                    bulkEditSwitch.parentNode.classList.remove('indeterminate');
     82                                    hiddenSwitchInput.setAttribute('name', 'custom_' + fieldName);
     83                                    hiddenSwitchInput.setAttribute('value', 'yes');
    8184                                } else if (allNo) {
    8285                                    bulkEditSwitch.indeterminate = false;
     
    8689                                    bulkEditSwitch.removeAttribute('data-indeterminate');
    8790                                    bulkEditSwitch.parentNode.classList.remove('indeterminate');
     91                                    hiddenSwitchInput.setAttribute('name', 'custom_' + fieldName);
     92                                    hiddenSwitchInput.setAttribute('value', 'no');
    8893                                } else {
    8994                                    bulkEditSwitch.indeterminate = true;
     
    9398                                    bulkEditSwitch.setAttribute('data-indeterminate', 'true');
    9499                                    bulkEditSwitch.parentNode.classList.add('indeterminate');
     100                                    hiddenSwitchInput.setAttribute('name', 'custom_' + fieldName);
     101                                    hiddenSwitchInput.setAttribute('value', 'indeterminate');
    95102                                }
     103
     104                                // --- AJOUT DES LISTENERS ICI ---
     105                                // Écouteur pour le clic sur le slider
     106                                /*const slider = bulkEditSwitch.nextElementSibling;
     107                                if (slider && slider.classList.contains('slider')) {
     108                                    slider.addEventListener('click', function() {
     109                                        bulkEditSwitch.indeterminate = false;
     110                                        bulkEditSwitch.checked = !bulkEditSwitch.checked;
     111                                        bulkEditSwitch.removeAttribute('data-indeterminate');
     112                                        bulkEditSwitch.parentNode.classList.remove('indeterminate');
     113                                        hiddenSwitchInput.value = bulkEditSwitch.checked ? 'yes' : 'no';
     114                                    });
     115                                }
     116*/
     117                                // Écouteur pour le changement d'état de la checkbox
     118                                bulkEditSwitch.addEventListener('change', function() {
     119                                    //console.log("ALLO");
     120                                    bulkEditSwitch.indeterminate = false;
     121                                    bulkEditSwitch.removeAttribute('data-indeterminate');
     122                                    bulkEditSwitch.parentNode.classList.remove('indeterminate');
     123                                    bulkEditSwitch.value = bulkEditSwitch.checked ? 'yes' : 'no';
     124                                    hiddenSwitchInput.value = bulkEditSwitch.checked ? 'yes' : 'no';
     125                                });
     126                                // --- FIN DES LISTENERS ---
     127
    96128                            } else {
    97129                                console.log('Failed to get statuses for field:', fieldName);
  • bulk-content-toolkit/tags/1.2.7/readme.txt

    r3350483 r3350770  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable Tag: 1.2.5
     8Stable Tag: 1.2.7
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4646
    4747== Changelog ==
     48
     49= 1.2.7 =
     50- Fixed: Select and switch definitively handled in bulk edit
    4851
    4952= 1.2.5 =
  • bulk-content-toolkit/trunk/bulk-content-toolkit.php

    r3350483 r3350770  
    33Plugin Name: Bulk Content Toolkit
    44Description: A comprehensive toolkit for efficiently managing bulk actions on various types of content in WordPress, including posts, pages, and custom post types.
    5 Version: 1.2.5
     5Version: 1.2.7
    66Requires at least: 5.0
    77Tested up to: 6.8
     
    157157                continue;
    158158            }
     159            // select et checkbox sont les deux seuls a ne pas avoir de select prealable
     160            if ($input_type === 'select' && isset($_REQUEST[$custom_field_key]) && $_REQUEST[$custom_field_key] === '') {
     161                bulkedittoolkit_debug_log("Skipping field $field_name due to 'No Change' selection", $GLOBALS["bulkedittoolkit_is_debug_active"]);
     162                continue;
     163            }
    159164
    160165            // Handle checkboxes specifically
    161             if ($input_type === 'checkbox') {
     166        if ($input_type === 'checkbox') {
     167        $custom_field_key = 'custom_' . $custom_field_key;
    162168                if (isset($_REQUEST[$custom_field_key])) {
    163169                    $value = sanitize_text_field($_REQUEST[$custom_field_key]);
  • bulk-content-toolkit/trunk/includes/admin/quick-edit.php

    r3349434 r3350770  
    143143
    144144function bulkedittoolkit_generate_switch_html($field_name, $context) {
    145     return '<input type="checkbox" name="' . esc_attr('custom_' . $field_name) . '" id="bulk_edit_custom_' . esc_attr($field_name) . '_' . esc_attr($context) . '" value="yes" data-initial-state="mixed" />' .
     145           $html = '';
     146           if ($context === 'bulk') $html = '<input type="hidden" name="' . esc_attr('custom_' . $field_name) . '" value="yes"' . ' id="hidden_bulk_edit_custom_' . esc_attr($field_name) . '_' . esc_attr($context) . '" />';
     147    return $html .= '<input type="checkbox" name="' . esc_attr('custom_' . $field_name) . '" id="bulk_edit_custom_' . esc_attr($field_name) . '_' . esc_attr($context) . '" value="yes" data-initial-state="mixed" />' .
    146148           '<div class="slider"></div>';
    147149}
  • bulk-content-toolkit/trunk/js/user.js

    r3350006 r3350770  
    5353                const bulkEditSwitch = document.querySelector('#' + bulkEditId + '[type="checkbox"]');
    5454                const bulkEditSelect = document.querySelector('#' + bulkEditId + '[type="select"]');
     55                const hiddenSwitchInput = document.querySelector('#hidden_' + bulkEditId);
    5556
    5657                if (bulkEditSwitch) {
     
    7980                                    bulkEditSwitch.removeAttribute('data-indeterminate');
    8081                                    bulkEditSwitch.parentNode.classList.remove('indeterminate');
     82                                    hiddenSwitchInput.setAttribute('name', 'custom_' + fieldName);
     83                                    hiddenSwitchInput.setAttribute('value', 'yes');
    8184                                } else if (allNo) {
    8285                                    bulkEditSwitch.indeterminate = false;
     
    8689                                    bulkEditSwitch.removeAttribute('data-indeterminate');
    8790                                    bulkEditSwitch.parentNode.classList.remove('indeterminate');
     91                                    hiddenSwitchInput.setAttribute('name', 'custom_' + fieldName);
     92                                    hiddenSwitchInput.setAttribute('value', 'no');
    8893                                } else {
    8994                                    bulkEditSwitch.indeterminate = true;
     
    9398                                    bulkEditSwitch.setAttribute('data-indeterminate', 'true');
    9499                                    bulkEditSwitch.parentNode.classList.add('indeterminate');
     100                                    hiddenSwitchInput.setAttribute('name', 'custom_' + fieldName);
     101                                    hiddenSwitchInput.setAttribute('value', 'indeterminate');
    95102                                }
     103
     104                                // --- AJOUT DES LISTENERS ICI ---
     105                                // Écouteur pour le clic sur le slider
     106                                /*const slider = bulkEditSwitch.nextElementSibling;
     107                                if (slider && slider.classList.contains('slider')) {
     108                                    slider.addEventListener('click', function() {
     109                                        bulkEditSwitch.indeterminate = false;
     110                                        bulkEditSwitch.checked = !bulkEditSwitch.checked;
     111                                        bulkEditSwitch.removeAttribute('data-indeterminate');
     112                                        bulkEditSwitch.parentNode.classList.remove('indeterminate');
     113                                        hiddenSwitchInput.value = bulkEditSwitch.checked ? 'yes' : 'no';
     114                                    });
     115                                }
     116*/
     117                                // Écouteur pour le changement d'état de la checkbox
     118                                bulkEditSwitch.addEventListener('change', function() {
     119                                    //console.log("ALLO");
     120                                    bulkEditSwitch.indeterminate = false;
     121                                    bulkEditSwitch.removeAttribute('data-indeterminate');
     122                                    bulkEditSwitch.parentNode.classList.remove('indeterminate');
     123                                    bulkEditSwitch.value = bulkEditSwitch.checked ? 'yes' : 'no';
     124                                    hiddenSwitchInput.value = bulkEditSwitch.checked ? 'yes' : 'no';
     125                                });
     126                                // --- FIN DES LISTENERS ---
     127
    96128                            } else {
    97129                                console.log('Failed to get statuses for field:', fieldName);
  • bulk-content-toolkit/trunk/readme.txt

    r3350483 r3350770  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable Tag: 1.2.5
     8Stable Tag: 1.2.7
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4646
    4747== Changelog ==
     48
     49= 1.2.7 =
     50- Fixed: Select and switch definitively handled in bulk edit
    4851
    4952= 1.2.5 =
Note: See TracChangeset for help on using the changeset viewer.