');
+ if ($env{'form.action'} eq 'singlestudent') {
+ $r->print($lt{'ens'});
+ } else {
+ $r->print($lt{'cup'});
+ }
+ $r->print(' "'.$ccuname.'" '.$lt{'id'}.' "'.$ccdomain.'"'.
+ "\n".'
');
my ($personal_table,$showforceid) =
&personal_data_display($ccuname,$ccdomain,$newuser,$context,
$inst_results{$ccuname.':'.$ccdomain});
@@ -852,12 +880,21 @@ ENDNOPORTPRIV
if ($user_quota_text ne '') {
$r->print($user_quota_text);
}
- $r->print('
');
-
+ if ($env{'form.action'} eq 'singlestudent') {
+ $r->print(&date_sections_select($context,$newuser,$formname));
+ }
} elsif ($user_quota_text ne '') {
- $r->print('
'.$user_quota_text);
+ if ($env{'form.action'} eq 'singlestudent') {
+ $r->print(&date_sections_select($context,$newuser,$formname));
+ }
+ } else {
+ if ($env{'form.action'} eq 'singlestudent') {
+ $r->print('
'.
+ &date_sections_select($context,$newuser,$formname));
+ }
}
- $r->print('');
+ $r->print('
');
my %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname);
# Build up table of user roles to allow revocation of a role.
my ($tmp) = keys(%rolesdump);
@@ -1186,6 +1223,35 @@ ENDNOPORTPRIV
$r->print("".&Apache::loncommon::end_page());
}
+sub singleuser_breadcrumb {
+ my %breadcrumb_text;
+ if ($env{'form.action'} eq 'singlestudent') {
+ $breadcrumb_text{'search'} = 'Enroll a student';
+ $breadcrumb_text{'userpicked'} = 'Select a user',
+ $breadcrumb_text{'modify'} = 'Set section/dates',
+ } else {
+ $breadcrumb_text{'search'} = 'Create/modify user';
+ $breadcrumb_text{'userpicked'} = 'Select a user',
+ $breadcrumb_text{'modify'} = 'Set user role',
+ }
+ return %breadcrumb_text;
+}
+
+sub date_sections_select {
+ my ($context,$newuser,$formname,$permission) = @_;
+ my $cid = $env{'request.course.id'};
+ my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity($cid);
+ my $date_table = '
'.&mt('Starting and Ending Dates').'
'."\n".
+ &Apache::lonuserutils::date_setting_table(undef,undef,$context,
+ undef,$formname,$permission);
+ my $rowtitle = 'Section';
+ my $secbox = '
'.&mt('Section').'
'."\n".
+ &Apache::lonuserutils::section_picker($cdom,$cnum,'st',$rowtitle,
+ $permission);
+ my $output = $date_table.$secbox;
+ return $output;
+}
+
sub user_authentication {
my ($ccuname,$ccdomain,$krbdefdom,$abv_auth) = @_;
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
@@ -1459,20 +1525,20 @@ sub update_user_data {
} else {
$title='Modify User Privileges';
}
-
+ my $newuser = 0;
my ($jsback,$elements) = &crumb_utilities();
my $jscript = ''."\n";
-
+ my %breadcrumb_text = &singleuser_breadcrumb();
$r->print(&Apache::loncommon::start_page($title,$jscript));
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:backPage(document.userupdate)",
- text=>"Create/modify user",
+ text=>$breadcrumb_text{'search'},
faq=>282,bug=>'Instructor Interface',});
if ($env{'form.prevphase'} eq 'userpicked') {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:backPage(document.userupdate,'get_user_info','select')",
- text=>"Select a user",
+ text=>$breadcrumb_text{'userpicked'},
faq=>282,bug=>'Instructor Interface',});
}
&Apache::lonhtmlcommon::add_breadcrumb
@@ -1632,6 +1698,10 @@ sub update_user_data {
}
}
##
+ my (@userroles,%userupdate,$cnum,$cdom,$namechanged);
+ if ($context eq 'course') {
+ ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
+ }
if (! $env{'form.makeuser'} ) {
# Check for need to change
my %userenv = &Apache::lonnet::get
@@ -1647,10 +1717,9 @@ sub update_user_data {
my %domconfig =
&Apache::lonnet::get_dom('configuration',['usermodification'],
$env{'form.ccdomain'});
- my @roletypes = ('active','future');
- my %roles = &Apache::lonnet::get_my_roles($env{'form.ccuname'},$env{'form.ccdomain'},'userroles',\@roletypes,undef,$env{'request.role.domain'});
- my @userroles;
- my ($cnum,$cdom,$auname,$audom);
+ my @statuses = ('active','future');
+ my %roles = &Apache::lonnet::get_my_roles($env{'form.ccuname'},$env{'form.ccdomain'},'userroles',\@statuses,undef,$env{'request.role.domain'});
+ my ($auname,$audom);
if ($context eq 'course') {
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -1783,7 +1852,7 @@ sub update_user_data {
}
}
}
- my ($quotachanged,$namechanged,$oldportfolioquota,$newportfolioquota,
+ my ($quotachanged,$oldportfolioquota,$newportfolioquota,
$inststatus,$oldisdefault,$newisdefault,$olddefquotatext,
$newdefquotatext);
my ($defquota,$settingstatus) =
@@ -1918,7 +1987,7 @@ END
($env{'form.ccuname'} => $env{'form.cid'}));
if (($recurseid) &&
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) {
- my %userupdate = (
+ %userupdate = (
lastname => $env{'form.clasaname'},
middlename => $env{'form.cmiddlename'},
firstname => $env{'form.cfirstname'},
@@ -2655,7 +2724,8 @@ sub handler {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
}
$r->print(''.&Apache::loncommon::end_page());
- } elsif ($env{'form.action'} eq 'singleuser' && $permission->{'cusr'}) {
+ } elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
+ eq 'singlestudent')) && ($permission->{'cusr'})) {
my $phase = $env{'form.phase'};
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain');
&Apache::loncreateuser::restore_prev_selections();
@@ -2768,6 +2838,26 @@ sub handler {
$formname,$totcodes,$codetitles,$idlist,$idlist_titles);
$r->print(&Apache::loncommon::end_page());
}
+ } elsif ($env{'form.action'} eq 'drop' && $permission->{'cusr'}) {
+ $r->print(&header());
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=drop',
+ text=>"Drop Students"});
+ if (!exists($env{'form.state'})) {
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Drop Students',
+ 'Course_Drop_Student'));
+
+ &Apache::lonuserutils::print_drop_menu($r,$context,$permission);
+ } elsif ($env{'form.state'} eq 'done') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=drop',
+ text=>"Result"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Drop Students',
+ 'Course_Drop_Student'));
+ &Apache::lonuserutils::update_user_list($r,$context,undef,
+ $env{'form.action'});
+ }
+ $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'dateselect') {
if ($permission->{'cusr'}) {
$r->print(&header(undef,undef,{'no_nav_bar' => 1}).
@@ -2866,21 +2956,33 @@ sub print_main_menu {
push(@menu,$customlink);
}
if ($context eq 'course') {
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my @courselinks =
+ my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
+ my @courselinks =
(
- { text => 'Automated Enrollment Manager',
+ { text => 'Enroll a Single Student',
+ help => 'Course_Single_Student',
+ action => 'singlestudent',
+ permission => $permission->{'cusr'},
+ },
+ { text => 'Drop Students',
+ help => 'Course_Drop_Student',
+ action => 'drop',
+ permission => $permission->{'cusr'},
+ });
+ if (!exists($permission->{'cusr_section'})) {
+ push(@courselinks,
+ { text => 'Automated Student Enrollment Manager',
permission => (&Apache::lonnet::auto_run($cnum,$cdom)
&& $permission->{'cusr'}),
url => '/adm/populate',
- },
+ });
+ }
+ push(@courselinks,
{ text => 'Manage Course Groups',
help => 'Course_Manage_Group',
permission => $permission->{'grp_manage'},
url => '/adm/coursegroups?refpage=cusr',
- },
- );
+ });
push(@menu,@courselinks);
}
my $menu_html = '';
@@ -3378,7 +3480,8 @@ sub course_level_table {
&Apache::loncommon::get_sections($domain,$cnum);
}
}
- foreach my $role ('st','ta','ep','in','cc') {
+ my @roles = &Apache::lonuserutils::roles_by_context('course');
+ foreach my $role (@roles) {
if (&Apache::lonnet::allowed('c'.$role,$thiscourse)) {
my $plrole=&Apache::lonnet::plaintext($role);
$table .= &Apache::loncommon::start_data_table_row().
@@ -3478,6 +3581,7 @@ $table.
sub course_level_dc {
my ($dcdom) = @_;
my %customroles=&Apache::lonuserutils::my_custom_roles();
+ my @roles = &Apache::lonuserutils::roles_by_context('course');
my $hiddenitems = '
'.
'
'.
'
';
@@ -3502,7 +3606,7 @@ sub course_level_dc {
my $otheritems = &Apache::loncommon::start_data_table_row()."\n".
'
| '."\n".
'
|