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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 25 Oct 2005 01:23:49 -0000


banghart		Mon Oct 24 21:23:49 2005 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	Preparation to handle course meta restrictions in prettyinput.
  	Maybe the right place? Maybe Guy thinks differently?
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.115 loncom/interface/lonmeta.pm:1.116
--- loncom/interface/lonmeta.pm:1.115	Fri Oct 21 15:20:58 2005
+++ loncom/interface/lonmeta.pm	Mon Oct 24 21:23:47 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.115 2005/10/21 19:20:58 banghart Exp $
+# $Id: lonmeta.pm,v 1.116 2005/10/25 01:23:47 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -476,10 +476,40 @@
 
 sub prettyinput {
     my ($type,$value,$fieldname,$formname,
-	$relatedsearchflag,$relatedsep,$relatedvalue,$size)=@_;
+	$relatedsearchflag,$relatedsep,$relatedvalue,$size,$course_key)=@_;
     if (! defined($size)) {
         $size = 80;
     }
+    if (defined($course_key)) {
+        my $stu_add;
+        my $only_one;
+        if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) {
+            $stu_add = 'true';
+        }
+        if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) {
+            $only_one = 'true';
+        }
+        title' => 'Title',
+        if ($type eq 'author') {
+        }
+        if ($type eq 'authorspace') {
+        }
+        if ($type eq 'modifyinguser') {
+        }
+        if ($type eq 'subject') {
+        }
+        if ($type eq 'keywords') {
+        }
+        if ($type eq  'notes') {
+        }
+        if ($type eq  'abstract') {
+        if (($type eq 'lowestgradelevel') ||
+	    ($type eq 'highestgradelevel')) {
+	    return &Apache::loncommon::select_level_form($value,$fieldname).
+            &relatedfield(0,$relatedsearchflag,$relatedsep); 
+        }
+        return(); 
+    }
     # Language
     if ($type eq 'language') {
 	return &selectbox($fieldname,
@@ -1033,7 +1063,7 @@
                     $output.=('<p>'.$lt{$_}.': '.
                             &prettyinput($_,
 				   $Apache::lonpublisher::metadatafields{$_},
-				   'new_'.$_,'defaultmeta').'</p>');
+				   'new_'.$_,'defaultmeta',undef,undef,undef,undef,$key_base).'</p>');
                 }
             } else {
                 $output.=('<p>'.$lt{$_}.': '.