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

www lon-capa-cvs@mail.lon-capa.org
Fri, 18 Jun 2004 16:52:20 -0000


www		Fri Jun 18 12:52:20 2004 EDT

  Modified files:              
    /loncom/publisher	lonpubdir.pm lonpublisher.pm 
  Log:
  * show sourcerights in dir listing
  * dial in the previously set value of sourceavail on re-publish
  * fix paths for sourcerights-file the same as for customrights
  
  
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.60 loncom/publisher/lonpubdir.pm:1.61
--- loncom/publisher/lonpubdir.pm:1.60	Mon Jun  7 18:34:12 2004
+++ loncom/publisher/lonpubdir.pm	Fri Jun 18 12:52:19 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.60 2004/06/07 22:34:12 albertel Exp $
+# $Id: lonpubdir.pm,v 1.61 2004/06/18 16:52:19 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -256,6 +256,11 @@
     my $fullname = shift;
     return &Apache::lonnet::metadata($fullname, 'copyright');
 }
+
+sub getSourceRightString {
+    my $fullname = shift;
+    return &Apache::lonnet::metadata($fullname, 'sourceavail');
+}
 #
 #  Put out a directory table row:
 #    putdirectory(r, base, here, dirname, modtime)
@@ -321,7 +326,8 @@
 	$publish_button=&mt('Re-Publish');
 	if ($rmtime>=$cmtime) {
 	    $status=&mt('Published').'<br />'.
-		&mt(&getCopyRightString($targetdir.'/'.$filename));
+		&mt(&getCopyRightString($targetdir.'/'.$filename)).' '.
+		&mt(&getSourceRightString($targetdir.'/'.$filename));
 	    $bgcolor='#CCFF88';
 	    if (&Apache::lonnet::metadata($targetdir.'/'.$filename,'obsolete')) {
 		$status=&mt('Obsolete');
@@ -332,7 +338,8 @@
 		&getTitleString($targetdir.'/'.$filename).'</a>';
 	} else {
 	    $status=&mt('Modified').'<br />'.
-		&mt(&getCopyRightString($targetdir.'/'.$filename));
+		&mt(&getCopyRightString($targetdir.'/'.$filename)).' '.
+		&mt(&getSourceRightString($targetdir.'/'.$filename));
             $bgcolor='#FFFF77';
 	    $title='<a href="/res/'.$targetdir.'/'.$filename.'.meta" target=cat>'.
 		&getTitleString($targetdir.'/'.$filename).'</a>';
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.173 loncom/publisher/lonpublisher.pm:1.174
--- loncom/publisher/lonpublisher.pm:1.173	Fri Jun 18 12:02:18 2004
+++ loncom/publisher/lonpublisher.pm	Fri Jun 18 12:52:19 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.173 2004/06/18 16:02:18 www Exp $
+# $Id: lonpublisher.pm,v 1.174 2004/06/18 16:52:19 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -199,7 +199,8 @@
 		}
 	    }
 	    my $newentry=$parser->get_text('/'.$entry);
-	    if ($entry eq 'customdistributionfile') {
+	    if (($entry eq 'customdistributionfile') ||
+		($entry eq 'sourcerights')) {
 		$newentry=~s/^\s*//;
 		if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; }
 	    }
@@ -1210,11 +1211,15 @@
 	$metadatafields{'copyright'}='default';
 	$metadatafields{'sourceavail'}='open';
     }
-# -------------------------------------------------- Correct copyright for rat.
+# ------------------------------------------------ Dial in reasonable defaults
     my $defaultoption=$metadatafields{'copyright'};
     unless ($defaultoption) { $defaultoption='default'; }
+    my $defaultsourceoption=$metadatafields{'sourceavail'};
+    unless ($defaultsourceoption) { $defaultsourceoption='closed'; }
     unless ($style eq 'prv') {
+# -------------------------------------------------- Correct copyright for rat.
 	if ($style eq 'rat') {
+# -------------------------------------- Retrofix for non-applicable copyright
 	    if ($metadatafields{'copyright'} eq 'public') { 
 		delete $metadatafields{'copyright'};
 		$defaultoption='default';
@@ -1223,39 +1228,38 @@
 				     $defaultoption,
 				     \&Apache::loncommon::copyrightdescription,
 				    (grep !/^public$/,(&Apache::loncommon::copyrightids)));
-	    } else {
-		$intr_scrout.=&selectbox('Copyright/Distribution','copyright',
-				    $defaultoption,
-				    \&Apache::loncommon::copyrightdescription,
-				    (&Apache::loncommon::copyrightids));
-	    }
-    
-	    my $copyright_help =
-		Apache::loncommon::help_open_topic('Publishing_Copyright');
-	    $intr_scrout =~ s/DISTRIBUTION:/'DISTRIBUTION: ' . $copyright_help/ge;
-	    $intr_scrout.=&textfield('Custom Distribution File','customdistributionfile',
-				$metadatafields{'customdistributionfile'}).
-				    $copyright_help;
-	    $intr_scrout.=&selectbox('Source Distribution','sourceavail',
-				    $defaultoption,
-				    \&Apache::loncommon::source_copyrightdescription,
-				    (&Apache::loncommon::source_copyrightids));
-		 $intr_scrout.=&textfield('Source Custom Distribution File','sourcerights',
-				$metadatafields{'sourcerights'});
-	    my $uctitle=&mt('Obsolete');
-            $intr_scrout.=
-		"\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
-		'</b></font> <input type="checkbox" name="obsolete" ';
-	    if ($metadatafields{'obsolete'}) {
-		$intr_scrout.=' checked="1" ';
-	    }
-	    $intr_scrout.='/ ></p>'.
-		&textfield('Suggested Replacement for Obsolete File',
-				    'obsoletereplacement',
-				    $metadatafields{'obsoletereplacement'});
 	} else {
-	    $intr_scrout.=&hiddenfield('copyright','private');
+	    $intr_scrout.=&selectbox('Copyright/Distribution','copyright',
+				     $defaultoption,
+				     \&Apache::loncommon::copyrightdescription,
+				     (&Apache::loncommon::copyrightids));
 	}
+	my $copyright_help =
+	    Apache::loncommon::help_open_topic('Publishing_Copyright');
+	$intr_scrout =~ s/DISTRIBUTION:/'DISTRIBUTION: ' . $copyright_help/ge;
+	$intr_scrout.=&textfield('Custom Distribution File','customdistributionfile',
+				 $metadatafields{'customdistributionfile'}).
+				     $copyright_help;
+	$intr_scrout.=&selectbox('Source Distribution','sourceavail',
+				 $defaultsourceoption,
+				 \&Apache::loncommon::source_copyrightdescription,
+				 (&Apache::loncommon::source_copyrightids));
+		 $intr_scrout.=&textfield('Source Custom Distribution File','sourcerights',
+					  $metadatafields{'sourcerights'});
+	my $uctitle=&mt('Obsolete');
+	$intr_scrout.=
+	    "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
+	    '</b></font> <input type="checkbox" name="obsolete" ';
+	if ($metadatafields{'obsolete'}) {
+	    $intr_scrout.=' checked="1" ';
+	}
+	$intr_scrout.='/ ></p>'.
+	    &textfield('Suggested Replacement for Obsolete File',
+		       'obsoletereplacement',
+		       $metadatafields{'obsoletereplacement'});
+    } else {
+	$intr_scrout.=&hiddenfield('copyright','private');
+    }
     if (!$batch) {
 	$scrout.=$intr_scrout.'<p><input type="submit" value="'.
 	    &mt('Finalize Publication').'" /></p></form>';