[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm lonselstudent.pm

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 15 May 2006 22:01:17 -0000


foxr		Mon May 15 18:01:17 2006 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm lonselstudent.pm 
  Log:
  Allow specification of the form name in student selector too.
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.148 loncom/interface/lonhelper.pm:1.149
--- loncom/interface/lonhelper.pm:1.148	Thu May 11 17:10:21 2006
+++ loncom/interface/lonhelper.pm	Mon May 15 18:01:12 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.148 2006/05/11 21:10:21 foxr Exp $
+# $Id: lonhelper.pm,v 1.149 2006/05/15 22:01:12 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2355,11 +2355,12 @@
     #   Current personel
 
     $result .= &Apache::lonselstudent::render_student_list( $current_members,
-				     "current",
-				     \%defaultUsers,
-				     $self->{'multichoice'},
-				     $self->{'variable'},
-				     1);
+							    "helpform",
+							    "current", 
+							    \%defaultUsers,
+							    $self->{'multichoice'},
+							    $self->{'variable'},
+							    1);
 
 
     # If activeonly is not set then we can also give the expired students:
@@ -2369,19 +2370,21 @@
 	# And future.
 
 	$result .= &Apache::lonselstudent::render_student_list( $future_members,
-					 "future",
-					 \%defaultUsers,
-					 $self->{'multichoice'},
-					 $self->{'variable'},
-					 0);
+								"helpform",
+								"future",
+								\%defaultUsers,
+								$self->{'multichoice'},
+								$self->{'variable'},
+								0);
 	# Past 
 
 	$result .= &Apache::lonselstudent::render_student_list($expired_members,
-					"past",
-					\%defaultUsers,
-					$self->{'multichoice'},
-					$self->{'variable'},
-					0);
+							       "helpform",
+							       "past",
+							       \%defaultUsers,
+							       $self->{'multichoice'},
+							       $self->{'variable'},
+							       0);
     }
 
 
Index: loncom/interface/lonselstudent.pm
diff -u loncom/interface/lonselstudent.pm:1.1 loncom/interface/lonselstudent.pm:1.2
--- loncom/interface/lonselstudent.pm:1.1	Thu May 11 17:10:21 2006
+++ loncom/interface/lonselstudent.pm	Mon May 15 18:01:12 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # lonselstudent.pm : Reusable subs for student selection.
 #
-# $Id: lonselstudent.pm,v 1.1 2006/05/11 21:10:21 foxr Exp $
+# $Id: lonselstudent.pm,v 1.2 2006/05/15 22:01:12 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -155,6 +155,7 @@
 #  Parameters:
 #     $students    - Students in the section. (ref to array of references
 #                    to arrays).
+#     $formname    - Name of the form in which this stuff gets rendered.
 #     $formprefix  - form path prefix for form element names
 #                    This is used to make each form element
 #                    so that the segments having to do with each
@@ -171,7 +172,7 @@
 #     HTML  text to add to the rendering of the helper.
 #
 sub render_student_list {
-    my ($students, $formprefix, $defaultusers,
+    my ($students, $formname, $formprefix, $defaultusers,
 	$multiselect, $resultname, $javascript) = @_;
 
     my $result = "";
@@ -184,8 +185,8 @@
     function findElement(name) {
 	var i;
 	var ele;
-	for(i =0; i < document.forms.helpform.elements.length; i++) {
-	    ele = document.forms.helpform.elements[i];
+	for(i =0; i < document.forms.$formname.elements.length; i++) {
+	    ele = document.forms.$formname.elements[i];
 	    if(ele.name == name) {
 		return ele;
 	    }
@@ -219,8 +220,8 @@
     function setAllStudents(value, which) {
 	var i;
 	var ele;
-	for (i =0; i < document.forms.helpform.elements.length; i++) {
-	    ele = document.forms.helpform.elements[i];
+	for (i =0; i < document.forms.$formname.elements.length; i++) {
+	    ele = document.forms.$formname.elements[i];
 	    if(isStudent(ele) && rightSubForm(ele, which)) {
 		ele.checked=value;
 	    }
@@ -229,8 +230,8 @@
     function setAllCoursePersonnel(value, which) {
 	var i;
 	var ele;
-	for (i =0; i < document.forms.helpform.elements.length; i++) {
-	    ele = document.forms.helpform.elements[i];
+	for (i =0; i < document.forms.$formname.elements.length; i++) {
+	    ele = document.forms.$formname.elements[i];
 	    if(!isStudent(ele) && rightSubForm(ele, which)) {
 		ele.checked = value;
 	    }
@@ -239,8 +240,8 @@
     function setSection(which, value, subform) {
 	var i;
 	var ele;
-	for (i =0; i < document.forms.helpform.elements.length; i++) {
-	    ele = document.forms.helpform.elements[i];
+	for (i =0; i < document.forms.$formname.elements.length; i++) {
+	    ele = document.forms.$formname.elements[i];
 	    if (ele.value.indexOf(':') != -1) {
 		if ((section(ele) == which) && rightSubForm(ele, subform)) {
 		    ele.checked = value;