[LON-CAPA-cvs] cvs: loncom /homework grades.pm

ng lon-capa-cvs@mail.lon-capa.org
Fri, 11 Jul 2003 20:22:43 -0000


ng		Fri Jul 11 16:22:43 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Use lonhtml::StatusOptions to display student status.
  Format display of fullname (username) to be consistent across different pages.
  
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.111 loncom/homework/grades.pm:1.112
--- loncom/homework/grades.pm:1.111	Fri Jul 11 10:45:59 2003
+++ loncom/homework/grades.pm	Fri Jul 11 16:22:43 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.111 2003/07/11 14:45:59 ng Exp $
+# $Id: grades.pm,v 1.112 2003/07/11 20:22:43 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,6 +41,7 @@
 use Apache::lonxml;
 use Apache::lonnet;
 use Apache::loncommon;
+use Apache::lonhtmlcommon;
 use Apache::lonnavmaps;
 use Apache::lonhomework;
 use Apache::loncoursedata;
@@ -129,8 +130,8 @@
 	my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
             @{$classlist->{$_}};
 	# filter students according to status selected
-	if ($filterlist && $ENV{'form.status'} ne 'Any') {
-	    if ($ENV{'form.status'} ne $status) {
+	if ($filterlist && $ENV{'form.Status'} ne 'Any') {
+	    if ($ENV{'form.Status'} ne $status) {
 		delete ($classlist->{$_});
 		next;
 	    }
@@ -391,7 +392,7 @@
     }
 
     function reLoadList(formname) {
-	if (formname.saveStatusOld.value == pullDownSelection(formname.status)) {return;}
+	if (formname.saveStatusOld.value == pullDownSelection(formname.Status)) {return;}
 	formname.command.value = 'submission';
 	formname.submit();
     }
@@ -425,8 +426,8 @@
 	$gradeTable.='<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> handgrade only'."\n";
     }
 
-    my $saveStatus = $ENV{'form.status'} eq '' ? 'Active' : $ENV{'form.status'};
-    $ENV{'form.status'} = $saveStatus;
+    my $saveStatus = $ENV{'form.Status'} eq '' ? 'Active' : $ENV{'form.Status'};
+    $ENV{'form.Status'} = $saveStatus;
 
     $gradeTable.='<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last sub only'."\n".
 	'<input type="radio" name="lastSub" value="last" /> last sub & parts info'."\n".
@@ -442,12 +443,9 @@
 	'<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
 	'<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n";
 
-    $gradeTable.='<b>Student Status:</b> <select onchange="javascript:reLoadList(this.form);" name="status">'.
-	'<option value="Active" '.($saveStatus eq 'Active' ? 'selected' : '').'>Active</option>'.
-	'<option value="Expired" '.($saveStatus eq 'Expired' ? 'selected' : '').'>Expired</option>'.
-	'<option value="Any" '.($saveStatus eq 'Any' ? 'selected' : '').'>Any</option>'.
-	'</select><br />'."\n";
- 
+    $gradeTable.='<b>Student Status:</b> '.
+	&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,'javascript:reLoadList(this.form);').'<br />';
+
     $gradeTable.='To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
 	'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".
 	' on the check boxes for the group of students.<br />'."\n".
@@ -1975,7 +1973,7 @@
     }
     $result.= '<table border=0><tr><td bgcolor="#777777">'."\n".
 	'<table border=0><tr bgcolor="#deffff">'.
-	'<td><b>Fullname</b></td><td><b>Username</b></td><td><b>Domain</b></td>'."\n";
+	'<td><b>Fullname</b> <font color="#999999">(Username)</font></td>'."\n";
     my (@parts) = sort(&getpartlist($url));
     foreach my $part (@parts) {
 	my $display=&Apache::lonnet::metadata($url,$part.'.display');
@@ -2009,7 +2007,7 @@
 	'onClick="javascript:submit();" TARGET=_self /></form>'."\n";
     if (scalar(%$fullname) eq 0) {
 	my $colspan=3+scalar(@parts);
-	$result='<font color="red">There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.status'}.'" to modify or grade.</font>';
+	$result='<font color="red">There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.Status'}.'" to modify or grade.</font>';
     }
     $result.=&show_grading_menu_form($symb,$url);
     return $result;
@@ -2023,8 +2021,8 @@
     my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
     my $result='<tr bgcolor="#ffffdd"><td>'.
 	'<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.
-	'\')"; TARGET=_self>'.$fullname.'</a>'.
-	'</td><td>'.$uname.'</td><td align="middle">'.$udom.'</td>'."\n";
+	'\')"; TARGET=_self>'.$fullname.'</a> '.
+	'<font color="#999999">('.$uname.($ENV{'user.domain'} eq $udom ? '' : ':'.$udom).')</font></td>'."\n";
     foreach my $apart (@$parts) {
 	my ($part,$type) = &split_part_type($apart);
 	my $score=$record{"resource.$part.$type"};
@@ -2618,7 +2616,7 @@
 	'<input type="radio" name="lastSub" value="all" /> all details'."\n";
 
     $result.='<input type="hidden" name="section"     value="'.$getsec.'" />'."\n".
-	'<input type="hidden" name="status"     value="'.$ENV{'form.status'}.'" />'."\n".
+	'<input type="hidden" name="Status"     value="'.$ENV{'form.Status'}.'" />'."\n".
 	'<input type="hidden" name="command" value="displayPage" />'."\n".
 	'<input type="hidden" name="url"     value="'.$url.'" />'."\n".
 	'<input type="hidden" name="symb"    value="'.$symb.'" />'."\n".
@@ -3341,7 +3339,7 @@
     function checkChoice(formname) {
 	var cmd = formname.command;
 	formname.saveState.value = "saveCmd="+radioSelection(cmd)+":saveSec="+pullDownSelection(formname.section)+
-	    ":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.status);
+	    ":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status);
 	if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[3].checked || cmd[4].checked) formname.submit();
 	if (cmd[5].checked) {
 	    if (!checkReceiptNo(formname,'notOK')) { return false;}
@@ -3479,12 +3477,7 @@
     }
     $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="on"' : ''). '>all</select> &nbsp; ';
 
-    $result.='Student Status:</b><select name="status">'.
-	'<option value="Active" '.($saveStatus eq 'Active' ? 'selected' : '').'>Active</option>'.
-	'<option value="Expired" '.($saveStatus eq 'Expired' ? 'selected' : '').'>Expired</option>'.
-	'<option value="Any" '.($saveStatus eq 'Any' ? 'selected' : '').'>Any</option>'.
-	'</select>';
-
+    $result.='Student Status:</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
     $result.=' &nbsp; <font color="red">(Applies to the first three options only.)</font>'."\n";
 
     if (ref($sections)) {