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

banghart lon-capa-cvs@mail.lon-capa.org
Fri, 25 Aug 2006 23:05:55 -0000


banghart		Fri Aug 25 19:05:55 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	Address bug 4979. Now metadata works when getting file through
  	access server. 
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.172 loncom/interface/lonmeta.pm:1.173
--- loncom/interface/lonmeta.pm:1.172	Mon Aug 21 15:26:27 2006
+++ loncom/interface/lonmeta.pm	Fri Aug 25 19:05:52 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.172 2006/08/21 19:26:27 banghart Exp $
+# $Id: lonmeta.pm,v 1.173 2006/08/25 23:05:52 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1291,22 +1291,20 @@
 		     '<>&"').
 		     '</'.$tag.'>';
 	    }
-	    if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/portfolio/|) {
-		my ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|);
+	    if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles|) {
+	        my ($path, $new_fn);
+	        if ($fn =~ m|\w+/groups/\w+/portfolio/|) {
+                    ($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|);
+	        } else {
+		    ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|);
+	        }
                 $r->print(&store_portfolio_metadata($formname,$file_content,$path,
                                                     $new_fn));
-                unless ($env{'form.associate'}) {
+                if (! $env{'form.associate'}) {
                     $r->print(&Apache::portfolio::done("Return to Portfolio",'/adm/portfolio'));
                     return;
                 }  
-            } elsif ($fn =~  m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/groups/\w+/portfolio/|) {
-                my ($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|);
-                $r->print(&store_portfolio_metadata($formname,$file_content,$path,$new_fn));
-                unless ($env{'form.associate'}) {
-                    $r->print(&Apache::portfolio::done("Return to Portfolio",'/adm/portfolio'));
-                    return;
-                }  
-	    } else {
+            } else {
 		if (!  ($mfh=Apache::File->new('>'.$fn))) {
 		    $r->print('<p><font color="red">'.
 			      &mt('Could not write metadata').', '.
@@ -1317,7 +1315,7 @@
 			      ' '.&Apache::lonlocal::locallocaltime(time).
 			      '</font></p>');
 		}
-                unless ($env{'form.associate'}) {
+                if (! $env{'form.associate'}) {
                     $r->print(&Apache::portfolio::done("Return to Portfolio",'/adm/portfolio'));
                     return;
                 }