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

raeburn raeburn at source.lon-capa.org
Tue Nov 7 16:31:11 EST 2023


raeburn		Tue Nov  7 21:31:11 2023 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  - Support domain default or user override in new metadata file for:
    Default Copyright/Distribution and Default Source Available.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.256 loncom/interface/lonmeta.pm:1.257
--- loncom/interface/lonmeta.pm:1.256	Fri Jul 14 23:15:10 2023
+++ loncom/interface/lonmeta.pm	Tue Nov  7 21:31:11 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.256 2023/07/14 23:15:10 raeburn Exp $
+# $Id: lonmeta.pm,v 1.257 2023/11/07 21:31:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1509,9 +1509,48 @@
             $Apache::lonpublisher::metadatafields{'copyright'}='custom';
             $Apache::lonpublisher::metadatafields{'customdistributionfile'}=$crsaurights;
         }
+        my (%domdefs,$got_domdefs);
         if (! $Apache::lonpublisher::metadatafields{'copyright'}) {
-                $Apache::lonpublisher::metadatafields{'copyright'}=
-		    'default';
+            my $copyright = 'default';
+            if ($env{'environment.copyright'} ne '') {
+                $copyright = $env{'environment.copyright'};
+            } else {
+                my $defdom = $env{'request.role.domain'};
+                if ($disuri =~ m{^/priv/($match_domain)/}) {
+                    $defdom = $1;
+                }
+                if ($defdom ne '') {
+                    %domdefs = &Apache::lonnet::get_domain_defaults($defdom);
+                    $got_domdefs = 1;
+                    if ($domdefs{'copyright'} ne '') {
+                        $copyright = $domdefs{'copyright'};
+                    }
+                }
+            }
+            $Apache::lonpublisher::metadatafields{'copyright'}=
+		$copyright;
+        }
+        if (! $Apache::lonpublisher::metadatafields{'sourceavail'}) {
+            my $sourceavail = 'closed';
+            if ($env{'environment.sourceavail'} ne '') {
+                $sourceavail = $env{'environment.sourceavail'};
+            } else {
+                my $defdom = $env{'request.role.domain'};
+                if ($disuri =~ m{^/priv/($match_domain)/}) {
+                    $defdom = $1;
+                }
+                if ($defdom ne '') {
+                    unless ($got_domdefs) {
+                        %domdefs = &Apache::lonnet::get_domain_defaults($defdom);
+                        $got_domdefs = 1;
+                    }
+                    if ($domdefs{'sourceavail'} ne '') {
+                        $sourceavail = $domdefs{'sourceavail'};
+                    }
+                }
+            }
+            $Apache::lonpublisher::metadatafields{'sourceavail'}=
+                $sourceavail;
         }
 	if (($file_type eq 'portfolio') || ($file_type eq 'groups'))  {
 	    if (! $Apache::lonpublisher::metadatafields{'mime'}) {




More information about the LON-CAPA-cvs mailing list