--- loncom/homework/grades.pm 2010/01/27 06:28:35 1.574.2.8 +++ loncom/homework/grades.pm 2010/04/01 00:58:43 1.604 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.574.2.8 2010/01/27 06:28:35 raeburn Exp $ +# $Id: grades.pm,v 1.604 2010/04/01 00:58:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -96,6 +96,9 @@ sub ssi_print_error { # # --- Retrieve the parts from the metadata file.--- +# Returns an array of everything that the resources stores away +# + sub getpartlist { my ($symb,$errorref) = @_; @@ -121,13 +124,17 @@ sub getpartlist { } # --- Get the symbolic name of a problem and the url +# Generate an error message if symb could not be found unless silent flag is set +# Takes $env{'form.symb'} by default; if not present, takes $env{'form.url'} and tries to get symb from that +# + sub get_symb { my ($request,$silent) = @_; (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); if ($symb eq '') { if (!$silent) { - $request->print("Unable to handle ambiguous references:$url:."); + $request->print(&mt("Unable to handle ambiguous references: [_1].",$url)); return (); } } @@ -160,6 +167,10 @@ sub response_type { return; } my $res = $navmap->getBySymb($symb); + unless (ref($res)) { + $$response_error = 1; + return; + } my $partlist = $res->parts(); my %vPart = map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart')); @@ -195,55 +206,14 @@ sub get_display_part { my ($partID,$symb)=@_; my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); if (defined($display) and $display ne '') { - $display.= " (id $partID)"; + $display.= ' (' + .&mt('Part ID: [_1]',$partID).')'; } else { $display=$partID; } return $display; } -#--- Show resource title -#--- and parts and response type -sub showResourceInfo { - my ($symb,$probTitle,$checkboxes,$res_error) = @_; - my $col=3; - if ($checkboxes) { $col=4; } - my $result = '

'.&mt('Current Resource').': '.$probTitle.'

'."\n"; - my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); - if (ref($res_error)) { - if ($$res_error) { - return; - } - } - $result .=''; - my %resptype = (); - my $hdgrade='no'; - my %partsseen; - foreach my $partID (sort(keys(%$responseType))) { - foreach my $resID (sort(keys(%{ $responseType->{$partID} }))) { - my $handgrade=$$handgrade{$partID.'_'.$resID}; - my $responsetype = $responseType->{$partID}->{$resID}; - $hdgrade = $handgrade if ($handgrade eq 'yes'); - $result.=''; - if ($checkboxes) { - if (exists($partsseen{$partID})) { - $result.=""; - } else { - $result.=""; - } - $partsseen{$partID}=1; - } - my $display_part=&get_display_part($partID,$symb); - $result.=''. - ''; -# ''; - } - } - $result.='
 '.&mt('Part').': '.$display_part. - ' '.$resID.''.&mt('Type').': '.$responsetype.'
'.&mt('Handgrade: [_1]',$handgrade).'
'."\n"; - return $result,$responseType,$hdgrade,$partlist,$handgrade; -} - sub reset_caches { &reset_analyze_cache(); &reset_perm(); @@ -413,7 +383,7 @@ sub cleanRecord { return '
'. ''.$toprow.''. ''. - $grayFont.$bottomrow.''.'
'.&mt('Answer').'
'.$grayFont.&mt('Option ID').'
'; + $bottomrow.''.''; } elsif ($response eq 'essay') { if (! exists ($env{'form.'.$symb})) { my (%keyhash) = &Apache::lonnet::dump('nohist_handgrade', @@ -475,8 +445,7 @@ sub cleanRecord { #-- A couple of common js functions sub commonJSfunctions { my $request = shift; - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< 1) { @@ -504,7 +473,6 @@ sub commonJSfunctions { return selectOne.value; } } - COMMONJSFUNCTIONS } @@ -659,13 +627,13 @@ sub student_gradeStatus { sub jscriptNform { my ($symb) = @_; my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); - my $jscript=''."\n"; + "\n"); $jscript.= '
'."\n". ''."\n". ''."\n". @@ -722,7 +690,7 @@ sub most_similar { # ignore empty submissions (occuring when only files are sent) - unless ($uessay=~/\w+/) { return ''; } + unless ($uessay=~/\w+/s) { return ''; } # these will be returned. Do not care if not at least 50 percent similar my $limit=0.6; @@ -759,6 +727,19 @@ sub most_similar { #------------------------------------ Receipt Verification Routines # + +sub initialverifyreceipt { + my $request = shift; + &commonJSfunctions($request); + my ($symb) = &get_symb($request); + return ''. + &Apache::lonnet::recprefix($env{'request.course.id'}). + '-'. + ''."\n". + ''. + "
\n"; +} + #--- Check whether a receipt number is valid.--- sub verifyreceipt { my $request = shift; @@ -771,7 +752,7 @@ sub verifyreceipt { my $title.= '

'. - &mt('Verifying Receipt No. [_1]',$receipt). + &mt('Verifying Receipt No. [_1]',$receipt). '

'."\n". '

'.&mt('Resource: [_1]',$env{'form.probTitle'}). '

'."\n"; @@ -831,11 +812,14 @@ sub verifyreceipt { } } if ($matches == 0) { - $string = $title.&mt('No match found for the above receipt.'); + $string = $title + .'

' + .&mt('No match found for the above receipt number.') + .'

'; } else { $string = &jscriptNform($symb).$title. '

'. - &mt('The above receipt matches the following [numerate,_1,student].',$matches). + &mt('The above receipt number matches the following [quant,_1,student].',$matches). '

