--- loncom/interface/lonuserutils.pm 2013/09/26 17:46:42 1.156
+++ loncom/interface/lonuserutils.pm 2014/02/16 15:38:53 1.163
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.156 2013/09/26 17:46:42 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.163 2014/02/16 15:38:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -401,7 +401,7 @@ sub javascript_validations {
my $showcredits;
my %domdefaults = &Apache::lonnet::get_domain_defaults($domain);
- if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+ if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
$showcredits = 1;
}
@@ -1013,7 +1013,9 @@ sub print_upload_manager_footer {
.&Apache::lonhtmlcommon::row_closure();
}
if ($context eq 'course' || $context eq 'domain') {
- $Str .= &forceid_change($context);
+ $Str .= &Apache::lonhtmlcommon::row_title(&mt('Student/Employee ID'))
+ .&forceid_change($context)
+ .&Apache::lonhtmlcommon::row_closure(1); # last row in pick_box
}
$Str .= &Apache::lonhtmlcommon::end_pick_box();
@@ -1047,10 +1049,12 @@ sub get_defaultcredits {
return unless(($cdom =~ /^$match_domain$/) && ($cnum =~ /^$match_courseid$/));
my ($defaultcredits,$domdefcredits);
my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom);
- if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+ if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
my $instcode = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'};
if ($instcode) {
$domdefcredits = $domdefaults{'officialcredits'};
+ } elsif ($env{'course.'.$cdom.'_'.$cnum.'.internal.textbook'}) {
+ $domdefcredits = $domdefaults{'textbookcredits'};
} else {
$domdefcredits = $domdefaults{'unofficialcredits'};
}
@@ -1076,18 +1080,15 @@ sub get_defaultcredits {
sub forceid_change {
my ($context) = @_;
my $output =
- &Apache::lonhtmlcommon::row_title(&mt('Student/Employee ID'))
- .'
'."\n"
- .&mt('(only do if you know what you are doing.)')."\n";
+ ''.&Apache::loncommon::help_open_topic('ForceIDChange')."\n";
if ($context eq 'domain') {
- $output .= '
'."\n";
+ $output .=
+ '
'
+ .''."\n";
}
- $output .= &Apache::lonhtmlcommon::row_closure(1); # last row in pick_box
return $output;
}
@@ -1392,9 +1393,9 @@ sub default_role_selector {
&default_course_roles($context,$checkpriv,'Course',%customroles)."\n".
'
'.
''.
- ''.
+ ' | '.
$lt{'exs'}.'
| '.
' | '.
''.$lt{'new'}.' '.
@@ -1637,7 +1638,7 @@ sub print_userlist {
return;
}
my ($indexhash,$keylist) = &make_keylist_array();
- my (%userlist,%userinfo,$clearcoursepick);
+ my (%userlist,%userinfo,$clearcoursepick,$needauthorquota,$needauthorusage);
if (($context eq 'domain') &&
($env{'form.roletype'} eq 'course') ||
($env{'form.roletype'} eq 'community')) {
@@ -1709,6 +1710,12 @@ sub print_userlist {
\%cstr_roles,$permission);
} elsif ($context eq 'domain') {
if ($env{'form.roletype'} eq 'domain') {
+ if (grep(/^authorusage$/,@cols)) {
+ $needauthorusage = 1;
+ }
+ if (grep(/^authorquota$/,@cols)) {
+ $needauthorquota = 1;
+ }
%dom_roles = &Apache::lonnet::get_domain_roles($env{'request.role.domain'});
foreach my $key (keys(%dom_roles)) {
if (ref($dom_roles{$key}) eq 'HASH') {
@@ -1821,7 +1828,7 @@ sub print_userlist {
} else {
($usercount) = &show_users_list($r,$context,$env{'form.output'},
$permission,$env{'form.Status'},\%userlist,
- $keylist,'',$showcredits);
+ $keylist,'',$showcredits,$needauthorquota,$needauthorusage);
}
if (!$usercount) {
$r->print(' '
@@ -1991,7 +1998,7 @@ sub get_cols_array {
push(@cols,'photo');
}
if ($context eq 'domain') {
- push (@cols,'extent');
+ push (@cols,('authorusage','authorquota','extent'));
}
}
return @cols;
@@ -2027,6 +2034,8 @@ sub column_checkboxes {
if (($env{'form.roletype'} eq 'course') ||
($env{'form.roletype'} eq 'community')) {
$disabledchk{'status'} = 1;
+ $disabledchk{'authorusage'} = 1;
+ $disabledchk{'authorquota'} = 1;
} elsif ($env{'form.roletype'} eq 'domain') {
$disabledchk{'extent'} = 1;
}
@@ -2078,7 +2087,11 @@ sub column_checkboxes {
if (($env{'form.roletype'} eq 'domain') || ($env{'form.roletype'} eq '')) {
$style = ' style="display: none;"';
}
- }
+ } elsif (($cols[$i] eq 'authorusage') || ($cols[$i] eq 'authorquota')) {
+ if ($env{'form.roletype'} ne 'domain') {
+ $style = ' style="display: none;"';
+ }
+ }
$output .= ' | |