'."\n";
+ $result.= ''.
+ 'Username | Fullname | '."\n";
+
+ my %scoreptr = (
+ 'correct' =>'correct_by_override',
+ 'incorrect'=>'incorrect_by_override',
+ 'excused' =>'excused',
+ 'ungraded' =>'ungraded_attempted',
+ 'nothing' => '',
+ );
+ my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($ENV{'form.section'},'0');
- function savedMsgHeader(Nmsg,usrctr,fullname) {
- var height = 30*Nmsg+250;
- var scrollbar = "no";
- if (height > 600) {
- height = 600;
- scrollbar = "yes";
+ my (@partid);
+ my %weight = ();
+ my ($i,$ctr,$count,$rec_update) = (0,0,0,0);
+ while ($ctr < $ENV{'form.totalparts'}) {
+ my $partid = $ENV{'form.partid_'.$ctr};
+ push @partid,$partid;
+ $weight{$partid} = $ENV{'form.weight_'.$partid};
+ $ctr++;
+ $result .= 'Part '.$partid.
+ ' (Weight = '.$weight{$partid}.') | ';
}
-/* if (window.pWin)
- window.pWin.close(); */
- pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx=70,screeny=75,width=600,height='+height);
- pWin.document.write("");
- pWin.document.write("Message Central");
-
- pWin.document.write("
-SUBJAVASCRIPT
-}
+#----------------------------------------------------------------------------
+#
+#-------------------------- Next few routines handles grading by csv upload
+#
+#--- Javascript to handle csv upload
sub csvupload_javascript_reverse_associate {
return(<';
+ $result.='Resource: '.$url.' | ';
+ my ($partlist,$handgrade) = &response_type($url);
+ my ($resptype,$hdgrade)=('','no');
+ for (sort keys(%$handgrade)) {
+ my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
+ $resptype = $responsetype;
+ $hdgrade = $handgrade if ($handgrade eq 'yes');
+ $result.='Part '.(split(/_/))[0].' | '.
+ 'Type: '.$responsetype.' | '.
+ 'Handgrade: '.$handgrade.' | ';
+ }
+ $result.=' ';
$request->print(<
-Uploading Class Grades for resource $url
+Uploading Class Grades
+$result
Identify fields
Total number of records found in file: $distotal
@@ -1697,6 +2007,7 @@ sub csvuploadmap {
my ($i,$keyfields);
if (@records) {
my @fields=&csvupload_fields($url);
+
if ($ENV{'form.upfile_associate'} eq 'reverse') {
&Apache::loncommon::csv_print_samples($request,\@records);
$i=&Apache::loncommon::csv_print_select_table($request,\@records,
@@ -1720,7 +2031,7 @@ sub csvuploadassign {
my ($symb,$url)=&get_symb_and_url($request);
if (!$symb) {return '';}
&Apache::loncommon::load_tmp_file($request);
- my @gradedata=&Apache::loncommon::upfile_record_sep();
+ my @gradedata = &Apache::loncommon::upfile_record_sep();
my @keyfields = split(/\,/,$ENV{'form.keyfields'});
my %fields=();
for (my $i=0; $i<=$ENV{'form.nfields'}; $i++) {
@@ -1736,8 +2047,6 @@ sub csvuploadassign {
}
$request->print('Assigning Grades');
my $courseid=$ENV{'request.course.id'};
-# my $cdom=$ENV{"course.$courseid.domain"};
-# my $cnum=$ENV{"course.$courseid.num"};
my ($classlist) = &getclasslist('all','1');
my @skipped;
my $countdone=0;
@@ -1774,22 +2083,193 @@ sub csvuploadassign {
$request->print(&show_grading_menu_form($symb,$url));
return '';
}
+#------------- end of section for handling csv file upload ---------
+#
+#-------------------------------------------------------------------
-sub send_header {
- my ($request)= @_;
- $request->print(&Apache::lontexconvert::header());
-# $request->print("
-#");
- $request->print('');
+#-------------------------- Menu interface -------------------------
+#
+#--- Show a Grading Menu button - Calls the next routine ---
+sub show_grading_menu_form {
+ my ($symb,$url)=@_;
+ my $result.=''."\n";
+ return $result;
}
-sub send_footer {
- my ($request)= @_;
- $request->print('');
- $request->print(&Apache::lontexconvert::footer());
+#--- Displays the main menu page -------
+sub gradingmenu {
+ my ($request) = @_;
+ my ($symb,$url)=&get_symb_and_url($request);
+ if (!$symb) {return '';}
+ my $result=' Select a Grading Method';
+ $result.='';
+ $result.='Resource: '.$url.' | ';
+ my ($partlist,$handgrade) = &response_type($url);
+ my ($resptype,$hdgrade)=('','no');
+ for (sort keys(%$handgrade)) {
+ my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
+ $resptype = $responsetype;
+ $hdgrade = $handgrade if ($handgrade eq 'yes');
+ $result.='Part '.(split(/_/))[0].' | '.
+ 'Type: '.$responsetype.' | '.
+ 'Handgrade: '.$handgrade.' | ';
+ }
+ $result.=' ';
+ $result.=&view_edit_entire_class_form($symb,$url).' ';
+ $result.=&upcsvScores_form($symb,$url).' ';
+ $result.=&viewGradeaStu_form($symb,$url,$resptype,$hdgrade).' ';
+ $result.=&verifyReceipt_form($symb,$url)
+ if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb));
+
+ return $result;
+}
+
+#--- Menu for grading a section or the whole class ---
+sub view_edit_entire_class_form {
+ my ($symb,$url)=@_;
+ my ($classlist,$sections) = &getclasslist('all','0');
+ my $result.=''."\n";
+ $result.=''."\n";
+ $result.=' Grade Entire Section or Class | '."\n";
+ $result.=''."\n";
+ $result.=''."\n";
+ $result.=' | '."\n";
+ $result.=' | '."\n";
+ return $result;
+}
+
+#--- Menu to upload a csv scores ---
+sub upcsvScores_form {
+ my ($symb,$url) = @_;
+ if (!$symb) {return '';}
+ my $result = ''."\n";
+
+ $result.=''."\n";
+ $result.=''."\n";
+ $result.=' | '."\n";
+ return $result;
+}
+
+#--- Handgrading problems ---
+sub viewGradeaStu_form {
+ my ($symb,$url,$response,$handgrade) = @_;
+ my ($classlist,$sections) = &getclasslist('all','0');
+ my $result.=''."\n";
+ $result.=''."\n";
+ $result.=' ';
+ if ($handgrade eq 'yes') {
+ $result.="View/Grade ";
+ } else {
+ $result.="View ";
+ }
+ $result.='an Individual Student\'s Submission | '."\n";
+ $result.=''."\n";
+ $result.=''."\n";
+ $result.=' | '."\n";
+ $result.=' | '."\n";
+ return $result;
+}
+
+#--- Form to input a receipt number ---
+sub verifyReceipt_form {
+ my ($symb,$url) = @_;
+ my $result = ''."\n";
+
+ my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'});
+
+ $result.=''."\n";
+ $result.=''."\n";
+ $result.=' Verify a Submission Receipt Issued by this Server | '."\n";
+ $result.=''."\n";
+ $result.='';
+ $result.=' | '."\n";
+ $result.=' | '."\n";
+ return $result;
}
sub handler {
@@ -1801,7 +2281,7 @@ sub handler {
$request->content_type('text/html');
}
$request->send_http_header;
- return OK if $request->header_only;
+ return '' if $request->header_only;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
my $url=$ENV{'form.url'};
my $symb=$ENV{'form.symb'};
@@ -1830,17 +2310,16 @@ sub handler {
'grade_courseid' => $tcrsid,
'grade_symb' => $tsymb)));
} else {
- $request->print('Not authorized: '.$token.'');
+ $request->print('Not authorized: '.$token.'');
}
} else {
- $request->print('Not a valid DocID: '.$token.'');
+ $request->print('Not a valid DocID: '.$token.'');
}
} else {
$request->print(&Apache::lonxml::tokeninputfield());
}
}
} else {
- #&Apache::lonhomework::showhashsubset(\%ENV,'^form');
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});
if ($command eq 'submission') {
&listStudents($request) if ($ENV{'form.student'} eq '');
@@ -1863,8 +2342,6 @@ sub handler {
$request->print(&viewclasslist($request));
} elsif ($command eq 'csvuploadmap') {
$request->print(&csvuploadmap($request));
-# } elsif ($command eq 'receiptInput') {
-# &receiptInput($request);
} elsif ($command eq 'csvuploadassign') {
if ($ENV{'form.associate'} ne 'Reverse Association') {
$request->print(&csvuploadassign($request));
@@ -1881,7 +2358,24 @@ sub handler {
}
}
&send_footer($request);
- return OK;
+ return '';
+}
+
+sub send_header {
+ my ($request)= @_;
+ $request->print(&Apache::lontexconvert::header());
+# $request->print("
+#");
+ $request->print(&Apache::loncommon::bodytag('Grading'));
+}
+
+sub send_footer {
+ my ($request)= @_;
+ $request->print('');
+ $request->print(&Apache::lontexconvert::footer());
}
1;
|