--- loncom/homework/grades.pm 2010/04/21 20:22:19 1.629 +++ loncom/homework/grades.pm 2010/06/06 02:40:35 1.635 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.629 2010/04/21 20:22:19 www Exp $ +# $Id: grades.pm,v 1.635 2010/06/06 02:40:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -820,9 +820,7 @@ sub listStudents { $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; } - my $result='

 ' - .&mt("View/Grade/Regrade Submissions for a Student or a Group of Students") - .'

'; + my $result=''; my $res_error; my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error); @@ -1269,12 +1267,6 @@ sub sub_page_js { } } - if (val == "Grade Student") { - if (formname.Status.value == "") { - formname.Status.value = "Active"; - } - formname.studentNo.value = total; - } formname.submit(); } @@ -1913,7 +1905,6 @@ sub submission { if ($counter == 0) { &sub_page_js($request); &sub_page_kw_js($request); - $request->print('

 '.&mt('Submission Record').'

'); # option to display problem, only once else it cause problems # with the form later since the problem has a form. @@ -2217,13 +2208,8 @@ KEYWORDS $request->print(''."\n"); # return if view submission with no grading option -# FIXME: the logic seems off here. Why show the grade button if you cannot grade? if (!&canmodify($usec)) { - my $toGrade.='  '."\n" if (&canmodify($usec)); - $toGrade.=''."\n"; - $request->print($toGrade); + $request->print('

'.&mt('No grading privileges').'

'); return; } else { $request->print(''."\n"); @@ -2341,10 +2327,10 @@ sub check_collaborators { next if ($record->{'resource.'.$part.'.collaborators'} eq ''); my (@good_collaborators, @bad_collaborators); foreach my $possible_collaborator - (split(/,?\s+/,$record->{'resource.'.$part.'.collaborators'})) { + (split(/[,;\s]+/,$record->{'resource.'.$part.'.collaborators'})) { $possible_collaborator =~ s/[\$\^\(\)]//g; next if ($possible_collaborator eq ''); - my ($co_name,$co_dom) = split(/\@|:/,$possible_collaborator); + my ($co_name,$co_dom) = split(/:/,$possible_collaborator); $co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i); next if ($co_name eq $uname && $co_dom eq $udom); # Doing this grep allows 'fuzzy' specification @@ -2357,13 +2343,13 @@ sub check_collaborators { } } if (scalar(@good_collaborators) != 0) { - $result.='
'.&mt('Collaborators: '); + $result.='
'.&mt('Collaborators:').'
    '; foreach my $name (@good_collaborators) { my ($lastname,$givenn) = split(/,/,$$fullname{$name}); push(@col_fullnames, $givenn.' '.$lastname); - $result.=$fullname->{$name}.'     '; + $result.='
  1. '.$fullname->{$name}.'
  2. '; } - $result.='
    '."\n"; + $result.='

'."\n"; my ($part)=split(/\./,$part); $result.=''. @@ -2596,16 +2582,6 @@ sub processHandGrade { return ''; } -# Go directly to grade student - from submission or link from chart page -# FIXME: looks like reading off the button label! - if ($button eq 'Grade Student') { - my $processUser = $env{'form.unamedom'.$env{'form.studentNo'}}; - ($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser); - $env{'form.fullname'} = $$fullname{$processUser}; - &submission($request,0,0,$symb); - return ''; - } - # Get the next/previous one or group of students my $firststu = $env{'form.unamedom0'}; my $laststu = $env{'form.unamedom'.($ngrade-1)}; @@ -2693,9 +2669,7 @@ sub processHandGrade { $ctr++; } if ($total < 0) { - my $the_end = '

'.&mt('LON-CAPA User Message').'


'."\n"; - $the_end.=&mt('Message: No more students for this section or class.').'

'."\n"; - $the_end.=&mt('Click on the button below to return to the grading menu.').'

'."\n"; + my $the_end.=&mt('Message: No more students for this section or class.').'

'."\n"; $request->print($the_end); } return ''; @@ -3824,18 +3798,14 @@ sub csvuploadmap_header { $javascript=&csvupload_javascript_forward_associate(); } - my $result=''; $symb = &Apache::lonenc::check_encrypt($symb); + $request->print('
'. + &mt('Total number of records found in file: [_1]',$distotal).'
'. + &mt('Associate entries from the uploaded file with as many fields as you can.')); + my $reverse=&mt("Reverse Association"); $request->print(< -

Uploading Class Grades

-$result -
-

