Diff for /loncom/interface/londocs.pm between versions 1.90 and 1.91

version 1.90, 2003/10/28 00:57:50 version 1.91, 2003/10/28 21:50:02
Line 576  sub checkversions { Line 576  sub checkversions {
     my $r=shift;      my $r=shift;
     $r->print('<html><head><title>Check Versions</title></head>'.      $r->print('<html><head><title>Check Versions</title></head>'.
               &Apache::loncommon::bodytag('Check Course Document Versions'));                &Apache::loncommon::bodytag('Check Course Document Versions'));
     $hashtied=0;  
     &tiehash();  
     my $header='';      my $header='';
     my $startsel='';      my $startsel='';
     my $monthsel='';      my $monthsel='';
Line 586  sub checkversions { Line 584  sub checkversions {
     my $allsel='';      my $allsel='';
     my %changes=();      my %changes=();
     my $starttime=0;      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('<h1>'.&mt('Your Version Settings have been Stored').'</h1>');
    &changewarning($r,'');
    return;
       }
       $hashtied=0;
       &tiehash();
     if ($ENV{'form.timerange'} eq 'all') {      if ($ENV{'form.timerange'} eq 'all') {
 # show all documents  # show all documents
  $header=&mt('All Documents in Course');   $header=&mt('All Documents in Course');
    $allsel=1;
  foreach (keys %hash) {   foreach (keys %hash) {
     if ($_=~/^ids\_(\/res\/.+)$/) {      if ($_=~/^ids\_(\/res\/.+)$/) {
  my $src=$1;   my $src=$1;
Line 633  sub checkversions { Line 647  sub checkversions {
        'lm' => 'Version changes since last Month',         'lm' => 'Version changes since last Month',
        'lw' => 'Version changes since last Week',         'lw' => 'Version changes since last Week',
        'sy' => 'Version changes since Yesterday',         'sy' => 'Version changes since Yesterday',
                'al' => 'All Resources',                 'al' => 'All Resources (possibly large output)',
        'sd' => 'Display',         'sd' => 'Display',
        'fi' => 'File',         'fi' => 'File',
        'md' => 'Modification Date',         'md' => 'Modification Date',
                'mr' => 'Most recently published Version',                 'mr' => 'Most recently published Version',
        've' => 'Version used in Course',         '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');         'di' => 'Differences');
     $r->print(<<ENDHEADERS);      $r->print(<<ENDHEADERS);
 <form action="/adm/coursedocs" method="post">  <form action="/adm/coursedocs" method="post">
   <input type="hidden" name="versions" value="1" />
   <input type="submit" name="setmostrecent" value="$lt{'sm'}" />
   <input type="submit" name="setcurrent" value="$lt{'sc'}" /><hr />
 <select name="timerange">  <select name="timerange">
 <option value='all' $allsel>$lt{'al'}</option>  <option value='all' $allsel>$lt{'al'}</option>
 <option value="-1" $startsel>$lt{'st'}</option>  <option value="-1" $startsel>$lt{'st'}</option>
Line 650  sub checkversions { Line 670  sub checkversions {
 <option value="604800" $weeksel>$lt{'lw'}</option>  <option value="604800" $weeksel>$lt{'lw'}</option>
 <option value="86400" $daysel>$lt{'sy'}</option>  <option value="86400" $daysel>$lt{'sy'}</option>
 </select>  </select>
 <input type="submit" name="versions" value="$lt{'sd'}" />  <input type="submit" name="display" value="$lt{'sd'}" />
 </form>  </form>
 <h3>$header</h3>  <h3>$header</h3>
   <input type="submit" name="setversions" value="$lt{'sv'}" />
 <table border="2">  <table border="2">
 <tr>  <tr>
 <th>$lt{'fi'}</th><th>$lt{'md'}</th><th>$lt{'mr'}</th>  <th>$lt{'fi'}</th><th>$lt{'md'}</th><th>$lt{'mr'}</th>
 <th>$lt{'ve'}</th><th>$lt{'vu'}</th><th>$lt{'di'}</th></tr>  <th>$lt{'ve'}</th><th>$lt{'vu'}</th><th>$lt{'di'}</th></tr>
 ENDHEADERS  ENDHEADERS
     foreach (keys %changes) {      foreach (sort keys %changes) {
  if ($changes{$_}>$starttime) {   if ($changes{$_}>$starttime) {
     my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);      my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);
     my $currentversion=&Apache::lonnet::getversion($_);      my $currentversion=&Apache::lonnet::getversion($_);
     my $linkurl=&Apache::lonnet::clutter($_);      my $linkurl=&Apache::lonnet::clutter($_);
     $r->print(      $r->print(
       '<tr><td><a href="'.$linkurl.'" target="cat">'.$linkurl.        '<tr><td><b>'.
         &Apache::lonnet::gettitle($linkurl).
      '</b><br /><a href="'.$linkurl.'" target="cat">'.$linkurl.
       '</a></td><td>'.        '</a></td><td>'.
       &Apache::lonlocal::locallocaltime($changes{$_}).        &Apache::lonlocal::locallocaltime($changes{$_}).
                       '</td><td><font size="+2">'.                        '</td><td><font size="+2">'.
Line 681  ENDHEADERS Line 704  ENDHEADERS
     $r->print(&Apache::loncommon::select_form($usedversion,      $r->print(&Apache::loncommon::select_form($usedversion,
       'set_version_'.$linkurl,        'set_version_'.$linkurl,
       ('' => '',        ('' => '',
        'current' => 'current',         'current' => 'most recent',
        map {$_,$_} (1..$currentversion))));         map {$_,$_} (1..$currentversion))));
     $r->print('</td><td>');      $r->print('</td><td><font size="1"><ul>');
     my $lastold=1;      my $lastold=1;
     for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {      for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
  my $url=$root.'.'.$prevvers.'.'.$extension;   my $url=$root.'.'.$prevvers.'.'.$extension;
Line 694  ENDHEADERS Line 717  ENDHEADERS
     }      }
             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {              for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
  my $url=$root.'.'.$prevvers.'.'.$extension;   my $url=$root.'.'.$prevvers.'.'.$extension;
  $r->print('<a href="'.&Apache::lonnet::clutter($url).   $r->print('<li><a href="'.&Apache::lonnet::clutter($url).
   '">'.&mt('Version').' '.$prevvers.' ('.    '">'.&mt('Version').' '.$prevvers.'</a> ('.
   &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($url,'lastrevisiondate')).    &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($url,'lastrevisiondate')).
   ')</a>');    ')');
  if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {   if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
                     $r->print(' <a href="/adm/diff?filename='.                      $r->print(' <a href="/adm/diff?filename='.
       &Apache::lonnet::clutter($root.'.'.$extension).        &Apache::lonnet::clutter($root.'.'.$extension).
       '&versionone='.$prevvers.        '&versionone='.$prevvers.
       '">'.&mt('Diffs').'</a>');        '">'.&mt('Diffs').'</a>');
  }   }
  $r->print('<br />');   $r->print('</li>');
     }      }
     $r->print('</td></tr>');      $r->print('</ul></font></td></tr>');
  }   }
     }      }
     $r->print('</table>');      $r->print('</table>');
Line 715  ENDHEADERS Line 738  ENDHEADERS
     &untiehash();      &untiehash();
 }  }
   
   sub changewarning {
       my ($r,$postexec)=@_;
       $r->print(
   '<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. 
   '<form method="post" action="/adm/roles" target="loncapaclient">'.
   '<input type="hidden" name="orgurl" value="/adm/coursedocs" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
   &mt('Changes will become active for your current session after').
   ' <input type="hidden" name="'.
   $ENV{'request.role'}.'" value="1" /><input type="button" value="'.
   &mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.').
   $help{'Caching'}.'</font></h3></form>');
   }
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
Line 962  ENDCOURSEVERIFY Line 998  ENDCOURSEVERIFY
        $hadchanges=0;         $hadchanges=0;
        &editor($r,$coursenum,$coursedom,$folder,$allowed);         &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($hadchanges) {         if ($hadchanges) {
    $r->print(     &changewarning($r,$postexec);
 '<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'.   
 '<form method="post" action="/adm/roles" target="loncapaclient">'.  
 '<input type="hidden" name="orgurl" value="/adm/coursedocs" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.  
 &mt('Changes will become active for your current session after').  
 ' <input type="hidden" name="'.  
 $ENV{'request.role'}.'" value="1" /><input type="button" value="'.  
 &mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.').  
 $help{'Caching'}.'</font></h3></form>');  
        }         }
        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.         my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
                      '.sequence';                       '.sequence';

Removed from v.1.90  
changed lines
  Added in v.1.91


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>