Annotation of loncom/interface/lonmeta.pm, revision 1.7
1.1 www 1: # The LearningOnline Network with CAPA
2: #
3: # Metadata display handler
4: #
5: # (TeX Content Handler
6: #
7: # 05/29/00,05/30,10/11 Gerd Kortemeyer)
8: #
1.7 ! www 9: # 10/19,10/21,10/23,11/27,08/09/01 Gerd Kortemeyer
1.1 www 10:
11: package Apache::lonmeta;
12:
13: use strict;
14: use Apache::Constants qw(:common);
1.3 www 15: use Apache::lonnet();
1.1 www 16:
17:
18: # ================================================================ Main Handler
19:
20: sub handler {
21: my $r=shift;
1.3 www 22: my %content=();
1.1 www 23:
24: # ----------------------------------------------------------- Set document type
25:
26: $r->content_type('text/html');
27: $r->send_http_header;
28:
29: return OK if $r->header_only;
30:
31: # ------------------------------------------------------------------- Read file
32:
1.3 www 33: my $uri=$r->uri;
34: map {
35: $content{$_}=&Apache::lonnet::metadata($uri,$_);
36: } split(/\,/,&Apache::lonnet::metadata($uri,'keys'));
1.1 www 37:
1.6 albertel 38: # ------------------------------------------------------------------ Hide stuff
1.7 ! www 39:
! 40: unless ($ENV{'user.adv'}) {
! 41: map {
! 42: $content{$_}='<i>- not displayed -</i>';
! 43: } ('keywords','notes','abstract','subject');
1.6 albertel 44: }
45:
1.1 www 46: # --------------------------------------------------------------- Render Output
1.2 www 47:
48: my $creationdate=localtime($content{'creationdate'});
49: my $lastrevisiondate=localtime($content{'lastrevisiondate'});
1.1 www 50:
51: $r->print(<<ENDHEAD);
52: <html><head><title>Catalog Information</title></head>
53: <body bgcolor="#FFFFFF">
54: <h1>Catalog Information</h1>
55: <h2>$content{'title'}</h2>
56: <h3>Author(s): $content{'author'}</h3>
57: <b>Subject:</b> $content{'subject'}<br>
58: <b>Keyword(s):</b> $content{'keywords'}<br>
59: <b>Notes:</b> $content{'notes'}<br>
60: <b>Abstract:</b>
61: <blockquote>$content{'abstract'}</blockquote>
62: <hr>
63: <b>MIME Type:</b> $content{'mime'}<br>
64: <b>Language:</b> $content{'language'}<br>
1.2 www 65: <b>Creation Date:</b> $creationdate<br>
66: <b>Last Revision Date:</b> $lastrevisiondate<br>
1.1 www 67: <b>Publisher/Owner:</b> $content{'owner'}<br>
68: <b>Copyright/Distribution:</b> $content{'copyright'}
69: <hr>
70: ENDHEAD
71: delete($content{'title'});
72: delete($content{'author'});
73: delete($content{'subject'});
74: delete($content{'keywords'});
75: delete($content{'notes'});
76: delete($content{'abstract'});
77: delete($content{'mime'});
78: delete($content{'language'});
79: delete($content{'creationdate'});
80: delete($content{'lastrevisiondate'});
81: delete($content{'owner'});
82: delete($content{'copyright'});
1.7 ! www 83: if ($ENV{'user.adv'}) {
! 84: map {
1.3 www 85: my $name=$_;
86: my $display=&Apache::lonnet::metadata($uri,$name.'.display');
1.5 www 87: unless ($display) { $display=$name; };
88: my $otherinfo='';
89: map {
90: if (defined(&Apache::lonnet::metadata($uri,$name.'.'.$_))) {
91: $otherinfo.=' '.$_.'='.
92: &Apache::lonnet::metadata($uri,$name.'.'.$_).'; ';
93: }
94: } ('name','part','type','default');
95: $r->print('<b>'.$display.':</b> '.$content{$name});
96: if ($otherinfo) {
97: $r->print(' ('.$otherinfo.')');
98: }
99: $r->print("<br>\n");
1.7 ! www 100: } sort keys %content;
! 101: }
1.1 www 102: $r->print('</body></html>');
103: return OK;
104: }
105:
106: 1;
107: __END__
108:
109:
110:
111:
112:
113:
114:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>