--- loncom/interface/londocs.pm 2003/10/28 00:57:50 1.90 +++ loncom/interface/londocs.pm 2003/10/28 21:50:02 1.91 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.90 2003/10/28 00:57:50 www Exp $ +# $Id: londocs.pm,v 1.91 2003/10/28 21:50:02 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -576,8 +576,6 @@ sub checkversions { my $r=shift; $r->print('Check Versions'. &Apache::loncommon::bodytag('Check Course Document Versions')); - $hashtied=0; - &tiehash(); my $header=''; my $startsel=''; my $monthsel=''; @@ -586,9 +584,25 @@ sub checkversions { my $allsel=''; my %changes=(); my $starttime=0; + my $haschanged=0; + if ($ENV{'form.setmostrecent'}) { + $haschanged=1; + } elsif ($ENV{'form.setcurrent'}) { + $haschanged=1; + } elsif ($ENV{'form.setversions'}) { + $haschanged=1; + } + if ($haschanged) { + $r->print('

'.&mt('Your Version Settings have been Stored').'

'); + &changewarning($r,''); + return; + } + $hashtied=0; + &tiehash(); if ($ENV{'form.timerange'} eq 'all') { # show all documents $header=&mt('All Documents in Course'); + $allsel=1; foreach (keys %hash) { if ($_=~/^ids\_(\/res\/.+)$/) { my $src=$1; @@ -633,16 +647,22 @@ sub checkversions { 'lm' => 'Version changes since last Month', 'lw' => 'Version changes since last Week', 'sy' => 'Version changes since Yesterday', - 'al' => 'All Resources', + 'al' => 'All Resources (possibly large output)', 'sd' => 'Display', 'fi' => 'File', 'md' => 'Modification Date', 'mr' => 'Most recently published Version', 've' => 'Version used in Course', - 'vu' => 'Set Version to be used in Course', + 'vu' => 'Set Version to be used in Course', +'sv' => 'Set Versions to be used in Course according to Selections below', +'sm' => 'Keep all Resources up-to-date with most recent Versions (default)', +'sc' => 'Set all Resource Versions to current Version (Fix Versions)', 'di' => 'Differences'); $r->print(< + + +
- +

$header

+ ENDHEADERS - foreach (keys %changes) { + foreach (sort keys %changes) { if ($changes{$_}>$starttime) { my ($root,$extension)=($_=~/^(.*)\.(\w+)$/); my $currentversion=&Apache::lonnet::getversion($_); my $linkurl=&Apache::lonnet::clutter($_); $r->print( - ''); + $r->print(''); } } $r->print('
$lt{'fi'}$lt{'md'}$lt{'mr'} $lt{'ve'}$lt{'vu'}$lt{'di'}
'.$linkurl. + '
'. + &Apache::lonnet::gettitle($linkurl). + '
'.$linkurl. '
'. &Apache::lonlocal::locallocaltime($changes{$_}). ''. @@ -681,9 +704,9 @@ ENDHEADERS $r->print(&Apache::loncommon::select_form($usedversion, 'set_version_'.$linkurl, ('' => '', - 'current' => 'current', + 'current' => 'most recent', map {$_,$_} (1..$currentversion)))); - $r->print(''); + $r->print('
    '); my $lastold=1; for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { my $url=$root.'.'.$prevvers.'.'.$extension; @@ -694,19 +717,19 @@ ENDHEADERS } for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { my $url=$root.'.'.$prevvers.'.'.$extension; - $r->print(''.&mt('Version').' '.$prevvers.' ('. + $r->print('
  • '.&mt('Version').' '.$prevvers.' ('. &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($url,'lastrevisiondate')). - ')'); + ')'); if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { $r->print(' '.&mt('Diffs').''); } - $r->print('
    '); + $r->print('
  • '); } - $r->print('
'); @@ -715,6 +738,19 @@ ENDHEADERS &untiehash(); } +sub changewarning { + my ($r,$postexec)=@_; + $r->print( +''. +'
'. +'

'. +&mt('Changes will become active for your current session after'). +' '.&mt(', or the next time you log in.'). +$help{'Caching'}.'

'); +} + # ================================================================ Main Handler sub handler { my $r = shift; @@ -962,15 +998,7 @@ ENDCOURSEVERIFY $hadchanges=0; &editor($r,$coursenum,$coursedom,$folder,$allowed); if ($hadchanges) { - $r->print( -''. -'
'. -'

'. -&mt('Changes will become active for your current session after'). -' '.&mt(', or the next time you log in.'). -$help{'Caching'}.'

'); + &changewarning($r,$postexec); } my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. '.sequence';