--- loncom/interface/loncommon.pm 2006/11/29 21:00:35 1.477
+++ loncom/interface/loncommon.pm 2006/12/01 00:26:07 1.480
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.477 2006/11/29 21:00:35 www Exp $
+# $Id: loncommon.pm,v 1.480 2006/12/01 00:26:07 banghart 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") ) {
@@ -1385,14 +1385,14 @@ sub display_filter {
return ' '.
&mt('Filter [_1]',
&select_form($env{'form.displayfilter'},
'displayfilter',
('currentfolder' => 'Current folder/page',
'containing' => 'Containing phrase',
'none' => 'None'))).
- '';
+ '';
}
sub gradeleveldescription {
@@ -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 {
}
@@ -5138,7 +5136,15 @@ sub record_sep {
$i++;
}
} else {
- my @allfields=split(/\,/,$record);
+ my @allfields;
+ &Apache::lonnet::logthis("file type is ".$env{'form.upfiletype'});
+ if ($env{'form.upfiletype'} eq 'semisv') {
+ &Apache::lonnet::logthis("splitting on ; ");
+ @allfields=split(/;/,$record);
+ } else {
+ &Apache::lonnet::logthis("splitting on , ");
+ @allfields=split(/\,/,$record);
+ }
my $i=0;
my $j;
for ($j=0;$j<=$#allfields;$j++) {
@@ -5176,6 +5182,7 @@ the file type.
sub upfile_select_html {
my %Types = (
csv => &mt('CSV (comma separated values, spreadsheet)'),
+ semisv => &mt('Semicolon separated values'),
space => &mt('Space separated'),
tab => &mt('Tabulator separated'),
# xml => &mt('HTML/XML'),
@@ -6015,7 +6022,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 +6031,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 .=