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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Oct 2006 21:09:22 -0000


albertel		Mon Oct 23 17:09:22 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  -style 
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.184 loncom/interface/lonmeta.pm:1.185
--- loncom/interface/lonmeta.pm:1.184	Mon Oct 23 16:53:46 2006
+++ loncom/interface/lonmeta.pm	Mon Oct 23 17:09:21 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.184 2006/10/23 20:53:46 banghart Exp $
+# $Id: lonmeta.pm,v 1.185 2006/10/23 21:09:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1196,7 +1196,7 @@
 	if ($file_type eq 'portfolio' || $file_type eq 'groups') {
 	    if(exists ($env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'})) {
 	        # retrieve fieldnames (in order) from the course restricted list
-	        @fields = (split /,/,$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'});
+	        @fields = (split(/,/,$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'}));
 	    } else {
 	        # no saved field list, use default list
 	        @fields =  ('author','title','subject','keywords','abstract',
@@ -1204,16 +1204,16 @@
 	                    'highestgradelevel','standards');
 	        $added_metadata_fields = &Apache::lonparmset::get_added_meta_fieldnames();
 	        if ($env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}) {
-	            @added_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
+	            @added_order = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'});
 	        }
-	        $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'} = join (",",@fields);
+	        $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'} = join(",",@fields);
 	    }
 	} else {
 	    @fields = ('author','title','subject','keywords','abstract','notes',
-                 'copyright','customdistributionfile','language',
-                 'standards',
-                 'lowestgradelevel','highestgradelevel','sourceavail','sourcerights',
-                 'obsolete','obsoletereplacement');
+		       'copyright','customdistributionfile','language',
+		       'standards',
+		       'lowestgradelevel','highestgradelevel','sourceavail','sourcerights',
+		       'obsolete','obsoletereplacement');
         }
         if ($file_type eq 'groups') {
             $Apache::lonpublisher::metadatafields{'courserestricted'}=
@@ -1249,13 +1249,13 @@
 	    }
 	}
 	if (@added_order) {
-	    foreach my $field_name(@added_order) {
-                push (@fields,$field_name);
+	    foreach my $field_name (@added_order) {
+                push(@fields,$field_name);
                 $lt{$field_name} = $$added_metadata_fields{$field_name};
 	    }
 	} else {
-            foreach my $field_name(keys (%$added_metadata_fields)) {
-                push (@fields,$field_name);
+            foreach my $field_name (keys(%$added_metadata_fields)) {
+                push(@fields,$field_name);
                 $lt{$field_name} = $$added_metadata_fields{$field_name};
             }
         }
@@ -1280,9 +1280,9 @@
             } else {
 
                     $output.=('<p>'.$lt{$field_name}.': '.
-                            &prettyinput($field_name,
-				   $Apache::lonpublisher::metadatafields{$field_name},
-				   'new_'.$field_name,'defaultmeta').'</p>');
+			      &prettyinput($field_name,
+					   $Apache::lonpublisher::metadatafields{$field_name},
+					   'new_'.$field_name,'defaultmeta').'</p>');
                
             }
         }
@@ -1294,7 +1294,7 @@
 		$Apache::lonpublisher::metadatafields{'keywords'} = 
 		    join (',', &Apache::loncommon::get_env_multiple('form.new_keywords'));
 	    }
-	    foreach my $field (sort keys %Apache::lonpublisher::metadatafields) {
+	    foreach my $field (sort(keys(%Apache::lonpublisher::metadatafields))) {
 		next if ($field =~ /\./);
 		my $unikey=$field;
 		$unikey=~/^([A-Za-z_]+)/;
@@ -1302,8 +1302,8 @@
 		$tag=~tr/A-Z/a-z/;
 		$file_content.= "\n\<$tag";
 		foreach my $key (split(/\,/,
-			       $Apache::lonpublisher::metadatakeys{$unikey})
-			 ) {
+				       $Apache::lonpublisher::metadatakeys{$unikey})
+				 ) {
 		    my $value=
 			$Apache::lonpublisher::metadatafields{$unikey.'.'.$key};
 		    $value=~s/\"/\'\'/g;
@@ -1325,12 +1325,12 @@
                 $r->print(&store_portfolio_metadata($formname,$file_content,$path,
                                                     $new_fn));
             } else {
-		if (!  ($mfh=Apache::File->new('>'.$fn))) {
+		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;
+		    print $mfh ($file_content);
 		    $r->print('<p><font color="blue">'.&mt('Wrote Metadata').
 			      ' '.&Apache::lonlocal::locallocaltime(time).
 			      '</font></p>');