[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Wed, 30 Apr 2003 19:08:15 -0000
bowersj2 Wed Apr 30 15:08:15 2003 EDT
Modified files:
/loncom/interface lonhelper.pm
Log:
Add "Select All" and "Unselect All" button to the resource selector,
and fix some of the other "Select All" buttons.
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.14 loncom/interface/lonhelper.pm:1.15
--- loncom/interface/lonhelper.pm:1.14 Wed Apr 30 14:40:49 2003
+++ loncom/interface/lonhelper.pm Wed Apr 30 15:08:15 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.14 2003/04/30 18:40:49 bowersj2 Exp $
+# $Id: lonhelper.pm,v 1.15 2003/04/30 19:08:15 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -988,8 +988,8 @@
$result .= <<SCRIPT;
<script>
function checkall(value) {
- for (i=0; i<document.forms.wizform.elements.length; i++) {
- document.forms.wizform.elements[i].checked=value;
+ for (i=0; i<document.forms.helpform.elements.length; i++) {
+ document.forms.helpform.elements[i].checked=value;
}
}
</script>
@@ -1455,10 +1455,35 @@
my $var = $self->{'variable'};
my $curVal = $helper->{VARS}->{$var};
+ my $buttons = '';
+
+ if ($self->{'multichoice'}) {
+ $result = <<SCRIPT;
+<script>
+ function checkall(value) {
+ for (i=0; i<document.forms.helpform.elements.length; i++) {
+ ele = document.forms.helpform.elements[i];
+ if (ele.type == "checkbox") {
+ 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" />
+<br />
+BUTTONS
+ }
+
if (defined $self->{ERROR_MSG}) {
$result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />';
}
+ $result .= $buttons;
+
my $filterFunc = $self->{FILTER_FUNC};
my $choiceFunc = $self->{CHOICE_FUNC};
my $valueFunc = $self->{VALUE_FUNC};
@@ -1500,6 +1525,8 @@
'resource_no_folder_link' => 1,
'iterator_map' => $mapUrl }
);
+
+ $result .= $buttons;
return $result;
}
@@ -1591,8 +1618,8 @@
$result = <<SCRIPT;
<script>
function checkall(value) {
- for (i=0; i<document.forms.wizform.elements.length; i++) {
- document.forms.wizform.elements[i].checked=value;
+ for (i=0; i<document.forms.helpform.elements.length; i++) {
+ document.forms.helpform.elements[i].checked=value;
}
}
</script>
@@ -1792,16 +1819,16 @@
$result = <<SCRIPT;
<script>
function checkall(value) {
- for (i=0; i<document.forms.wizform.elements.length; i++) {
- ele = document.forms.wizform.elements[i];
+ for (i=0; i<document.forms.helpform.elements.length; i++) {
+ ele = document.forms.helpform.elements[i];
if (ele.type == "checkbox") {
- document.forms.wizform.elements[i].checked=value;
+ document.forms.helpform.elements[i].checked=value;
}
}
}
</script>
SCRIPT
- my $buttons = <<BUTTONS;
+ $buttons = <<BUTTONS;
<br />
<input type="button" onclick="checkall(true)" value="Select All" />
<input type="button" onclick="checkall(false)" value="Unselect All" />