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

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


albertel		Mon Dec 19 15:07:13 2005 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  - cleaning up url's and some language in the metadata eidtor for portfolios
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.140 loncom/interface/lonmeta.pm:1.141
--- loncom/interface/lonmeta.pm:1.140	Mon Dec 19 11:00:05 2005
+++ loncom/interface/lonmeta.pm	Mon Dec 19 15:07:13 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.140 2005/12/19 16:00:05 banghart Exp $
+# $Id: lonmeta.pm,v 1.141 2005/12/19 20:07:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -289,23 +289,38 @@
     }
     return &Apache::lonlocal::texthash(%fields);
 }
+
+sub portfolio_display_uri {
+    my ($uri)=@_;
+    $uri =~ s|.*/portfolio(/.*)$|$1|;
+    my ($res_uri,$meta_uri) = ($uri,$uri);
+
+    if ($uri =~ /\.meta$/) {
+	$res_uri =~ s/\.meta//;
+    } else {
+	$meta_uri .= '.meta';
+    }
+    return ($res_uri,$meta_uri);
+}
+
 sub pre_select_course {
     my ($r,$uri) = @_;
     my $output;
     my $fn=&Apache::lonnet::filelocation('',$uri);
-    my $disuri=$uri;
+    my ($res_uri,$meta_uri) = &portfolio_display_uri($uri);
     %Apache::lonpublisher::metadatafields=();
     %Apache::lonpublisher::metadatakeys=();
     my $result=&Apache::lonnet::getfile($fn);
     if ($result == -1){
-        $r->print('Creating new '.$disuri);
+        $r->print(&mt('Creating new file [_1]'),$meta_uri);
     } else {
         &Apache::lonpublisher::metaeval($result);
     }
-    $r->print('<form method="post" action="" >');
+    $r->print('<hr /><form method="post" action="" >');
+    $r->print('<p>'.&mt('If you would like to associate this resource ([_1]) with a current or previous course, please select one from the list below, otherwise select, \'None\'','<tt>'.$res_uri.'</tt>').'</p>');
     $output = &select_course();
     $r->print($output.'<br /><input type="submit" name="store" value="'.
-                  &mt('Select Metadata Course Restrictions').'">');
+                  &mt('Associate Resource With Selected Course').'">');
     $r->print('</form>');
     return;
 }
@@ -1028,7 +1043,10 @@
     my $fn=&Apache::lonnet::filelocation('',$uri);
     $disuri=~s/^\/\~/\/priv\//;
     $disuri=~s/\.meta$//;
-    $disuri=~s|^/editupload||;
+    my $meta_uri = $disuri;
+    if ($disuri =~ m|/portfolio/|) {
+	($disuri, $meta_uri) =  &portfolio_display_uri($disuri);
+    }
     my $target=$uri;
     $target=~s/^\/\~/\/res\/$env{'request.role.domain'}\//;
     $target=~s/\.meta$//;
@@ -1082,7 +1100,7 @@
         %Apache::lonpublisher::metadatakeys=();
         my $result=&Apache::lonnet::getfile($fn);
         if ($result == -1){
-            $r->print('Creating new '.$disuri);
+	    $r->print(&mt('Creating new file [_1]'),$meta_uri);
         } else {
             &Apache::lonpublisher::metaeval($result);
         }
@@ -1119,10 +1137,10 @@
                 'default';
         }
         if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') {
-            $r->print('Using: <strong> '.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}.
-                        "</strong> metadata framework<br />");
+            $r->print(&mt('Associated with course [_1]','<strong>'.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}.
+                        '</strong>').'<br />');
         } else {
-            $r->print("This resource is not associated with a metadata framework<br />");
+            $r->print("This resource is not associated with a course.<br />");
         }
         foreach my $field_name(@fields) {