Diff for /loncom/interface/londocs.pm between versions 1.520 and 1.521

version 1.520, 2012/12/04 00:39:48 version 1.521, 2012/12/05 13:50:32
Line 2627  sub checkonthis { Line 2627  sub checkonthis {
              $r->print('<span class="LC_error">'.&mt('connection down').'</span>');               $r->print('<span class="LC_error">'.&mt('connection down').'</span>');
           } elsif ($result eq 'not_found') {            } elsif ($result eq 'not_found') {
       unless ($url=~/\$/) {        unless ($url=~/\$/) {
   $r->print('<span class="LC_error">'.&mt('not found').'</b></span>');    $r->print('<span class="LC_error">'.&mt('not found').'</span>');
       } else {        } else {
   $r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>');    $r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>');
       }        }
Line 2673  sub list_symbs { Line 2673  sub list_symbs {
             $r->print(&Apache::loncommon::start_data_table_row().              $r->print(&Apache::loncommon::start_data_table_row().
                       '<td>'.$res->compTitle().'</td>'.                        '<td>'.$res->compTitle().'</td>'.
                       '<td>'.$res->symb().'</td>'.                        '<td>'.$res->symb().'</td>'.
                       &Apache::loncommon::start_data_table_row());                        &Apache::loncommon::end_data_table_row());
             $count ++;              $count ++;
         }          }
         if (!$count) {          if (!$count) {
Line 2683  sub list_symbs { Line 2683  sub list_symbs {
         }          }
         $r->print(&Apache::loncommon::end_data_table());          $r->print(&Apache::loncommon::end_data_table());
     }      }
       $r->print(&endContentScreen());
 }  }
   
   
Line 2713  sub verifycontent { Line 2714  sub verifycontent {
    }     }
    &untiehash();     &untiehash();
    $r->print('<p class="LC_success">'.&mt('Done').'</p>');     $r->print('<p class="LC_success">'.&mt('Done').'</p>');
       $r->print(&endContentScreen());
 }  }
   
   
