Diff for /loncom/interface/lonmeta.pm between versions 1.37 and 1.40

version 1.37, 2003/09/27 13:20:46 version 1.40, 2003/11/12 21:38:35
Line 55  sub dynamicmeta { Line 55  sub dynamicmeta {
     my %sum=();      my %sum=();
     my %cnt=();      my %cnt=();
     my %concat=();      my %concat=();
     my %listitems=('count'        => 'add',      my %listitems=(
                    'course'       => 'add',                     'course'       => 'add',
                    'goto'         => 'add',                     'goto'         => 'add',
                    'comefrom'     => 'add',                     'comefrom'     => 'add',
Line 70  sub dynamicmeta { Line 70  sub dynamicmeta {
                    'comments'     => 'app',                     'comments'     => 'app',
                    'usage'        => 'cnt'                     'usage'        => 'cnt'
                    );                     );
     foreach (keys %evaldata) {      while ($_=each(%evaldata)) {
  my ($item,$purl,$cat)=&Apache::lonnet::decode_symb($_);   my ($item,$purl,$cat)=split(/___/,$_);
 ### print "\n".$_.' - '.$item.'<br />';   ### Apache->request->print("\n".$_.' - '.$item.'<br />');
         if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; }   if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; }
         unless ($listitems{$cat} eq 'app') {          unless ($listitems{$cat} eq 'app') {
             if (defined($sum{$cat})) {              if (defined($sum{$cat})) {
                $sum{$cat}+=$evaldata{$_};                 $sum{$cat}+=$evaldata{$_};
Line 93  sub dynamicmeta { Line 93  sub dynamicmeta {
  }   }
     }      }
     my %returnhash=();      my %returnhash=();
     foreach (keys %cnt) {      while ($_=each(%cnt)) {
        if ($listitems{$_} eq 'avg') {         if ($listitems{$_} eq 'avg') {
    $returnhash{$_}=int(($sum{$_}/$cnt{$_})*100.0+0.5)/100.0;     $returnhash{$_}=int(($sum{$_}/$cnt{$_})*100.0+0.5)/100.0;
        } elsif ($listitems{$_} eq 'cnt') {         } elsif ($listitems{$_} eq 'cnt') {
Line 102  sub dynamicmeta { Line 102  sub dynamicmeta {
            $returnhash{$_}=$sum{$_};             $returnhash{$_}=$sum{$_};
        }         }
        $returnhash{$_.'_list'}=$concat{$_};         $returnhash{$_.'_list'}=$concat{$_};
 ### print "\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'};         ### Apache->request->print("\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'});
     }      }
       #
       # Deal with 'count' seperately
       $returnhash{'count'} = &access_count($url,$aauthor,$adomain);
   
     return %returnhash;      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  # ------------------------------------- Try to make an alt tag if there is none
   
 sub alttag {  sub alttag {
Line 219  sub handler { Line 234  sub handler {
   
 # --------------------------------------------------------------- Render Output  # --------------------------------------------------------------- Render Output
   my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/);    my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/);
 my $creationdate=localtime(  my $creationdate=&Apache::lonlocal::locallocaltime(
  &Apache::loncommon::unsqltime($content{'creationdate'}));   &Apache::loncommon::unsqltime($content{'creationdate'}));
 my $lastrevisiondate=localtime(  my $lastrevisiondate=&Apache::lonlocal::locallocaltime(
  &Apache::loncommon::unsqltime($content{'lastrevisiondate'}));   &Apache::loncommon::unsqltime($content{'lastrevisiondate'}));
 my $language=&Apache::loncommon::languagedescription($content{'language'});  my $language=&Apache::loncommon::languagedescription($content{'language'});
 my $mime=&Apache::loncommon::filedescription($content{'mime'});   my $mime=&Apache::loncommon::filedescription($content{'mime'}); 
Line 234  my $owner=$content{'owner'}; Line 249  my $owner=$content{'owner'};
 $owner=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;  $owner=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
 my $versiondisplay='';  my $versiondisplay='';
 if ($thisversion) {  if ($thisversion) {
     $versiondisplay='Version: '.$thisversion.      $versiondisplay=&mt('Version').': '.$thisversion.
     ' (most recent version: '.$currentversion.')';      ' ('.&mt('most recent version').': '.$currentversion.')';
 } else {  } else {
     $versiondisplay='Version: '.$currentversion;      $versiondisplay='Version: '.$currentversion;
 }  }

Removed from v.1.37  
changed lines
  Added in v.1.40


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>