--- loncom/interface/lonmeta.pm 2006/11/20 20:58:30 1.189 +++ loncom/interface/lonmeta.pm 2006/12/05 02:55:53 1.190 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.189 2006/11/20 20:58:30 banghart Exp $ +# $Id: lonmeta.pm,v 1.190 2006/12/05 02:55:53 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,8 +39,7 @@ use Apache::lonpublisher; use Apache::lonlocal; use Apache::lonmysql; use Apache::lonmsg; -use lib '/home/httpd/lib/perl/'; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); ############################################################ @@ -63,7 +62,7 @@ use LONCAPA; ############################################################ sub get_dynamic_metadata_from_sql { my ($url) = shift(); - my ($authordom,$author)=($url=~m:^/res/(\w+)/(\w+)/:); + my ($authordom,$author)=($url=~m{^/res/($match_domain)/($match_username)/}); if (! defined($authordom)) { $authordom = shift(); } @@ -112,7 +111,7 @@ sub get_dynamic_metadata_from_sql { sub dynamicmeta { my $url=&Apache::lonnet::declutter(shift); $url=~s/\.meta$//; - my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); + my ($adomain,$aauthor)=($url=~/^($match_domain)\/($match_username)\//); my $regexp=$url; $regexp=~s/(\W)/\\$1/g; $regexp='___'.$regexp.'___'; @@ -449,7 +448,7 @@ sub prettyprint { ($type eq 'owner') || ($type eq 'modifyinguser') || ($type eq 'authorspace')) { - $value=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse; + $value=~s/($match_username)(\:|\@)($match_domain)/&authordisplay($1,$3)/gse; return $value; } # Gradelevel @@ -732,14 +731,14 @@ sub handler { $r->send_http_header; return OK if $r->header_only; my ($resdomain,$resuser)= - (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//); + (&Apache::lonnet::declutter($uri)=~/^($match_domain)\/($match_username)\//); if ($uri=~m:/adm/bombs/(.*)$:) { $r->print(&Apache::loncommon::start_page('Error Messages')); # Looking for all bombs? &report_bombs($r,$uri); } elsif ($uri=~m|^/editupload/[^/]+/[^/]+/portfolio/|) { ($resdomain,$resuser)= - (&Apache::lonnet::declutter($uri)=~m|^(\w+)/(\w+)/portfolio|); + (&Apache::lonnet::declutter($uri)=~m|^($match_domain)/($match_name)/portfolio|); $r->print(&Apache::loncommon::start_page('Edit Portfolio File Catalog Information', undef, {'domain' => $resdomain,})); @@ -793,7 +792,7 @@ sub report_bombs { $uri =~ s:/adm/bombs/::; $uri = &Apache::lonnet::declutter($uri); $r->print('

'.&Apache::lonnet::clutter($uri).'

'); - my ($domain,$author)=($uri=~/^(\w+)\/(\w+)\//); + my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//); if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) { if ($env{'form.clearbombs'}) { &Apache::lonmsg::clear_author_res_msg($uri); @@ -1060,7 +1059,7 @@ sub print_dynamic_metadata { } else { $r->print('

'.&mt('No Evaluation Data is available for this resource.').'

'); } - $uri=~/^\/res\/(\w+)\/(\w+)\//; + $uri=~/^\/res\/($match_domain)\/($match_username)\//; if ((($env{'user.domain'} eq $1) && ($env{'user.name'} eq $2)) || ($env{'user.role.ca./'.$1.'/'.$2})) { if (exists($dynmeta{'comments'})) { @@ -1337,7 +1336,7 @@ ENDEDIT } if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles|) { my ($path, $new_fn); - if ($fn =~ m|\w+/groups/\w+/portfolio/|) { + if ($fn =~ m|$match_name/groups/\w+/portfolio/|) { ($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|); } else { ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|);