--- loncom/interface/lonmeta.pm 2002/10/07 13:50:36 1.21 +++ loncom/interface/lonmeta.pm 2003/03/14 19:29:36 1.28 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.21 2002/10/07 13:50:36 www Exp $ +# $Id: lonmeta.pm,v 1.28 2003/03/14 19:29:36 albertel 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 @@ -96,6 +98,23 @@ 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'; } +} + # -------------------------------------------------------------- Pretty display sub evalgraph { @@ -149,6 +168,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,9 +200,11 @@ sub handler { } # --------------------------------------------------------------- Render Output - my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta/); -my $creationdate=localtime($content{'creationdate'}); -my $lastrevisiondate=localtime($content{'lastrevisiondate'}); + my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/); +my $creationdate=localtime( + &Apache::loncommon::unsqltime($content{'creationdate'})); +my $lastrevisiondate=localtime( + &Apache::loncommon::unsqltime($content{'lastrevisiondate'})); my $language=&Apache::loncommon::languagedescription($content{'language'}); my $mime=&Apache::loncommon::filedescription($content{'mime'}); my $disuri=&Apache::lonnet::declutter($uri); @@ -292,7 +315,17 @@ $dynmeta{$_}." \n"); || ($ENV{'user.role.ca./'.$1.'/'.$2})) { $r->print( '
'.$dynmeta{'comments'}.''); + '
'.$dynmeta{'comments'}.''); + $r->print( + '