[LON-CAPA-cvs] cvs: loncom /publisher londiff.pm

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


www		Fri Oct 18 09:48:57 2002 EDT

  Modified files:              
    /loncom/publisher	londiff.pm 
  Log:
  Better mark up and comparison between /res-files.
  
  
Index: loncom/publisher/londiff.pm
diff -u loncom/publisher/londiff.pm:1.9 loncom/publisher/londiff.pm:1.10
--- loncom/publisher/londiff.pm:1.9	Mon Sep 16 09:05:49 2002
+++ loncom/publisher/londiff.pm	Fri Oct 18 09:48:57 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to show differences between file versions
 #
-# $Id: londiff.pm,v 1.9 2002/09/16 13:05:49 www Exp $
+# $Id: londiff.pm,v 1.10 2002/10/18 13:48:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,7 +69,11 @@
   my $cuname=$ENV{'user.name'};
   my $cudom=$ENV{'user.domain'};
 
-  unless (($cuname,$cudom)=
+  if ($ENV{'form.filename'}=~/^\/res\//) {
+      ($cudom,$cuname,$ENV{'form.filename'})=
+       ($ENV{'form.filename'}=~/^\/res\/(\w+)\/(\w+)\/(.*)$/);
+  } else {
+   unless (($cuname,$cudom)=
     &Apache::loncacc::constructaccess($ENV{'form.filename'},
                                       $r->dir_config('lonDefDomain'))) {
      $r->log_reason($cuname.' at '.$cudom.
@@ -77,6 +81,7 @@
          '  - not authorized', 
          $r->filename); 
      return HTTP_NOT_ACCEPTABLE;
+   }
   }
 
   my $efn=$ENV{'form.filename'};
@@ -104,6 +109,7 @@
 
  if (&Apache::loncommon::fileembstyle(($efn=~/\.(\w+)$/)) eq
       'ssi') {
+  $r->print('<p><font color="red">');
   if ($ENV{'form.versionone'} eq 'priv') {
       my $fn='/home/'.$cuname.'/public_html/'.$efn;
       if (-e $fn) {
@@ -114,22 +120,22 @@
              $f1[$#f1+1]=$line;
 	 }
       }
-      $r->print('<h3>Construction Space Version</h3>');
+      $r->print('<b>Construction Space Version</b>');
   } else {
       my $fn=
        '/home/httpd/html//res/'.$cudom.'/'.$cuname.'/';
       if ($ENV{'form.versionone'}) {
          my ($main,$suffix)=($efn=~/^(.+)\.(\w+)$/);
          $fn.=$main.'.'.$ENV{'form.versionone'}.'.'.$suffix;
-	 $r->print('<h3>Version '.$ENV{'form.versionone'}.'</h3>');
+	 $r->print('<b>Version '.$ENV{'form.versionone'}.'</b>');
       } else {
          $fn.=$efn;
-	 $r->print('<h3>Current Version</h3>');
+	 $r->print('<b>Current Version</b>');
       }
       @f1=split(/\n/,&Apache::lonnet::getfile($fn));      
   }
 
-  $r->print('versus');
+  $r->print('</font><br />versus<br /><font color="green">');
 
   if ($ENV{'form.versiontwo'} eq 'priv') {
       my $fn='/home/'.$cuname.'/public_html/'.$efn;
@@ -141,21 +147,21 @@
              $f2[$#f2+1]=$line;
 	 }
       }
-      $r->print('<h3>Construction Space Version</h3>');
+      $r->print('<b>Construction Space Version</b>');
   } else {
       my $fn=
        '/home/httpd/html/res/'.$cudom.'/'.$cuname.'/';
       if ($ENV{'form.versiontwo'}) {
          my ($main,$suffix)=($efn=~/^(.+)\.(\w+)$/);
          $fn.=$main.'.'.$ENV{'form.versiontwo'}.'.'.$suffix;
-	 $r->print('<h3>Version '.$ENV{'form.versiontwo'}.'</h3>');
+	 $r->print('<b>Version '.$ENV{'form.versiontwo'}.'</b>');
       } else {
          $fn.=$efn;
-	 $r->print('<h3>Current Version</h3>');
+	 $r->print('<b>Current Version</b>');
       }
       @f2=split(/\n/,&Apache::lonnet::getfile($fn));      
   }
-
+  $r->print('</font></p>');
 # Run diff
 
   my $diffs = diff(\@f1, \@f2);