');
- hDoc.write("$lt{'txtc'}<\\/b><\\/td> $lt{'font'}<\\/b><\\/td> $lt{'fnst'}<\\/td><\\/tr>");
+ hDoc.write(" Text Color<\\/b><\\/td> Font Size<\\/b><\\/td> Font Style<\\/td><\\/tr>");
}
function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) {
@@ -1737,14 +1637,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
}
@@ -1854,7 +1753,7 @@ sub handback_box {
my ($symb,$uname,$udom,$counter,$partid,$record,$res_error) = @_;
my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
my (@respids);
- my @part_response_id = &flatten_responseType($responseType);
+ my @part_response_id = &flatten_responseType($responseType);
foreach my $part_response_id (@part_response_id) {
my ($part,$resp) = @{ $part_response_id };
if ($part eq $partid) {
@@ -1866,10 +1765,9 @@ sub handback_box {
my $prefix = $counter.'_'.$partid.'_'.$respid.'_';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
next if (!@$files);
- my $file_counter = 0;
+ my $file_counter = 1;
foreach my $file (@$files) {
if ($file =~ /\/portfolio\//) {
- $file_counter++;
my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|);
my ($name,$version,$ext) = &file_name_version_ext($file_disp);
$file_disp = "$name.$ext";
@@ -1877,14 +1775,11 @@ sub handback_box {
$result.=&mt('Return commented version of [_1] to student.',
''.$file_disp.' ');
$result.=' '."\n";
- $result.=' '."\n";
+ $result.=' ';
+ $result.='('.&mt('File will be uploaded when you click on Save & Next below.').') ';
+ $file_counter++;
}
}
- if ($file_counter) {
- $result .= ' '."\n".
- ''.
- '('.&mt('File(s) will be uploaded when you click on Save & Next below.',$file_counter).') ';
- }
}
return $result;
}
@@ -1917,27 +1812,14 @@ sub show_problem {
$companswer=~s|||g;
$companswer=~s|name="submit"|name="would_have_been_submit"|g;
}
- my $renderheading = &mt('View of the problem');
- my $answerheading = &mt('Correct answer');
- if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
- my $stu_fullname = $env{'form.fullname'};
- if ($stu_fullname eq '') {
- $stu_fullname = &Apache::loncommon::plainname($uname,$udom,'lastname');
- }
- my $forwhom = &nameUserString(undef,$stu_fullname,$uname,$udom);
- if ($forwhom ne '') {
- $renderheading = &mt('View of the problem for[_1]',$forwhom);
- $answerheading = &mt('Correct answer for[_1]',$forwhom);
- }
- }
$rendered=
' '
- .'
'.$renderheading.' '
+ .''.&mt('View of the problem').' '
.$rendered
.'';
$companswer=
''
- .'
'.$answerheading.' '
+ .''.&mt('Correct answer').' '
.$companswer
.'';
my $result;
@@ -2003,12 +1885,13 @@ sub build_section_inputs {
# --------------------------- show submissions of a student, option to grade
sub submission {
- my ($request,$counter,$total) = @_;
+ my ($request,$counter,$total,$symb) = @_;
my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'});
$udom = ($udom eq '' ? $env{'user.domain'} : $udom); #has form.userdom changed for a student?
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'});
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq '';
- my ($symb) = &get_symb($request);
+
+ my $probtitle=&Apache::lonnet::gettitle($symb);
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; }
if (!&canview($usec)) {
@@ -2032,13 +1915,10 @@ sub submission {
if ($counter == 0) {
&sub_page_js($request);
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes');
- $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ?
- &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};
if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) {
&download_all_link($request, $symb);
}
- $request->print(' '.&mt('Submission Record').' '."\n".
- ' '.&mt('Resource: [_1]',$env{'form.probTitle'}).' '."\n");
+ $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.
@@ -2069,7 +1949,7 @@ sub submission {
$env{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0';
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
$env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ?
- $keyhash{$symb.'_subject'} : $env{'form.probTitle'};
+ $keyhash{$symb.'_subject'} : $probtitle;
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0';
}
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'};
@@ -2079,7 +1959,6 @@ sub submission {
' '."\n".
' '."\n".
' '."\n".
- ' '."\n".
' '."\n".
' '."\n".
' '."\n".
@@ -2119,22 +1998,15 @@ sub submission {
$request->print($prnmsg);
if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') {
-
- my %lt = &Apache::lonlocal::texthash(
- keyw => 'Keyword Options',
- list => 'List',
- past => 'Paste Selection to List',
- high => 'Highlight Attribute',
- );
#
# Print out the keyword options line
#
$request->print(<$lt{'keyw'}:
-$lt{'list'}
+ Keyword Options:
+List
$lt{'past'}
-$lt{'high'}
+ CLASS="page">Paste Selection to List
+Highlight Attribute
KEYWORDS
#
# Load the other essays for similarity check
@@ -2261,7 +2133,7 @@ KEYWORDS
$lastsubonly.="\n".''.
''.&mt('Part: [_1]',$display_part).' '.
' '.
- '('.&mt('Response ID: [_1]',$respid).')'.
+ '('.&mt('Part ID: [_1]',$respid).')'.
' '.
''.&mt('Nothing submitted - no attempts.').'
';
next;
@@ -2272,12 +2144,6 @@ KEYWORDS
my ($ressub,$hide,$subval) = split(/:/,$submission,3);
# Similarity check
my $similar='';
- my ($type,$trial,$rndseed);
- if ($hide eq 'rand') {
- $type = 'randomizetry';
- $trial = $record{"resource.$partid.tries"};
- $rndseed = $record{"resource.$partid.rndseed"};
- }
if($env{'form.checkPlag'}){
my ($oname,$odom,$ocrsid,$oessay,$osim)=
&most_similar($uname,$udom,$subval,\%old_essays);
@@ -2287,7 +2153,7 @@ KEYWORDS
&Apache::lonnet::coursedescription($ocrsid,
{'one_time' => 1});
- if ($hide eq 'anon') {
+ 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 {
@@ -2304,8 +2170,7 @@ KEYWORDS
}
}
}
- my $order=&get_order($partid,$respid,$symb,$uname,$udom,
- undef,$type,$trial,$rndseed);
+ my $order=&get_order($partid,$respid,$symb,$uname,$udom);
if ($env{'form.lastSub'} eq 'lastonly' ||
($env{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
@@ -2313,11 +2178,11 @@ KEYWORDS
$lastsubonly.=''.
''.&mt('Part: [_1]',$display_part).' '.
' '.
- '('.&mt('Response ID: [_1]',$respid).')'.
+ '('.&mt('Part ID: [_1]',$respid).')'.
' ';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
if (@$files) {
- if ($hide eq 'anon') {
+ 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').' ';
@@ -2328,12 +2193,12 @@ KEYWORDS
}
$lastsubonly.=' ';
}
- if ($hide eq 'anon') {
+ if ($hide) {
$lastsubonly.=''.&mt('Anonymous Survey').' ';
} else {
$lastsubonly.=''.&mt('Submitted Answer:').' '.
&cleanRecord($subval,$responsetype,$symb,$partid,
- $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+ $respid,\%record,$order,undef,$uname,$udom);
}
if ($similar) {$lastsubonly.=" $similar\n";}
$lastsubonly.='
';
@@ -2344,7 +2209,9 @@ KEYWORDS
}
$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,
@@ -2483,10 +2350,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
@@ -2499,13 +2366,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.=$fullname->{$name}.' ';
}
- $result.=' '."\n";
+ $result.=' '."\n";
my ($part)=split(/\./,$part);
$result.=' '.
@@ -2541,51 +2408,35 @@ sub get_last_submission {
&Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'});
}
}
- my (%typeparts,%randombytry);
+ 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') ||
- ($lasthash{$key} eq 'randomizetry')) {
+ ($lasthash{$key} eq 'anonsurveycred')) {
my ($ign,@parts) = split(/\./,$key);
pop(@parts);
- my $id = join('.',@parts);
- if ($lasthash{$key} eq 'randomizetry') {
- $randombytry{$ign.'.'.$id} = $lasthash{$key};
- } else {
- unless ($showsurv) {
- $typeparts{$ign.'.'.$id} = $lasthash{$key};
- }
+ unless ($showsurv) {
+ my $id = join(',',@parts);
+ $typeparts{$ign.'.'.$id} = $lasthash{$key};
}
delete($lasthash{$key});
}
}
}
my @hidden = keys(%typeparts);
- my @randomize = keys(%randombytry);
foreach my $key (keys(%lasthash)) {
next if ($key !~ /\.submission$/);
my $hide;
if (@hidden) {
foreach my $id (@hidden) {
if ($key =~ /^\Q$id\E/) {
- $hide = 'anon';
+ $hide = 1;
last;
}
}
}
- unless ($hide) {
- if (@randomize) {
- foreach my $id (@hidden) {
- if ($key =~ /^\Q$id\E/) {
- $hide = 'rand';
- last;
- }
- }
- }
- }
my ($partid,$foo) = split(/submission$/,$key);
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ?
'Draft Copy ' : '';
@@ -2612,187 +2463,9 @@ sub keywords_highlight {
return $string;
}
-# For Tasks provide a mechanism to display previous version for one specific student
-
-sub show_previous_task_version {
- my ($request,$symb) = @_;
- if ($symb eq '') {
- $request->print("Unable to handle ambiguous references.");
-
- return '';
- }
- my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'});
- my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'});
- if (!&canview($usec)) {
- $request->print('Unable to view previous version for requested student.('.
- $uname.':'.$udom.' in section '.$usec.' in course id '.
- $env{'request.course.id'}.') ');
- return;
- }
- my $mode = 'both';
- my $isTask = ($symb =~/\.task$/);
- if ($isTask) {
- if ($env{'form.previousversion'} =~ /^\d+$/) {
- if ($env{'form.fullname'} eq '') {
- $env{'form.fullname'} =
- &Apache::loncommon::plainname($uname,$udom,'lastname');
- }
- my $probtitle=&Apache::lonnet::gettitle($symb);
- $request->print("\n\n".
- ''.
- '
'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).
- ' '."\n");
- &Apache::lonxml::clear_problem_counter();
- $request->print(&show_problem($request,$symb,$uname,$udom,1,1,$mode,
- {'previousversion' => $env{'form.previousversion'} }));
- $request->print("\n");
- }
- }
- return;
-}
-
-sub choose_task_version_form {
- my ($symb,$uname,$udom,$nomenu) = @_;
- my $isTask = ($symb =~/\.task$/);
- my ($current,$version,$result,$js,$displayed,$rowtitle);
- if ($isTask) {
- my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},
- $udom,$uname);
- if (($record{'resource.0.version'} eq '') ||
- ($record{'resource.0.version'} < 2)) {
- return ($record{'resource.0.version'},
- $record{'resource.0.version'},$result,$js);
- } else {
- $current = $record{'resource.0.version'};
- }
- if ($env{'form.previousversion'}) {
- $displayed = $env{'form.previousversion'};
- $rowtitle = &mt('Choose another version:')
- } else {
- $displayed = $current;
- $rowtitle = &mt('Show earlier version:');
- }
- $result = '';
- my $list;
- my $numversions = 0;
- for (my $i=1; $i<=$record{'resource.0.version'}; $i++) {
- if ($i == $current) {
- if (!$env{'form.previousversion'} || $nomenu) {
- next;
- } else {
- $list .= '
'.&mt('Current').' '."\n";
- $numversions ++;
- }
- } elsif (defined($record{'resource.'.$i.'.0.status'})) {
- unless ($i == $env{'form.previousversion'}) {
- $numversions ++;
- }
- $list .= '
'.$i.' '."\n";
- }
- }
- if ($numversions) {
- $symb = &HTML::Entities::encode($symb,'<>"&');
- $result .=
- '
';
- $js = &previous_display_javascript($nomenu,$current);
- } elsif ($displayed && $nomenu) {
- $result .= '
'.&mt('Close window').' ';
- } else {
- $result .= &mt('No previous versions to show for this student');
- }
- $result .= '
';
- }
- return ($current,$displayed,$result,$js);
-}
-
-sub previous_display_javascript {
- my ($nomenu,$current) = @_;
- my $js = <<"JSONE";
-
-ENDJS
-
-}
-
#--- Called from submission routine
sub processHandGrade {
- my ($request) = shift;
- my ($symb) = &get_symb($request);
+ my ($request,$symb) = @_;
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
my $button = $env{'form.gradeOpt'};
my $ngrade = $env{'form.NCT'};
@@ -2832,7 +2505,7 @@ sub processHandGrade {
if ($env{'form.withgrades'.$ctr}) {
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
$messagetail = " for $env{'form.probTitle'} ";
+ $feedurl."?symb=$showsymb\">$restitle";
}
$msgstatus =
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject,
@@ -2841,7 +2514,7 @@ sub processHandGrade {
undef,undef,$showsymb,
$restitle);
$request->print(' '.&mt('Sending message to [_1]',$uname.':'.$udom).': '.
- $msgstatus.' ');
+ $msgstatus);
}
if ($env{'form.collaborator'.$ctr}) {
my @collabstrs=&Apache::loncommon::get_env_multiple("form.collaborator$ctr");
@@ -2860,7 +2533,7 @@ sub processHandGrade {
$udom);
if ($env{'form.withgrades'.$ctr}) {
$messagetail = " for $env{'form.probTitle'} ";
+ $baseurl."?symb=$showsymb\">$restitle";
}
$msgstatus =
&Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle);
@@ -2933,7 +2606,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};
@@ -2960,6 +2633,7 @@ sub processHandGrade {
}
return $a cmp $b;
} (keys(%$fullname))) {
+# FIXME: this is fishy, looks like the button label
if ($nextflg == 1 && $button =~ /Next$/) {
push(@parsedlist,$item);
}
@@ -2970,6 +2644,7 @@ sub processHandGrade {
}
}
$ctr = 0;
+# FIXME: this is fishy, looks like the button label
@parsedlist = reverse @parsedlist if ($button eq 'Previous');
my $res_error;
my ($partlist) = &response_type($symb,\$res_error);
@@ -3027,7 +2702,7 @@ sub processHandGrade {
}
if ($total < 0) {
my $the_end = ''.&mt('LON-CAPA User Message').' '."\n";
- $the_end.=''.&mt('[_1]Message:[_2] No more students for this section or class.','',' ').'
'."\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";
$the_end.=&show_grading_menu_form($symb);
$request->print($the_end);
@@ -3180,79 +2855,64 @@ sub handback_files {
$request->print(' '.&navmap_errormsg().' ');
return;
}
- my @handedback;
- my $file_msg;
my @part_response_id = &flatten_responseType($responseType);
foreach my $part_response_id (@part_response_id) {
my ($part_id,$resp_id) = @{ $part_response_id };
my $part_resp = join('_',@{ $part_response_id });
- if (($env{'form.'.$newflg.'_'.$part_resp.'_countreturndoc'} =~ /^\d+$/) & ($new_part eq $part_id)) {
- for (my $counter=1; $counter<=$env{'form.'.$newflg.'_'.$part_resp.'_countreturndoc'}; $counter++) {
+ if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) {
# if multiple files are uploaded names will be 'returndoc2','returndoc3'
- if ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$counter}) {
- my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$counter.'.filename'};
+ my $file_counter = 1;
+ my $file_msg;
+ while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) {
+ my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'};
my ($directory,$answer_file) =
- ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter} =~ /^(.*?)([^\/]*)$/);
+ ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/);
my ($answer_name,$answer_ver,$answer_ext) =
&file_name_version_ext($answer_file);
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/);
my $getpropath = 1;
- my ($dir_list,$listerror) =
- &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,
- $domain,$stuname,$getpropath);
- my $version = &get_next_version($answer_name,$answer_ext,$dir_list);
+ my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,$domain,$stuname,$getpropath);
+ my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
# fix file name
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/);
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain,
- $newflg.'_'.$part_resp.'_returndoc'.$counter,
+ $newflg.'_'.$part_resp.'_returndoc'.$file_counter,
$save_file_name);
if ($result !~ m|^/uploaded/|) {
$request->print(''.
&mt('An error occurred ([_1]) while trying to upload [_2].',
- $result,$newflg.'_'.$part_resp.'_returndoc'.$counter).
+ $result,$newflg.'_'.$part_resp.'_returndoc'.$file_counter).
' ');
} else {
# mark the file as read only
- push(@handedback,$save_file_name);
+ my @files = ($save_file_name);
+ my @what = ($symb,$env{'request.course.id'},'handback');
+ &Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what);
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) {
$$newrecord{"resource.$new_part.$resp_id.handback"}.=',';
}
$$newrecord{"resource.$new_part.$resp_id.handback"} .= $save_file_name;
- $file_msg.=''.$save_file_name." ";
+ $file_msg.= "\n".''.$save_file_name." ";
}
- $request->print(' '.&mt('[_1] will be the uploaded file name [_2]',''.$fname.' ',''.$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter}.' '));
+ $request->print(" ".$fname." will be the uploaded file name");
+ $request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter});
+ $file_counter++;
}
+ my $subject = "File Handed Back by Instructor ";
+ my $message = "A file has been returned that was originally submitted in reponse to: ";
+ $message .= "".&Apache::lonnet::gettitle($symb)." ";
+ $message .= ' The returned file(s) are named: '. $file_msg;
+ $message .= " and can be found in your portfolio space.";
+ my ($feedurl,$showsymb) =
+ &get_feedurl_and_symb($symb,$domain,$stuname);
+ my $restitle = &Apache::lonnet::gettitle($symb);
+ my $msgstatus =
+ &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject.
+ ' (File Returned) ['.$restitle.']',$message,undef,
+ $feedurl,undef,undef,undef,$showsymb,$restitle);
}
}
- }
- if (@handedback > 0) {
- $request->print(' ');
- my @what = ($symb,$env{'request.course.id'},'handback');
- &Apache::lonnet::mark_as_readonly($domain,$stuname,\@handedback,\@what);
- my $user_lh = &Apache::loncommon::user_lang($stuname,$domain,$env{'request.course.id'});
- my ($subject,$message);
- if (scalar(@handedback) == 1) {
- $subject = &mt_user($user_lh,'File Handed Back by Instructor');
- } else {
- $subject = &mt_user($user_lh,'Files Handed Back by Instructor');
- $message = &mt_user($user_lh,'Files have been returned that were originally submitted in response to: ');
- }
- $message .= "".&Apache::lonnet::gettitle($symb)."
";
- $message .= &mt_user($user_lh,'The returned file(s) are named: [_1]'," $file_msg ").
- &mt_user($user_lh,'The file(s) can be found in your [_1]portfolio[_2].','',' ');
- my ($feedurl,$showsymb) =
- &get_feedurl_and_symb($symb,$domain,$stuname);
- my $restitle = &Apache::lonnet::gettitle($symb);
- $subject .= ' '.&mt_user($user_lh,'(File Returned)').' ['.$restitle.']';
- my $msgstatus =
- &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject,
- $message,undef,$feedurl,undef,undef,undef,$showsymb,
- $restitle);
- if ($msgstatus) {
- $request->print(&mt('Notification message status: [_1]',''.$msgstatus.' ').' ');
- }
- }
return;
}
@@ -3360,11 +3020,9 @@ sub version_portfiles {
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/);
my ($answer_name,$answer_ver,$answer_ext) =
&file_name_version_ext($answer_file);
- my $getpropath = 1;
- my ($dir_list,$listerror) =
- &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,
- $stu_name,$getpropath);
- my $version = &get_next_version($answer_name,$answer_ext,$dir_list);
+ my $getpropath = 1;
+ my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,$stu_name,$getpropath);
+ my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version);
if ($new_answer ne 'problem getting file') {
push(@versioned_portfiles, $directory.$new_answer);
@@ -3383,24 +3041,21 @@ sub version_portfiles {
sub get_next_version {
my ($answer_name, $answer_ext, $dir_list) = @_;
my $version;
- if (ref($dir_list) eq 'ARRAY') {
- foreach my $row (@{$dir_list}) {
- my ($file) = split(/\&/,$row,2);
- my ($file_name,$file_version,$file_ext) =
- &file_name_version_ext($file);
- if (($file_name eq $answer_name) &&
- ($file_ext eq $answer_ext)) {
- # gets here if filename and extension match,
- # regardless of version
+ foreach my $row (@$dir_list) {
+ my ($file) = split(/\&/,$row,2);
+ my ($file_name,$file_version,$file_ext) =
+ &file_name_version_ext($file);
+ if (($file_name eq $answer_name) &&
+ ($file_ext eq $answer_ext)) {
+ # gets here if filename and extension match, regardless of version
if ($file_version ne '') {
- # a versioned file is found so save it for later
- if ($file_version > $version) {
- $version = $file_version;
- }
+ # a versioned file is found so save it for later
+ if ($file_version > $version) {
+ $version = $file_version;
}
}
}
- }
+ }
$version ++;
return($version);
}
@@ -3447,8 +3102,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
}
#--- show scores for a section or whole class w/ option to change/update a score
sub viewgrades {
- my ($request) = shift;
+ my ($request,$symb) = @_;
&viewgrades_js($request);
- my ($symb) = &get_symb($request);
#need to make sure we have the correct data for later EXT calls,
#thus invalidate the cache
&Apache::lonnet::devalidatecourseresdata(
@@ -3627,7 +3279,6 @@ sub viewgrades {
&Apache::lonnet::clear_EXT_cache_status();
my $result=''.&mt('Manual Grading').' ';
- $result.=''.&mt('Current Resource: [_1]',$env{'form.probTitle'}).' '."\n";
#view individual student submission form - called using Javascript viewOneStudent
$result.=&jscriptNform($symb);
@@ -3640,7 +3291,6 @@ sub viewgrades {
&build_section_inputs().
' '."\n".
' '."\n".
- ' '."\n";
my ($common_header,$specific_header);
if ($env{'form.section'} eq 'all') {
@@ -3858,12 +3508,10 @@ sub viewstudentgrade {
#--- change scores for all the students in a section/class
# record does not get update if unchanged
sub editgrades {
- my ($request) = @_;
+ my ($request,$symb) = @_;
- my ($symb)=&get_symb($request);
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
my $title=''.&mt('Current Grade Status').' ';
- $title.=''.&mt('Current Resource: [_1]',$env{'form.probTitle'}).' '."\n";
$title.=''.&mt('Section: [_1]',$section_display).' '."\n";
my $result= &Apache::loncommon::start_data_table().
@@ -4185,7 +3833,7 @@ sub csvuploadmap_header {
$javascript=&csvupload_javascript_forward_associate();
}
- my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
+ my $result='';
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
my $ignore=&mt('Ignore First Line');
$symb = &Apache::lonenc::check_encrypt($symb);
@@ -4209,13 +3857,10 @@ to this page if the data selected is ins
value="$env{'form.upfile_associate'}" />
-
-
ENDPICK
+ $request->print(&Apache::lonhtmlcommon::scripttag($javascript));
return '';
}
@@ -4260,8 +3905,7 @@ 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;
}
sub upcsvScores_form {
- my ($request) = shift;
- my ($symb)=&get_symb($request);
+ my ($request,$symb) = @_;
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.=' '.&mt('Specify a file containing the class scores for current resource.').
' '."\n";
- $result.=''."\n";
+ $result.=' '."\n";
my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
my $ignore=&mt('Ignore First Line');
@@ -4295,7 +3934,6 @@ sub upcsvScores_form {