--- loncom/interface/lonuserutils.pm 2010/11/14 21:19:08 1.97.2.22
+++ loncom/interface/lonuserutils.pm 2009/09/12 17:06:16 1.100
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.97.2.22 2010/11/14 21:19:08 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.100 2009/09/12 17:06:16 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);
@@ -92,7 +91,7 @@ sub modifyuserrole {
if ($setting eq 'course' || $context eq 'course') {
$scope = '/'.$cid;
$scope =~ s/\_/\//g;
- if (($role ne 'cc') && ($role ne 'co') && ($sec ne '')) {
+ if ($role ne 'cc' && $sec ne '') {
$scope .='/'.$sec;
}
} elsif ($context eq 'domain') {
@@ -236,7 +235,7 @@ sub domain_roles_select {
# domain context
#
# Role types
- my @roletypes = ('domain','author','course','community');
+ my @roletypes = ('domain','author','course');
my %lt = &role_type_names();
#
# build up the menu information to be passed to
@@ -248,10 +247,6 @@ sub domain_roles_select {
foreach my $roletype (@roletypes) {
# set up the text for this domain
$select_menus{$roletype}->{'text'}= $lt{$roletype};
- my $crstype;
- if ($roletype eq 'community') {
- $crstype = 'Community';
- }
# we want a choice of 'default' as the default in the second menu
if ($env{'form.roletype'} ne '') {
$select_menus{$roletype}->{'default'} = $env{'form.showrole'};
@@ -266,7 +261,7 @@ sub domain_roles_select {
@roles = &construction_space_roles();
} else {
my $custom = 1;
- @roles = &course_roles('domain',undef,$custom,$roletype);
+ @roles = &course_roles('domain',undef,$custom);
}
my $order = ['Any',@roles];
$select_menus{$roletype}->{'order'} = $order;
@@ -276,15 +271,14 @@ sub domain_roles_select {
&mt('Custom role');
} else {
$select_menus{$roletype}->{'select2'}->{$role} =
- &Apache::lonnet::plaintext($role,$crstype);
+ &Apache::lonnet::plaintext($role);
}
}
$select_menus{$roletype}->{'select2'}->{'Any'} = &mt('Any');
}
my $result = &Apache::loncommon::linked_select_forms
('studentform',(' 'x3).&mt('Role: '),$env{'form.roletype'},
- 'roletype','showrole',\%select_menus,
- ['domain','author','course','community']);
+ 'roletype','showrole',\%select_menus,['domain','author','course']);
return $result;
}
@@ -296,8 +290,7 @@ sub hidden_input {
}
sub print_upload_manager_header {
- my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission,$crstype,
- $can_assign)=@_;
+ my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission)=@_;
my $javascript;
#
if (! exists($env{'form.upfile_associate'})) {
@@ -311,9 +304,9 @@ sub print_upload_manager_header {
}
}
if ($env{'form.upfile_associate'} eq 'reverse') {
- $javascript=&upload_manager_javascript_reverse_associate($can_assign);
+ $javascript=&upload_manager_javascript_reverse_associate();
} else {
- $javascript=&upload_manager_javascript_forward_associate($can_assign);
+ $javascript=&upload_manager_javascript_forward_associate();
}
#
# Deal with restored settings
@@ -334,7 +327,7 @@ sub print_upload_manager_header {
my $javascript_validations =
&javascript_validations('upload',$krbdefdom,$password_choice,undef,
$env{'request.role.domain'},$context,
- $groupslist,$crstype);
+ $groupslist);
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
$r->print('
'
.&mt('Total number of records found in file: [_1]'
@@ -367,7 +360,7 @@ sub print_upload_manager_header {
###############################################################
sub javascript_validations {
my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain,
- $context,$groupslist,$crstype)=@_;
+ $context,$groupslist)=@_;
my %param = (
kerb_def_dom => $krbdefdom,
curr_authtype => $curr_authtype,
@@ -388,10 +381,10 @@ 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'}.');';
$setsections_js =
&setsections_javascript($param{'formname'},$groupslist,
- $mode,'',$crstype);
+ $mode);
} else {
$setsection_call = "'ok'";
}
@@ -534,7 +527,6 @@ END
if (message!='') {
message+='\\n';
}
- message+='$alert{'section'}';
}
if (foundemail==0) {
if (message!='') {
@@ -588,46 +580,6 @@ END
###############################################################
###############################################################
sub upload_manager_javascript_forward_associate {
- my ($can_assign) = @_;
- my ($auth_update,$numbuttons,$argreset);
- if (ref($can_assign) eq 'HASH') {
- if ($can_assign->{'krb4'} || $can_assign->{'krb5'}) {
- $argreset .= " vf.krbarg.value='';\n";
- $numbuttons ++ ;
- }
- if ($can_assign->{'int'}) {
- $argreset .= " vf.intarg.value='';\n";
- $numbuttons ++;
- }
- if ($can_assign->{'loc'}) {
- $argreset .= " vf.locarg.value='';\n";
- $numbuttons ++;
- }
- if (!$can_assign->{'int'}) {
- my $warning = &mt('You may not specify an initial password for each user, as this is only available when new users use LON-CAPA internal authentication.\n').
- &mt('Your current role does not have rights to create users with that authentication type.');
- $auth_update = <<"END";
- // Currently the initial password field is only supported for internal auth
- // (see bug 6368).
- if (nw==9) {
- eval('vf.f'+tf+'.selectedIndex=0;')
- alert('$warning');
- }
-END
- } elsif ($numbuttons > 1) {
- $auth_update = <<"END";
- // If we set the password, make the password form below correspond to
- // the new value.
- if (nw==9) {
- changed_radio('int',document.studentform);
- set_auth_radio_buttons('int',document.studentform);
-$argreset
- }
-
-END
- }
- }
-
return(<{'krb4'} || $can_assign->{'krb5'}) {
- $argreset .= " vf.krbarg.value='';\n";
- $numbuttons ++ ;
- }
- if ($can_assign->{'int'}) {
- $argreset .= " vf.intarg.value='';\n";
- $numbuttons ++;
- }
- if ($can_assign->{'loc'}) {
- $argreset .= " vf.locarg.value='';\n";
- $numbuttons ++;
- }
- if (!$can_assign->{'int'}) {
- my $warning = &mt('You may not specify an initial password, as this is only available when new users use LON-CAPA internal authentication.\n').
- &mt('Your current role does not have rights to create users with that authentication type.');
- $auth_update = <<"END";
- // Currently the initial password field is only supported for internal auth
- // (see bug 6368).
- if (tf==8 && nw!=0) {
- eval('vf.f'+tf+'.selectedIndex=0;')
- alert('$warning');
- }
-END
- } elsif ($numbuttons > 1) {
- $auth_update = <<"END";
- // initial password specified, pick internal authentication
- if (tf==8 && nw!=0) {
- changed_radio('int',document.studentform);
- set_auth_radio_buttons('int',document.studentform);
-$argreset
- }
-
-END
- }
- }
-
return(<';
$Str .= &hidden_input('nfields',$i);
@@ -907,7 +825,7 @@ sub print_upload_manager_footer {
.' '.&mt('Add a domain role').''
.' '
+ .' '.&mt('Add a course role').''
.'';
} elsif ($context eq 'author') {
$Str .= &Apache::lonhtmlcommon::row_title(
@@ -942,26 +860,15 @@ sub print_upload_manager_footer {
my ($cnum,$cdom) = &get_course_identity();
my $rowtitle = &mt('section');
my $secbox = §ion_picker($cdom,$cnum,'Any',$rowtitle,
- $permission,$context,'upload',$crstype);
+ $permission,$context,'upload');
$Str .= $secbox
.&Apache::lonhtmlcommon::row_closure();
- my %lt;
- if ($crstype eq 'Community') {
- %lt = &Apache::lonlocal::texthash (
- disp => 'Display members with current/future access who are not in the uploaded file',
- stus => 'Members selected from this list can be dropped.'
- );
- } else {
- %lt = &Apache::lonlocal::texthash (
- disp => 'Display students with current/future access who are not in the uploaded file',
- stus => 'Students selected from this list can be dropped.'
- );
- }
+
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Full Update'))
- .'
\n");
}
my ($indexhash,$keylist) = &make_keylist_array();
- my (%userlist,%userinfo,$clearcoursepick);
- if (($context eq 'domain') &&
- ($env{'form.roletype'} eq 'course') ||
- ($env{'form.roletype'} eq 'community')) {
- my ($crstype,$numcodes,$title,$warning);
- if ($env{'form.roletype'} eq 'course') {
- $crstype = 'Course';
- $numcodes = $totcodes;
- $title = &mt('Select Courses');
- $warning = &mt('Warning: data retrieval for multiple courses can take considerable time, as this operation is not currently optimized.');
- } elsif ($env{'form.roletype'} eq 'community') {
- $crstype = 'Community';
- $numcodes = 0;
- $title = &mt('Select Communities');
- $warning = &mt('Warning: data retrieval for multiple communities can take considerable time, as this operation is not currently optimized.');
- }
+ my (%userlist,%userinfo);
+ if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
my $courseform =
- &Apache::lonhtmlcommon::course_selection($formname,$numcodes,
- $codetitles,$idlist,$idlist_titles,$crstype);
+ &Apache::lonhtmlcommon::course_selection($formname,$totcodes,
+ $codetitles,$idlist,$idlist_titles);
$r->print('
'.&mt('Warning: data retrieval for multiple courses can take considerable time, as this operation is not currently optimized.').''."\n");
+ if ($env{'form.coursepick'}) {
$r->print(''.&mt('Searching').' ...
');
}
} else {
@@ -1640,9 +1499,8 @@ sub print_userlist {
}
}
}
- } elsif (($env{'form.roletype'} eq 'course') ||
- ($env{'form.roletype'} eq 'community')) {
- if (($env{'form.coursepick'}) && (!$clearcoursepick)) {
+ } elsif ($env{'form.roletype'} eq 'course') {
+ if ($env{'form.coursepick'}) {
my %courses = &process_coursepick();
my %allusers;
my $hidepriv = 1;
@@ -1653,8 +1511,7 @@ sub print_userlist {
my (@roles,@sections,%access,%users,%userdata,
%statushash);
if ($env{'form.showrole'} eq 'Any') {
- @roles = &course_roles($context,undef,$custom,
- $env{'form.roletype'});
+ @roles = &course_roles($context,undef,$custom);
} else {
@roles = ($env{'form.showrole'});
}
@@ -1700,8 +1557,6 @@ sub print_userlist {
$r->print(&mt('There are no authors or co-authors to display.')."\n");
} elsif ($env{'form.roletype'} eq 'course') {
$r->print(&mt('There are no course users to display')."\n");
- } elsif ($env{'form.roletype'} eq 'community') {
- $r->print(&mt('There are no community users to display')."\n");
}
} elsif ($context eq 'course') {
$r->print(&mt('There are no course users to display.')."\n");
@@ -1744,16 +1599,7 @@ sub role_filter {
$role_select = '