--- loncom/interface/lonmeta.pm 2002/10/18 13:49:49 1.22 +++ loncom/interface/lonmeta.pm 2002/10/20 18:40:00 1.23 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.22 2002/10/18 13:49:49 www Exp $ +# $Id: lonmeta.pm,v 1.23 2002/10/20 18:40:00 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,6 +37,8 @@ use strict; use Apache::Constants qw(:common); use Apache::lonnet(); use Apache::loncommon(); +use Apache::lonmsg; +use Apache::lonpublisher; # ----------------------------------------- Fetch and evaluate dynamic metadata @@ -149,6 +151,8 @@ sub handler { my $uri=$r->uri; + unless ($uri=~/^\/\~/) { +# =========================================== This is not in construction space my ($resdomain,$resuser)= (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//); @@ -179,7 +183,7 @@ sub handler { } # --------------------------------------------------------------- Render Output - my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta/); + my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/); my $creationdate=localtime( &Apache::loncommon::unsqltime($content{'creationdate'})); my $lastrevisiondate=localtime( @@ -294,7 +298,17 @@ $dynmeta{$_}." \n"); || ($ENV{'user.role.ca./'.$1.'/'.$2})) { $r->print( '

Evaluation Comments (visible to author and co-authors only)

'. - '
'.$dynmeta{'comments'}.'
'); + '
'.$dynmeta{'comments'}.'
'); + $r->print( + '

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+$/) { + my %content=&Apache::lonmsg::unpackagemsg($errormsgs{$_}); + $r->print(''.$content{'time'}.': '.$content{'message'}. + '
'); + } + } } # ------------------------------------------------------------- All other stuff $r->print( @@ -317,8 +331,42 @@ $dynmeta{$_}." \n"); $r->print("
\n"); } } - $r->print(''); - return OK; +# ===================================================== End Resource Space Call + } else { +# ===================================================== Construction Space Call + +# ----------------------------------------------------------- Set document type + + $r->content_type('text/html'); + $r->send_http_header; + + return OK if $r->header_only; +# ---------------------------------------------------------------------- Header + my $bodytag=&Apache::loncommon::bodytag('Edit Catalog Information'); + my $disuri=$uri; + my $fn=&Apache::lonnet::filelocation('',$uri); + $disuri=~s/^\/\~\w+//; + $disuri=~s/\.meta$//; + my $displayfile='Catalog Information for '.$disuri; + if ($disuri=~/\/default$/) { + my $dir=$disuri; + $dir=~s/default$//; + $displayfile='Default Cataloging Information for Directory '.$dir; + } + %Apache::lonpublisher::metadatafields=(); + %Apache::lonpublisher::metadatakeys=(); + &Apache::lonpublisher::metaeval(&Apache::lonnet::getfile($fn)); + $r->print(<Edit Catalog Information +$bodytag +

$displayfile

+ENDEDIT + foreach (keys %Apache::lonpublisher::metadatafields) { + $r->print('
'.$_.' '.$Apache::lonpublisher::metadatafields{$_}); + } + } + $r->print(''); + return OK; } 1;