--- loncom/interface/lonuserutils.pm 2010/11/01 13:46:36 1.97.2.19
+++ loncom/interface/lonuserutils.pm 2009/11/18 21:32:41 1.105
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.97.2.19 2010/11/01 13:46:36 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.105 2009/11/18 21:32:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,8 +47,7 @@ sub modifystudent {
# this one. If $csec is defined, drop them from all other sections of
# this course and add them to section $csec
my ($cnum,$cdom) = &get_course_identity($courseid);
- my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});
- my %roles = &Apache::lonnet::dump('roles',$udom,$unam,'.',undef,$extra);
+ my %roles = &Apache::lonnet::dump('roles',$udom,$unam);
my ($tmp) = keys(%roles);
# Bail out if we were unable to get the students roles
return "$1" if ($tmp =~ /^(con_lost|error|no_such_host)/i);
@@ -387,7 +386,7 @@ sub javascript_validations {
if (($context eq 'course') || ($context eq 'domain')) {
if ($context eq 'course') {
if ($env{'request.course.sec'} eq '') {
- $setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');';
+ $setsection_call = 'setSections(document.'.$param{'formname'}."'$crstype'".');';
$setsections_js =
&setsections_javascript($param{'formname'},$groupslist,
$mode,'',$crstype);
@@ -1447,19 +1446,14 @@ sub print_userlist {
' ');
return;
}
- if (!(($context eq 'domain') &&
- (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) {
- $r->print(
- "\n
\n"
- .''
- .&list_submit_button(&mt('Update Display'))
- ."
\n"
- );
+ if (!(($context eq 'domain') && ($env{'form.roletype'} eq 'course'))) {
+ $r->print(' '.&list_submit_button(&mt('Update Display')).
+ "\n\n");
}
my ($indexhash,$keylist) = &make_keylist_array();
- my (%userlist,%userinfo,$clearcoursepick);
+ my (%userlist,%userinfo);
if (($context eq 'domain') &&
- ($env{'form.roletype'} eq 'course') ||
+ ($env{'form.roletype'} eq 'course') ||
($env{'form.roletype'} eq 'community')) {
my ($crstype,$numcodes,$title,$warning);
if ($env{'form.roletype'} eq 'course') {
@@ -1482,15 +1476,9 @@ sub print_userlist {
$courseform."\n".
&Apache::lonhtmlcommon::row_closure(1).
&Apache::lonhtmlcommon::end_pick_box().''.
- ' '.
- &list_submit_button(&mt('Update Display')).
+ '
'.&list_submit_button(&mt('Update Display')).
"\n".'
'.$warning.' '."\n");
- $clearcoursepick = 0;
- if (($env{'form.origroletype'} ne '') &&
- ($env{'form.origroletype'} ne $env{'form.roletype'})) {
- $clearcoursepick = 1;
- }
- if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
+ if ($env{'form.coursepick'}) {
$r->print(' '.&mt('Searching').' ... ');
}
} else {
@@ -1565,7 +1553,7 @@ sub print_userlist {
}
} elsif (($env{'form.roletype'} eq 'course') ||
($env{'form.roletype'} eq 'community')) {
- if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
+ if ($env{'form.coursepick'}) {
my %courses = &process_coursepick();
my %allusers;
my $hidepriv = 1;
@@ -1733,7 +1721,7 @@ sub section_group_filter {
}
if (@options > 0) {
my $currsel;
- $markup = ''."\n";
+ $markup = ' '."\n";
foreach my $option ('all','none',@options) {
$currsel = '';
if ($env{'form.'.$name{$item}} eq $option) {
@@ -1748,9 +1736,7 @@ sub section_group_filter {
$markup .= ''."\n";
}
$markup .= ' '."\n";
- $output .= (' 'x3).''
- .''.$title{$item}.': '.$markup.' '
- .' ';
+ $output .= (' 'x3).''.$title{$item}.': '.$markup.' ';
}
}
return $output;
@@ -2278,7 +2264,7 @@ END
push(@cols,'section');
}
if (!($context eq 'domain' && ($env{'form.roletype'} eq 'course')
- && ($env{'form.roletype'} eq 'community'))) {
+ && ($env{'form.roletype'} eq 'community'))) {
push(@cols,('start','end'));
}
if ($env{'form.showrole'} eq 'Any' || $env{'form.showrole'} eq 'cr') {
@@ -2289,7 +2275,7 @@ END
$env{'form.roletype'} eq 'community')) {
push (@cols,'extent');
}
- if (($statusmode eq 'Any') &&
+ if (($statusmode eq 'Any') &&
(!($context eq 'domain' && (($env{'form.roletype'} eq 'course')
|| ($env{'form.roletype'} eq 'community'))))) {
push(@cols,'status');
@@ -2310,7 +2296,6 @@ END
if ($mode ne 'autoenroll') {
$results_description = &results_header_row($rolefilter,$statusmode,
$context,$permission,$mode,$crstype);
-
$r->print(''.$results_description.' ');
}
my ($output,$actionselect,%canchange,%canchangesec);
@@ -2332,7 +2317,7 @@ END
END
if ($actionselect) {
$output .= <<"END";
-$lt{'ac'}
+
$lt{'ac'}
$actionselect
@@ -2377,7 +2362,7 @@ END
}
}
}
- $output .= '';
}
$output .= "\n".''."\n".
&Apache::loncommon::start_data_table().
@@ -2469,13 +2455,9 @@ END
time.'_'.rand(1000000000).'.csv';
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {
$r->log_error("Couldn't open $CSVfilename for output $!");
- $r->print(
- ''
- .&mt('Problems occurred in writing the CSV file.')
- .' '.&mt('This error has been logged.')
- .' '.&mt('Please alert your LON-CAPA administrator.')
- .'
'
- );
+ $r->print(&mt('Problems occurred in writing the CSV file. '
+ .'This error has been logged. '
+ .'Please alert your LON-CAPA administrator.'));
$CSVfile = undef;
}
#
@@ -2657,7 +2639,7 @@ END
if ($clickers!~/\w/) { $clickers='-'; }
$in{'clicker'} = $clickers;
my $role = $in{'role'};
- $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype);
+ $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype);
if (! defined($in{'start'}) || $in{'start'} == 0) {
$in{'start'} = &mt('none');
} else {
@@ -2944,7 +2926,7 @@ sub print_username_link {
$output = $in->{'username'};
} else {
$output = '{'username'}','$in->{'domain'}'".')">'.
+ "'$in->{'username'}','$in->{'domain'}'".')" />'.
$in->{'username'}.' ';
}
return $output;
@@ -3174,8 +3156,8 @@ ENDJS
my %lt = &Apache::lonlocal::texthash (
chac => 'Access dates to apply for selected users',
chse => 'Changes in section affiliation to apply to selected users',
- fors => 'For student roles, changing the section will result in a section switch as students may only be in one section of a course at a time.',
- forn => 'For a course role that is not "student", users may have roles in more than one section at a time.',
+ fors => 'For student roles changing the section, will result in a section switch as students may only be in one section of a course at a time.',
+ forn => 'For a role in a course that is not a student role, a user may have roles in more than one section of a course at a time.',
reta => "Retain each user's current section affiliations?",
dnap => '(Does not apply to student roles).',
);
@@ -3194,13 +3176,14 @@ ENDJS
$permission,$crstype);
}
$output .= ''.$headertext.' '.
- '