--- loncom/interface/lonmeta.pm 2002/10/25 13:50:48 1.24 +++ 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.24 2002/10/25 13:50:48 www Exp $ +# $Id: lonmeta.pm,v 1.29 2003/04/12 15:57:30 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,6 +55,8 @@ sub dynamicmeta { my %cnt; my %listitems=('count' => 'add', 'course' => 'add', + 'goto' => 'add', + 'comefrom' => 'add', 'avetries' => 'avg', 'stdno' => 'add', 'difficulty' => 'avg', @@ -98,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 { @@ -193,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. @@ -200,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(< - + @@ -228,9 +265,11 @@ $versiondisplay
- + - + +
Author(s)$content{'author'} 
$author 
Subject $content{'subject'} 
Keyword(s)
Last Revision Date$lastrevisiondate 
Publisher/Owner$content{'owner'} 
$owner 
Copyright/Distribution$content{'copyright'} +$content{'copyright'} 
Custom Distribution File$customdistributionfile 
ENDHEAD delete($content{'title'}); @@ -303,7 +342,7 @@ $dynmeta{$_}." \n"); '

Error Messages (visible to author and co-authors only)

'); my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$1,$2); foreach (keys %errormsgs) { - if ($_=~/^$disuri\_\d+$/) { + if ($_=~/^\Q$disuri\E\_\d+$/) { my %content=&Apache::lonmsg::unpackagemsg($errormsgs{$_}); $r->print(''.$content{'time'}.': '.$content{'message'}. '
'); @@ -363,7 +402,7 @@ $bodytag
ENDEDIT foreach ('author','title','subject','keywords','abstract','notes', - 'copyright','language') { + 'copyright','customdistributionfile','language') { if ($ENV{'form.new_'.$_}) { $Apache::lonpublisher::metadatafields{$_}=$ENV{'form.new_'.$_}; }