Line 2792  sub checkversions { Line 2794  sub checkversions {
     if ($env{'form.timerange'} eq 'all') {      if ($env{'form.timerange'} eq 'all') {
 # show all documents  # show all documents
  $header=&mt('All Documents in '.$crstype);   $header=&mt('All Documents in '.$crstype);
  $allsel=1;   $allsel=' selected="selected"';
  foreach my $key (keys(%hash)) {   foreach my $key (keys(%hash)) {
     if ($key=~/^ids\_(\/res\/.+)$/) {      if ($key=~/^ids\_(\/res\/.+)$/) {
  my $src=$1;   my $src=$1;
Line 2813  sub checkversions { Line 2815  sub checkversions {
  .&mt('seconds');   .&mt('seconds');
     if ($env{'form.timerange'}==-1) {      if ($env{'form.timerange'}==-1) {
  $seltext='since start of course';   $seltext='since start of course';
  $startsel='selected';   $startsel=' selected="selected"';
  $env{'form.timerange'}=time;   $env{'form.timerange'}=time;
     }      }
     $starttime=time-$env{'form.timerange'};      $starttime=time-$env{'form.timerange'};
     if ($env{'form.timerange'}==2592000) {      if ($env{'form.timerange'}==2592000) {
  $seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';   $seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
  $monthsel='selected';   $monthsel=' selected="selected"';
     } elsif ($env{'form.timerange'}==604800) {      } elsif ($env{'form.timerange'}==604800) {
  $seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';   $seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
  $weeksel='selected';   $weeksel=' selected="selected"';
     } elsif ($env{'form.timerange'}==86400) {      } elsif ($env{'form.timerange'}==86400) {
  $seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';   $seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
  $daysel='selected';   $daysel=' selected="selected"';
     }      }
     $header=&mt('Content changed').' '.$seltext;      $header=&mt('Content changed').' '.$seltext;
  } else {   } else {
Line 2863  sub checkversions { Line 2865  sub checkversions {
 <fieldset>  <fieldset>
 <legend>$lt{'cd'}</legend>  <legend>$lt{'cd'}</legend>
 <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>
 <option value="2592000" $monthsel>$lt{'lm'}</option>  <option value="2592000"$monthsel>$lt{'lm'}</option>
 <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="display" value="$lt{'sd'}" />  <input type="submit" name="display" value="$lt{'sd'}" />
 </fieldset>  </fieldset>
Line 2883  $lt{'sc'}: <input type="submit" name="se Line 2885  $lt{'sc'}: <input type="submit" name="se
 <hr />  <hr />
 <h4>$lt{'vers'}</h4>  <h4>$lt{'vers'}</h4>
 <input type="submit" name="setversions" value="$lt{'save'}" />  <input type="submit" name="setversions" value="$lt{'save'}" />
 <table border="0">  
 ENDHEADERS  ENDHEADERS
     #number of columns for version history      #number of columns for version history
     my $num_ver_col = 1;  
     $r->print(      $r->print(
     &Apache::loncommon::start_data_table().          &Apache::loncommon::start_data_table().
     &Apache::loncommon::start_data_table_header_row().          &Apache::loncommon::start_data_table_header_row().
     '<th>'.&mt('Resources').'</th>'.          '<th>'.&mt('Resources').'</th>'.
     "<th>$lt{'mr'}</th>".          "<th>$lt{'mr'}</th>".
     "<th>$lt{'ve'}</th>".          "<th>$lt{'ve'}</th>".
     "<th>$lt{'vu'}</th>".          "<th>$lt{'vu'}</th>".
     '<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'.          '<th>'.&mt('History').'</th>'.
     '</b>');          &Apache::loncommon::end_data_table_header_row()
       );
     foreach my $key (sort(keys(%changes))) {      foreach my $key (sort(keys(%changes))) {
         #excludes not versionable problems from resource version history:          #excludes not versionable problems from resource version history:
         if ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/) {          next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/);
     my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);          my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
     my $currentversion=&Apache::lonnet::getversion($key);          my $currentversion=&Apache::lonnet::getversion($key);
     if ($currentversion<0) {          if ($currentversion<0) {
                 $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';              $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
     }          }
     my $linkurl=&Apache::lonnet::clutter($key);          my $linkurl=&Apache::lonnet::clutter($key);
         $r->print(          $r->print(
             &Apache::loncommon::end_data_table_header_row().  
             &Apache::loncommon::start_data_table_row().              &Apache::loncommon::start_data_table_row().
             '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'.              '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'.
             '<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.              '<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.
             '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('.              '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('.
             &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'.              &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'.
             '<td align="right">');              '<td align="right">'
 # Used in course          );
     my $usedversion=$hash{'version_'.$linkurl};          # Used in course
     if (($usedversion) && ($usedversion ne 'mostrecent')) {          my $usedversion=$hash{'version_'.$linkurl};
                 if($usedversion != $currentversion){          if (($usedversion) && ($usedversion ne 'mostrecent')) {
                   if ($usedversion != $currentversion) {
                     $r->print('<span class="LC_warning">'.$usedversion.'</span>');                      $r->print('<span class="LC_warning">'.$usedversion.'</span>');
                 }else{                  } else {
                     $r->print($usedversion);                      $r->print($usedversion);
                 }                  }
     } else {  
  $r->print($currentversion);  
     }  
     $r->print('</td><td title="'.$lt{'vu'}.'">');  
 # Set version  
     $r->print(&Apache::loncommon::select_form($setversions{$linkurl},  
       'set_version_'.$linkurl,  
       {'select_form_order' =>  
        ['',1..$currentversion,'mostrecent'],  
        '' => '',  
        'mostrecent' => &mt('most recent'),  
        map {$_,$_} (1..$currentversion)}));  
     my $lastold=1;  
     for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {  
  my $url=$root.'.'.$prevvers.'.'.$extension;  
  if (&Apache::lonnet::metadata($url,'lastrevisiondate')<  
     $starttime) {  
     $lastold=$prevvers;  
  }  
     }  
             #  
             # Code to figure out how many version entries should go in  
             # each of the four columns  
             my $entries_per_col = 0;  
             my $num_entries = ($currentversion-$lastold);  
             if ($num_entries % $num_ver_col == 0) {  
                 $entries_per_col = $num_entries/$num_ver_col;  
             } else {              } else {
                 $entries_per_col = $num_entries/$num_ver_col + 1;                  $r->print($currentversion);
             }              }
             my $entries_count = 0;          $r->print('</td><td title="'.$lt{'vu'}.'">');
             $r->print('<td valign="top"><span class="LC_fontsize_medium">');          # Set version
             my $cols_output = 1;          $r->print(&Apache::loncommon::select_form(
             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {              $setversions{$linkurl},
  my $url=$root.'.'.$prevvers.'.'.$extension;              'set_version_'.$linkurl,
  $r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url).              {'select_form_order' => ['',1..$currentversion,'mostrecent'],
   '">'.&mt('Version').' '.$prevvers.'</a> ('.               '' => '',
   &Apache::lonlocal::locallocaltime(               'mostrecent' => &mt('most recent'),
                                 &Apache::lonnet::metadata($url,               map {$_,$_} (1..$currentversion)}));
                                                           'lastrevisiondate')          my $lastold=1;
                                                             ).          for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
   ')');              my $url=$root.'.'.$prevvers.'.'.$extension;
  if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {              if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) {
                     $r->print(' <a href="/adm/diff?filename='.                  $lastold=$prevvers;
       &Apache::lonnet::clutter($root.'.'.$extension).  
       '&versionone='.$prevvers.  
       '" target="diffs">'.&mt('Diffs').'</a>');  
  }  
  $r->print('</span><br />');  
                 if (++$entries_count % $entries_per_col == 0) {  
                     $r->print('</span></td>');  
                     if ($cols_output != $num_ver_col) {  
                         $r->print('<td valign="top"><span class="LC_fontsize_medium">');  
                         $cols_output++;  
                     }  
                 }  
     }  
             while($cols_output++ < $num_ver_col) {  
                 $r->print('</span></td><td>');  
             }              }
  }          }
           $r->print('</td>');
           # List all available versions
           $r->print('<td valign="top"><span class="LC_fontsize_medium">');
           for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
               my $url=$root.'.'.$prevvers.'.'.$extension;
               $r->print(
                   '<span class="LC_nobreak">'
                  .'<a href="'.&Apache::lonnet::clutter($url).'">'
                  .&mt('Version [_1]',$prevvers).'</a>'
                  .' ('.&Apache::lonlocal::locallocaltime(
                            &Apache::lonnet::metadata($url,'lastrevisiondate'))
                  .')');
               if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
                   $r->print(
                       ' <a href="/adm/diff?filename='.
                       &Apache::lonnet::clutter($root.'.'.$extension).
                       &HTML::Entities::encode('&versionone='.$prevvers,'"<>&').
                       '" target="diffs">'.&mt('Diffs').'</a>');
               }
               $r->print('</span><br />');
           }
           $r->print('</span></td>'.&Apache::loncommon::end_data_table_row());
     }      }
     $r->print('</td>'.&Apache::loncommon::end_data_table_row().      $r->print(
             &Apache::loncommon::end_data_table().          &Apache::loncommon::end_data_table().
             '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />');          '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
           '</form>'
       );
   
     &untiehash();      &untiehash();
       $r->print(&endContentScreen());
 }  }
   
 sub mark_hash_old {  sub mark_hash_old {

Removed from v.1.520  
changed lines
  Added in v.1.521


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