diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index c9773372e93fad910a6fb37d9986013e5c6441a5..5bd0bc5ee95efa485ee06efcc89089c2d8e03c09 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -140,26 +140,28 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh { if (count($showextcals) > 0) { - print '<tr><td><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>'; + print '<tr><td>'; + //jQuery Learning "How do I select an element by an ID that has characters used in CSS notation?" + //http://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/ + print '<script type="text/javascript"> + function jq( myid ) { + return myid.replace( /(:|\.|\[|\]|,|@)/g, "\\\\$1" ); + } + jQuery(document).ready(function () { + + jQuery("form.listactionsfilter input[name^=\"check_\"]").click(function() { + var name = $(this).attr("name"); + + jQuery(".family_" + jq(name.replace("check_", ""))).toggle(); + }); + }); + </script>'; + print '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>'; foreach ($showextcals as $val) { $htmlname = dol_string_nospecial($val['name']); print '<tr><td>'; - print '<script type="text/javascript">' . "\n"; - - //jQuery Learning "How do I select an element by an ID that has characters used in CSS notation?" - //http://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/ - print ' function jq( myid ) { - return myid.replace( /(:|\.|\[|\]|,|@)/g, "\\\\$1" ); - }'; - - print 'jQuery(document).ready(function () {' . "\n"; - print ' jQuery("#check_" + jq("'.$htmlname.'")).click(function() {'; - print ' jQuery(".family_" + jq("'.$htmlname.'")).toggle();'; - print ' });' . "\n"; - print '});' . "\n"; - print '</script>' . "\n"; print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name']; print '</td></tr>'; }