version 1.596.2.12.2.44, 2018/10/08 19:12:29
|
version 1.596.2.12.2.45, 2019/02/16 17:53:05
|
Line 2053 sub submission {
|
Line 2053 sub submission {
|
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq ''; |
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq ''; |
my ($symb) = &get_symb($request); |
my ($symb) = &get_symb($request); |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } |
|
my ($essayurl,%coursedesc_by_cid); |
|
|
if (!&canview($usec)) { |
if (!&canview($usec)) { |
$request->print( |
$request->print( |
Line 2190 sub submission {
|
Line 2191 sub submission {
|
# |
# |
# Load the other essays for similarity check |
# Load the other essays for similarity check |
# |
# |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
(undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); |
if ($essayurl eq 'lib/templates/simpleproblem.problem') { |
$apath=&escape($apath); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$apath=~s/\W/\_/gs; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
&init_old_essays($symb,$apath,$adom,$aname); |
if ($cdom ne '' && $cnum ne '') { |
|
my ($map,$id,$res) = &Apache::lonnet::decode_symb($symb); |
|
if ($map =~ m{^\Quploaded/$cdom/$cnum/\E(default(?:|_\d+)\.(?:sequence|page))$}) { |
|
my $apath = $1.'_'.$id; |
|
$apath=~s/\W/\_/gs; |
|
&init_old_essays($symb,$apath,$cdom,$cnum); |
|
} |
|
} |
|
} else { |
|
my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); |
|
$apath=&escape($apath); |
|
$apath=~s/\W/\_/gs; |
|
&init_old_essays($symb,$apath,$adom,$aname); |
|
} |
} |
} |
} |
} |
|
|
Line 2335 sub submission {
|
Line 2349 sub submission {
|
&most_similar($uname,$udom,$symb,$subval); |
&most_similar($uname,$udom,$symb,$subval); |
if ($osim) { |
if ($osim) { |
$osim=int($osim*100.0); |
$osim=int($osim*100.0); |
my %old_course_desc = |
|
&Apache::lonnet::coursedescription($ocrsid, |
|
{'one_time' => 1}); |
|
|
|
if ($hide eq 'anon') { |
if ($hide eq 'anon') { |
$similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'. |
$similar='<hr /><span class="LC_warning">'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'<br />'. |
&mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />'; |
&mt('As the current submission is for an anonymous survey, no other details are available.').'</span><hr />'; |
} else { |
} else { |
$similar="<hr /><h3><span class=\"LC_warning\">". |
$similar='<hr />'; |
&mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', |
if ($essayurl eq 'lib/templates/simpleproblem.problem') { |
$osim, |
$similar .= '<h3><span class="LC_warning">'. |
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', |
&mt('Essay is [_1]% similar to an essay by [_2]', |
$old_course_desc{'description'}, |
$osim, |
$old_course_desc{'num'}, |
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')'). |
$old_course_desc{'domain'}). |
'</span></h3>'; |
'</span></h3><blockquote><i>'. |
} elsif ($ocrsid ne '') { |
&keywords_highlight($oessay). |
if (ref($coursedesc_by_cid{$ocrsid}) eq 'HASH') { |
'</i></blockquote><hr />'; |
%old_course_desc = %{$coursedesc_by_cid{$ocrsid}}; |
} |
} else { |
} |
my $args; |
} |
if ($ocrsid ne $env{'request.course.id'}) { |
|
$args = {'one_time' => 1}; |
|
} |
|
%old_course_desc = |
|
&Apache::lonnet::coursedescription($ocrsid,$args); |
|
$coursedesc_by_cid{$ocrsid} = \%old_course_desc; |
|
} |
|
$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'}). |
|
'</span></h3>'; |
|
} else { |
|
$similar .= |
|
'<h3><span class="LC_warning">'. |
|
&mt('Essay is [_1]% similar to an essay by [_2] in an unknown course', |
|
$osim, |
|
&Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')'). |
|
'</span></h3>'; |
|
} |
|
$similar .= '<blockquote><i>'. |
|
&keywords_highlight($oessay). |
|
'</i></blockquote><hr />'; |
|
} |
|
} |
|
} |
my $order=&get_order($partid,$respid,$symb,$uname,$udom, |
my $order=&get_order($partid,$respid,$symb,$uname,$udom, |
undef,$type,$trial,$rndseed); |
undef,$type,$trial,$rndseed); |
if ($env{'form.lastSub'} eq 'lastonly' || $env{'form.lastSub'} eq 'datesub' || $env{'form.lastSub'} =~ /^(last|all)$/ || ($env{'form.lastSub'} eq 'hdgrade' && |
if ($env{'form.lastSub'} eq 'lastonly' || $env{'form.lastSub'} eq 'datesub' || $env{'form.lastSub'} =~ /^(last|all)$/ || ($env{'form.lastSub'} eq 'hdgrade' && |