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

www lon-capa-cvs@mail.lon-capa.org
Mon, 22 Dec 2003 22:09:06 -0000


www		Mon Dec 22 17:09:06 2003 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  * get nestedness of default.meta files correct
  * warn and abort if copyright=custom and no valid rights file given
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.148 loncom/publisher/lonpublisher.pm:1.149
--- loncom/publisher/lonpublisher.pm:1.148	Mon Dec 22 16:57:25 2003
+++ loncom/publisher/lonpublisher.pm	Mon Dec 22 17:09:06 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.148 2003/12/22 21:57:25 albertel Exp $
+# $Id: lonpublisher.pm,v 1.149 2003/12/22 22:09:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,24 +25,6 @@
 #
 # http://www.lon-capa.org/
 #
-# 
-# (TeX Content Handler
-#
-# 05/29/00,05/30,10/11 Gerd Kortemeyer)
-#
-# 11/28,11/29,11/30,12/01,12/02,12/04,12/23 Gerd Kortemeyer
-# 03/23 Guy Albertelli
-# 03/24,03/29,04/03 Gerd Kortemeyer
-# 05/03,05/05,05/07 Gerd Kortemeyer
-# 06/23,08/07,08/11,8/13,8/17,8/18,8/24,9/26,10/16 Gerd Kortemeyer
-# 12/04,12/05 Guy Albertelli
-# 12/05 Gerd Kortemeyer
-# 12/05 Guy Albertelli
-# 12/06,12/07 Gerd Kortemeyer
-# 12/25 Gerd Kortemeyer
-# YEAR=2002
-# 1/17 Gerd Kortemeyer
-#
 ###
 
 ###############################################################################
@@ -219,9 +201,8 @@
 		$newentry=~s/^\s*//;
 		if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; }
 	    }
-	    unless ($metadatafields{$unikey}=~/\w/) {
-		$metadatafields{$unikey}=$newentry;
-	    }
+# actually store
+	    $metadatafields{$unikey}=$newentry;
 	}
     }
 }
@@ -981,10 +962,6 @@
 	                                 $ENV{'user.domain'};
 	$metadatafields{'authorspace'}=$cuname.'@'.$cudom;
 
-# ----------------------------------------------------------- Parse file itself
-# read %metadatafields from file itself
- 
-	$allmeta=&parseformeta($source,$style);
 # ------------------------------------------------ Check out directory hierachy
 
         my $thisdisfn=$source;
@@ -1001,6 +978,10 @@
             $scrout.=&metaread($logfile,$currentpath.'default.meta',$prefix);
 	    $prefix=~s|^\.\./||;
         }
+# ----------------------------------------------------------- Parse file itself
+# read %metadatafields from file itself
+ 
+	$allmeta=&parseformeta($source,$style);
 
 # ------------------- Clear out parameters and stores (there should not be any)
 
@@ -1357,6 +1338,15 @@
     $allkeywords=~s/^\,//;
     $metadatafields{'keywords'}=$allkeywords;
     
+# check if custom distribution file is specified
+    if ($metadatafields{'copyright'} eq 'custom') {
+	my $file=$metadatafields{'customdistributionfile'};
+	unless ($file=~/\.rights$/) {
+            return 
+                '<font color="red">'.&mt('No valid custom distribution rights file specified, FAIL').
+		'</font>';
+        }
+    }
     {
         print $logfile "\nWrite metadata file for ".$source;
         my $mfh;
@@ -1562,6 +1552,7 @@
                    '"><font size="+2">'.
 		  &mt('Back to Source Directory').'</font></a></p>');
     }
+    return '<p><font color="green">'.&mt('Done').'</font></p>';
 }
 
 #########################################
@@ -1861,8 +1852,8 @@
 	    my ($outstring,$error)=&publish($thisfn,$thistarget,$thisembstyle);
 	    $r->print('<hr />'.$outstring);
 	} else {
-	    $r->print('<hr />');
-	    &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget); 
+	    $r->print('<hr />'.
+	    &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget)); 
 	}
     }
     $r->print('</body></html>');