Annotation of loncom/interface/lonmeta.pm, revision 1.6

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.3       www         9: # 10/19,10/21,10/23,11/27 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
        !            39:   if (!$ENV{'user.adv'}) {
        !            40:     map {
        !            41:       $content{$_}='<i>- not displayed -</i>';
        !            42:     } ('keywords','notes','abstract','subject');
        !            43:   }
        !            44: 
1.1       www        45: # --------------------------------------------------------------- Render Output
1.2       www        46: 
                     47: my $creationdate=localtime($content{'creationdate'});
                     48: my $lastrevisiondate=localtime($content{'lastrevisiondate'});
1.1       www        49:   
                     50:   $r->print(<<ENDHEAD);
                     51: <html><head><title>Catalog Information</title></head>
                     52: <body bgcolor="#FFFFFF">
                     53: <h1>Catalog Information</h1>
                     54: <h2>$content{'title'}</h2>
                     55: <h3>Author(s): $content{'author'}</h3>
                     56: <b>Subject:</b> $content{'subject'}<br>
                     57: <b>Keyword(s):</b> $content{'keywords'}<br>
                     58: <b>Notes:</b> $content{'notes'}<br>
                     59: <b>Abstract:</b>
                     60: <blockquote>$content{'abstract'}</blockquote>
                     61: <hr>
                     62: <b>MIME Type:</b> $content{'mime'}<br>
                     63: <b>Language:</b> $content{'language'}<br>
1.2       www        64: <b>Creation Date:</b> $creationdate<br>
                     65: <b>Last Revision Date:</b> $lastrevisiondate<br>
1.1       www        66: <b>Publisher/Owner:</b> $content{'owner'}<br>
                     67: <b>Copyright/Distribution:</b> $content{'copyright'}
                     68: <hr>
                     69: ENDHEAD
                     70:   delete($content{'title'});
                     71:   delete($content{'author'});
                     72:   delete($content{'subject'});
                     73:   delete($content{'keywords'});
                     74:   delete($content{'notes'});
                     75:   delete($content{'abstract'});
                     76:   delete($content{'mime'});
                     77:   delete($content{'language'});
                     78:   delete($content{'creationdate'});
                     79:   delete($content{'lastrevisiondate'});
                     80:   delete($content{'owner'});
                     81:   delete($content{'copyright'});
                     82:   map {
1.3       www        83:       my $name=$_;
                     84:       my $display=&Apache::lonnet::metadata($uri,$name.'.display');
1.5       www        85:       unless ($display) { $display=$name; };
                     86:       my $otherinfo='';
                     87:       map {
                     88:           if (defined(&Apache::lonnet::metadata($uri,$name.'.'.$_))) {
                     89:              $otherinfo.=' '.$_.'='.
                     90: 		 &Apache::lonnet::metadata($uri,$name.'.'.$_).'; ';
                     91:           }
                     92:       } ('name','part','type','default'); 
                     93:       $r->print('<b>'.$display.':</b> '.$content{$name});
                     94:       if ($otherinfo) {
                     95:          $r->print(' ('.$otherinfo.')');
                     96:       }
                     97:       $r->print("<br>\n");
1.1       www        98:   } sort keys %content;
                     99:   $r->print('</body></html>');
                    100:   return OK;
                    101: }
                    102: 
                    103: 1;
                    104: __END__
                    105: 
                    106: 
                    107: 
                    108: 
                    109: 
                    110: 
                    111: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>