version 1.163, 2007/07/17 21:24:17
|
version 1.169, 2007/08/31 03:22:51
|
Line 45 use LONCAPA();
|
Line 45 use LONCAPA();
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub header { |
sub header { |
my $start_page=&Apache::loncommon::start_page('Enrollment Manager'); |
my ($jscript,$loaditems) = @_; |
|
my $start_page; |
|
if (ref($loaditems) eq 'HASH') { |
|
$start_page=&Apache::loncommon::start_page('Enrollment Manager',$jscript,{'add_entries' => $loaditems,}); |
|
} else { |
|
$start_page=&Apache::loncommon::start_page('Enrollment Manager',$jscript); |
|
} |
return(<<ENDHEAD); |
return(<<ENDHEAD); |
$start_page |
$start_page |
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
Line 133 sub domain_form {
|
Line 139 sub domain_form {
|
############################################################### |
############################################################### |
# Menu Phase One |
# Menu Phase One |
sub print_main_menu { |
sub print_main_menu { |
my ($r,$enrl_permission,$view_permission,$grp_manage_permission, |
my ($r,$permission)=@_; |
$grp_view_permission)=@_; |
|
# |
# |
my $cid =$env{'request.course.id'}; |
my $cid =$env{'request.course.id'}; |
my $cdom=$env{'course.'.$cid.'.domain'}; |
my $cdom=$env{'course.'.$cid.'.domain'}; |
Line 144 sub print_main_menu {
|
Line 149 sub print_main_menu {
|
{ text => 'Upload a class list', |
{ text => 'Upload a class list', |
help => 'Course_Create_Class_List', |
help => 'Course_Create_Class_List', |
action => 'upload', |
action => 'upload', |
permission => $enrl_permission, |
permission => $permission->{'enrl'}, |
}, |
}, |
{ text => 'Enroll a single student', |
{ text => 'Enroll a single student', |
help => 'Course_Add_Student', |
help => 'Course_Add_Student', |
action => 'enrollstudent', |
action => 'enrollstudent', |
permission => $enrl_permission, |
permission => $permission->{'enrl'}, |
}, |
}, |
{ text => 'Modify student data', |
{ text => 'Modify student data', |
help => 'Course_Modify_Student_Data', |
help => 'Course_Modify_Student_Data', |
action => 'modifystudent', |
action => 'modifystudent', |
permission => $enrl_permission, |
permission => $permission->{'enrl'}, |
}, |
}, |
{ text => 'View Class List', |
{ text => 'View Class List', |
help => 'Course_View_Class_List', |
help => 'Course_View_Class_List', |
action => 'classlist', |
action => 'classlist', |
permission => $view_permission, |
permission => $permission->{'view'}, |
}, |
}, |
{ text => 'Drop Students', |
{ text => 'Drop Students', |
help => 'Course_Drop_Student', |
help => 'Course_Drop_Student', |
action => 'drop', |
action => 'drop', |
permission => $enrl_permission, |
permission => $permission->{'enrl'}, |
}, |
}, |
{ text => 'Automated Enrollment Manager', |
{ text => 'Automated Enrollment Manager', |
permission => &Apache::lonnet::auto_run($cnum,$cdom), |
permission => (&Apache::lonnet::auto_run($cnum,$cdom) |
|
&& $permission->{'enrl'}), |
url => '/adm/populate', |
url => '/adm/populate', |
}, |
}, |
{ text => 'Create a new group', |
{ text => 'Create a new group', |
help => 'Course_Create_Group', |
help => 'Course_Create_Group', |
permission => $grp_manage_permission, |
permission => $permission->{'grp_manage'}, |
url => '/adm/coursegroups?refpage=enrl&action=create', |
url => '/adm/coursegroups?refpage=enrl&action=create', |
}, |
}, |
{ text => 'Modify an existing group', |
{ text => 'Modify an existing group', |
help => 'Course_Modify_Group', |
help => 'Course_Modify_Group', |
permission => $grp_manage_permission, |
permission => $permission->{'grp_manage'}, |
url => '/adm/coursegroups?refpage=enrl&action=modify', |
url => '/adm/coursegroups?refpage=enrl&action=modify', |
}, |
}, |
{ text => 'Delete an existing group', |
{ text => 'Delete an existing group', |
help => 'Course_Delete_Group', |
help => 'Course_Delete_Group', |
permission => $grp_manage_permission, |
permission => $permission->{'grp_manage'}, |
url => '/adm/coursegroups?refpage=enrl&action=delete', |
url => '/adm/coursegroups?refpage=enrl&action=delete', |
}, |
}, |
{ text => 'Re-enable a deleted group', |
{ text => 'Re-enable a deleted group', |
help => 'Course_Reenable_Group', |
help => 'Course_Reenable_Group', |
permission => $grp_manage_permission, |
permission => $permission->{'grp_manage'}, |
url => '/adm/coursegroups?refpage=enrl&action=reenable', |
url => '/adm/coursegroups?refpage=enrl&action=reenable', |
}, |
}, |
{ text => 'Enter an existing group', |
{ text => 'Enter an existing group', |
help => 'Course_Display_Group', |
help => 'Course_Display_Group', |
permission => $grp_view_permission, |
permission => $permission->{'grp_view'}, |
url => '/adm/coursegroups?refpage=enrl&action=view', |
url => '/adm/coursegroups?refpage=enrl&action=view', |
}, |
}, |
); |
); |
my $menu_html = ''; |
my $menu_html = ''; |
Line 738 sub print_upload_manager_form {
|
Line 744 sub print_upload_manager_form {
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub enroll_single_student { |
sub enroll_single_student { |
my $r=shift; |
my ($r,$srcharray) = @_; |
# Remove non alphanumeric values from section |
# Remove non alphanumeric values from section |
$env{'form.csec'}=~s/\W//g; |
$env{'form.csec'}=~s/\W//g; |
# |
# |
Line 823 sub enroll_single_student {
|
Line 829 sub enroll_single_student {
|
$r->print(&mt('Invalid username or domain')); |
$r->print(&mt('Invalid username or domain')); |
} |
} |
$r->print("<p><a href='/adm/dropadd?action=enrollstudent'>".&mt("Enroll another student")."</a></p>"); |
$r->print("<p><a href='/adm/dropadd?action=enrollstudent'>".&mt("Enroll another student")."</a></p>"); |
|
if (ref($srcharray) eq 'ARRAY') { |
|
foreach my $item (@{$srcharray},'ccuname','ccdomain') { |
|
$r->print('<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n"); |
|
} |
|
} |
|
foreach my $item ('sortby','seluname','seludom') { |
|
if (exists($env{'form.'.$item})) { |
|
$r->print('<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n"); |
|
} |
|
} |
|
$r->print('<input type="hidden" name="phase" value="get_user_info" />'."\n". |
|
'<input type="hidden" name="currstate" value="" />'."\n". |
|
'<input type="hidden" name="prevphase" value="" />'."\n". |
|
'<input type="hidden" name="action" value="enrollstudent" />'."\n". |
|
'<input type="hidden" name="state" value="gotusername" />'); |
} |
} |
|
|
sub setup_date_selectors { |
sub setup_date_selectors { |
Line 936 sub make_dates_default {
|
Line 957 sub make_dates_default {
|
## Single student enrollment routines (some of them) |
## Single student enrollment routines (some of them) |
## |
## |
sub get_student_username_domain_form { |
sub get_student_username_domain_form { |
my $r = shift; |
my ($r,$elements,$response,$srch,$forcenewuser) = @_; |
my $domform = &Apache::loncommon::select_dom_form |
my $loaditems = { |
($env{'course.'.$env{'request.course.id'}.'.domain'},'cudomain',0); |
'onload' => "javascript:setFormElements(document.studentform)", |
|
}; |
|
$r->print(&header(undef,$loaditems)); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'','')", |
|
text=>"Single user search"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enroll Student', |
|
'Course_Add_Student')); |
|
my $defdom=$env{'request.role.domain'}; |
|
|
|
my $jscript = &Apache::loncommon::studentbrowser_javascript()."\n". |
|
'<script type="text/javascript">'."\n". |
|
&Apache::lonhtmlcommon::set_form_elements($elements->{'studentform'}). |
|
'</script>'."\n"; |
|
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'eos' => "Enroll One Student", |
'eos' => "Enroll One Student", |
'usr' => "Username", |
'usr' => "Username", |
Line 946 sub get_student_username_domain_form {
|
Line 981 sub get_student_username_domain_form {
|
'been' => "Begin Enrollment", |
'been' => "Begin Enrollment", |
); |
); |
$r->print(<<END); |
$r->print(<<END); |
<input type="hidden" name="action" value="enrollstudent" /> |
$jscript |
<input type="hidden" name="state" value="gotusername" /> |
|
<h3>$lt{'eos'}</h3> |
<h3>$lt{'eos'}</h3> |
<table> |
|
<tr><td class="LC_dropadd_labeltext"><label for="cuname">$lt{'usr'}</label>:</td> |
|
<td><input type="text" name="cuname" size="15" /></td></tr> |
|
<tr><td class="LC_dropadd_labeltext"><label for="cudomain">$lt{'dom'}</label>:</td> |
|
<td>$domform</td></tr> |
|
<tr><td> </td> |
|
<td> |
|
<input type="submit" name="Begin Enrollment" value="$lt{'been'}" /> |
|
</td></tr> |
|
</table> |
|
<script type="text/javascript"> |
|
// the if prevents the script error if the browser can not handle this |
|
if ( document.studentform.cuname ) { document.studentform.cuname.focus(); } |
|
</script> |
|
END |
END |
|
$r->print($response); |
|
$r->print(&single_user_entry_form($defdom,$srch,$forcenewuser)); |
return; |
return; |
} |
} |
|
|
|
sub single_user_entry_form { |
|
my ($dom,$srch,$forcenewuser) = @_; |
|
my $userpicker = |
|
&Apache::loncommon::user_picker($dom,$srch,$forcenewuser, |
|
'document.studentform'); |
|
my $srchbutton = &mt('Search'); |
|
my $output = <<"ENDDOCUMENT"; |
|
<input type="hidden" name="action" value="enrollstudent" /> |
|
<input type="hidden" name="state" value="gotusername" /> |
|
<input type="hidden" name="phase" value="get_user_info" /> |
|
$userpicker |
|
<input name="userrole" type="button" value="$srchbutton" onclick="javascript:validateEntry(document.studentform)" /> |
|
ENDDOCUMENT |
|
return $output; |
|
} |
|
|
sub print_enroll_single_student_form { |
sub print_enroll_single_student_form { |
my $r=shift; |
my ($r,$jscript,$ccuname,$ccdomain,$srch) = @_; |
|
$r->print(&header($jscript)); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'','')", |
|
text=>"Single user search"}); |
|
if ($env{'form.phase'} eq 'userpicked') { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'get_user_info','select')", |
|
text=>"Select user",}); |
|
} |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'$env{'form.phase'}','modify')", |
|
text=>"Set enrollment",}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enroll Student', |
|
'Course_Add_Student')); |
$r->print("<h3>".&mt('Enroll One Student')."</h3>"); |
$r->print("<h3>".&mt('Enroll One Student')."</h3>"); |
# |
# |
my $username = &LONCAPA::clean_username($env{'form.cuname'}); |
my $home = &Apache::lonnet::homeserver($ccuname,$ccdomain); |
my $domain = &LONCAPA::clean_domain($env{'form.cudomain'}); |
|
my $home = &Apache::lonnet::homeserver($username,$domain); |
|
# $new_user flags whether we are creating a new user or using an old one |
# $new_user flags whether we are creating a new user or using an old one |
my $new_user = 1; |
my $new_user = 1; |
if ($home ne 'no_host') { |
if ($home ne 'no_host') { |
Line 983 sub print_enroll_single_student_form {
|
Line 1033 sub print_enroll_single_student_form {
|
my $user_data_html = ''; |
my $user_data_html = ''; |
my $javascript_validations = ''; |
my $javascript_validations = ''; |
if ($new_user) { |
if ($new_user) { |
|
my $usertoadd; |
|
my $instsrch = { |
|
srchin => 'instd', |
|
srchby => 'uname', |
|
srchtype => 'exact', |
|
srchterm => $ccuname, |
|
srchdomain => $ccdomain, |
|
}; |
|
if (($instsrch->{'srchterm'} ne '') && ($instsrch->{'srchdomain'} ne '')) { |
|
$usertoadd = $instsrch->{'srchterm'}.':'.$instsrch->{'srchdomain'}; |
|
} |
|
my (%dirsrch_results,%inst_results); |
|
if ($usertoadd) { |
|
if (&Apache::loncreateuser::directorysrch_check($instsrch) eq 'ok') { |
|
%dirsrch_results = &Apache::lonnet::inst_directory_query($instsrch); |
|
if (ref($dirsrch_results{$usertoadd}) eq 'HASH') { |
|
%inst_results = %{$dirsrch_results{$usertoadd}}; |
|
} |
|
} |
|
} |
|
|
my $defdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $defdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
# Set up authentication forms |
# Set up authentication forms |
my ($krbdef,$krbdefdom) = |
my ($krbdef,$krbdefdom) = |
&Apache::loncommon::get_kerberos_defaults($domain); |
&Apache::loncommon::get_kerberos_defaults($ccdomain); |
$javascript_validations=&javascript_validations('auth',$krbdefdom); |
$javascript_validations=&javascript_validations('auth',$krbdefdom); |
my %param = ( formname => 'document.studentform', |
my %param = ( formname => 'document.studentform', |
kerb_def_dom => $krbdefdom, |
kerb_def_dom => $krbdefdom, |
Line 998 sub print_enroll_single_student_form {
|
Line 1069 sub print_enroll_single_student_form {
|
# |
# |
# Set up domain selection form |
# Set up domain selection form |
my $homeserver_form = ''; |
my $homeserver_form = ''; |
my %servers = &Apache::lonnet::get_servers($domain,'library'); |
my %servers = &Apache::lonnet::get_servers($ccdomain,'library'); |
$homeserver_form = '<select name="lcserver" size="1">'."\n". |
$homeserver_form = '<select name="lcserver" size="1">'."\n". |
'<option value="default" selected>default</option>'."\n"; |
'<option value="default" selected>default</option>'."\n"; |
while (my ($servername,$serverdescription) = each (%servers)) { |
while (my ($servername,$serverdescription) = each (%servers)) { |
Line 1021 sub print_enroll_single_student_form {
|
Line 1092 sub print_enroll_single_student_form {
|
); |
); |
my $authhelp=&Apache::loncommon::help_open_topic('Auth_Options'); |
my $authhelp=&Apache::loncommon::help_open_topic('Auth_Options'); |
$user_data_html = <<END; |
$user_data_html = <<END; |
<h3>$lt{'udf'} $username:$domain</h3> |
<h3>$lt{'udf'} $ccuname:$ccdomain</h3> |
<table> |
<table> |
<tr><td class="LC_dropadd_labeltext"><label for="cfirst">$lt{'fn'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="cfirst">$lt{'fn'}</label>:</td> |
<td><input type="text" name="cfirst" size="15" /></td></tr> |
<td><input type="text" name="cfirst" size="15" value="$inst_results{'firstname'}" /></td></tr> |
<tr><td class="LC_dropadd_labeltext"><label for="cmiddle">$lt{'mn'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="cmiddle">$lt{'mn'}</label>:</td> |
<td><input type="text" name="cmiddle" size="15" /></td></tr> |
<td><input type="text" name="cmiddle" size="15" value="$inst_results{'middlename'}" /></td></tr> |
<tr><td class="LC_dropadd_labeltext"><label for="clast">$lt{'ln'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="clast">$lt{'ln'}</label>:</td> |
<td><input type="text" name="clast" size="15" /></td></tr> |
<td><input type="text" name="clast" size="15" value="$inst_results{'lastname'}" /></td></tr> |
<tr><td class="LC_dropadd_labeltext"><label for="cgen">$lt{'gen'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="cgen">$lt{'gen'}</label>:</td> |
<td><input type="text" name="cgen" size="5" /> </td></tr> |
<td><input type="text" name="cgen" size="5" value="$inst_results{'generation'}" /> </td></tr> |
<tr><td class="LC_dropadd_labeltext"><label for="lcserver">$lt{'hs'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="lcserver">$lt{'hs'}</label>:</td> |
<td>$homeserver_form</td></tr> |
<td>$homeserver_form</td></tr> |
<tr><td class="LC_dropadd_labeltext"><label for="emailaddress">$lt{'mail'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="emailaddress">$lt{'mail'}</label>:</td> |
<td><input type="text" name="emailaddress" size="20" /></td></tr> |
<td><input type="text" name="emailaddress" size="20" value="$inst_results{'permanentemail'}" /></td></tr> |
</table> |
</table> |
<h3>$lt{'pswd'}</h3> |
<h3>$lt{'pswd'}</h3> |
$lt{'psam'}$authhelp |
$lt{'psam'}$authhelp |
Line 1049 $locform
|
Line 1120 $locform
|
END |
END |
} else { |
} else { |
# User already exists. Do not worry about authentication |
# User already exists. Do not worry about authentication |
my %uenv = &Apache::lonnet::dump('environment',$domain,$username); |
my %uenv = &Apache::lonnet::dump('environment',$ccdomain,$ccuname); |
$javascript_validations = &javascript_validations('noauth'); |
$javascript_validations = &javascript_validations('noauth'); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'udf' => "User Data for", |
'udf' => "User Data for", |
Line 1060 END
|
Line 1131 END
|
'mail' => "Email Address", |
'mail' => "Email Address", |
); |
); |
$user_data_html = <<END; |
$user_data_html = <<END; |
<h3>$lt{'udf'} $username:$domain</h3> |
<h3>$lt{'udf'} $ccuname:$ccdomain</h3> |
<input type="hidden" name="lcserver" value="default" /> |
<input type="hidden" name="lcserver" value="default" /> |
<table> |
<table> |
<tr><td class="LC_dropadd_labeltext"><label for="cfirst">$lt{'fn'}</label>:</td> |
<tr><td class="LC_dropadd_labeltext"><label for="cfirst">$lt{'fn'}</label>:</td> |
Line 1087 END
|
Line 1158 END
|
); |
); |
$r->print(<<END); |
$r->print(<<END); |
<input type="hidden" name="action" value="enrollstudent" /> |
<input type="hidden" name="action" value="enrollstudent" /> |
<input type="hidden" name="state" value="done" /> |
<input type="hidden" name="state" value="gotusername" /> |
<input type="hidden" name="cuname" value="$username" /> |
<input type="hidden" name="cuname" value="$ccuname" /> |
<input type="hidden" name="lcdomain" value="$domain" /> |
<input type="hidden" name="lcdomain" value="$ccdomain" /> |
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
function verify(vf,sec_caller) { |
function verify(vf,sec_caller) { |
var founduname=0; |
var founduname=0; |
Line 1149 $lt{'disn'}
|
Line 1220 $lt{'disn'}
|
<input type="button" onClick="verify(this.form,this.form.csec)" value="$lt{'eas'}" /> |
<input type="button" onClick="verify(this.form,this.form.csec)" value="$lt{'eas'}" /> |
</p> |
</p> |
END |
END |
|
$r->print('<input type="hidden" name="currstate" value="" />'."\n". |
|
'<input type="hidden" name="phase" value="" />'."\n". |
|
'<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />'."\n"); |
|
if (ref($srch) eq 'HASH') { |
|
foreach my $item (sort(keys(%{$srch}))) { |
|
$r->print('<input type="hidden" name="'.$item.'" value="'.$srch->{$item}.'" />'."\n"); |
|
} |
|
} |
|
foreach my $item ('sortby','seluname','seludom') { |
|
if (exists($env{'form.'.$item})) { |
|
$r->print('<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n"); |
|
} |
|
} |
return; |
return; |
} |
} |
|
|
Line 1169 sub print_drop_menu {
|
Line 1253 sub print_drop_menu {
|
|
|
# ============================================== view classlist |
# ============================================== view classlist |
sub print_html_classlist { |
sub print_html_classlist { |
my ($r,$mode) = @_; |
my ($r,$mode,$permission) = @_; |
if (! exists($env{'form.sortby'})) { |
if (! exists($env{'form.sortby'})) { |
$env{'form.sortby'} = 'username'; |
$env{'form.sortby'} = 'username'; |
} |
} |
Line 1233 sub print_html_classlist {
|
Line 1317 sub print_html_classlist {
|
# Print the classlist |
# Print the classlist |
$r->print('<h2>'.&mt('Current Class List').'</h2>'); |
$r->print('<h2>'.&mt('Current Class List').'</h2>'); |
my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist(); |
my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist(); |
|
|
|
if (exists($permission->{'view_section'})) { |
|
my $sec = &Apache::loncoursedata::CL_SECTION(); |
|
foreach my $student (keys(%{$classlist})) { |
|
if ($classlist->{$student}[$sec] ne $permission->{'view_section'}) { |
|
delete($classlist->{$student}); |
|
} |
|
} |
|
} |
|
|
if (! defined($classlist)) { |
if (! defined($classlist)) { |
$r->print(&mt('There are no students currently enrolled.')."\n"); |
$r->print(&mt('There are no students currently enrolled.')."\n"); |
} else { |
} else { |
Line 1464 END
|
Line 1558 END
|
|
|
my %emails = &Apache::loncommon::getemails($username,$domain); |
my %emails = &Apache::loncommon::getemails($username,$domain); |
my $email; |
my $email; |
foreach my $type ('critnotification', 'permanentemail', |
if ($emails{'permanentemail'} =~ /\S/) { |
'notification') { |
$email = $emails{'permanentemail'}; |
if ($emails{$type} =~ /\S/) { |
|
$email = $emails{$type}; |
|
last; |
|
} |
|
} |
} |
|
|
if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') { |
if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') { |
Line 1622 sub print_modify_student_form {
|
Line 1712 sub print_modify_student_form {
|
# determine the students name information |
# determine the students name information |
my %info=&Apache::lonnet::get('environment', |
my %info=&Apache::lonnet::get('environment', |
['firstname','middlename', |
['firstname','middlename', |
'lastname','generation','id'], |
'lastname','generation','id', |
$sdom, $sname); |
'permanentemail'], $sdom, $sname); |
my ($tmp) = keys(%info); |
my ($tmp) = keys(%info); |
if ($tmp =~ /^(con_lost|error|no_such_host)/i) { |
if ($tmp =~ /^(con_lost|error|no_such_host)/i) { |
$r->print('<font color="#ff0000" size="+2">'.&mt('Error').'</font>'. |
$r->print('<font color="#ff0000" size="+2">'.&mt('Error').'</font>'. |
Line 1677 sub print_modify_student_form {
|
Line 1767 sub print_modify_student_form {
|
'mn' => "Middle", |
'mn' => "Middle", |
'ln' => "Last", |
'ln' => "Last", |
'gen' => "Generation", |
'gen' => "Generation", |
|
'email' => "E-mail address", |
'sid' => "Student ID", |
'sid' => "Student ID", |
'disn' => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)", |
'disn' => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)", |
'sec' => "Section", |
'sec' => "Section", |
Line 1706 $lt{'odcc'}
|
Line 1797 $lt{'odcc'}
|
<input type="hidden" name="state" value="done" /> |
<input type="hidden" name="state" value="done" /> |
<input type="hidden" name="sortby" value="$sortby" /> |
<input type="hidden" name="sortby" value="$sortby" /> |
<input type="hidden" name="Status" value="$env{'form.Status'}" /> |
<input type="hidden" name="Status" value="$env{'form.Status'}" /> |
<h2>$lt{'mef'} $info{'firstname'} $info{'middlename'} |
<h3>$lt{'mef'} $info{'firstname'} $info{'middlename'} |
$info{'lastname'} $info{'generation'}, $sname:$sdom</h2> |
$info{'lastname'} $info{'generation'}, $sname:$sdom</h3> |
<p> |
<p> |
<b>$lt{'sn'}</b> |
<b>$lt{'sn'}</b> |
<table> |
<table> |
Line 1719 $info{'lastname'} $info{'generation'}, $
|
Line 1810 $info{'lastname'} $info{'generation'}, $
|
<input type="text" name="generation" value="$info{'generation'}" /></td></tr> |
<input type="text" name="generation" value="$info{'generation'}" /></td></tr> |
</table> |
</table> |
</p><p> |
</p><p> |
|
<b>$lt{'email'}</b>: <input type="text" name="permanentemail" value="$info{'permanentemail'}" size="30" /> |
|
</p><p> |
<b>$lt{'sid'}</b>: <input type="text" name="id" value="$info{'id'}" size="12" /> |
<b>$lt{'sid'}</b>: <input type="text" name="id" value="$info{'id'}" size="12" /> |
</p><p> |
</p><p> |
<label> |
<label> |
Line 1762 sub modify_single_student {
|
Line 1855 sub modify_single_student {
|
# Get the old data |
# Get the old data |
my %old=&Apache::lonnet::get('environment', |
my %old=&Apache::lonnet::get('environment', |
['firstname','middlename', |
['firstname','middlename', |
'lastname','generation','id'], |
'lastname','generation','id', |
$sdom, $slogin); |
'permanentemail'],$sdom, $slogin); |
$old{'section'} = &Apache::lonnet::getsection($sdom,$slogin, |
$old{'section'} = &Apache::lonnet::getsection($sdom,$slogin, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
my ($tmp) = keys(%old); |
my ($tmp) = keys(%old); |
Line 1778 sub modify_single_student {
|
Line 1871 sub modify_single_student {
|
my $middlename = $env{'form.middlename'}; |
my $middlename = $env{'form.middlename'}; |
my $lastname = $env{'form.lastname'}; |
my $lastname = $env{'form.lastname'}; |
my $generation = $env{'form.generation'}; |
my $generation = $env{'form.generation'}; |
|
my $permanentemail = $env{'form.permanentemail'}; |
my $section = $env{'form.section'}; |
my $section = $env{'form.section'}; |
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
my $sid = $env{'form.id'}; |
my $sid = $env{'form.id'}; |
Line 1802 sub modify_single_student {
|
Line 1896 sub modify_single_student {
|
'mn' => "Middle name", |
'mn' => "Middle name", |
'ln' => "Last name", |
'ln' => "Last name", |
'gen' => "Generation", |
'gen' => "Generation", |
|
'em' => "E-mail address", |
'sec' => "Section", |
'sec' => "Section", |
'ri' => "Role Information", |
'ri' => "Role Information", |
'st' => "Start Time", |
'st' => "Start Time", |
'et' => "End Time", |
'et' => "End Time", |
); |
); |
$r->print(<<END); |
$r->print(<<END); |
<h2>$lt{'mdu'} $slogin : $sdom </h2> |
<h3>$lt{'mdu'} $slogin:$sdom </h3> |
<h3>$lt{'si'}</h3> |
END |
<table rules="rows" border="1" cellpadding="3" > |
$r->print(<<END); |
<tr> |
|
<th> $lt{'fd'} </th> |
|
<th> $lt{'ov'} </th> |
|
<th> $lt{'nv'} </th> |
|
</tr> |
|
<tr> |
|
<td> <b>$lt{'fn'}</b> </td> |
|
<td> $old{'firstname'} </td> |
|
<td> $firstname </td> |
|
</tr><tr> |
|
<td> <b>$lt{'mn'}</b> </td> |
|
<td> $old{'middlename'} </td> |
|
<td> $middlename </td> |
|
</tr><tr> |
|
<td> <b>$lt{'ln'}</b> </td> |
|
<td> $old{'lastname'} </td> |
|
<td> $lastname </td> |
|
</tr><tr> |
|
<td> <b>$lt{'gen'}</b> </td> |
|
<td> $old{'generation'} </td> |
|
<td> $generation </td> |
|
</tr><tr> |
|
<td> <b>ID</b> </td> |
|
<td> $old{'id'} </td> |
|
<td> $sid </td> |
|
</tr><tr> |
|
<td> <b>$lt{'sec'}</b> </td> |
|
<td> $old{'section'} </td> |
|
<td> $section</td> |
|
</tr> |
|
</table> |
|
<h3>$lt{'ri'}</h3> |
|
<table> |
<table> |
<tr><td align="right"><b>$lt{'st'}:</b></td><td> $displayable_starttime </td></tr> |
<tr> |
<tr><td align="right"><b>$lt{'et'}:</b></td><td> $displayable_endtime </td></tr> |
<td> |
|
<table class="LC_nested_outer"> |
|
<tr> |
|
<th>$lt{si}</th> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
|
<tr class="LC_info_row"> |
|
<td class="LC_left_item"> $lt{'fd'} </td> |
|
<td class="LC_left_item"> $lt{'ov'} </td> |
|
<td class="LC_left_item"> $lt{'nv'} </td> |
|
</tr> |
|
<tr class="LC_odd_row"> |
|
<td class="LC_left_item"> <b>$lt{'fn'}</b> </td> |
|
<td class="LC_left_item"> $old{'firstname'} </td> |
|
<td class="LC_left_item"> $firstname </td> |
|
</tr> |
|
<tr> |
|
<td class="LC_left_item"> <b>$lt{'mn'}</b> </td> |
|
<td class="LC_left_item"> $old{'middlename'} </td> |
|
<td class="LC_left_item"> $middlename </td> |
|
</tr> |
|
<tr class="LC_odd_row"> |
|
<td class="LC_left_item"> <b>$lt{'ln'}</b> </td> |
|
<td class="LC_left_item"> $old{'lastname'} </td> |
|
<td class="LC_left_item"> $lastname </td> |
|
</tr> |
|
<tr> |
|
<td class="LC_left_item"> <b>$lt{'gen'}</b> </td> |
|
<td class="LC_left_item"> $old{'generation'} </td> |
|
<td class="LC_left_item"> $generation </td> |
|
</tr> |
|
<tr class="LC_odd_row"> |
|
<td class="LC_left_item"> <b>ID</b> </td> |
|
<td class="LC_left_item"> $old{'id'} </td> |
|
<td class="LC_left_item"> $sid </td> |
|
</tr> |
|
<tr> |
|
<td class="LC_left_item"> <b>$lt{'em'}</b> </td> |
|
<td class="LC_left_item"> $old{'permanentemail'} </td> |
|
<td class="LC_left_item"> $permanentemail </td> |
|
<tr class="LC_odd_row"> |
|
<td> <b>$lt{'sec'}</b> </td> |
|
<td> $old{'section'} </td> |
|
<td> $section</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
|
<table class="LC_nested_outer"> |
|
<tr> |
|
<th>$lt{'ri'}</th> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
|
<tr class="LC_odd_row"> |
|
<td class="LC_left_item"><b>$lt{'st'}:</b></td> |
|
<td class="LC_right_item"> $displayable_starttime </td> |
|
</tr> |
|
<tr> |
|
<td class="LC_left_item"><b>$lt{'et'}:</b></td> |
|
<td class="LC_right_item"> $displayable_endtime </td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
</table> |
</table> |
<p> |
<p> |
END |
END |
Line 1860 END
|
Line 1995 END
|
} |
} |
my $roleresults = &Apache::lonnet::modifystudent |
my $roleresults = &Apache::lonnet::modifystudent |
($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname, |
($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname, |
$generation,$section,$endtime,$starttime,$env{'form.forceid'}); |
$generation,$section,$endtime,$starttime,$env{'form.forceid'}, |
|
undef,$permanentemail); |
|
if ($old{'permanentemail'} ne $permanentemail) { |
|
&Apache::loncommon::flush_email_cache($slogin,$sdom); |
|
} |
if ($roleresults eq 'refused' ) { |
if ($roleresults eq 'refused' ) { |
$r->print(&mt('Your request to change the role information for this student was refused. You do not appear to have sufficient authority to change student information.')); |
$r->print(&mt('Your request to change the role information for this student was refused. You do not appear to have sufficient authority to change student information.')); |
} elsif ($roleresults !~ /ok/) { |
} elsif ($roleresults !~ /ok/) { |
Line 2419 function validate(caller) {
|
Line 2558 function validate(caller) {
|
END |
END |
} |
} |
|
|
|
sub get_permission { |
|
my %permission; |
|
$permission{'view'} = |
|
&Apache::lonnet::allowed('vcl',$env{'request.course.id'}); |
|
if (!$permission{'view'}) { |
|
my $scope = $env{'request.course.id'}.'/'.$env{'request.course.sec'}; |
|
$permission{'view'} = &Apache::lonnet::allowed('vcl',$scope); |
|
if ($permission{'view'}) { |
|
$permission{'view_section'} = $env{'request.course.sec'}; |
|
} |
|
} |
|
|
|
$permission{'enrl'} = |
|
&Apache::lonnet::allowed('cst',$env{'request.course.id'}); |
|
|
|
$permission{'grp_view'} = |
|
&Apache::lonnet::allowed('vcg',$env{'request.course.id'}); |
|
$permission{'grp_manage'} = |
|
&Apache::lonnet::allowed('mdg',$env{'request.course.id'}); |
|
my $allowed = 0; |
|
foreach my $perm (values(%permission)) { |
|
if ($perm) { $allowed=1; last; } |
|
} |
|
return (\%permission,$allowed); |
|
} |
|
|
################################################################### |
################################################################### |
################################################################### |
################################################################### |
|
|
Line 2477 sub handler {
|
Line 2642 sub handler {
|
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
# |
# |
my $view_permission = |
|
&Apache::lonnet::allowed('vcl',$env{'request.course.id'}); |
|
my $enrl_permission = |
|
&Apache::lonnet::allowed('cst',$env{'request.course.id'}); |
|
|
|
my $grp_view_permission = |
|
&Apache::lonnet::allowed('vcg',$env{'request.course.id'}); |
|
my $grp_manage_permission = |
|
&Apache::lonnet::allowed('mdg',$env{'request.course.id'}); |
|
|
|
|
my ($permission,$allowed) = &get_permission(); |
|
|
if (! $grp_view_permission && ! $grp_manage_permission && |
if (!$allowed) { |
! $view_permission && ! $enrl_permission) { |
|
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/coursegroups:cst:0:0:Cannot manage or view course groups, ". |
"/adm/dropadd:cst:0:0:Cannot manage or view course groups, ". |
"or drop or add students"; |
"or drop or add students"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
|
Line 2502 sub handler {
|
Line 2658 sub handler {
|
# Start page |
# Start page |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
$r->print(&header()); |
|
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
if (! exists($env{'form.action'})) { |
if (! exists($env{'form.action'})) { |
|
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment Manager')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment Manager')); |
&print_main_menu($r,$enrl_permission,$view_permission,$grp_manage_permission, |
my $action = &print_main_menu($r,$permission); |
$grp_view_permission); |
} elsif ($env{'form.action'} eq 'upload' && $permission->{'enrl'}) { |
} elsif ($env{'form.action'} eq 'upload' && $enrl_permission) { |
$r->print(&header()); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/dropadd?action=upload&state=', |
({href=>'/adm/dropadd?action=upload&state=', |
text=>"Upload Classlist"}); |
text=>"Upload Classlist"}); |
Line 2528 sub handler {
|
Line 2684 sub handler {
|
} else { |
} else { |
&print_first_courselist_upload_form($r); |
&print_first_courselist_upload_form($r); |
} |
} |
} elsif ($env{'form.action'} eq 'drop' && $enrl_permission) { |
} elsif ($env{'form.action'} eq 'drop' && $permission->{'enrl'}) { |
|
$r->print(&header()); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/dropadd?action=drop', |
({href=>'/adm/dropadd?action=drop', |
text=>"Drop Students"}); |
text=>"Drop Students"}); |
Line 2541 sub handler {
|
Line 2698 sub handler {
|
} else { |
} else { |
&print_drop_menu($r); |
&print_drop_menu($r); |
} |
} |
} elsif ($env{'form.action'} eq 'enrollstudent' && $enrl_permission) { |
} elsif ($env{'form.action'} eq 'enrollstudent' && $permission->{'enrl'}) { |
&Apache::lonhtmlcommon::add_breadcrumb |
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain'); |
({href=>'/adm/dropadd?action=enrollstudent', |
my ($jsback,$elements) = &Apache::loncreateuser::crumb_utilities(); |
text=>"Enroll Student"}); |
my $jscript = '<script type="text/javascript">'.$jsback.'</script>'; |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enroll Student', |
if ($env{'form.state'} eq 'gotusername') { |
'Course_Add_Student')); |
my $srch; |
if (! exists($env{'form.state'})) { |
foreach my $item (@search) { |
&get_student_username_domain_form($r); |
$srch->{$item} = $env{'form.'.$item}; |
} elsif ($env{'form.state'} eq 'gotusername') { |
} |
&print_enroll_single_student_form($r); |
if ($env{'form.phase'} eq 'get_user_info') { |
|
my ($currstate,$response,$forcenewuser,$results) = |
|
&Apache::loncreateuser::user_search_result($srch); |
|
if ($currstate eq 'select') { |
|
$r->print(&header()); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.usersrchform,'','')", |
|
text=>"Single user search"}, |
|
{href=>"javascript:backPage(document.usersrchform,'get_user_info','select')", |
|
text=>"Select User",}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enroll Student', |
|
'Course_Add_Student')); |
|
&Apache::loncreateuser::print_user_selection_page($r, |
|
$response,$srch,$results,'enrollstudent',\@search); |
|
} elsif ($currstate eq 'modify') { |
|
my ($ccuname,$ccdomain); |
|
if (($srch->{'srchby'} eq 'uname') && |
|
($srch->{'srchtype'} eq 'exact')) { |
|
$ccuname = $srch->{'srchterm'}; |
|
$ccdomain= $srch->{'srchdomain'}; |
|
} else { |
|
my @matchedunames = keys(%{$results}); |
|
($ccuname,$ccdomain) = split(/:/,$matchedunames[0]); |
|
} |
|
$ccuname =&LONCAPA::clean_username($ccuname); |
|
$ccdomain=&LONCAPA::clean_domain($ccdomain); |
|
&print_enroll_single_student_form($r,$jscript,$ccuname, |
|
$ccdomain,$srch,$response); |
|
} elsif ($currstate eq 'query') { |
|
$r->print(&header($jscript)); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'','')", |
|
text=>"Single user search"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enroll Student', |
|
'Course_Add_Student')); |
|
&Apache::loncreateuser::print_user_query_page($r,'enrollstudent'); |
|
} else { |
|
&get_student_username_domain_form($r,$elements,$response, |
|
$srch,$forcenewuser); |
|
} |
|
} elsif ($env{'form.phase'} eq 'userpicked') { |
|
my $ccuname = &LONCAPA::clean_username($env{'form.seluname'}); |
|
my $ccdomain = &LONCAPA::clean_domain($env{'form.seludom'}); |
|
&print_enroll_single_student_form($r,$jscript,$ccuname, |
|
$ccdomain,$srch); |
|
} else { |
|
&get_student_username_domain_form($r,$elements); |
|
} |
} elsif ($env{'form.state'} eq 'enrolling') { |
} elsif ($env{'form.state'} eq 'enrolling') { |
&enroll_single_student($r); |
$r->print(&header($jscript)); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'','')", |
|
text=>"Single user search"}); |
|
if ($env{'form.prevphase'} eq 'userpicked') { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'get_user_info','select')", |
|
text=>"Select user",}); |
|
} |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:backPage(document.studentform,'$env{'form.prevphase'}','modify')", |
|
text=>"Set enrollment",}, |
|
{href=>"javascript:backPage(document.studentform,$env{'form.phase'},'')", |
|
text=>"Result",}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enroll Student', |
|
'Course_Add_Student')); |
|
&enroll_single_student($r,\@search); |
} else { |
} else { |
&get_student_username_domain_form($r); |
&get_student_username_domain_form($r,$elements); |
} |
} |
} elsif ($env{'form.action'} eq 'classlist' && $view_permission) { |
} elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) { |
|
$r->print(&header()); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/dropadd?action=classlist', |
({href=>'/adm/dropadd?action=classlist', |
text=>"View Classlist"}); |
text=>"View Classlist"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('View Classlist', |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('View Classlist', |
'Course_View_Class_List')); |
'Course_View_Class_List')); |
if (! exists($env{'form.state'})) { |
if (! exists($env{'form.state'})) { |
&print_html_classlist($r,undef); |
&print_html_classlist($r,undef,$permission); |
} elsif ($env{'form.state'} eq 'csv') { |
} elsif ($env{'form.state'} eq 'csv') { |
&print_html_classlist($r,'csv'); |
&print_html_classlist($r,'csv',$permission); |
} elsif ($env{'form.state'} eq 'excel') { |
} elsif ($env{'form.state'} eq 'excel') { |
&print_html_classlist($r,'excel'); |
&print_html_classlist($r,'excel',$permission); |
} else { |
} else { |
&print_html_classlist($r,undef); |
&print_html_classlist($r,undef,$permission); |
} |
} |
} elsif ($env{'form.action'} eq 'modifystudent' && $enrl_permission) { |
} elsif ($env{'form.action'} eq 'modifystudent' && $permission->{'enrl'}) { |
|
$r->print(&header()); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/dropadd?action=modifystudent', |
({href=>'/adm/dropadd?action=modifystudent', |
text=>"Modify Student Data"}); |
text=>"Modify Student Data"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Modify Student Data', |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Modify Student Data', |
'Course_Modify_Student_Data')); |
'Course_Modify_Student_Data')); |
if (! exists($env{'form.state'})) { |
if (! exists($env{'form.state'})) { |
&print_html_classlist($r); |
&print_html_classlist($r,undef,$permission); |
} elsif ($env{'form.state'} eq 'selected') { |
} elsif ($env{'form.state'} eq 'selected') { |
&print_modify_student_form($r); |
&print_modify_student_form($r); |
} elsif ($env{'form.state'} eq 'done') { |
} elsif ($env{'form.state'} eq 'done') { |
&modify_single_student($r); |
&modify_single_student($r); |
} else { |
} else { |
&print_html_classlist($r); |
&print_html_classlist($r,undef,$permission); |
} |
} |
} else { |
} else { |
# We should not end up here, but I guess it is possible |
# We should not end up here, but I guess it is possible |
&Apache::lonnet::logthis("Undetermined state in londropadd.pm. ". |
&Apache::lonnet::logthis("Undetermined state in londropadd.pm. ". |
"form.action = ".$env{'form.action'}. |
"form.action = ".$env{'form.action'}. |
"Someone should fix this."); |
"Someone should fix this."); |
|
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment Manager')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment Manager')); |
&print_main_menu($r,$enrl_permission,$view_permission); |
&print_main_menu($r,$permission); |
} |
} |
# |
# |
# Finish up |
# Finish up |