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

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 12 Nov 2003 21:38:35 -0000


matthew		Wed Nov 12 16:38:35 2003 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  Get the access count from the nohist_accesscount.db.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.39 loncom/interface/lonmeta.pm:1.40
--- loncom/interface/lonmeta.pm:1.39	Fri Oct 24 10:58:36 2003
+++ loncom/interface/lonmeta.pm	Wed Nov 12 16:38:35 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.39 2003/10/24 14:58:36 albertel Exp $
+# $Id: lonmeta.pm,v 1.40 2003/11/12 21:38:35 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -55,7 +55,7 @@
     my %sum=();
     my %cnt=();
     my %concat=();
-    my %listitems=('count'        => 'add',
+    my %listitems=(
                    'course'       => 'add',
                    'goto'         => 'add',
                    'comefrom'     => 'add',
@@ -104,7 +104,22 @@
        $returnhash{$_.'_list'}=$concat{$_};
        ### Apache->request->print("\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'});
     }
+    #
+    # Deal with 'count' seperately
+    $returnhash{'count'} = &access_count($url,$aauthor,$adomain);
+
     return %returnhash;
+}
+
+sub access_count {
+    my ($src,$author,$adomain) = @_;
+    my %countdata=&Apache::lonnet::dump('nohist_accesscount',$adomain,
+                                        $author,$src);
+    if (! exists($countdata{$src})) {
+        return 'Not Available';
+    } else {
+        return $countdata{$src};
+    }
 }
 
 # ------------------------------------- Try to make an alt tag if there is none