--- loncom/interface/lonhelper.pm 2003/05/02 19:20:51 1.17 +++ loncom/interface/lonhelper.pm 2003/05/05 15:17:25 1.18 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.17 2003/05/02 19:20:51 bowersj2 Exp $ +# $Id: lonhelper.pm,v 1.18 2003/05/05 15:17:25 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -997,17 +997,20 @@ sub render { if ($self->{'multichoice'}) { $result .= <<SCRIPT; <script> - function checkall(value) { + function checkall(value, checkName) { for (i=0; i<document.forms.helpform.elements.length; i++) { - document.forms.helpform.elements[i].checked=value; + ele = document.forms.helpform.elements[i]; + if (ele.name == checkName + '.forminput') { + document.forms.helpform.elements[i].checked=value; + } } } </script> SCRIPT $buttons = <<BUTTONS; <br /> -<input type="button" onclick="checkall(true)" value="Select All" /> -<input type="button" onclick="checkall(false)" value="Unselect All" /> +<input type="button" onclick="checkall(true, '$var')" value="Select All" /> +<input type="button" onclick="checkall(false, '$var')" value="Unselect All" /> <br /> BUTTONS } @@ -1474,10 +1477,10 @@ sub render { if ($self->{'multichoice'}) { $result = <<SCRIPT; <script> - function checkall(value) { + function checkall(value, checkName) { for (i=0; i<document.forms.helpform.elements.length; i++) { ele = document.forms.helpform.elements[i]; - if (ele.type == "checkbox") { + if (ele.name == checkName + '.forminput') { document.forms.helpform.elements[i].checked=value; } } @@ -1486,8 +1489,8 @@ sub render { SCRIPT $buttons = <<BUTTONS; <br /> -<input type="button" onclick="checkall(true)" value="Select All" /> -<input type="button" onclick="checkall(false)" value="Unselect All" /> +<input type="button" onclick="checkall(true, '$var')" value="Select All Resources" /> +<input type="button" onclick="checkall(false, '$var')" value="Unselect All Resources" /> <br /> BUTTONS } @@ -1627,21 +1630,25 @@ sub render { my $self = shift; my $result = ''; my $buttons = ''; + my $var = $self->{'variable'}; if ($self->{'multichoice'}) { $result = <<SCRIPT; <script> - function checkall(value) { + function checkall(value, checkName) { for (i=0; i<document.forms.helpform.elements.length; i++) { - document.forms.helpform.elements[i].checked=value; + ele = document.forms.helpform.elements[i]; + if (ele.name == checkName + '.forminput') { + document.forms.helpform.elements[i].checked=value; + } } } </script> SCRIPT $buttons = <<BUTTONS; <br /> -<input type="button" onclick="checkall(true)" value="Select All" /> -<input type="button" onclick="checkall(false)" value="Unselect All" /> +<input type="button" onclick="checkall(true, '$var')" value="Select All Students" /> +<input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" /> <br /> BUTTONS } @@ -1832,10 +1839,10 @@ sub render { if ($self->{'multichoice'}) { $result = <<SCRIPT; <script> - function checkall(value) { + function checkall(value, checkName) { for (i=0; i<document.forms.helpform.elements.length; i++) { ele = document.forms.helpform.elements[i]; - if (ele.type == "checkbox") { + if (ele.name == checkName + '.forminput') { document.forms.helpform.elements[i].checked=value; } } @@ -1844,8 +1851,8 @@ sub render { SCRIPT $buttons = <<BUTTONS; <br /> -<input type="button" onclick="checkall(true)" value="Select All" /> -<input type="button" onclick="checkall(false)" value="Unselect All" /> +<input type="button" onclick="checkall(true, '$var')" value="Select All Files" /> +<input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" /> <br /> BUTTONS }