--- loncom/interface/loncommon.pm 2007/11/10 03:51:46 1.612 +++ loncom/interface/loncommon.pm 2007/11/18 21:19:16 1.616 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.612 2007/11/10 03:51:46 raeburn Exp $ +# $Id: loncommon.pm,v 1.616 2007/11/18 21:19:16 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; @@ -6431,60 +6441,64 @@ END_BLOCK } sub user_rule_check { - my ($usershash,$checks,$alerts,$rulematch,$inst_results,$curr_rules) = @_; + my ($usershash,$checks,$alerts,$rulematch,$inst_results,$curr_rules,$got_rules) = @_; my $response; if (ref($usershash) eq 'HASH') { - my %got_rules; foreach my $user (keys(%{$usershash})) { my ($uname,$udom) = split(/:/,$user); next if ($udom eq '' || $uname eq ''); - my ($userstatus,$id); + my ($id,$newuser); if (ref($usershash->{$user}) eq 'HASH') { - $userstatus = $usershash->{$user}->{'status'}; + $newuser = $usershash->{$user}->{'newuser'}; $id = $usershash->{$user}->{'id'}; } my $inst_response; if (ref($checks) eq 'HASH') { if (defined($checks->{'username'})) { - ($inst_response,%{$inst_results}) = + ($inst_response,%{$inst_results->{$user}}) = &Apache::lonnet::get_instuser($udom,$uname); } elsif (defined($checks->{'id'})) { - ($inst_response,%{$inst_results}) = + ($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}) { + if (!$got_rules->{$udom}) { my %domconfig = &Apache::lonnet::get_dom('configuration', ['usercreation'],$udom); if (ref($domconfig{'usercreation'}) eq 'HASH') { - foreach my $item (keys(%{$checks})) { + foreach my $item ('username','id') { if (ref($domconfig{'usercreation'}{$item.'_rule'}) eq 'ARRAY') { $$curr_rules{$udom}{$item} = $domconfig{'usercreation'}{$item.'_rule'}; } } } - $got_rules{$udom} = 1; + $got_rules->{$udom} = 1; } foreach my $item (keys(%{$checks})) { if (ref($$curr_rules{$udom}) eq 'HASH') { if (ref($$curr_rules{$udom}{$item}) eq 'ARRAY') { if (@{$$curr_rules{$udom}{$item}} > 0) { - my %rule_check; my %rule_check = &Apache::lonnet::inst_rulecheck($udom,$uname,$id,$item,$$curr_rules{$udom}{$item}); foreach my $rule (@{$$curr_rules{$udom}{$item}}) { if ($rule_check{$rule}) { $$rulematch{$user}{$item} = $rule; if ($inst_response eq 'ok') { - if (keys(%{$inst_results}) == 0) { - if ($userstatus eq 'new') { - $$alerts{$user}{$item} = 1; + if (ref($inst_results) eq 'HASH') { + if (ref($inst_results->{$user}) eq 'HASH') { + if (keys(%{$inst_results->{$user}}) == 0) { + $$alerts{$item}{$udom}{$uname} = 1; + } } } - } + } + last; } } - last; } } } @@ -6522,7 +6536,7 @@ sub user_rule_formats { } sub instrule_disallow_msg { - my ($checkitem,$domdesc,$count) = @_; + my ($checkitem,$domdesc,$count,$mode) = @_; my $response; my %text = ( item => 'username', @@ -6543,12 +6557,24 @@ sub instrule_disallow_msg { $text{'items'} = 'IDs'; $text{'item'} = 'ID'; $text{'action'} = 'an ID'; + if ($count > 1) { + $text{'item'} = 'IDs'; + $text{'action'} = 'IDs'; + } } $response = &mt("The $text{'item'} you chose $text{'match'} the format of $text{'items'} defined for [_1], but the $text{'item'} $text{'do'} not exist in the institutional directory.",$domdesc).'
'; - if ($checkitem eq 'username') { - $response .= &mt("You must choose $text{'action'} with a different format -- $text{'one'} that will not conflict with 'official' institutional $text{'items'}."); - } elsif ($checkitem eq 'id') { - $response .= &mt("You must either choose $text{'action'} with a different format -- $text{'one'} that will not conflict with 'official' institutional $text{'items'}, or leave this field blank."); + if ($mode eq 'upload') { + if ($checkitem eq 'username') { + $response .= &mt("You will need to modify your upload file so it will include $text{'action'} with a different format -- $text{'one'} that will not conflict with 'official' institutional $text{'items'}."); + } elsif ($checkitem eq 'id') { + $response .= &mt("Either upload a file which includes $text{'action'} with a different format -- $text{'one'} that will not conflict with 'official' institutional $text{'items'}, or when associating fields with data columns, omit an association for the ID/Student Number field."); + } + } else { + if ($checkitem eq 'username') { + $response .= &mt("You must choose $text{'action'} with a different format -- $text{'one'} that will not conflict with 'official' institutional $text{'items'}."); + } elsif ($checkitem eq 'id') { + $response .= &mt("You must either choose $text{'action'} with a different format -- $text{'one'} that will not conflict with 'official' institutional $text{'items'}, or leave the ID field blank."); + } } return $response; }