--- loncom/interface/loncommon.pm 2007/11/09 23:05:47 1.611
+++ loncom/interface/loncommon.pm 2007/12/01 03:42:47 1.617
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.611 2007/11/09 23:05:47 albertel Exp $
+# $Id: loncommon.pm,v 1.617 2007/12/01 03:42:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4834,6 +4834,7 @@ table.LC_descriptive_input td.LC_descrip
font-weight: bold;
}
div.LC_feedback_link {
+ clear: both;
background: white;
width: 100%;
}
@@ -5097,13 +5098,22 @@ span.LC_grade_check_note {
right: 1em;
}
+table.LC_scantron_action {
+ width: 100%;
+}
+table.LC_scantron_action tr th {
+ font: normal bold $sans;
+}
-div.LC_edit_problem_header {
+div.LC_edit_problem_header,
+div.LC_edit_problem_footer {
font: normal medium $sans;
margin: 2px;
}
div.LC_edit_problem_header,
div.LC_edit_problem_header div,
+div.LC_edit_problem_footer,
+div.LC_edit_problem_footer div,
div.LC_edit_problem_editxml_header,
div.LC_edit_problem_editxml_header div {
margin-top: 5px;
@@ -5851,7 +5861,6 @@ sub get_course_users {
my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist($cdom,$cnum);
my $now = time;
foreach my $student (keys(%{$classlist})) {
- my $status;
my $match = 0;
my $secmatch = 0;
my $section = $$classlist{$student}[$idx{section}];
@@ -6430,57 +6439,143 @@ END_BLOCK
return $output;
}
-sub username_rule_check {
- my ($srch,$caller) = @_;
- my ($response,@curr_rules,%inst_results,$rulematch);
- my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($srch->{'srchdomain'});
- if (ref($srch) eq 'HASH') {
- (my $inst_response,%inst_results) =
- &Apache::lonnet::get_instuser($srch->{'srchdomain'},
- $srch->{'srchterm'});
- my %domconfig = &Apache::lonnet::get_dom('configuration',
- ['usercreation'],$srch->{'srchdomain'});
- if (ref($domconfig{'usercreation'}) eq 'HASH') {
- if (ref($domconfig{'usercreation'}{'username_rule'}) eq 'ARRAY') {
- @curr_rules = @{$domconfig{'usercreation'}{'username_rule'}};
- }
- }
- if (@curr_rules > 0) {
- my $domdesc = &Apache::lonnet::domain($srch->{'srchdomain'},'description');
- my $instuser_reqd;
- my %rule_check = &Apache::lonnet::inst_rulecheck($srch->{'srchdomain'},$srch->{'srchterm'},\@curr_rules);
- foreach my $rule (@curr_rules) {
- if ($rule_check{$rule}) {
- $rulematch = $rule;
- if ($inst_response eq 'ok') {
- if (keys(%inst_results) == 0) {
- if ($caller eq 'new') {
- $response = &mt('The username you chose matches the format of usernames defined for [_1], but the user does not exist in the institutional directory.',$domdesc).'
'.&mt("You must choose a username with a different format -- one that will not conflict with 'official' institutional usernames.");
- }
+sub user_rule_check {
+ my ($usershash,$checks,$alerts,$rulematch,$inst_results,$curr_rules,$got_rules) = @_;
+ my $response;
+ if (ref($usershash) eq 'HASH') {
+ foreach my $user (keys(%{$usershash})) {
+ my ($uname,$udom) = split(/:/,$user);
+ next if ($udom eq '' || $uname eq '');
+ my ($id,$newuser);
+ if (ref($usershash->{$user}) eq 'HASH') {
+ $newuser = $usershash->{$user}->{'newuser'};
+ $id = $usershash->{$user}->{'id'};
+ }
+ my $inst_response;
+ if (ref($checks) eq 'HASH') {
+ if (defined($checks->{'username'})) {
+ ($inst_response,%{$inst_results->{$user}}) =
+ &Apache::lonnet::get_instuser($udom,$uname);
+ } elsif (defined($checks->{'id'})) {
+ ($inst_response,%{$inst_results->{$user}}) =
+ &Apache::lonnet::get_instuser($udom,undef,$id);
+ }
+ } else {
+ ($inst_response,%{$inst_results->{$user}}) =
+ &Apache::lonnet::get_instuser($udom,$uname);
+ return;
+ }
+ if (!$got_rules->{$udom}) {
+ my %domconfig = &Apache::lonnet::get_dom('configuration',
+ ['usercreation'],$udom);
+ if (ref($domconfig{'usercreation'}) eq 'HASH') {
+ foreach my $item ('username','id') {
+ if (ref($domconfig{'usercreation'}{$item.'_rule'}) eq 'ARRAY') {
+ $$curr_rules{$udom}{$item} =
+ $domconfig{'usercreation'}{$item.'_rule'};
}
}
- last;
}
+ $got_rules->{$udom} = 1;
}
- if ($response) {
- if ((ref($rules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) {
- if (@{$ruleorder} > 0) {
- $response .= '
'.&mt('Usernames with the following format(s) may only be used for verified users at [_1]:',$domdesc).'