Identify fields

-Total number of records found in file: $distotal
-Enter as many fields as you can. The system will inform you and bring you back -to this page if the data selected is insufficient to run your class.
- +
+ @@ -3891,7 +3861,7 @@ ENDPICK } sub checkforfile_js { - my $alertmsg = &mt('Please use the browse button to select a file from your local directory.'); + my $alertmsg = &mt('Please use the "Choose File" button to select a file from your local directory.'); my $result = &Apache::lonhtmlcommon::scripttag(<'."\n"; - $result.=''."\n"; + $result.=&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Specify a file containing the class scores for current resource.').''. + &Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row().''; my $upload=&mt("Upload Scores"); my $upfile_select=&Apache::loncommon::upfile_select_html(); my $ignore=&mt('Ignore First Line'); @@ -3926,9 +3896,10 @@ $upfile_select ENDUPFORM $result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", - &mt("How do I create a CSV file from a spreadsheet")) - .''."\n"; - $result.='

'."\n"; + &mt("How do I create a CSV file from a spreadsheet")). + ''. + &Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(); return $result; } @@ -3980,29 +3951,21 @@ sub csvuploadmap { sub csvuploadoptions { my ($request,$symb)= @_; + my $overwrite=&mt('Overwrite any existing score'); $request->print(< -

Uploading Class Grade Options

-

ENDPICK my %fields=&get_fields(); if (!defined($fields{'domain'})) { my $domform = &Apache::loncommon::select_dom_form($env{'request.role.domain'},'default_domain'); - $request->print("\n

Users are in domain: ".$domform."

\n"); + $request->print("\n

".&mt('Users are in domain: [_1]',$domform)."

\n"); } foreach my $key (sort(keys(%env))) { if ($key !~ /^form\.(.*)$/) { next; } @@ -4042,7 +4005,6 @@ sub csvuploadassign { &Apache::loncommon::load_tmp_file($request); my @gradedata = &Apache::loncommon::upfile_record_sep(); my %fields=&get_fields(); - $request->print('

Assigning Grades

'); my $courseid=$env{'request.course.id'}; my ($classlist) = &getclasslist('all',0); my @notallowed; @@ -8501,11 +8463,7 @@ sub submit_options_sequence { $result.='
'."\n". ''."\n"; - $result.=' -

- '.&mt('Grade page/folder for one student').' -

'. - &selectfield(0). + $result.=&selectfield(0). '
@@ -8524,11 +8482,7 @@ sub submit_options_table { $result.=''."\n". ''."\n"; - $result.=' -

- '.&mt('Grading table').' -

'. - &selectfield(0). + $result.=&selectfield(0). '
@@ -8570,10 +8524,7 @@ sub submit_options { $result.=''."\n". ''."\n"; - $result.=' -

- '.&mt('Select individual students to grade').' -

'.&selectfield(1).' + $result.=&selectfield(1).'
@@ -8586,6 +8537,14 @@ sub submit_options { sub selectfield { my ($full)=@_; + my %options = + (&Apache::lonlocal::texthash( + 'yes' => 'with submissions', + 'queued' => 'in grading queue', + 'graded' => 'with ungraded submissions', + 'incorrect' => 'with incorrect submissions', + 'all' => 'with any status'), + 'select_form_order' => ['yes','queued','graded','incorrect','all']); my $result='
@@ -8614,14 +8573,7 @@ sub selectfield { '.&mt('Submission Status').' '. - &Apache::loncommon::select_form('all','submitonly', - (&Apache::lonlocal::texthash( - 'yes' => 'with submissions', - 'queued' => 'in grading queue', - 'graded' => 'with ungraded submissions', - 'incorrect' => 'with incorrect submissions', - 'all' => 'with any status'), - 'select_form_order' => ['yes','queued','graded','incorrect','all'])). + &Apache::loncommon::select_form('all','submitonly',\%options). '
'; } $result.='

'; @@ -8715,11 +8667,11 @@ sub process_clicker { my ($r,$symb)=@_; if (!$symb) {return '';} my $result=&checkforfile_js(); - $result.='
'."\n"; - $result.=''."\n"; - $result.=''. + &Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row()."'.&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::start_data_table_row().''.&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::start_data_table_row().'
'."\n"; - $result.=' '.&mt('Specify a file containing the clicker information for this resource.'). - '
'."\n"; + $result.=&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Specify a file containing clicker information and set grading options.').'\n"; # Attempt to restore parameters from last session, set defaults if not present my %Saveable_Parameters=&clicker_grading_parameters(); &Apache::loncommon::restore_course_settings('grades_clicker', @@ -8736,7 +8688,7 @@ sub process_clicker { } } - my $upload=&mt("Upload File"); + my $upload=&mt("Evaluate File"); my $type=&mt("Type"); my $attendance=&mt("Award points just for participation"); my $personnel=&mt("Correctness determined from response by course personnel"); @@ -8746,8 +8698,8 @@ sub process_clicker { my $pcorrect=&mt("Percentage points for correct solution"); my $pincorrect=&mt("Percentage points for incorrect solution"); my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype', - ('iclicker' => 'i>clicker', - 'interwrite' => 'interwrite PRS')); + {'iclicker' => 'i>clicker', + 'interwrite' => 'interwrite PRS'}); $symb = &Apache::lonenc::check_encrypt($symb); $result.= &Apache::lonhtmlcommon::scripttag(<
-
+ENDUPFORM + $result.='
'.(<$attendance

@@ -8802,13 +8757,17 @@ ENDUPFORM
    -
+ENDGRADINGFORM + $result.='
'.(<$pcorrect:

' -ENDUPFORM - $result.='
'."\n". - '


'."\n"; +ENDPERCFORM + $result.=''. + &Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(); return $result; } @@ -8888,11 +8847,12 @@ sub process_clicker_file { $result.=&Apache::loncommon::studentbrowser_javascript(); $symb = &Apache::lonenc::check_encrypt($symb); - my $heading=&mt('Scanning clicker file'); - $result.=(<
-'. + &Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row().(<
@@ -8940,7 +8900,9 @@ ENDHEADER } elsif ($clicker_ids{$id}) { if ($clicker_ids{$id}=~/\,/) { # More than one user with the same clicker! - $result.="\n
".&mt('Clicker registered more than once').": ".$id."
"; + $result.="".&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::start_data_table_row()."
".&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::start_data_table_row()."
-$heading
+ $result.=&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Evaluate clicker file').'". + &mt('Clicker registered more than once').": ".$id."
"; $result.="\n".''. "
". + &mt('Unregistered Clicker')." ".$id."
"; $result.="\n".''. "\n".&mt("Username").":  ". "\n".&mt("Domain").": ". @@ -8980,8 +8944,9 @@ ENDHEADER } else { $result.='
'; } - $result.='
'."\n". - '


'."\n"; + $result.=''. + &Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(); return $result; } @@ -9055,14 +9020,11 @@ sub assign_clicker_grades { # FIXME: This should probably look for the first handgradeable part my $part=$$partlist[0]; # Start screen output - my $result=''; - - my $heading=&mt('Assigning grades based on clicker file'); - $result.=(<
-'. + &Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row().'
-$heading
-ENDHEADER + my $result=&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Assigning grades based on clicker file').''; # Get correct result # FIXME: Possibly need delimiter other than ":" my @correct=(); @@ -9097,6 +9059,7 @@ ENDHEADER my $pcorrect=$env{'form.pcorrect'}; my $pincorrect=$env{'form.pincorrect'}; my $storecount=0; + my %users=(); foreach my $key (keys(%env)) { my $user=''; if ($key=~/^form\.student\:(.*)$/) { @@ -9110,7 +9073,13 @@ ENDHEADER $user=$env{'form.multi'.$id}; } } - if ($user) { + if ($user) { + if ($users{$user}) { + $result.='
'. + &mt("More than one entry found for [_1]!",$user). + '
'; + } + $users{$user}=1; my @answer=split(/\,/,$env{$key}); my $sum=0; my $realnumber=$number; @@ -9150,8 +9119,9 @@ ENDHEADER } # We are done $result.='
'.&mt('Successfully stored grades for [quant,_1,student].',$storecount). - '
'."\n". - '


'."\n"; + ''. + &Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(); return $result; } @@ -9167,6 +9137,7 @@ sub startpage { unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"}); $r->print(&Apache::loncommon::start_page('Grading',undef, {'bread_crumbs' => $crumbs})); + $r->print('

'.$$crumbs[-1]{'text'}.'

'); unless ($nodisplayflag) { $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag)); } @@ -9174,7 +9145,7 @@ sub startpage { sub select_problem { my ($r)=@_; - $r->print('

'.&mt('Select the problem or one of the problems you want to grade').'

'); + $r->print('

'.&mt('Select the problem or one of the problems you want to grade').'

'); $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1)); $r->print(''); $r->print('
');