'. $header. $contents. @@ -865,14 +849,15 @@ sub listStudents { .&mt("$viewgrade Submissions for a Student or a Group of Students") .''; - my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($symb,$env{'form.probTitle'},($env{'form.showgrading'} eq 'yes')); + my ($partlist,$handgrade,$responseType) = &response_type($symb +#,$res_error + ); my %lt = &Apache::lonlocal::texthash ( 'multiple' => 'Please select a student or group of students before clicking on the Next button.', 'single' => 'Please select the student before clicking on the Next button.', ); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< LISTJAVASCRIPT &commonJSfunctions($request); @@ -910,7 +894,7 @@ LISTJAVASCRIPT my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked="checked"' : ''; my $checklastsub = $checkhdgrade eq '' ? 'checked="checked"' : ''; my $gradeTable='
'. - "\n".$table; + "\n"; $gradeTable .= &Apache::lonhtmlcommon::start_pick_box(); $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text')) @@ -933,10 +917,18 @@ LISTJAVASCRIPT my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status; $env{'form.Status'} = $saveStatus; $submission_options.= - ''."\n". - ''."\n". - ''."\n". - ''; + ''. + ''."\n". + ''. + ''."\n". + ''. + ''."\n". + ''. + ''; $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Submissions')) .$submission_options .&Apache::lonhtmlcommon::row_closure(); @@ -982,8 +974,8 @@ LISTJAVASCRIPT # checkall buttons $gradeTable.=&check_script('gradesub', 'stuinfo'); $gradeTable.='
'."\n"; + 'onclick="javascript:checkSelect(this.form.stuinfo);" '."\n". + 'value="'.&mt('Next').' →" />
'."\n"; $gradeTable.=&check_buttons(); my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup); $gradeTable.= &Apache::loncommon::start_data_table(). @@ -1100,9 +1092,9 @@ LISTJAVASCRIPT } $gradeTable.=&Apache::loncommon::end_data_table()."\n". - '
'."\n"; + ''."\n"; if ($ctr == 0) { my $num_students=(scalar(keys(%$fullname))); if ($num_students eq 0) { @@ -1129,7 +1121,7 @@ LISTJAVASCRIPT sub check_script { my ($form, $type)=@_; - my $chkallscript=''."\n"; +'."\n"); return $chkallscript; } @@ -1199,8 +1191,7 @@ sub processGroup { sub sub_page_js { my $request = shift; my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< SUBJAVASCRIPT } @@ -1378,8 +1368,7 @@ sub sub_page_kw_js { my $iconpath = $request->dir_config('lonIconsURL'); &commonJSfunctions($request); - my $inner_js_msg_central=< + my $inner_js_msg_central= &Apache::lonhtmlcommon::scripttag(< INNERJS - my $inner_js_highlight_central=< + my $inner_js_highlight_central= &Apache::lonhtmlcommon::scripttag(< INNERJS my $start_page_msg_central = @@ -1455,8 +1441,7 @@ INNERJS my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); $docopen=~s/^document\.//; my $alertmsg = &mt('Please select a word or group of words from document and then click this link.'); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(<"); pDoc.write("<\\/td><\\/tr><\\/table> "); - pDoc.write("  "); - pDoc.write("

"); + pDoc.write("  "); + pDoc.write("

"); pDoc.write("<\\/form>"); pDoc.write('$end_page_msg_central'); pDoc.close(); @@ -1680,14 +1665,13 @@ INNERJS var hDoc = hwdWin.document; hDoc.write("<\\/table>"); hDoc.write("<\\/td><\\/tr><\\/table> "); - hDoc.write("  "); - hDoc.write("

"); + hDoc.write("  "); + hDoc.write("

"); hDoc.write("<\\/form>"); hDoc.write('$end_page_highlight_central'); hDoc.close(); } - SUBJAVASCRIPT } @@ -1700,6 +1684,25 @@ sub get_increment { return $increment; } +sub gradeBox_start { + return ( + &Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .''.&mt('Part').'' + .''.&mt('Points').'' + .' ' + .''.&mt('Assign Grade').'' + .''.&mt('Weight').'' + .''.&mt('Grade Status').'' + .&Apache::loncommon::end_data_table_header_row() + ); +} + +sub gradeBox_end { + return ( + &Apache::loncommon::end_data_table() + ); +} #--- displays the grading box, used in essay type problem and grading by page/sequence sub gradeBox { my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; @@ -1719,7 +1722,7 @@ sub gradeBox { if ($last_resets{$partid}) { $aggtries = &get_num_tries($record,$last_resets{$partid},$partid); } - $result.=''; + $result.=&Apache::loncommon::start_data_table_row(); my $ctr = 0; my $thisweight = 0; my $increment = &get_increment(); @@ -1727,7 +1730,7 @@ sub gradeBox { my $radio.='
'."\n"; # display radio buttons in a nice table 10 across while ($thisweight<=$wgt) { $radio.= '\n"; $radio.=(($ctr+1)%10 == 0 ? '' : ''); @@ -1738,13 +1741,13 @@ sub gradeBox { my $line.=''."\n"; $line.=''."\n"; + $line.='',$display_part,$radio,$line); $result .= - ''; - $result.='
/'.$wgt.' '.$wgtmsg. ($$record{'resource.'.$partid.'.solved'} eq 'correct_by_student' ? ' '.$checkIcon : ''). - ' '.&mt('Grade Status').':'."\n"; - $line.=''."\n"; - #&mt('Part:[_1]Points:[_2]or[_3]'.&mt('Part').':'.$display_part.''.&mt('Points').':'.$radio.''.&mt('or').''.$line.'
'."\n"; + ''.$display_part.''.$radio.''.&mt('or').''.$line.''; + $result.=&Apache::loncommon::end_data_table_row(); $result.=''."\n". ''."\n". ''. - &mt('View of the problem'). - '
'. - $rendered. - '
'; + '
' + .'

'.&mt('View of the problem').'

' + .$rendered + .'
'; $companswer= - '
'. - &mt('Correct answer'). - '
'. - $companswer. - '
'; + '
' + .'

'.&mt('Correct answer').'

' + .$companswer + .'
'; my $result; if ($mode eq 'both') { - $result=$rendered.$companswer; + $result=$rendered.$companswer; } elsif ($mode eq 'text') { - $result=$rendered; + $result=$rendered; } elsif ($mode eq 'answer') { - $result=$companswer; + $result=$companswer; } - $result='
'.$result.'
'; return $result; } @@ -2036,7 +2035,7 @@ sub submission { $request->print(<Keyword Options:  List    -Paste Selection to List    Highlight Attribute

KEYWORDS @@ -2052,12 +2051,31 @@ KEYWORDS } # This is where output for one specific student would start - my $add_class = ($counter%2) ? 'LC_grade_show_user_odd_row' : ''; - $request->print("\n\n". - '
'. - '
'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'
'. - '
'."\n"); + my $add_class = ($counter%2) ? ' LC_grade_show_user_odd_row' : ''; + $request->print( + "\n\n" + .'
' + .'

'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'

' + ."\n" + ); + # Show additional functions if allowed + if ($perm{'vgr'}) { + $request->print( + &Apache::loncommon::track_student_link( + &mt('View recent activity'), + $uname,$udom,'check') + .' ' + ); + } + if ($perm{'opa'}) { + $request->print( + &Apache::loncommon::pprmlink( + &mt('Set/Change parameters'), + $uname,$udom,$symb,'check')); + } + + # Show Problem if ($env{'form.vProb'} eq 'all' or $env{'form.vAns'} eq 'all') { my $mode; if ($env{'form.vProb'} eq 'all' && $env{'form.vAns'} eq 'all') { @@ -2081,20 +2099,17 @@ KEYWORDS # Display student info $request->print(($counter == 0 ? '' : '
')); - my $result='
'; - - $result.='
'; - $result.= &mt('Submissions'); + + my $result='
' + .'

'.&mt('Submissions').'

'; $result.=''."\n"; + '" value="'.$env{'form.fullname'}.'" />'."\n"; if ($env{'form.handgrade'} eq 'no') { - $result.=''. - &mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon)."\n"; - + $result.='

' + .&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon) + ."

\n"; } - - # If any part of the problem is an essay-response (handgraded), then check for collaborators my $fullname; my $col_fullnames = []; @@ -2105,9 +2120,9 @@ KEYWORDS $result.=$sub_result; } $request->print($result."\n"); - $request->print('
'."\n"); + # print student answer/submission - # Options are (1) Handgaded submission only + # Options are (1) Handgraded submission only # (2) Last submission, includes submission that is not handgraded # (for multi-response type part) # (3) Last submission plus the parts info @@ -2117,10 +2132,12 @@ KEYWORDS my $lastsubonly; - if ($$timestamp eq '') { - $lastsubonly.='
'.$$string[0].'
'; - } else { - $lastsubonly = '
Date Submitted: '.$$timestamp."\n"; + if ($$timestamp eq '') { + $lastsubonly.='
'.$$string[0].'
'; + } else { + $lastsubonly = + '
' + .''.&mt('Date Submitted:').' '.$$timestamp."\n"; my %seenparts; my @part_response_id = &flatten_responseType($responseType); @@ -2144,16 +2161,18 @@ KEYWORDS } my $responsetype = $responseType->{$partid}->{$respid}; if (!exists($record{"resource.$partid.$respid.submission"})) { - $lastsubonly.="\n".'
Part: '. - $display_part.' ( ID '.$respid. - ' )   '. + $lastsubonly.="\n".'
'. + ''.&mt('Part: [_1]',$display_part).''. + ' '. + '('.&mt('Part ID: [_1]',$respid).')'. + '   '. ''.&mt('Nothing submitted - no attempts.').'

'; next; } foreach my $submission (@$string) { my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } - my ($ressub,$subval) = split(/:/,$submission,2); + my ($ressub,$hide,$subval) = split(/:/,$submission,3); # Similarity check my $similar=''; if($env{'form.checkPlag'}){ @@ -2165,16 +2184,21 @@ KEYWORDS &Apache::lonnet::coursedescription($ocrsid, {'one_time' => 1}); - $similar="

". - &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', - $osim, - &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', - $old_course_desc{'description'}, - $old_course_desc{'num'}, - $old_course_desc{'domain'}). - '

'. - &keywords_highlight($oessay). - '

'; + if ($hide) { + $similar='
'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'
'. + &mt('As the current submission is for an anonymous survey, no other details are available.').'

'; + } else { + $similar="

". + &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', + $osim, + &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', + $old_course_desc{'description'}, + $old_course_desc{'num'}, + $old_course_desc{'domain'}). + '

'. + &keywords_highlight($oessay). + '

'; + } } } my $order=&get_order($partid,$respid,$symb,$uname,$udom); @@ -2182,33 +2206,43 @@ KEYWORDS ($env{'form.lastSub'} eq 'hdgrade' && $$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { my $display_part=&get_display_part($partid,$symb); - $lastsubonly.='
Part: '. - $display_part.' ( ID '.$respid. - ' )   '; + $lastsubonly.='
'. + ''.&mt('Part: [_1]',$display_part).''. + ' '. + '('.&mt('Part ID: [_1]',$respid).')'. + '   '; my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); if (@$files) { - $lastsubonly.='
'.&mt('Like all files provided by users, this file may contain viruses').'
'; - my $file_counter = 0; - foreach my $file (@$files) { - $file_counter++; - &Apache::lonnet::allowuploaded('/adm/grades',$file); - $lastsubonly.='
'.$file.''; - } + if ($hide) { + $lastsubonly.='
'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files})); + } else { + $lastsubonly.='
'.&mt('Like all files provided by users, this file may contain viruses').'
'; + foreach my $file (@$files) { + &Apache::lonnet::allowuploaded('/adm/grades',$file); + $lastsubonly.='
'.$file.''; + } + } $lastsubonly.='
'; } - $lastsubonly.=''.&mt('Submitted Answer:').' '. - &cleanRecord($subval,$responsetype,$symb,$partid, - $respid,\%record,$order,undef,$uname,$udom); + if ($hide) { + $lastsubonly.=''.&mt('Anonymous Survey').''; + } else { + $lastsubonly.=''.&mt('Submitted Answer:').' '. + &cleanRecord($subval,$responsetype,$symb,$partid, + $respid,\%record,$order,undef,$uname,$udom); + } if ($similar) {$lastsubonly.="

$similar\n";} $lastsubonly.='
'; } } } - $lastsubonly.='
'."\n"; + $lastsubonly.='
'."\n"; # End: LC_grade_submissions_body } $request->print($lastsubonly); } elsif ($env{'form.lastSub'} eq 'datesub') { - my (undef,$responseType,undef,$parts) = &showResourceInfo($symb); +# my (undef,$responseType,undef,$parts) = &showResourceInfo($symb); + my ($parts,$handgrade,$responseType) = &response_type($symb); + $request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom)); } elsif ($env{'form.lastSub'} =~ /^(last|all)$/) { $request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, @@ -2222,7 +2256,7 @@ KEYWORDS # return if view submission with no grading option if ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) { my $toGrade.='  '."\n" if (&canmodify($usec)); $toGrade.='
'."\n"; if (($env{'form.command'} eq 'submission') || @@ -2266,11 +2300,11 @@ KEYWORDS my @partlist; my @gradePartRespid; my @part_response_id = &flatten_responseType($responseType); - $request->print('
'. - - '
'. - &mt('Assign Grades').'
'. - '
'); + $request->print( + '
' + .'

'.&mt('Assign Grades').'

' + ); + $request->print(&gradeBox_start()); foreach my $part_response_id (@part_response_id) { my ($partid,$respid) = @{ $part_response_id }; my $part_resp = join('_',@{ $part_response_id }); @@ -2282,19 +2316,10 @@ KEYWORDS push(@gradePartRespid,$partid.'.'.$respid); $request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); } - $request->print('
'); + $request->print(&gradeBox_end()); #
+ $request->print('
'); $request->print(''); $result=''."\n"; + my $endform='

'."\n"; $endform.='  '."\n"; my $ntstu ='  '; - $endform.=&mt('(Next and Previous (student) do not save the scores.)')."\n" ; + 'onclick="javascript:checksubmit(this.form,\'Next\');" target="_self" />  '; + $endform.=''. + &mt('(Next and Previous (student) do not save the scores.)'). + ''."\n" ; $endform.=""; $endform.='
'; @@ -2401,7 +2427,7 @@ sub check_collaborators { #--- Retrieve the last submission for all the parts sub get_last_submission { my ($returnhash)=@_; - my (@string,$timestamp); + my (@string,$timestamp,%lasthidden); if ($$returnhash{'version'}) { my %lasthash=(); my ($version); @@ -2413,13 +2439,39 @@ sub get_last_submission { &Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'}); } } + my %typeparts; + my $showsurv = + &Apache::lonnet::allowed('vas',$env{'request.course.id'}); + foreach my $key (sort(keys(%lasthash))) { + if ($key =~ /\.type$/) { + if (($lasthash{$key} eq 'anonsurvey') || + ($lasthash{$key} eq 'anonsurveycred')) { + my ($ign,@parts) = split(/\./,$key); + pop(@parts); + unless ($showsurv) { + my $id = join(',',@parts); + $typeparts{$ign.'.'.$id} = $lasthash{$key}; + } + delete($lasthash{$key}); + } + } + } + my @hidden = keys(%typeparts); foreach my $key (keys(%lasthash)) { next if ($key !~ /\.submission$/); - + my $hide; + if (@hidden) { + foreach my $id (@hidden) { + if ($key =~ /^\Q$id\E/) { + $hide = 1; + last; + } + } + } my ($partid,$foo) = split(/submission$/,$key); my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? 'Draft Copy ' : ''; - push(@string, join(':', $key, $draft.$lasthash{$key})); + push(@string, join(':', $key, $hide, $draft.$lasthash{$key})); } } if (!@string) { @@ -2586,7 +2638,7 @@ sub processHandGrade { # Go directly to grade student - from submission or link from chart page if ($button eq 'Grade Student') { - (undef,undef,$env{'form.handgrade'},undef,undef) = &showResourceInfo($symb); +# (undef,undef,$env{'form.handgrade'},undef,undef) = &showResourceInfo($symb); my $processUser = $env{'form.unamedom'.$env{'form.studentNo'}}; ($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser); $env{'form.fullname'} = $$fullname{$processUser}; @@ -3080,8 +3132,7 @@ sub viewgrades_js { my ($request) = shift; my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = '); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< VIEWJAVASCRIPT } @@ -3320,11 +3370,11 @@ sub viewgrades { } $radio.=''; my $line = ' /'. $weight{$partid}.' '.&mt('(problem weight)').''."\n"; $line.= ''.&mt('Grade Status').':'; $result.=''; + 'onclick="javascript:resetEntry('.$ctsparts.');" />'; #table listing all the students in a section/class #header of table @@ -3409,7 +3459,7 @@ sub viewgrades { $result.=&Apache::loncommon::end_data_table(); $result.=''."\n"; $result.=''."\n"; + 'onclick="javascript:submit();" target="_self" />'."\n"; if (scalar(%$fullname) eq 0) { my $colspan=3+scalar(@parts); my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); @@ -3461,7 +3511,7 @@ sub viewstudentgrade { 'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n"; $result.=''."\n"; } elsif ($type eq 'solved') { my ($status,$foo)=split(/_/,$score,2); @@ -3470,7 +3520,7 @@ sub viewstudentgrade { $part.'_solved_s" value="'.$status.'" />'."\n"; $result.='  + @@ -3844,16 +3896,13 @@ to this page if the data selected is ins
- ENDPICK + $request->print(&Apache::lonhtmlcommon::scripttag($javascript)); return ''; } sub csvupload_fields { - my ($symb) = @_; my ($symb,$errorref) = @_; my (@parts) = &getpartlist($symb,$errorref); if (ref($errorref)) { @@ -3886,15 +3935,14 @@ sub csvuploadmap_footer { -
+
ENDPICK } sub checkforfile_js { my $alertmsg = &mt('Please use the browse button to select a file from your local directory.'); - my $result =< + my $result = &Apache::lonhtmlcommon::scripttag(< CSVFORMJS return $result; } @@ -3913,8 +3960,8 @@ sub upcsvScores_form { if (!$symb) {return '';} my $result=&checkforfile_js(); $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); - my ($table) = &showResourceInfo($symb,$env{'form.probTitle'}); - $result.=$table; +# my ($table) = &showResourceInfo($symb,$env{'form.probTitle'}); +# $result.=$table; $result.='
'."\n"; $result.=''. @@ -4471,11 +4518,13 @@ sub displayPage { } if (&canmodify($usec)) { + $studentTable.=&gradeBox_start(); foreach my $partid (@{$parts}) { $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record); $studentTable.=''."\n"; $question++; } + $studentTable.=&gradeBox_end(); $prob++; } $studentTable.=''; @@ -4484,10 +4533,11 @@ sub displayPage { $curRes = $iterator->next(); } - $studentTable.='
'."\n"; $result.=' '.&mt('Specify a file containing the class scores for current resource.'). @@ -3931,7 +3978,7 @@ sub upcsvScores_form { $upfile_select -
+
ENDUPFORM @@ -3962,7 +4009,7 @@ sub csvuploadmap { my ($i,$keyfields); if (@records) { my $fieldserror; - my @fields=&csvupload_fields($symb,\$fieldserror); + my @fields=&csvupload_fields($symb,\$fieldserror); if ($fieldserror) { $request->print(&navmap_errormsg()); return; @@ -4176,8 +4223,7 @@ sub pickStudentPage { my ($request) = shift; my $alertmsg = &mt('Please select the student you wish to grade.'); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< LISTJAVASCRIPT &commonJSfunctions($request); my ($symb) = &get_symb($request); @@ -4206,7 +4251,7 @@ LISTJAVASCRIPT my ($titles,$symbx) = &getSymbMap($map_error); if ($map_error) { $request->print(&navmap_errormsg()); - return; + return; } my ($curpage) =&Apache::lonnet::decode_symb($symb); # my ($curpage,$mapId) =&Apache::lonnet::decode_symb($symb); @@ -4254,7 +4299,7 @@ LISTJAVASCRIPT $result.=' '.&mt('Use CODE').':
'."\n"; $result.=' 
'."\n"; + 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" />
'."\n"; $request->print($result); @@ -4293,7 +4338,7 @@ LISTJAVASCRIPT } $studentTable.=&Apache::loncommon::end_data_table()."\n"; $studentTable.=''."\n"; + 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" />'."\n"; $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); @@ -4400,7 +4445,9 @@ sub displayPage { my $checkIcon = ''.&mt('Check Mark').
 	''; - $studentTable.=' '.&mt('Note: Problems graded correct by the computer are marked with a [_1] symbol.',$checkIcon)."\n". + $studentTable.=' '. + &mt('Problems graded correct by the computer are marked with a [_1] symbol.',$checkIcon). + ''."\n". &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(). '
 Prob. 
'."\n". - ''. - ''."\n"; + $studentTable.= + '
'."\n". + ''. + ''."\n"; $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); @@ -4533,37 +4583,49 @@ sub displaySubByDates { my @versionKeys = split(/\:/,$$record{$version.':keys'}); my @displaySub = (); foreach my $partid (@{$parts}) { + my $hidden; + if (($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurvey') || + ($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurveycred')) { + $hidden = 1; + } my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys) : sort(grep /^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys)); - # next if ($$record{"$version:resource.$partid.solved"} eq ''); my $display_part=&get_display_part($partid,$symb); foreach my $matchKey (@matchKey) { if (exists($$record{$version.':'.$matchKey}) && $$record{$version.':'.$matchKey} ne '') { - + my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/) : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/)); - $displaySub[0].=''.&mt('Part:').' '.$display_part.' '; - $displaySub[0].='('.&mt('ID').' '. - $responseId.') '; - if ($$record{"$where.$partid.tries"} eq '') { - $displaySub[0].=&mt('Trial not counted'); - } else { - $displaySub[0].=&mt('Trial [_1]', + $displaySub[0].='' + .' ' + .'('.&mt('Part ID: [_1]',$responseId).')' + .'' + .' '; + if ($hidden) { + $displaySub[0].= &mt('Anonymous Survey').''; + } else { + if ($$record{"$where.$partid.tries"} eq '') { + $displaySub[0].=&mt('Trial not counted'); + } else { + $displaySub[0].=&mt('Trial: [_1]', $$record{"$where.$partid.tries"}); - } - my $responseType=($isTask ? 'Task' + } + my $responseType=($isTask ? 'Task' : $responseType->{$partid}->{$responseId}); - if (!exists($orders{$partid})) { $orders{$partid}={}; } - if (!exists($orders{$partid}->{$responseId})) { - $orders{$partid}->{$responseId}= - &get_order($partid,$responseId,$symb,$uname,$udom, - $no_increment); - } - $displaySub[0].='  '. - &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'
'; + if (!exists($orders{$partid})) { $orders{$partid}={}; } + if (!exists($orders{$partid}->{$responseId})) { + $orders{$partid}->{$responseId}= + &get_order($partid,$responseId,$symb,$uname,$udom, + $no_increment); + } + $displaySub[0].=''; # /nobreak + $displaySub[0].='  '. + &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'
'; + } } } if (exists($$record{"$where.$partid.checkedin"})) { @@ -4623,6 +4685,7 @@ sub updateGradeByPage { $request->print($result); + my $navmap = Apache::lonnavmaps::navmap->new(); unless (ref($navmap)) { $request->print(&navmap_errormsg()); @@ -4772,7 +4835,7 @@ sub updateGradeByPage { # #------------------------------------------------------------------- -#--------------------Bubblesheet (Scantron) Grading----------------------------------- +#-------------------- Bubblesheet (Scantron) Grading ------------------- # #------ start of section for handling grading by page/sequence --------- @@ -4831,9 +4894,7 @@ the homework problem. Returns html hidden inputs used to hold context/default values. Arguments: - $symb - $symb of the current resource - $map_error - ref to scalar which will container error if - $navmap object is unavailable in &getSymbMap(). + $symb - $symb of the current resource =cut @@ -4852,7 +4913,9 @@ sub defaultFormData { Return html dropdown of possible sequences to grade Arguments: - $symb - $symb of the current resource + $symb - $symb of the current resource + $map_error - ref to scalar which will container error if + $navmap object is unavailable in &getSymbMap(). =cut @@ -5210,17 +5273,15 @@ sub scantron_selectphase { my $default_form_data=&defaultFormData(&get_symb($r,1)); my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; - $r->print(' - - + }')); + $r->print('
'.$default_form_data.' @@ -5228,7 +5289,7 @@ sub scantron_selectphase { '.&mt('File to upload: [_1]','').'
- +
'); @@ -6759,7 +6820,7 @@ sub scantron_validate_ID { #get scantron line setup my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); my ($scanlines,$scan_data)=&scantron_getfile(); - + my $nav_error; &scantron_get_maxbubble(\$nav_error); # parse needs the bubble_lines.. array. if ($nav_error) { @@ -6907,8 +6968,7 @@ sub scantron_get_correction { $r->print("\n
"); } - $r->print(< + $r->print(&Apache::lonhtmlcommon::scripttag(< ENDSCRIPT my $href="/adm/pickcode?". "form=".&escape("scantronupload"). @@ -6988,8 +7047,7 @@ sub verify_bubbles_checked { my (@ansnums) = @_; my $ansnumstr = join('","',@ansnums); my $warning = &mt("A bubble or 'No bubble' selection has not been made for one or more lines."); - my $output = (< + my $output = &Apache::lonhtmlcommon::scripttag((< ENDSCRIPT return $output; } @@ -7401,7 +7458,6 @@ sub scantron_validate_doublebubble { sub scantron_get_maxbubble { my ($nav_error) = @_; - if (defined($env{'form.scantron_maxbubble'}) && $env{'form.scantron_maxbubble'}) { &restore_bubble_lines(); @@ -7872,8 +7928,7 @@ sub scantron_upload_scantron_data { my $default_form_data=&defaultFormData(&get_symb($r,1)); my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.'); my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded."); - $r->print(' - - +')); + $r->print('

'.&mt('Send scanned bubblesheet data to a course').'

@@ -7922,7 +7977,7 @@ sub scantron_upload_scantron_data { &Apache::lonhtmlcommon::end_pick_box().'
- +
'); return ''; @@ -8422,135 +8477,174 @@ sub show_grading_menu_form { return $result; } -# -- Retrieve choices for grading form -sub savedState { - my %savedState = (); - if ($env{'form.saveState'}) { - foreach (split(/:/,$env{'form.saveState'})) { - my ($key,$value) = split(/=/,$_,2); - $savedState{$key} = $value; - } - } - return \%savedState; -} - sub grading_menu { my ($request) = @_; my ($symb)=&get_symb($request); if (!$symb) {return '';} my $probTitle = &Apache::lonnet::gettitle($symb); - my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle); - $request->print($table); my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), - 'handgrade'=>$hdgrade, 'probTitle'=>$probTitle, - 'command'=>'submit_options', - 'saveState'=>"", + 'command'=>'individual', 'gradingMenu'=>1, 'showgrading'=>"yes"); - my $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - my @menu = ({ url => $url, - name => &mt('Manual Grading/View Submissions'), - short_description => - &mt('Start the process of hand grading submissions.'), - }); + + my $url1a = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + + $fields{'command'}='ungraded'; + my $url1b=&Apache::lonhtmlcommon::build_url('grades/',\%fields); + + $fields{'command'}='table'; + my $url1c=&Apache::lonhtmlcommon::build_url('grades/',\%fields); + + $fields{'command'}='all_for_one'; + my $url1d=&Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'csvform'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => $url, - name => &mt('Upload Scores'), - short_description => - &mt('Specify a file containing the class scores for current resource.')}); + my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'processclicker'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => $url, - name => &mt('Process Clicker'), - short_description => - &mt('Specify a file containing the clicker information for this resource.')}); + my $url3 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'scantron_selectphase'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => $url, - name => &mt('Grade/Manage/Review Bubblesheets'), - short_description => - &mt('Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.')}); - $fields{'command'} = 'verify'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => "", - name => &mt('Verify Receipt'), - short_description => - &mt('')}); + my $url4 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + + $fields{'command'} = 'initialverifyreceipt'; + my $url5 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + + my @menu = ({ categorytitle=>'Hand Grading', + items =>[ + { linktext => 'Select individual students to grade', + url => $url1a, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Grade current resource for a selection of students.' + }, + { linktext => 'Grade ungraded submissions.', + url => $url1b, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Grade all submissions that have not been graded yet.' + }, + + { linktext => 'Grading table', + url => $url1c, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Grade current resource for all students.' + }, + { linktext => 'Grade complete page/sequence/folder for one student', + url => $url1d, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Grade all resources in current page/sequence/folder for one student.' + }]}, + { categorytitle=>'Automated Grading', + items =>[ + + { linktext => 'Upload Scores', + url => $url2, + permission => 'F', + icon => 'uploadscores.png', + linktitle => 'Specify a file containing the class scores for current resource.' + }, + { linktext => 'Process Clicker', + url => $url3, + permission => 'F', + icon => 'addClickerInfoFile.png', + linktitle => 'Specify a file containing the clicker information for this resource.' + }, + { linktext => 'Grade/Manage/Review Bubblesheets', + url => $url4, + permission => 'F', + icon => 'stat.png', + linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.' + }, + { linktext => 'Verify Receipt No.', + url => $url5, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Verify a system-generated receipt number for correct problem solution.' + } + + ] + }); + # Create the menu my $Str; - # $Str .= '

'.&mt('Please select a grading task').'

'; $Str .= '
'; $Str .= ''. ''."\n". - ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n"; - foreach my $menudata (@menu) { - if ($menudata->{'name'} ne &mt('Verify Receipt')) { - $Str .='

{'jscript'}. - ' href="'. - $menudata->{'url'}.'" >'. - $menudata->{'name'}."

\n"; - } else { - $Str .='
{'jscript'}. - ' onClick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '. - ' /> '. - &Apache::lonnet::recprefix($env{'request.course.id'}). - '-'; - } - $Str .= ' '.(' 'x8).$menudata->{'short_description'}. - "\n"; - } - $Str .="
\n"; - my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box."); - $request->print(< - function checkChoice(formname,val,cmdx) { - if (val <= 2) { - var cmd = radioSelection(formname.radioChoice); - var cmdsave = cmd; - } else { - cmd = cmdx; - cmdsave = 'submission'; - } - formname.command.value = cmd; - if (val < 5) formname.submit(); - if (val == 5) { - if (!checkReceiptNo(formname,'notOK')) { - return false; - } else { - formname.submit(); - } - } - } - function checkReceiptNo(formname,nospace) { - var receiptNo = formname.receipt.value; - var checkOpt = false; - if (nospace == "OK" && isNaN(receiptNo)) {checkOpt = true;} - if (nospace == "notOK" && (isNaN(receiptNo) || receiptNo == "")) {checkOpt = true;} - if (checkOpt) { - alert("$receiptalert"); - formname.receipt.value = ""; - formname.receipt.focus(); - return false; - } - return true; - } - -GRADINGMENUJS - &commonJSfunctions($request); + $Str .= &Apache::lonhtmlcommon::generate_menu(@menu); return $Str; } +sub ungraded { + my ($request)=@_; + &submit_options($request); +} + +sub submit_options_sequence { + my ($request) = @_; + my ($symb)=&get_symb($request); + if (!$symb) {return '';} + &commonJSfunctions($request); + my $result; + + $result.='
'."\n". + ''."\n". + ''."\n". + ''."\n"; + + $result.=' +

+ '.&mt('Grade complete page/sequence/folder for one student').' +

'. + &selectfield(0). + ' +
+ +
+
+ '; + $result .= &show_grading_menu_form($symb); + return $result; +} + +sub submit_options_table { + my ($request) = @_; + my ($symb)=&get_symb($request); + if (!$symb) {return '';} + &commonJSfunctions($request); + my $result; + + $result.='
'."\n". + ''."\n". + ''."\n". + ''."\n"; + + $result.=' +

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

'. + &selectfield(0). + ' +
+ +
+
+ '; + $result .= &show_grading_menu_form($symb); + return $result; +} + + + #--- Displays the submissions first page ------- sub submit_options { my ($request) = @_; @@ -8558,173 +8652,74 @@ sub submit_options { if (!$symb) {return '';} my $probTitle = &Apache::lonnet::gettitle($symb); - my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box."); - $request->print(< - function checkChoice(formname,val,cmdx) { - if (val <= 2) { - var cmd = radioSelection(formname.radioChoice); - var cmdsave = cmd; - } else { - cmd = cmdx; - cmdsave = 'submission'; - } - formname.command.value = cmd; - formname.saveState.value = "saveCmd="+cmdsave+":saveSec="+pullDownSelection(formname.section)+ - ":saveSub="+pullDownSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status); - if (val < 5) formname.submit(); - if (val == 5) { - if (!checkReceiptNo(formname,'notOK')) { return false;} - formname.submit(); - } - if (val < 7) formname.submit(); - } - - function checkReceiptNo(formname,nospace) { - var receiptNo = formname.receipt.value; - var checkOpt = false; - if (nospace == "OK" && isNaN(receiptNo)) {checkOpt = true;} - if (nospace == "notOK" && (isNaN(receiptNo) || receiptNo == "")) {checkOpt = true;} - if (checkOpt) { - alert("$receiptalert"); - formname.receipt.value = ""; - formname.receipt.focus(); - return false; - } - return true; - } - -GRADINGMENUJS &commonJSfunctions($request); - my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle); my $result; - my (undef,$sections) = &getclasslist('all','0'); - my $savedState = &savedState(); - my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'}); - my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'}); - my $saveSub = ($$savedState{'saveSub'} eq '' ? 'all' : $$savedState{'saveSub'}); - my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'}); - - # Preselect sections - my $selsec=""; - if (ref($sections)) { - foreach my $section (sort(@$sections)) { - $selsec.=''."\n"; - } - } $result.='
'."\n". ''."\n". - ''."\n". ''."\n". - ''."\n". - ''."\n". ''."\n". ''."\n"; $result.=' -
-
-

- '.&mt('Grade Current Resource').' -

-
-
- '.$table.' -
-
-
- '.&mt('Sections').' -
-
-   '; - $result.=' -
-
-
-
- '.&mt('Groups').' -
-
- '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' -
-
-
-
- '.&mt('Access Status').' -
-
- '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').' -
-
-
-
- '.&mt('Submission Status').' -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
-
-

- '.&mt('Grade Complete Folder for One Student').' -

-
-
-
- -
-
- +

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

'.&selectfield(1).' + +
-
-
-
+ +
'; $result .= &show_grading_menu_form($symb); return $result; } +sub selectfield { + my ($full)=@_; + my $result='
+ +
+ + '.&mt('Sections').' + + '.&Apache::lonstatistics::SectionSelect('section','multiple',5).' +
+ +
+ + '.&mt('Groups').' + + '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' +
+ +
+ + '.&mt('Access Status').' + + '.&Apache::lonhtmlcommon::StatusOptions(undef,undef,5,undef,'mult').' +
'; + if ($full) { + $result.=' +
+ + '.&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'])). + '
'; + } + $result.='

