--- loncom/interface/londocs.pm 2003/10/28 21:50:02 1.91 +++ loncom/interface/londocs.pm 2003/11/07 23:22:21 1.95 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.91 2003/10/28 21:50:02 www Exp $ +# $Id: londocs.pm,v 1.95 2003/11/07 23:22:21 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -510,6 +510,7 @@ sub checkonthis { &Apache::lonxml::xmlparse($r,'web', &Apache::lonnet::getfile( &Apache::lonnet::filelocation('',$url))); + undef($Apache::lonhomework::parsing_a_problem); $ENV{'request.filename'}=$oldpath; if (($Apache::lonxml::errorcount) || ($Apache::lonxml::warningcount)) { @@ -585,20 +586,52 @@ sub checkversions { my %changes=(); my $starttime=0; my $haschanged=0; + my %setversions=&Apache::lonnet::dump('resourceversions', + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + + $hashtied=0; + &tiehash(); + my %newsetversions=(); if ($ENV{'form.setmostrecent'}) { $haschanged=1; + foreach (keys %hash) { + if ($_=~/^ids\_(\/res\/.+)$/) { + $newsetversions{$1}='mostrecent'; + } + } } elsif ($ENV{'form.setcurrent'}) { $haschanged=1; + foreach (keys %hash) { + if ($_=~/^ids\_(\/res\/.+)$/) { + my $getvers=&Apache::lonnet::getversion($1); + if ($getvers>0) { + $newsetversions{$1}=$getvers; + } + } + } } elsif ($ENV{'form.setversions'}) { $haschanged=1; + foreach (keys %ENV) { + if ($_=~/^form\.set_version_(.+)$/) { + my $src=$1; + &Apache::lonnet::logthis('Found: '.$1.' '.$ENV{$_}); + if (($ENV{$_}) && ($ENV{$_} ne $setversions{$src})) { + $newsetversions{$src}=$ENV{$_}; + } + } + } } if ($haschanged) { - $r->print('
'. @@ -694,17 +732,17 @@ ENDHEADERS $currentversion.' | '); # Used in course my $usedversion=$hash{'version_'.$linkurl}; - if ($usedversion) { + if (($usedversion) && ($usedversion ne 'mostrecent')) { $r->print($usedversion); } else { $r->print($currentversion); } $r->print(' | '); # Set version - $r->print(&Apache::loncommon::select_form($usedversion, + $r->print(&Apache::loncommon::select_form($setversions{$linkurl}, 'set_version_'.$linkurl, ('' => '', - 'current' => 'most recent', + 'mostrecent' => 'most recent', map {$_,$_} (1..$currentversion)))); $r->print(' |
|