--- loncom/interface/loncommon.pm 2006/11/29 15:38:22 1.475
+++ 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.475 2006/11/29 15:38:22 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") ) {
@@ -1381,17 +1381,18 @@ sub select_form {
sub display_filter {
if (!$env{'form.show'}) { $env{'form.show'}=10; }
+ if (!$env{'form.displayfilter'}) { $env{'form.displayfilter'}='currentfolder'; }
return ' '.
&mt('Filter [_1]',
- &select_form(($env{'form.displayfilter'}?$env{'form.displayfilter'}:'currentfolder'),
- 'displayfilter',
- ('currentfolder' => 'Current folder',
- 'containing' => 'Containing phrase',
- 'none' => 'None'))).
- '';
+ &select_form($env{'form.displayfilter'},
+ 'displayfilter',
+ ('currentfolder' => 'Current folder/page',
+ 'containing' => 'Containing phrase',
+ 'none' => 'None'))).
+ '';
}
sub gradeleveldescription {
@@ -2809,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}));
@@ -2896,7 +2897,6 @@ sub parse_block_record {
($setuname,$setudom) = split(/:/,$record->{'setter'});
$title = &unescape($record->{'event'});
$blocks = $record->{'blocks'};
-
} else {
my @data = split(/:/,$record,3);
if (scalar(@data) eq 2) {
@@ -2919,7 +2919,7 @@ sub build_block_table {
'blse' => 'Block set by'
);
my $output;
- $output = '
'.$lt{'cacb'}.':
';
+ $output = '
'.$lt{'cacb'}.':
';
$output .= &start_data_table();
$output .= '
@@ -2932,15 +2932,14 @@ sub build_block_table {
my %courseinfo=&Apache::lonnet::coursedescription($course);
for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
- my $fullname = &Apache::loncommon::plainname($uname,$udom);
+ my $fullname = &aboutmewrapper(&plainname($uname,$udom),$uname,$udom);
my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
$openblock = &Apache::lonlocal::locallocaltime($openblock);
$closeblock= &Apache::lonlocal::locallocaltime($closeblock);
$output .= &Apache::loncommon::start_data_table_row().
''.$courseinfo{'description'}.' | '.
''.$openblock.' to '.$closeblock.' | '.
- ''.$fullname.' ('.$uname.':'.$udom.
- ') | '.
+ ''.$fullname.'. | '.
&Apache::loncommon::end_data_table_row();
}
}
@@ -3119,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
@@ -3625,8 +3624,6 @@ table.LC_whatsnew tr.LC_empty_row td {
table.LC_whatsnew tr.LC_empty_row td {
padding: 4ex
}
-
-
table.LC_whatsnew {
}
@@ -6016,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.'
';
#
@@ -6025,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 .=