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

www lon-capa-cvs@mail.lon-capa.org
Thu, 17 Oct 2002 15:18:03 -0000


www		Thu Oct 17 11:18:03 2002 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Choice of timerange for version change display
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.30 loncom/interface/londocs.pm:1.31
--- loncom/interface/londocs.pm:1.30	Wed Oct 16 16:18:19 2002
+++ loncom/interface/londocs.pm	Thu Oct 17 11:18:03 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.30 2002/10/16 20:18:19 www Exp $
+# $Id: londocs.pm,v 1.31 2002/10/17 15:18:03 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -311,9 +311,55 @@
    my %changes=&Apache::lonnet::dump
     ('versionupdate',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
                      $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
-   foreach (keys %changes) {
-       $r->print('<br /><a href="'.$_.'" target="cat">'.$_.'</a> - '.
-                 localtime($changes{$_}));
+   my $firstkey=(keys %changes)[0];
+   unless ($firstkey=~/^error\:/) {
+       unless ($ENV{'form.timerange'}) {
+	   $ENV{'form.timerange'}=604800;
+       }
+       my $seltext='during the last '.$ENV{'form.timerange'}.' seconds';
+       my $startsel='';
+       my $monthsel='';
+       my $weeksel='';
+       my $daysel='';
+       if ($ENV{'form.timerange'}==-1) {
+	   $seltext='since start of course';
+           $startsel='selected';
+       } elsif ($ENV{'form.timerange'}==2592000) {
+           $seltext='during the last month';
+           $monthsel='selected';
+       } elsif ($ENV{'form.timerange'}==604800) {
+           $seltext='during the last week';
+           $weeksel='selected';
+       } elsif ($ENV{'form.timerange'}==86400) {
+           $seltext='since yesterday';
+           $daysel='selected';
+       }
+       $r->print(<<ENDHEADERS);
+<form action="/adm/coursedocs" method="post">
+<select name="timerange">
+<option value="-1" $startsel>Since Start of Course</option>
+<option value="2592000" $monthsel>Last Month</option>
+<option value="604800" $weeksel>Last Week</option>
+<option value="86400" $daysel>Since Yesterday</option>
+</select>
+<input type="submit" name="versions" value="Display" />
+</form>
+<h1>Content changed $seltext</h1>
+<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>');
+       }
+       $r->print('</table>');
+   } else {
+       $r->print('<p>No content modifications yet.</p>');
    }
    &untiehash();
   } else {