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

www lon-capa-cvs@mail.lon-capa.org
Mon, 16 Sep 2002 21:01:41 -0000


www		Mon Sep 16 17:01:41 2002 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  Dynamic metadata is heavy load on both access and the home server.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.19 loncom/interface/lonmeta.pm:1.20
--- loncom/interface/lonmeta.pm:1.19	Wed Sep 11 15:37:51 2002
+++ loncom/interface/lonmeta.pm	Mon Sep 16 17:01:41 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.19 2002/09/11 19:37:51 www Exp $
+# $Id: lonmeta.pm,v 1.20 2002/09/16 21:01:41 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -142,6 +142,21 @@
 
 sub handler {
   my $r=shift;
+
+    my $loaderror=&Apache::lonnet::overloaderror($r);
+    if ($loaderror) { return $loaderror; }
+
+
+    my $uri=$r->uri;
+
+    my ($resdomain,$resuser)=
+           (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);
+
+    $loaderror=
+       &Apache::lonnet::overloaderror($r,
+         &Apache::lonnet::homeserver($resuser,$resdomain));
+    if ($loaderror) { return $loaderror; }
+
   my %content=();
 
 # ----------------------------------------------------------- Set document type
@@ -152,12 +167,9 @@
   return OK if $r->header_only;
 
 # ------------------------------------------------------------------- Read file
-
-  my $uri=$r->uri;
   foreach (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) {
       $content{$_}=&Apache::lonnet::metadata($uri,$_);
   }
-  my ($resdomain)=(&Apache::lonnet::declutter($uri)=~/^(\w+)\//);
 # ------------------------------------------------------------------ Hide stuff
 
   unless ($ENV{'user.adv'}) {