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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 01 Feb 2005 17:37:23 -0000


banghart		Tue Feb  1 12:37:23 2005 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	create frameword for different meta data fields for different
  	file types (specifically, portfolio types now)
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.89 loncom/interface/lonmeta.pm:1.90
--- loncom/interface/lonmeta.pm:1.89	Tue Jan 18 20:28:33 2005
+++ loncom/interface/lonmeta.pm	Tue Feb  1 12:37:23 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.89 2005/01/19 01:28:33 banghart Exp $
+# $Id: lonmeta.pm,v 1.90 2005/02/01 17:37:23 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -236,6 +236,17 @@
 
 # The field names
 sub fieldnames {
+    my $file_type=shift;
+    if ($file_type eq 'portfolio') {
+    return &Apache::lonlocal::texthash
+        (
+         'title' => 'Title',
+         'author' =>'Author(s)',
+         'authorspace' => 'Author Space',
+         'modifyinguser' => 'Last Modifying User',
+         'subject' => 'Subject',
+         'keywords' => 'Keyword(s)');
+    } else {
     return &Apache::lonlocal::texthash
         (
          'title' => 'Title',
@@ -280,6 +291,7 @@
          'disc'       => 'Degree of discrimination',
 	 'dependencies' => 'Resources used by this resource',
          );
+        }
 }
 
 # Pretty printing of metadata field
@@ -540,7 +552,7 @@
     } elsif ($uri=~/\/portfolio\//) {
         $r->print(&Apache::loncommon::bodytag
           ('Edit Portfolio File Information','','','',$resdomain));
-        &present_editable_metadata($r,$uri);
+        &present_editable_metadata($r,$uri,'portfolio');
         
     } elsif ($uri=~/^\/\~/) { 
         # Construction space
@@ -875,7 +887,7 @@
 #####################################################
 #####################################################
 sub present_editable_metadata {
-    my ($r,$uri) = @_;
+    my ($r,$uri, $file_type) = @_;
     # Construction Space Call
     # Header
     my $disuri=$uri;
@@ -920,13 +932,19 @@
         $r->print('<script language="JavaScript">'.
                   &Apache::loncommon::browser_and_searcher_javascript().
                   '</script>');
-        my %lt=&fieldnames();
+        my %lt=&fieldnames($file_type);
 	my $output;
-        foreach ('author','title','subject','keywords','abstract','notes',
+	my @fields;
+	if ($file_type eq 'portfolio') {
+	    @fields =  ('author','title','subject','keywords');
+	} else {
+	    @fields = ('author','title','subject','keywords','abstract','notes',
                  'copyright','customdistributionfile','language',
                  'standards',
                  'lowestgradelevel','highestgradelevel','sourceavail','sourcerights',
-                 'obsolete','obsoletereplacement') {
+                 'obsolete','obsoletereplacement');
+        }
+        foreach (@fields) {
             if (defined($ENV{'form.new_'.$_})) {
                 $Apache::lonpublisher::metadatafields{$_}=
                     $ENV{'form.new_'.$_};