--- loncom/interface/loncommon.pm 2006/11/29 22:02:47 1.478 +++ loncom/interface/loncommon.pm 2006/11/30 22:29:03 1.479 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.478 2006/11/29 22:02:47 www Exp $ +# $Id: loncommon.pm,v 1.479 2006/11/30 22:29:03 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -65,7 +65,7 @@ use Apache::lonhtmlcommon(); use Apache::loncoursedata(); use Apache::lontexconvert(); use Apache::lonclonecourse(); -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); my $readit; @@ -157,7 +157,7 @@ BEGIN { opendir(DIR,$designdir); while ($filename=readdir(DIR)) { if ($filename!~/\.tab$/) { next; } - my ($domain)=($filename=~/^(\w+)\./); + my ($domain)=($filename=~/^($match_domain)\./); { my $designfile = $designdir.'/'.$filename; if ( open (my $fh,"<$designfile") ) { @@ -2810,8 +2810,8 @@ sub findallcourses { my %courses; my $now=time; foreach my $key (keys(%env)) { - if ( $key=~m{^user\.role\.(\w+)\./(\w+)/(\w+)/?(\w*)$} || - $key=~m{^user\.role\.(cr/\w+/\w+/\w+)\./(\w+)/(\w+)}) { + if ( $key=~m{^user\.role\.(\w+)\./($match_domain)/($match_username)/?(\w*)$} || + $key=~m{^user\.role\.(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_username)}) { my ($role,$domain,$id,$sec) = ($1,$2,$3,$4); next if ($role eq 'ca' || $role eq 'aa'); next if (%roles && !exists($roles{$role})); @@ -3118,7 +3118,7 @@ sub bodytag { # role and realm my ($role,$realm) = split(/\./,$env{'request.role'},2); if ($role eq 'ca') { - my ($rdom,$rname) = ($realm =~ m-^/(\w+)/(\w+)$-); + my ($rdom,$rname) = ($realm =~ m{^/($match_domain)/($match_username)$}); $realm = &plainname($rname,$rdom).':'.$rdom; } # realm @@ -3624,8 +3624,6 @@ table.LC_whatsnew tr.LC_empty_row td { table.LC_whatsnew tr.LC_empty_row td { padding: 4ex } - - table.LC_whatsnew { } @@ -6015,7 +6013,7 @@ sub construct_course { # # Check if created correctly # - ($$crsudom,$$crsunum)=($$courseid=~/^\/(\w+)\/(\w+)$/); + ($$crsudom,$$crsunum)= &LONCAPA::split_courseid($$courseid); my $crsuhome=&Apache::lonnet::homeserver($$crsunum,$$crsudom); $outcome .= &mt('Created on').': '.$crsuhome.'
'; # @@ -6024,7 +6022,7 @@ sub construct_course { my $cloneid=''; if (($args->{'clonecourse'}) && ($args->{'clonedomain'})) { $cloneid='/'.$args->{'clonedomain'}.'/'.$args->{'clonecourse'}; - my ($clonecrsudom,$clonecrsunum)=($cloneid=~/^\/(\w+)\/(\w+)$/); + my ($clonecrsudom,$clonecrsunum)= &LONCAPA::split_courseid($cloneid); my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom); if ($clonehome eq 'no_host') { $outcome .=