--- loncom/interface/lonmeta.pm 2002/10/18 13:49:49 1.22
+++ loncom/interface/lonmeta.pm 2003/04/12 15:57:30 1.29
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.22 2002/10/18 13:49:49 www Exp $
+# $Id: lonmeta.pm,v 1.29 2003/04/12 15:57:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,6 +37,8 @@ use strict;
use Apache::Constants qw(:common);
use Apache::lonnet();
use Apache::loncommon();
+use Apache::lonmsg;
+use Apache::lonpublisher;
# ----------------------------------------- Fetch and evaluate dynamic metadata
@@ -53,6 +55,8 @@ sub dynamicmeta {
my %cnt;
my %listitems=('count' => 'add',
'course' => 'add',
+ 'goto' => 'add',
+ 'comefrom' => 'add',
'avetries' => 'avg',
'stdno' => 'add',
'difficulty' => 'avg',
@@ -96,6 +100,32 @@ sub dynamicmeta {
return %returnhash;
}
+# ------------------------------------- Try to make an alt tag if there is none
+
+sub alttag {
+ my ($base,$src)=@_;
+ my $fullpath=&Apache::lonnet::hreflocation($base,$src);
+ my $alttag=&Apache::lonnet::metadata($fullpath,'title').' '.
+ &Apache::lonnet::metadata($fullpath,'subject').' '.
+ &Apache::lonnet::metadata($fullpath,'abstract');
+ $alttag=~s/\s+/ /gs;
+ $alttag=~s/\"//gs;
+ $alttag=~s/\'//gs;
+ $alttag=~s/\s+$//gs;
+ $alttag=~s/^\s+//gs;
+ if ($alttag) { return $alttag; } else
+ { return 'No information available'; }
+}
+
+# -------------------------------------------------------------- Author display
+
+sub authordisplay {
+ my ($aname,$adom)=@_;
+ return &Apache::loncommon::aboutmewrapper(
+ &Apache::loncommon::plainname($aname,$adom),
+ $aname,$adom).' ['.$aname.'@'.$adom.']';
+}
+
# -------------------------------------------------------------- Pretty display
sub evalgraph {
@@ -149,6 +179,8 @@ sub handler {
my $uri=$r->uri;
+ unless ($uri=~/^\/\~/) {
+# =========================================== This is not in construction space
my ($resdomain,$resuser)=
(&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);
@@ -179,7 +211,7 @@ sub handler {
}
# --------------------------------------------------------------- Render Output
- my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta/);
+ my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/);
my $creationdate=localtime(
&Apache::loncommon::unsqltime($content{'creationdate'}));
my $lastrevisiondate=localtime(
@@ -189,6 +221,10 @@ my $mime=&Apache::loncommon::filedescrip
my $disuri=&Apache::lonnet::declutter($uri);
$disuri=~s/\.meta$//;
my $currentversion=&Apache::lonnet::getversion($disuri);
+my $author=$content{'author'};
+$author=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
+my $owner=$content{'owner'};
+$owner=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
my $versiondisplay='';
if ($thisversion) {
$versiondisplay='Version: '.$thisversion.
@@ -196,6 +232,11 @@ if ($thisversion) {
} else {
$versiondisplay='Version: '.$currentversion;
}
+my $customdistributionfile='';
+if ($content{'customdistributionfile'}) {
+ $customdistributionfile=''.$content{'customdistributionfile'}.'';
+}
my $bodytag=&Apache::loncommon::bodytag
('Catalog Information','','','',$resdomain);
$r->print(<
Author(s) | -$content{'author'} | $author |
Subject | $content{'subject'} | |
Keyword(s) | @@ -224,9 +265,11 @@ $versiondisplay||
Last Revision Date | $lastrevisiondate | |
Publisher/Owner | -$content{'owner'} | $owner |
Copyright/Distribution | -$content{'copyright'} + | $content{'copyright'} |
Custom Distribution File | +$customdistributionfile |
'.$dynmeta{'comments'}.''); + '
'.$dynmeta{'comments'}.''); + $r->print( + '