[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 18 Oct 2002 13:47:57 -0000


www		Fri Oct 18 09:47:57 2002 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Version control
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.31 loncom/interface/londocs.pm:1.32
--- loncom/interface/londocs.pm:1.31	Thu Oct 17 11:18:03 2002
+++ loncom/interface/londocs.pm	Fri Oct 18 09:47:57 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.31 2002/10/17 15:18:03 www Exp $
+# $Id: londocs.pm,v 1.32 2002/10/18 13:47:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -324,16 +324,20 @@
        if ($ENV{'form.timerange'}==-1) {
 	   $seltext='since start of course';
            $startsel='selected';
-       } elsif ($ENV{'form.timerange'}==2592000) {
-           $seltext='during the last month';
+           $ENV{'form.timerange'}=time;
+       }
+       my $starttime=time-$ENV{'form.timerange'};
+       if ($ENV{'form.timerange'}==2592000) {
+           $seltext='during the last month ('.localtime($starttime).')';
            $monthsel='selected';
        } elsif ($ENV{'form.timerange'}==604800) {
-           $seltext='during the last week';
+           $seltext='during the last week ('.localtime($starttime).')';
            $weeksel='selected';
        } elsif ($ENV{'form.timerange'}==86400) {
-           $seltext='since yesterday';
+           $seltext='since yesterday ('.localtime($starttime).')';
            $daysel='selected';
        }
+ 
        $r->print(<<ENDHEADERS);
 <form action="/adm/coursedocs" method="post">
 <select name="timerange">
@@ -344,18 +348,39 @@
 </select>
 <input type="submit" name="versions" value="Display" />
 </form>
-<h1>Content changed $seltext</h1>
+<h3>Content changed $seltext</h3>
 <table border="2">
 <tr>
 <th>File</th><th>Modification Date</th>
 <th>Version</th><th>Differences</th></tr>
 ENDHEADERS
        foreach (keys %changes) {
-           my $currentversion=&Apache::lonnet::getversion($_);
-           $r->print(
-                 '<tr><td><a href="'.$_.'" target="cat">'.$_.'</a></td><td>'.
-                 localtime($changes{$_}).'</td><td>'.$currentversion.'</td>');
-           $r->print('</tr>');
+	  if ($changes{$_}>$starttime) {
+	     my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);
+             my $currentversion=&Apache::lonnet::getversion($_);
+             my $linkurl=&Apache::lonnet::clutter($_);
+             $r->print(
+                 '<tr><td><a href="'.$linkurl.'" target="cat">'.$linkurl.
+                 '</a></td><td>'.
+                 localtime($changes{$_}).'</td><td>'.$currentversion.'</td>'.
+		       '<td>');
+             my $lastold=1;
+             for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
+                 my $url=$root.'.'.$prevvers.'.'.$extension;
+                 if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
+                                                             $starttime) {
+                     $lastold=$prevvers;
+                 }
+             }
+            for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
+                 my $url=$root.'.'.$prevvers.'.'.$extension;
+                 $r->print('<a href="'.&Apache::lonnet::clutter($url).
+                   '">Version '.$prevvers.' ('.
+                 localtime(&Apache::lonnet::metadata($url,'lastrevisiondate')).
+                 ')</a><br />');
+             }
+             $r->print('</td></tr>');
+          }
        }
        $r->print('</table>');
    } else {