Better fix for Bug #1825

This commit is contained in:
Marcos García de La Fuente 2015-02-20 10:17:02 +01:00
parent 0a81fe667f
commit fd18aa8717

View File

@ -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>';
}