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: #
9: # 10/19,10/21,10/23,11/27 Gerd Kortemeyer
10:
11: package Apache::lonmeta;
12:
13: use strict;
14: use Apache::Constants qw(:common);
15: use Apache::lonnet();
16:
17:
18: # ================================================================ Main Handler
19:
20: sub handler {
21: my $r=shift;
22: my %content=();
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:
33: my $uri=$r->uri;
34: map {
35: $content{$_}=&Apache::lonnet::metadata($uri,$_);
36: } split(/\,/,&Apache::lonnet::metadata($uri,'keys'));
37:
38: # --------------------------------------------------------------- Render Output
39:
40: my $creationdate=localtime($content{'creationdate'});
41: my $lastrevisiondate=localtime($content{'lastrevisiondate'});
42:
43: $r->print(<<ENDHEAD);
44: <html><head><title>Catalog Information</title></head>
45: <body bgcolor="#FFFFFF">
46: <h1>Catalog Information</h1>
47: <h2>$content{'title'}</h2>
48: <h3>Author(s): $content{'author'}</h3>
49: <b>Subject:</b> $content{'subject'}<br>
50: <b>Keyword(s):</b> $content{'keywords'}<br>
51: <b>Notes:</b> $content{'notes'}<br>
52: <b>Abstract:</b>
53: <blockquote>$content{'abstract'}</blockquote>
54: <hr>
55: <b>MIME Type:</b> $content{'mime'}<br>
56: <b>Language:</b> $content{'language'}<br>
57: <b>Creation Date:</b> $creationdate<br>
58: <b>Last Revision Date:</b> $lastrevisiondate<br>
59: <b>Publisher/Owner:</b> $content{'owner'}<br>
60: <b>Copyright/Distribution:</b> $content{'copyright'}
61: <hr>
62: ENDHEAD
63: delete($content{'title'});
64: delete($content{'author'});
65: delete($content{'subject'});
66: delete($content{'keywords'});
67: delete($content{'notes'});
68: delete($content{'abstract'});
69: delete($content{'mime'});
70: delete($content{'language'});
71: delete($content{'creationdate'});
72: delete($content{'lastrevisiondate'});
73: delete($content{'owner'});
74: delete($content{'copyright'});
75: map {
76: my $name=$_;
77: my $display=&Apache::lonnet::metadata($uri,$name.'.display');
78: unless ($display) { $display=$name; };
79: my $otherinfo='';
80: map {
81: if (defined(&Apache::lonnet::metadata($uri,$name.'.'.$_))) {
82: $otherinfo.=' '.$_.'='.
83: &Apache::lonnet::metadata($uri,$name.'.'.$_).'; ';
84: }
85: } ('name','part','type','default');
86: $r->print('<b>'.$display.':</b> '.$content{$name});
87: if ($otherinfo) {
88: $r->print(' ('.$otherinfo.')');
89: }
90: $r->print("<br>\n");
91: } sort keys %content;
92: $r->print('</body></html>');
93: return OK;
94: }
95:
96: 1;
97: __END__
98:
99:
100:
101:
102:
103:
104:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>