diff --git a/html/js/card.js b/html/js/card.js index 3e9c112fd..aba30582f 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -161,6 +161,8 @@ function action_concerned_save_card(obj) code_html = unescape_xml(code_html); $(namectl).update(code_html); removeDiv('search_card'); + + } }); } catch (e) @@ -277,6 +279,7 @@ function action_concerned_search_card(obj) if ( ! $('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); } $('search_card').innerHTML = code_html; $('query').focus(); + activate_checkbox_range('select_card_ck'); }catch (e) { alert_box(e.message); } diff --git a/html/js/noalyss_checkbox.js b/html/js/noalyss_checkbox.js new file mode 100644 index 000000000..04c44b26e --- /dev/null +++ b/html/js/noalyss_checkbox.js @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2020 Dany De Bontridder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/** + * + * @param {event} evt event + * @param {object} elt checkbox elt + * @param {string} p_name name of the checkbox object + + * @returns {undefined} + */ + +var lastcheck = null; +var endcheck = null; + +/** + * Check or uncheck checkbox if shift key is pressed and between the last checked elemet and the current one + * @param {type} evt event + * @param {type} elt Dom element + * @param {type} p_name name of range + */ +function checkbox_set_range(evt, elt, p_name) { + if (!evt.shiftKey) { + lastcheck = elt; + return; + } + var aName = document.getElementsByClassName(p_name); + + var from = 0; + var end = 0; + for (var i = 0; i < aName.length; i++) { + if (aName[i] == elt) { + endcheck = aName[i]; + from = i; + } + if (aName[i] == lastcheck) { + end = i; + } + } + if (from > end) { + let a = from; + from = end; + end = a; + } + var check = (aName[from].checked) ? true : false; + for (x = from; x <= end; x++) { + aName[x].checked = check; + } +} + + +/** + * For each checkbox , add an event on click + * @param {string} p_range_name name of the checkbox object + * @returns {undefined} + */ +function activate_checkbox_range(p_range_name) { + let node_lstCheckBox = document.getElementsByClassName(p_range_name); + var aCheckBox=Array.from(node_lstCheckBox) + if (aCheckBox == undefined) { + console.error("activate_checkbox_range_failed") + } + + aCheckBox.forEach(elt => elt.addEventListener ('click',function (event) { + checkbox_set_range(event, elt, p_range_name); + },false)); +} +; + + diff --git a/html/js/scripts.js b/html/js/scripts.js index a13ab26ef..25307b890 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -3803,4 +3803,4 @@ function json_concat(p_json1,p_json2) } return result; -} \ No newline at end of file +} diff --git a/include/ajax/ajax_add_concerned_card.php b/include/ajax/ajax_add_concerned_card.php index 9187a7045..bda4c60a3 100644 --- a/include/ajax/ajax_add_concerned_card.php +++ b/include/ajax/ajax_add_concerned_card.php @@ -120,6 +120,7 @@ for ($i=0; $ivalue=$a[$i]['f_id']; + $ic->set_range("select_card_ck"); $array[$i]['checkbox']=$ic->input(); $array[$i]['quick_code']=$a[$i]['quick_code']; $array[$i]['name']=h($a[$i]['vw_name']); @@ -141,8 +142,6 @@ echo HtmlInput::button_close("search_card"); echo ''; echo ''; echo ''; - - $response=ob_get_contents(); ob_end_clean(); diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php index ae2a6e874..801e98b34 100644 --- a/include/class/acc_ledger_search.class.php +++ b/include/class/acc_ledger_search.class.php @@ -897,6 +897,7 @@ class Acc_Ledger_Search if ($p_paid!=0) { $w=new ICheckBox(); + $w->set_range("paid_operation_ck"); $w->name="rd_paid".$row['jr_id']; $w->selected=($row['jr_rapt']=='paid')?true:false; // if p_paid == 2 then readonly diff --git a/include/class/anc_grandlivre.class.php b/include/class/anc_grandlivre.class.php index 2965087c3..d8d7991fd 100644 --- a/include/class/anc_grandlivre.class.php +++ b/include/class/anc_grandlivre.class.php @@ -272,6 +272,7 @@ class Anc_GrandLivre extends Anc_Print if ($str_document != "") { $ck = new ICheckBox('ck[]', $row['jr_id']); + $ck->set_range("document_export_ck"); $str_ck = $ck->input(); } } @@ -298,6 +299,7 @@ class Anc_GrandLivre extends Anc_Print $r.=td('') . td('') . td('') . td('') . td('') . td(nbm($tot_deb), ' class="num"') . td(nbm($tot_cred), ' class="num"') . td(nbm($tot_solde) . $sign, ' class="num"'); $r.= ''; + $r.=ICheckBox::javascript_set_range("document_export_ck"); return $r; } /*! diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index 4cbd1336c..0ad9fdc43 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -692,6 +692,7 @@ class Follow_Up $today=date('d.m.Y'); $i=0; $checkbox=new ICheckBox("mag_id[]"); + $checkbox->set_range("action_followup_ck"); //show the sub_action foreach ($a_row as $row) { @@ -762,6 +763,7 @@ class Follow_Up $r.=""; $r.='

'.$bar.'

'; + $r.=ICheckBox::javascript_set_range("action_followup_ck"); return $r; } @@ -1928,7 +1930,7 @@ class Follow_Up { $showAction=''; echo '
  • '.$margin.$showAction.$action[$o]['str_date']." ". - h($action[$o]['sub_title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.''." " + h($action[$o]['title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.''." " .'
  • '; } } diff --git a/include/compta_fin_rec.inc.php b/include/compta_fin_rec.inc.php index 7ca464ee1..8b53fa8bd 100644 --- a/include/compta_fin_rec.inc.php +++ b/include/compta_fin_rec.inc.php @@ -32,7 +32,43 @@ require_once NOALYSS_INCLUDE.'/class/acc_ledger_fin.class.php'; bcscale(2); ?>
         
     
    @@ -67,6 +69,7 @@ $http=new HttpInput(); get("input_switch_value","string","0")); + echo $input_switch->input(); ?>

    ReadOnly

    @@ -81,6 +84,20 @@ $http=new HttpInput(); $input_switch->readOnly=TRUE; echo $input_switch->input(); ?> +

    InputCheckBox (Check Box)

    + +

    Submit

             echo HtmlInput::submit("submit", _("Envoi"));
    @@ -88,4 +105,26 @@ $http=new HttpInput();
         

    - \ No newline at end of file +

    ICheckBox

    +

    + For using range all the checkbox must have the same name , like checkbox[] +

    +
      + id=uniqid(); + $icheckbox->set_range("icheckbox11"); + echo '
    1. '; + printf ("%s ".$icheckbox->input(),$i); + echo '
    2. '; + + } + echo ICheckBox::javascript_set_range("icheckbox11"); + ?> +
    + +
    + + \ No newline at end of file