--- loncom/interface/lonmeta.pm 2004/04/13 15:41:19 1.65
+++ loncom/interface/lonmeta.pm 2004/04/13 16:03:46 1.66
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.65 2004/04/13 15:41:19 matthew Exp $
+# $Id: lonmeta.pm,v 1.66 2004/04/13 16:03:46 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -146,7 +146,10 @@ sub diffgraph {
return $output;
}
+#
# Turn MySQL row into hash
+# This routine is here for historic reasons. Probably should be moved to
+# a more generic place since it has nothing to do with metadata
sub metadata_col_to_hash {
my @cols=@_;
my %hash=();
@@ -396,107 +399,125 @@ sub handler {
#
my $uri=$r->uri;
#
- # Looking for all bombs?
- if ($uri=~/\/adm\/bombs\/(.*)$/) {
- # Set document type
- $uri=&Apache::lonnet::declutter($1);
- &Apache::loncommon::content_type($r,'text/html');
- $r->send_http_header;
- #
- return OK if $r->header_only;
- $r->print(&Apache::loncommon::bodytag('Error Messages'));
- $r->print('
'.&Apache::lonnet::clutter($uri).'
');
- my ($domain,$author)=($uri=~/^(\w+)\/(\w+)\//);
- if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) {
- my %brokenurls=&Apache::lonmsg::all_url_author_res_msg($author,
- $domain);
- foreach (sort keys %brokenurls) {
- if ($_=~/^\Q$uri\E/) {
- $r->print(&Apache::lonhtmlcommon::crumbs
- (&Apache::lonnet::clutter($_)).
- &Apache::lonmsg::retrieve_author_res_msg($_).
- '
');
- }
+ if ($uri=~m:/adm/bombs/(.*)$:) {
+ # Looking for all bombs?
+ &report_bombs($r,$uri);
+ } elsif ($uri=~/^\/\~/) {
+ # Construction space
+ &present_editable_metadata($r,$uri);
+ } else {
+ &present_uneditable_metadata($r,$uri);
+ }
+ return OK;
+}
+
+sub report_bombs {
+ my ($r,$uri) = @_;
+ # Set document type
+ $uri=~ s:/adm/bombs/::;
+ $uri=&Apache::lonnet::declutter($uri);
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ #
+ return OK if $r->header_only;
+ $r->print(&Apache::loncommon::bodytag('Error Messages'));
+ $r->print(''.&Apache::lonnet::clutter($uri).'
');
+ my ($domain,$author)=($uri=~/^(\w+)\/(\w+)\//);
+ if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) {
+ my %brokenurls=&Apache::lonmsg::all_url_author_res_msg($author,
+ $domain);
+ foreach (sort keys %brokenurls) {
+ if ($_=~/^\Q$uri\E/) {
+ $r->print(&Apache::lonhtmlcommon::crumbs
+ (&Apache::lonnet::clutter($_)).
+ &Apache::lonmsg::retrieve_author_res_msg($_).
+ '
');
}
- } else {
- $r->print(&mt('Not authorized'));
- }
- $r->print('