--- loncom/interface/lonuserutils.pm 2009/02/19 11:07:20 1.82
+++ loncom/interface/lonuserutils.pm 2010/01/14 18:15:31 1.112
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.82 2009/02/19 11:07:20 weissno Exp $
+# $Id: lonuserutils.pm,v 1.112 2010/01/14 18:15:31 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -86,12 +86,12 @@ sub modifystudent {
sub modifyuserrole {
my ($context,$setting,$changeauth,$cid,$udom,$uname,$uid,$umode,$upass,
$first,$middle,$last,$gene,$sec,$forceid,$desiredhome,$email,$role,
- $end,$start,$checkid) = @_;
+ $end,$start,$checkid,$inststatus) = @_;
my ($scope,$userresult,$authresult,$roleresult,$idresult);
if ($setting eq 'course' || $context eq 'course') {
$scope = '/'.$cid;
$scope =~ s/\_/\//g;
- if ($role ne 'cc' && $sec ne '') {
+ if (($role ne 'cc') && ($role ne 'co') && ($sec ne '')) {
$scope .='/'.$sec;
}
} elsif ($context eq 'domain') {
@@ -124,7 +124,7 @@ sub modifyuserrole {
$userresult =
&Apache::lonnet::modifyuser($udom,$uname,$uid,$umode,$upass,$first,
$middle,$last,$gene,$forceid,$desiredhome,
- $email,$role,$start,$end);
+ $email,$inststatus);
if ($userresult eq 'ok') {
if ($role ne '') {
$role =~ s/_/\//g;
@@ -235,7 +235,7 @@ sub domain_roles_select {
# domain context
#
# Role types
- my @roletypes = ('domain','author','course');
+ my @roletypes = ('domain','author','course','community');
my %lt = &role_type_names();
#
# build up the menu information to be passed to
@@ -247,6 +247,10 @@ 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'};
@@ -261,7 +265,7 @@ sub domain_roles_select {
@roles = &construction_space_roles();
} else {
my $custom = 1;
- @roles = &course_roles('domain',undef,$custom);
+ @roles = &course_roles('domain',undef,$custom,$roletype);
}
my $order = ['Any',@roles];
$select_menus{$roletype}->{'order'} = $order;
@@ -271,14 +275,15 @@ sub domain_roles_select {
&mt('Custom role');
} else {
$select_menus{$roletype}->{'select2'}->{$role} =
- &Apache::lonnet::plaintext($role);
+ &Apache::lonnet::plaintext($role,$crstype);
}
}
$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']);
+ 'roletype','showrole',\%select_menus,
+ ['domain','author','course','community']);
return $result;
}
@@ -290,7 +295,7 @@ sub hidden_input {
}
sub print_upload_manager_header {
- my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission)=@_;
+ my ($r,$datatoken,$distotal,$krbdefdom,$context,$permission,$crstype)=@_;
my $javascript;
#
if (! exists($env{'form.upfile_associate'})) {
@@ -327,10 +332,12 @@ sub print_upload_manager_header {
my $javascript_validations =
&javascript_validations('upload',$krbdefdom,$password_choice,undef,
$env{'request.role.domain'},$context,
- $groupslist);
- my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');
- $r->print(&mt('Total number of records found in file: [_1]',''.$distotal.'').
- "
\n");
+ $groupslist,$crstype);
+ my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
+ $r->print('
' + .&mt('Total number of records found in file: [_1]' + ,''.$distotal.'') + ."
\n"); $r->print('