'; + return $result; +} + sub reset_perm { undef(%perm); } @@ -8814,13 +8809,11 @@ sub process_clicker { if (!$symb) {return '';} my $result=&checkforfile_js(); $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); - my ($table) = &showResourceInfo($symb,$env{'form.probTitle'}); - $result.=$table; $result.='
'."\n"; $result.=''."\n"; - $result.='
'."\n"; $result.=' '.&mt('Specify a file containing the clicker information for this resource.'). '
'."\n"; + $result.='
'."\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', @@ -8850,8 +8843,7 @@ sub process_clicker { ('iclicker' => 'i>clicker', 'interwrite' => 'interwrite PRS')); $symb = &Apache::lonenc::check_encrypt($symb); - $result.=< + $result.= &Apache::lonhtmlcommon::scripttag(< +ENDUPFORM + $result.= < @@ -8897,18 +8890,18 @@ function sanitycheck() {
-
-
-
+
+
+
-
+

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


'."\n"; @@ -8924,8 +8917,8 @@ sub process_clicker_file { my %Saveable_Parameters=&clicker_grading_parameters(); &Apache::loncommon::store_course_settings('grades_clicker', \%Saveable_Parameters); - - my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); + my $result=''; +# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) { $result.=''.&mt('You need to specify a clicker ID for the correct answer').''; return $result.&show_grading_menu_form($symb); @@ -9164,7 +9157,8 @@ sub assign_clicker_grades { # FIXME: This should probably look for the first handgradeable part my $part=$$partlist[0]; # Start screen output - my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); + my $result=''; +# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); my $heading=&mt('Assigning grades based on clicker file'); $result.=(<'. &mt('An error occurred retrieving information about resources in the course.').'
'. - &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page..','',''). + &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page.','',''). '
'; } @@ -9295,31 +9289,10 @@ sub handler { $request->print(&Apache::loncommon::start_page('Grading',undef, {'bread_crumbs' => $brcrum})); if ($symb eq '' && $command eq '') { - if ($env{'user.adv'}) { - if (($env{'form.codeone'}) && ($env{'form.codetwo'}) && - ($env{'form.codethree'})) { - my $token=$env{'form.codeone'}.'*'.$env{'form.codetwo'}.'*'. - $env{'form.codethree'}; - my ($tsymb,$tuname,$tudom,$tcrsid)= - &Apache::lonnet::checkin($token); - if ($tsymb) { - my ($map,$id,$url)=&Apache::lonnet::decode_symb($tsymb); - if (&Apache::lonnet::allowed('mgr',$tcrsid)) { - $request->print(&ssi_with_retries('/res/'.$url, $ssi_retries, - ('grade_username' => $tuname, - 'grade_domain' => $tudom, - 'grade_courseid' => $tcrsid, - 'grade_symb' => $tsymb))); - } else { - $request->print('

Not authorized: '.$token.'

'); - } - } else { - $request->print('

Not a valid DocID: '.$token.'

'); - } - } else { - $request->print(&Apache::lonxml::tokeninputfield()); - } - } +# +# Not called from a resource +# + } else { &init_perm(); if ($command eq 'submission' && $perm{'vgr'}) { @@ -9334,14 +9307,22 @@ sub handler { &processGroup($request); } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { $request->print(&grading_menu($request)); - } elsif ($command eq 'submit_options' && $perm{'vgr'}) { + } elsif ($command eq 'individual' && $perm{'vgr'}) { $request->print(&submit_options($request)); + } elsif ($command eq 'ungraded' && $perm{'vgr'}) { + $request->print(&submit_options($request)); + } elsif ($command eq 'table' && $perm{'vgr'}) { + $request->print(&submit_options_table($request)); + } elsif ($command eq 'all_for_one' && $perm{'vgr'}) { + $request->print(&submit_options_sequence($request)); } elsif ($command eq 'viewgrades' && $perm{'vgr'}) { $request->print(&viewgrades($request)); } elsif ($command eq 'handgrade' && $perm{'mgr'}) { $request->print(&processHandGrade($request)); } elsif ($command eq 'editgrades' && $perm{'mgr'}) { $request->print(&editgrades($request)); + } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) { + $request->print(&initialverifyreceipt($request)); } elsif ($command eq 'verify' && $perm{'vgr'}) { $request->print(&verifyreceipt($request)); } elsif ($command eq 'processclicker' && $perm{'mgr'}) {