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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 19 Dec 2005 20:08:41 -0000


albertel		Mon Dec 19 15:08:41 2005 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
   tabination repairs
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.141 loncom/interface/lonmeta.pm:1.142
--- loncom/interface/lonmeta.pm:1.141	Mon Dec 19 15:07:13 2005
+++ loncom/interface/lonmeta.pm	Mon Dec 19 15:08:40 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.141 2005/12/19 20:07:13 albertel Exp $
+# $Id: lonmeta.pm,v 1.142 2005/12/19 20:08:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1174,67 +1174,69 @@
         
     }
     $r->print('</form>');
-            if ($env{'form.store'}) {
-            my $mfh;
-            my $formname='store'; 
-            my $file_content;
-            foreach my $meta_field (keys %env) {
-                if (&Apache::loncommon::get_env_multiple('form.new_keywords')) {
-                    $Apache::lonpublisher::metadatafields{'keywords'} = 
-                        join (',', &Apache::loncommon::get_env_multiple('form.new_keywords'));
-                }
-            }
-            foreach (sort keys %Apache::lonpublisher::metadatafields) {
-                next if ($_ =~ /\./);
-                my $unikey=$_;
-                $unikey=~/^([A-Za-z]+)/;
-                my $tag=$1;
-                $tag=~tr/A-Z/a-z/;
-                $file_content.= "\n\<$tag";
-                foreach (split(/\,/,
-                             $Apache::lonpublisher::metadatakeys{$unikey})
-                         ) {
-                    my $value=
+
+    if ($env{'form.store'}) {
+	my $mfh;
+	my $formname='store'; 
+	my $file_content;
+	foreach my $meta_field (keys %env) {
+	    if (&Apache::loncommon::get_env_multiple('form.new_keywords')) {
+		$Apache::lonpublisher::metadatafields{'keywords'} = 
+		    join (',', &Apache::loncommon::get_env_multiple('form.new_keywords'));
+	    }
+	}
+	foreach (sort keys %Apache::lonpublisher::metadatafields) {
+	    next if ($_ =~ /\./);
+	    my $unikey=$_;
+	    $unikey=~/^([A-Za-z]+)/;
+	    my $tag=$1;
+	    $tag=~tr/A-Z/a-z/;
+	    $file_content.= "\n\<$tag";
+	    foreach (split(/\,/,
+			   $Apache::lonpublisher::metadatakeys{$unikey})
+		     ) {
+		my $value=
                     $Apache::lonpublisher::metadatafields{$unikey.'.'.$_};
-                    $value=~s/\"/\'\'/g;
-                    $file_content.=' '.$_.'="'.$value.'"' ;
-                    # print $mfh ' '.$_.'="'.$value.'"';
-                }
-                $file_content.= '>'.
-                    &HTML::Entities::encode
-                    ($Apache::lonpublisher::metadatafields{$unikey},
-                     '<>&"').
-                     '</'.$tag.'>';
-            }
-            if ($fn =~ /\/portfolio\//) {
-                $fn =~ /\/portfolio\/(.*)$/;
-                my $new_fn = '/'.$1;
-                $env{'form.'.$formname}=$file_content."\n";
-                $env{'form.'.$formname.'.filename'}=$new_fn;
-                &Apache::lonnet::userfileupload('uploaddoc','',
-	        	 'portfolio'.$env{'form.currentpath'});
-                if (&Apache::lonnet::userfileupload($formname,'','portfolio') eq 'error: no uploaded file') {
-                    $r->print('<p><font color="red">'.
-                      &mt('Could not write metadata').', '.
-                     &mt('FAIL').'</font></p>');
-                } else {
-                    $r->print('<p><font color="blue">'.&mt('Wrote Metadata').
-		  ' '.&Apache::lonlocal::locallocaltime(time).
-		  '</font></p>');
-                }
-            } else {
-                if (!  ($mfh=Apache::File->new('>'.$fn))) {
-                    $r->print('<p><font color="red">'.
-                        &mt('Could not write metadata').', '.
-                        &mt('FAIL').'</font></p>');
-                } else {
-                    print $mfh $file_content;
-		    $r->print('<p><font color="blue">'.&mt('Wrote Metadata').
-			      ' '.&Apache::lonlocal::locallocaltime(time).
-			      '</font></p>');
-                }
-            }
-        }
+		$value=~s/\"/\'\'/g;
+		$file_content.=' '.$_.'="'.$value.'"' ;
+		# print $mfh ' '.$_.'="'.$value.'"';
+	    }
+	    $file_content.= '>'.
+		&HTML::Entities::encode
+		($Apache::lonpublisher::metadatafields{$unikey},
+		 '<>&"').
+		 '</'.$tag.'>';
+	}
+	if ($fn =~ /\/portfolio\//) {
+	    $fn =~ /\/portfolio\/(.*)$/;
+	    my $new_fn = '/'.$1;
+	    $env{'form.'.$formname}=$file_content."\n";
+	    $env{'form.'.$formname.'.filename'}=$new_fn;
+	    &Apache::lonnet::userfileupload('uploaddoc','',
+					    'portfolio'.$env{'form.currentpath'});
+	    if (&Apache::lonnet::userfileupload($formname,'','portfolio') eq 'error: no uploaded file') {
+		$r->print('<p><font color="red">'.
+			  &mt('Could not write metadata').', '.
+			  &mt('FAIL').'</font></p>');
+	    } else {
+		$r->print('<p><font color="blue">'.&mt('Wrote Metadata').
+			  ' '.&Apache::lonlocal::locallocaltime(time).
+			  '</font></p>');
+	    }
+	} else {
+	    if (!  ($mfh=Apache::File->new('>'.$fn))) {
+		$r->print('<p><font color="red">'.
+			  &mt('Could not write metadata').', '.
+			  &mt('FAIL').'</font></p>');
+	    } else {
+		print $mfh $file_content;
+		$r->print('<p><font color="blue">'.&mt('Wrote Metadata').
+			  ' '.&Apache::lonlocal::locallocaltime(time).
+			  '</font></p>');
+	    }
+	}
+    }
+    
     return;
 }