Skip to content

Commit

Permalink
Better fix for Bug #1825
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgdf committed Feb 20, 2015
1 parent 0a81fe6 commit fd18aa8
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions htdocs/core/lib/agenda.lib.php
Expand Up @@ -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>';
}
Expand Down

0 comments on commit fd18aa8

Please sign in to comment.