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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 04 Aug 2006 19:42:59 -0000


albertel		Fri Aug  4 15:42:59 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm lonaboutme.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - can display the metadata of a portfolio file
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.161 loncom/interface/lonmeta.pm:1.162
--- loncom/interface/lonmeta.pm:1.161	Wed Jul 19 15:29:20 2006
+++ loncom/interface/lonmeta.pm	Fri Aug  4 15:42:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.161 2006/07/19 19:29:20 albertel Exp $
+# $Id: lonmeta.pm,v 1.162 2006/08/04 19:42:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -716,14 +716,13 @@
     #
     my ($resdomain,$resuser)=
         (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);
-
     if ($uri=~m:/adm/bombs/(.*)$:) {
         $r->print(&Apache::loncommon::start_page('Error Messages'));
         # Looking for all bombs?
         &report_bombs($r,$uri);
-    } elsif ($uri=~/\/portfolio\//) {
+    } elsif ($uri=~m|^/editupload/[^/]+/[^/]+/portfolio/|) {
 	    ($resdomain,$resuser)=
-	    (&Apache::lonnet::declutter($uri)=~m|^(\w+)/(\w+)/portfolio|);
+		(&Apache::lonnet::declutter($uri)=~m|^(\w+)/(\w+)/portfolio|);
         $r->print(&Apache::loncommon::start_page('Edit Portfolio File Catalog Information',
 						 undef,
 						 {'domain' => $resdomain,}));
@@ -732,7 +731,7 @@
         } else {
             &pre_select_course($r,$uri);
         }
-    } elsif ($uri=~/^\/\~/) { 
+    } elsif ($uri=~m|^/~|) { 
         # Construction space
         $r->print(&Apache::loncommon::start_page('Edit Catalog nformation',
 						 undef,
@@ -798,6 +797,7 @@
 sub present_uneditable_metadata {
     my ($r,$uri) = @_;
     #
+    my $uploaded = ($uri =~ m|/uploaded/|);
     my %content=();
     # Read file
     foreach (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) {
@@ -810,16 +810,18 @@
     my $disuri=&Apache::lonnet::clutter($uri);
     $disuri=~s/^\/adm\/wrapper//;
     # version
-    my $currentversion=&Apache::lonnet::getversion($disuri);
     my $versiondisplay='';
-    if ($thisversion) {
-        $versiondisplay=&mt('Version').': '.$thisversion.
-            ' ('.&mt('most recent version').': '.
-            ($currentversion>0 ? 
-             $currentversion   :
-             &mt('information not available')).')';
-    } else {
-        $versiondisplay='Version: '.$currentversion;
+    if (!$uploaded) {
+	my $currentversion=&Apache::lonnet::getversion($disuri);
+	if ($thisversion) {
+	    $versiondisplay=&mt('Version').': '.$thisversion.
+		' ('.&mt('most recent version').': '.
+		($currentversion>0 ? 
+		 $currentversion   :
+		 &mt('information not available')).')';
+	} else {
+	    $versiondisplay='Version: '.$currentversion;
+	}
     }
     # crumbify displayed URL               uri     target prefix form  size
     $disuri=&Apache::lonhtmlcommon::crumbs($disuri,undef, undef, undef,'+1');
@@ -876,7 +878,7 @@
 $table
 </table>
 ENDHEAD
-    if ($env{'user.adv'}) {
+    if (!$uploaded && $env{'user.adv'}) {
         &print_dynamic_metadata($r,$uri,\%content);
     }
     return;
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.47 loncom/interface/lonaboutme.pm:1.48
--- loncom/interface/lonaboutme.pm:1.47	Fri Aug  4 15:06:12 2006
+++ loncom/interface/lonaboutme.pm	Fri Aug  4 15:42:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.47 2006/08/04 19:06:12 albertel Exp $
+# $Id: lonaboutme.pm,v 1.48 2006/08/04 19:42:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -496,8 +496,10 @@
                 $showname = $currhash->{$item};
             }
             $showname=&HTML::Entities::encode($showname,'<>&"');
-            $output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" />&nbsp;<a href="/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.$currhash->{$item}.'">'.$showname.'</a>';
-	    $output.='</td><td><a href=""><img align="right" alt="'.&mt('Catalog Information').'" src="'.
+	    my $url = '/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.
+		$currhash->{$item};
+            $output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" />&nbsp;<a href="'.$url.'">'.$showname.'</a>';
+	    $output.='</td><td><a href="'.$url.'.meta"><img align="right" alt="'.&mt('Catalog Information').'" src="'.
 		&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').
 		'" /></a>';
 
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.767 loncom/lonnet/perl/lonnet.pm:1.768
--- loncom/lonnet/perl/lonnet.pm:1.767	Wed Aug  2 15:29:32 2006
+++ loncom/lonnet/perl/lonnet.pm	Fri Aug  4 15:42:59 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.767 2006/08/02 19:29:32 albertel Exp $
+# $Id: lonnet.pm,v 1.768 2006/08/04 19:42:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5884,7 +5884,7 @@
         my %metathesekeys=();
         unless ($filename=~/\.meta$/) { $filename.='.meta'; }
 	my $metastring;
-	if ($uri !~ m -^(uploaded|editupload)/-) {
+	if ($uri !~ m -^(editupload)/-) {
 	    my $file=&filelocation('',&clutter($filename));
 	    #push(@{$metaentry{$uri.'.file'}},$file);
 	    $metastring=&getfile($file);