--- loncom/interface/loncommon.pm 2007/11/09 23:05:47 1.611
+++ loncom/interface/loncommon.pm 2007/12/21 05:13:07 1.626
@@ -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.626 2007/12/21 05:13:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1942,6 +1942,11 @@ sub authform_kerberos {
if (defined($in{'curr_authtype'})) {
if ($in{'curr_authtype'} eq 'krb') {
$krbcheck = ' checked="on"';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $krbcheck = '';
+ }
+ }
if (defined($in{'curr_kerb_ver'})) {
if ($in{'curr_krb_ver'} eq '5') {
$check5 = ' checked="on"';
@@ -2039,6 +2044,11 @@ sub authform_internal{
if ($in{'curr_authtype'} eq 'int') {
if ($can_assign{'int'}) {
$intcheck = 'checked="on" ';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $intcheck = '';
+ }
+ }
if (defined($in{'curr_autharg'})) {
$intarg = $in{'curr_autharg'};
}
@@ -2073,6 +2083,7 @@ sub authform_internal{
$result = &mt
('[_1] Internally authenticated (with initial password [_2])',
''.$autharg);
+ $result.="';
return $result;
}
@@ -2088,6 +2099,11 @@ sub authform_local{
if ($in{'curr_authtype'} eq 'loc') {
if ($can_assign{'loc'}) {
$loccheck = 'checked="on" ';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $loccheck = '';
+ }
+ }
if (defined($in{'curr_autharg'})) {
$locarg = $in{'curr_autharg'};
}
@@ -2137,6 +2153,11 @@ sub authform_filesystem{
if ($in{'curr_authtype'} eq 'fsys') {
if ($can_assign{'fsys'}) {
$fsyscheck = 'checked="on" ';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $fsyscheck = '';
+ }
+ }
} else {
$result = &mt('Currently Filesystem Authenticated.');
return $result;
@@ -4834,6 +4855,7 @@ table.LC_descriptive_input td.LC_descrip
font-weight: bold;
}
div.LC_feedback_link {
+ clear: both;
background: white;
width: 100%;
}
@@ -5037,7 +5059,6 @@ div.LC_clear_float_footer {
div.LC_grade_select_mode {
- float: left;
font-family: $sans;
}
div.LC_grade_select_mode div div {
@@ -5097,13 +5118,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 +5881,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}];
@@ -6138,24 +6167,24 @@ sub default_quota {
my ($udom,$inststatus) = @_;
my ($defquota,$settingstatus);
my %quotahash = &Apache::lonnet::get_dom('configuration',
- ['quota'],$udom);
- if (ref($quotahash{'quota'}) eq 'HASH') {
+ ['quotas'],$udom);
+ if (ref($quotahash{'quotas'}) eq 'HASH') {
if ($inststatus ne '') {
my @statuses = split(/:/,$inststatus);
foreach my $item (@statuses) {
- if ($quotahash{'quota'}{$item} ne '') {
+ if ($quotahash{'quotas'}{$item} ne '') {
if ($defquota eq '') {
- $defquota = $quotahash{'quota'}{$item};
+ $defquota = $quotahash{'quotas'}{$item};
$settingstatus = $item;
- } elsif ($quotahash{'quota'}{$item} > $defquota) {
- $defquota = $quotahash{'quota'}{$item};
+ } elsif ($quotahash{'quotas'}{$item} > $defquota) {
+ $defquota = $quotahash{'quotas'}{$item};
$settingstatus = $item;
}
}
}
}
if ($defquota eq '') {
- $defquota = $quotahash{'quota'}{'default'};
+ $defquota = $quotahash{'quotas'}{'default'};
$settingstatus = 'default';
}
} else {
@@ -6214,7 +6243,7 @@ sub user_picker {
srchby => 'lastname',
);
my $srchterm;
- if (ref($srch) eq 'HASH') {
+ if ((ref($srch) eq 'HASH') && ($env{'form.origform'} ne 'crtusername')) {
if ($srch->{'srchby'} ne '') {
$curr_selected{'srchby'} = $srch->{'srchby'};
}
@@ -6430,57 +6459,156 @@ 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).'