--- loncom/interface/loncreateuser.pm 2006/11/22 21:55:53 1.136
+++ loncom/interface/loncreateuser.pm 2006/11/23 00:53:19 1.138
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.136 2006/11/22 21:55:53 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.138 2006/11/23 00:53:19 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -216,11 +216,8 @@ END
# =================================================================== Phase two
sub print_user_modification_page {
my $r=shift;
- my $ccuname=$env{'form.ccuname'};
- my $ccdomain=$env{'form.ccdomain'};
-
- $ccuname=~s/\W//g;
- $ccdomain=~s/\W//g;
+ my $ccuname =&LONCAPA::clean_username($env{'form.ccuname'});
+ my $ccdomain=&LONCAPA::clean_domain($env{'form.ccdomain'});
unless (($ccuname) && ($ccdomain)) {
&print_username_entry_form($r);
@@ -238,9 +235,9 @@ sub print_user_modification_page {
);
$loginscript = &Apache::loncommon::authform_header(%param);
$authformkrb = &Apache::loncommon::authform_kerberos(%param);
-
- $ccuname=~s/\W//g;
- $ccdomain=~s/\W//g;
+
+ $ccuname =&LONCAPA::clean_username($ccuname);
+ $ccdomain=&LONCAPA::clean_domain($ccdomain);
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
my $dc_setcourse_code = '';
my $nondc_setsection_code = '';
@@ -623,7 +620,6 @@ END
# Is this a custom role? Get role owner and title.
my ($croleudom,$croleuname,$croletitle)=
($role_code=~/^cr\/(\w+)\/(\w+)\/(\w+)$/);
- my $bgcol='ffffff';
my $allowed=0;
my $delallowed=0;
my $sortkey=$role_code;
@@ -664,9 +660,6 @@ END
}
}
# Compute the background color based on $area
- $bgcol=$1.'_'.$2;
- $bgcol=~s/[^7-9a-e]//g;
- $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6);
if ($area=~/^\/(\w+)\/(\d\w+)\/(\w+)/) {
$carea.='
Section: '.$3;
$sortkey.="\0$3";
@@ -706,9 +699,8 @@ END
$allowed=0;
}
}
- $bgcol='77FF77';
my $row = '';
- $row.='
';
+ $row.= ' | ';
my $active=1;
$active=0 if (($role_end_time) && ($now>$role_end_time));
if (($active) && ($allowed)) {
@@ -745,7 +737,7 @@ END
: ' ' ).
' | '.($role_end_time ?localtime($role_end_time)
: ' ' )
- ." |
\n";
+ ."";
$sortrole{$sortkey}=$envkey;
$roletext{$envkey}=$row;
$roleclass{$envkey}=$class;
@@ -758,30 +750,35 @@ END
$output{$type} = '';
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
if ( ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/ ) && ($rolepriv{$sortrole{$which}}) ) {
- $output{$type}.=$roletext{$sortrole{$which}};
+ $output{$type}.=
+ &Apache::loncommon::start_data_table_row().
+ $roletext{$sortrole{$which}}.
+ &Apache::loncommon::end_data_table_row();
}
}
unless($output{$type} eq '') {
- $output{$type} = "".
- "".&mt($type)." | ".
+ $output{$type} = '
'.
+ "".&mt($type)." |
".
$output{$type};
$rolesdisplay = 1;
}
}
if ($rolesdisplay == 1) {
- $r->print(<print('
-$lt{'rer'}
-
-$lt{'rev'} | $lt{'ren'} | $lt{'del'} | $lt{'rol'} | $lt{'e
-xt'} | $lt{'sta'} | $lt{'end'} |
-END
+'.$lt{'rer'}.'
'.
+&Apache::loncommon::start_data_table("LC_createuser").
+&Apache::loncommon::start_data_table_header_row().
+''.$lt{'rev'}.' | '.$lt{'ren'}.' | '.$lt{'del'}.
+' | '.$lt{'rol'}.' | '.$lt{'ext'}.
+' | '.$lt{'sta'}.' | '.$lt{'end'}.' | '.
+&Apache::loncommon::end_data_table_header_row());
foreach my $type ('Construction Space','Course','Group','Domain','System','Unknown') {
if ($output{$type}) {
$r->print($output{$type}."\n");
}
}
- $r->print('
---|
');
+ $r->print(&Apache::loncommon::end_data_table());
}
} # End of unless
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
@@ -1029,7 +1026,8 @@ sub update_user_data {
$r->print($error.&mt('No login name specified').'.'.$end);
return;
}
- if ( $env{'form.ccuname'} =~/\W/) {
+ if ( $env{'form.ccuname'} ne
+ &LONCAPA::clean_username($env{'form.ccuname'}) ) {
$r->print($error.&mt('Invalid login name').'. '.
&mt('Only letters, numbers, and underscores are valid').'.'.
$end);
@@ -1039,9 +1037,10 @@ sub update_user_data {
$r->print($error.&mt('No domain specified').'.'.$end);
return;
}
- if ( $env{'form.ccdomain'} =~/\W/) {
+ if ( $env{'form.ccdomain'} ne
+ &LONCAPA::clean_domain($env{'form.ccdomain'}) ) {
$r->print($error.&mt ('Invalid domain name').'. '.
- &mt('Only letters, numbers, and underscores are valid').'.'.
+ &mt('Only letters, numbers, periods, dashes, and underscores are valid').'.'.
$end);
return;
}
@@ -1774,8 +1773,9 @@ sub course_level_table {
if (%sections_count) {
my $currsec = &course_sections(\%sections_count,$protectedcourse.'_'.$role);
$table .=
- ''.
- ''.$lt{'exs'}.' '.
+ ' | '.
+ '
+ '.$lt{'exs'}.' '.
$currsec.' | '.
' | '.
' '.$lt{'new'}.' '.
| | |