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

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 19 Oct 2005 21:53:17 -0000


banghart		Wed Oct 19 17:53:17 2005 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	Removing "old idea" stuff, preparing for making
  	restricted data much more like other metadata.
  	work in progress
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.113 loncom/interface/lonmeta.pm:1.114
--- loncom/interface/lonmeta.pm:1.113	Mon Oct 17 17:36:44 2005
+++ loncom/interface/lonmeta.pm	Wed Oct 19 17:53:16 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.113 2005/10/17 21:36:44 banghart Exp $
+# $Id: lonmeta.pm,v 1.114 2005/10/19 21:53:16 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -238,6 +238,18 @@
 sub fieldnames {
     my $file_type=shift;
     my %fields;
+    %fields = 
+        (%fields,
+         'title' => 'Title',
+         'author' =>'Author(s)',
+         'authorspace' => 'Author Space',
+         'modifyinguser' => 'Last Modifying User',
+         'subject' => 'Subject',
+         'keywords' => 'Keyword(s)',
+         'notes' => 'Notes',
+         'abstract' => 'Abstract',
+         'lowestgradelevel' => 'Lowest Grade Level',
+         'highestgradelevel' => 'Highest Grade Level');
     if ($file_type eq 'portfolio') {
         %fields = 
         (%fields,
@@ -1021,12 +1033,18 @@
         $r->print('<script language="JavaScript">'.
                   &Apache::loncommon::browser_and_searcher_javascript().
                   '</script>');
+        if (($file_type eq 'portfolio') && $env{'form.metacourse'}) {
+            $file_type = 'restrictedportfolio';
+        }
         my %lt=&fieldnames($file_type);
 	my $output;
 	my @fields;
 	if ($file_type eq 'portfolio') {
 	    @fields =  ('author','title','subject','keywords','abstract','notes','lowestgradelevel',
 	                'highestgradelevel');
+	} elsif ($file_type eq 'restrictedportfolio') {
+	    @fields =  ('metadata.author','metadata.title','metadata.subject','metadata.keywords','metadata.abstract','metadata.notes','metadata.lowestgradelevel',
+	                'metadata.highestgradelevel');
 	} else {
 	    @fields = ('author','title','subject','keywords','abstract','notes',
                  'copyright','customdistributionfile','language',
@@ -1047,37 +1065,7 @@
                       &prettyinput($_,
 				   $Apache::lonpublisher::metadatafields{$_},
 				   'new_'.$_,'defaultmeta').'</p>');
-            if ($env{'form.metacourse'}) {
-                $r->print('This is the instructor metadata area<br />');
-                # have to find all the metadata items, so we'll loop through and find them
-                $r->print('<form method="post" action="" size="3" >');
-                $r->print('The course is: '.$env{'form.metacourse'}.'<br>');
-                foreach my $key (sort keys %env) {
-                    if ($key=~m/^($env{'form.metacourse'}\.metadata\.)(\d+)\.title/) {
-                        my $key_base = $1;
-                        my $item_num = $2;
-                        # found one, so let's display it
-                        my $title = $env{$key_base.$item_num.'.title'};
-                        my $type = $env{$key_base.$item_num.'.type'};
-                        my @choices = sort(split /, /,$env{$key_base.$item_num.'.values'});
-                        $r->print($title.'<br />');
-                        $r->print($type.'<br />');
-            
-            foreach my $word (@choices) {
-                my $checked;
-                if ($Apache::lonpublisher::metadatafields{'coursekeyword'}=~ m/$word/) {
-                    $checked = 1;
-                } else {
-                    undef($checked);
-                }
-                $r->print(&Apache::lonhtmlcommon::checkbox('instmeta_'.$env{'form.metacourse'}.'_'.$item_num,$checked,$word).$word.'<br />');
-            }
-        }
-    }   
-    $r->print('<br /><input type="submit" name="store" value="Assign Meta-data" />');
-    $r->print('</form>');
-    return 'ok';
-            }
+ 
         }
         if ($env{'form.store'}) {
             my $mfh;