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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 02 Jan 2007 11:38:28 -0000


raeburn		Tue Jan  2 06:38:28 2007 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  Close metadata filehandle after writing data.
  
  Display a "Discard Edits and Return to Portfolio" button on the group portfolio metadata editing screen
  
  Course Name not a link if "Associated with course" entry for group portfolio files as they can not be disassociated from course.  
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.190 loncom/interface/lonmeta.pm:1.191
--- loncom/interface/lonmeta.pm:1.190	Mon Dec  4 21:55:53 2006
+++ loncom/interface/lonmeta.pm	Tue Jan  2 06:38:28 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.190 2006/12/05 02:55:53 albertel Exp $
+# $Id: lonmeta.pm,v 1.191 2007/01/02 11:38:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -235,7 +235,7 @@
          'lowestgradelevel' => 'Lowest Grade Level',
          'highestgradelevel' => 'Highest Grade Level');
     
-    if (! defined($file_type) || $file_type ne 'portfolio') {
+    if ( !defined($file_type) || ($file_type ne 'portfolio' && $file_type ne 'groups') ) {
         %fields = 
         (%fields,
          'domain' => 'Domain',
@@ -1252,11 +1252,18 @@
 	    }
 
 	    if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') {
-		$r->print(&mt('Associated with course [_1]',
+                if ($file_type eq 'portfolio') {
+		    $r->print(&mt('Associated with course [_1]',
 		        '<strong><a href="'.$uri.'?changecourse=true">'.
 		        $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.
 		        ".description"}.
 			      '</a></strong>').'<br />');
+                } else {
+                    $r->print(&mt('Associated with course [_1]',
+                        '<strong>'.
+  $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.
+                        ".description"}.'</strong>').'<br />');
+                }
 	    } else {
 		$r->print('<a href="'.$uri.'?changecourse=true">This resource is not associated with a course.</a><br />');
 	    }
@@ -1350,6 +1357,7 @@
 			      &mt('FAIL').'</font></p>');
 		} else {
 		    print $mfh ($file_content);
+                    close($mfh);
 		    $r->print('<p><font color="blue">'.&mt('Wrote Metadata').
 			      ' '.&Apache::lonlocal::locallocaltime(time).
 			      '</font></p>');
@@ -1359,16 +1367,16 @@
 	$r->print($output.'<br /><input type="submit" name="store" value="'.
                   &mt('Store Catalog Information').'" />');
 
-	if ($file_type eq 'portfolio') {
+	if ($file_type eq 'portfolio' || $file_type eq 'groups') {
 	    my ($port_path,$group) = &get_port_path_and_group($uri);
-            if ($group) {
+            if ($group ne '') {
                 $r->print('<input type="hidden" name="group" value="'.$group.'" />');
             }
             $r->print('<input type="hidden" name="currentpath" value="'.$env{'form.currentpath'}.'" />');
 	    $r->print('</form><br /><br /><form method="post" action="'.$port_path.'">');
-	    if ($group) {
+	    if ($group ne '') {
 	        $r->print('<input type="hidden" name="group" value="'.$group.'" />');
-	    }
+            }
 	    $r->print('<input type="hidden" name="currentpath" value="'.$path.'" />'.
 		      '<input type="submit" name="cancel" value="'.&mt('Discard Edits and Return to Portfolio').'" />');
 	}