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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 20 May 2006 06:40:54 -0000


albertel		Sat May 20 02:40:54 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  - support groups in more spots in meta data editor
  
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.155 loncom/interface/lonmeta.pm:1.156
--- loncom/interface/lonmeta.pm:1.155	Sat May 20 02:34:50 2006
+++ loncom/interface/lonmeta.pm	Sat May 20 02:40:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.155 2006/05/20 06:34:50 albertel Exp $
+# $Id: lonmeta.pm,v 1.156 2006/05/20 06:40:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -318,10 +318,12 @@
     return $result;
 }
 
-sub portfolio_display_uri {
-    my ($uri,$as_links)=@_;
+sub get_port_path_and_group {
+    my ($uri)=@_;
+
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+
     my ($port_path,$group);
     if ($uri =~ m{^/editupload/\Q$cdom\E/\Q$cnum\E/groups/}) {
 	$group = (split('/',$uri))[5];
@@ -329,6 +331,14 @@
     } else {
 	$port_path = '/adm/portfolio';
     }
+    return ($port_path,$group);
+}
+
+sub portfolio_display_uri {
+    my ($uri,$as_links)=@_;
+
+    my ($port_path,$group) = &get_port_path_and_group($uri);
+
     $uri =~ s|.*/(portfolio/.*)$|$1|;
     my ($res_uri,$meta_uri) = ($uri,$uri);
     if ($uri =~ /\.meta$/) {
@@ -365,8 +375,10 @@
                   &mt('Associate Resource With Selected Course').'">');
     $r->print('</form>');
     
-    $r->print('<br /><br /><form method="POST" action="/adm/portfolio">'.
+    my ($port_path,$group) = &get_port_path_and_group($uri);
+    $r->print('<br /><br /><form method="POST" action="'.$port_path.'">'.
               '<input type="hidden" name="currentpath" value="'.$path.'" />'.
+	      '<input type="hidden" name="group" value="'.$group.'" />'.
 	      '<input type="submit" name="cancel" value="'.&mt('Cancel').'">'.
 	      '</form>');
 
@@ -1284,8 +1296,10 @@
                   &mt('Store Catalog Information').'">');
 
 	if ($file_type eq 'portfolio') {
+	    my ($port_path,$group) = &get_port_path_and_group($uri);
 	    $r->print('</form>
-               <br /><br /><form method="POST" action="/adm/portfolio">'.
+               <br /><br /><form method="POST" action="'.$port_path.'">'.
+		      '<input type="hidden" name="group" value="'.$group.'" />'.
 		      '<input type="hidden" name="currentpath" value="'.$path.'" />'.
 		      '<input type="submit" name="cancel" value="'.&mt('Discard Edits and Return to Portfolio').'">');
 	}