[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
www
lon-capa-cvs@mail.lon-capa.org
Tue, 18 Feb 2003 22:39:18 -0000
www Tue Feb 18 17:39:18 2003 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
Gets alttag info from metadata if not provided
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.25 loncom/interface/lonmeta.pm:1.26
--- loncom/interface/lonmeta.pm:1.25 Tue Feb 18 16:17:00 2003
+++ loncom/interface/lonmeta.pm Tue Feb 18 17:39:18 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.25 2003/02/18 21:17:00 www Exp $
+# $Id: lonmeta.pm,v 1.26 2003/02/18 22:39:18 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -101,8 +101,18 @@
# ------------------------------------- Try to make an alt tag if there is none
sub alttag {
- my $src=shift;
- return 'None';
+ 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