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

taceyjo1 lon-capa-cvs@mail.lon-capa.org
Fri, 11 Jun 2004 02:21:45 -0000


taceyjo1		Thu Jun 10 22:21:45 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonmeta.pm 
  Log:
  Well <puts on stylepolice repellent> here is the beginning of 
  opensource, you can now publish things, and it will go into the 
  metafile. 
  
  BUG: #78 
  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.191 loncom/interface/loncommon.pm:1.192
--- loncom/interface/loncommon.pm:1.191	Mon May  3 12:07:18 2004
+++ loncom/interface/loncommon.pm	Thu Jun 10 22:21:45 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.191 2004/05/03 16:07:18 matthew Exp $
+# $Id: loncommon.pm,v 1.192 2004/06/11 02:21:45 taceyjo1 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,6 +74,7 @@
 my %language;
 my %supported_language;
 my %cprtag;
+my %scprtag;
 my %fe; my %fd;
 my %category_extensions;
 
@@ -131,6 +132,20 @@
             close($fh);
         }
     }
+# ------------------------------------------------------------------ source copyrights
+    {
+        my $sourcecopyrightfile = $Apache::lonnet::perlvar{'lonIncludes'}.
+                                  '/source_copyright.tab';
+        if ( open (my $fh,"<$sourcecopyrightfile") ) {
+            while (<$fh>) {
+                next if /^\#/;
+                chomp;
+                my ($key,$val)=(split(/\s+/,$_,2));
+                $scprtag{$key}=$val;
+            }
+            close($fh);
+        }
+    }
 
 # -------------------------------------------------------------- domain designs
 
@@ -1811,6 +1826,27 @@
 sub copyrightdescription {
     return &mt($cprtag{shift(@_)});
 }
+=item * source_copyrightids() 
+
+returns list of all source copyrights
+
+=cut
+
+sub source_copyrightids {
+    return sort(keys(%scprtag));
+}
+
+=pod
+
+=item * source_copyrightdescription() 
+
+returns description of a specified source copyright id
+
+=cut
+
+sub source_copyrightdescription {
+    return &mt($scprtag{shift(@_)});
+}
 
 =pod
 
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.77 loncom/interface/lonmeta.pm:1.78
--- loncom/interface/lonmeta.pm:1.77	Fri May  7 13:17:58 2004
+++ loncom/interface/lonmeta.pm	Thu Jun 10 22:21:45 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.77 2004/05/07 17:17:58 matthew Exp $
+# $Id: lonmeta.pm,v 1.78 2004/06/11 02:21:45 taceyjo1 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -175,6 +175,8 @@
          'owner' => 'Publisher/Owner',
          'copyright' => 'Copyright/Distribution',
          'customdistributionfile' => 'Custom Distribution File',
+         'sourceavail' => 'Source Availible',
+         'sourcerights' => 'Source Custom Distribution File',
          'obsolete' => 'Obsolete',
          'obsoletereplacement' => 'Suggested Replacement for Obsolete File',
          'count'      => 'Network-wide number of accesses (hits)',
@@ -224,6 +226,10 @@
     if ($type eq 'copyright') {
 	return &Apache::loncommon::copyrightdescription($value);
     }
+    # Copyright
+    if ($type eq 'sourceavail') {
+	return &Apache::loncommon::source_copyrightdescription($value);
+    }
     # MIME
     if ($type eq 'mime') {
         return '<img src="'.&Apache::loncommon::icon($value).'" />&nbsp;'.
@@ -365,6 +371,14 @@
 			  (&Apache::loncommon::copyrightids)).
                               &relatedfield(0,$relatedsearchflag,$relatedsep);
     }
+    # Source Copyright
+    if ($type eq 'sourceavail') {
+	return &selectbox($fieldname,
+			  $value,
+			  \&Apache::loncommon::source_copyrightdescription,
+			  (&Apache::loncommon::source_copyrightids)).
+                              &relatedfield(0,$relatedsearchflag,$relatedsep);
+    }
     # Gradelevels
     if (($type eq 'lowestgradelevel') ||
 	($type eq 'highestgradelevel')) {
@@ -393,6 +407,14 @@
 	    ",'rights')\">".&mt('Select').'</a>'.
             &relatedfield(0,$relatedsearchflag,$relatedsep); 
     }
+    # Source Customdistribution file
+    if ($type eq 'sourcerights') {
+	return '<input type="text" name="'.$fieldname.
+	    '" size="60" value="'.$value.'" /><a href="javascript:openbrowser'.
+	    "('".$formname."','".$fieldname."'".
+	    ",'rights')\">".&mt('Select').'</a>'.
+            &relatedfield(0,$relatedsearchflag,$relatedsep); 
+    }
     # Dates
     if (($type eq 'creationdate') ||
 	($type eq 'lastrevisiondate')) {
@@ -542,7 +564,9 @@
              'lastrevisiondate', 
              'owner', 
              'copyright', 
-             'customdistributionfile', 
+             'customdistributionfile',
+             'sourceavail',
+             'sourcerights', 
              'obsolete', 
              'obsoletereplacement') {
         $table.='<tr><td bgcolor="#AAAAAA">'.$lt{$_}.
@@ -817,7 +841,7 @@
         foreach ('author','title','subject','keywords','abstract','notes',
                  'copyright','customdistributionfile','language',
                  'standards',
-                 'lowestgradelevel','highestgradelevel',
+                 'lowestgradelevel','highestgradelevel','sourceavail','sourcerights',
                  'obsolete','obsoletereplacement') {
             if (defined($ENV{'form.new_'.$_})) {
                 $Apache::lonpublisher::metadatafields{$_}=