version 1.170, 2007/09/27 18:58:52
|
version 1.173, 2007/10/22 22:16:38
|
Line 262 sub print_upload_manager_header {
|
Line 262 sub print_upload_manager_header {
|
$password_choice = 'int'; |
$password_choice = 'int'; |
} |
} |
# |
# |
my $javascript_validations=&javascript_validations('auth',$krbdefdom, |
my $javascript_validations = |
$password_choice); |
&javascript_validations('auth',$krbdefdom,$password_choice,undef, |
|
$env{'request.role.domain'}); |
my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':''); |
my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':''); |
$r->print('<h3>'.&mt('Uploading Class List')."</h3>\n". |
$r->print('<h3>'.&mt('Uploading Class List')."</h3>\n". |
"<hr>\n". |
"<hr>\n". |
Line 293 sub print_upload_manager_header {
|
Line 294 sub print_upload_manager_header {
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub javascript_validations { |
sub javascript_validations { |
my ($mode,$krbdefdom,$curr_authtype,$curr_authfield)=@_; |
my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain)=@_; |
my $authheader; |
my $authheader; |
if ($mode eq 'auth') { |
if ($mode eq 'auth') { |
my %param = ( formname => 'studentform', |
my %param = ( formname => 'studentform', |
Line 302 sub javascript_validations {
|
Line 303 sub javascript_validations {
|
$authheader = &Apache::loncommon::authform_header(%param); |
$authheader = &Apache::loncommon::authform_header(%param); |
} elsif ($mode eq 'createcourse') { |
} elsif ($mode eq 'createcourse') { |
my %param = ( formname => 'ccrs', |
my %param = ( formname => 'ccrs', |
kerb_def_dom => $krbdefdom, |
kerb_def_dom => $krbdefdom, |
curr_authtype => $curr_authtype ); |
curr_authtype => $curr_authtype ); |
$authheader = &Apache::loncommon::authform_header(%param); |
$authheader = &Apache::loncommon::authform_header(%param); |
} elsif ($mode eq 'modifycourse') { |
} elsif ($mode eq 'modifycourse') { |
Line 331 sub javascript_validations {
|
Line 332 sub javascript_validations {
|
my $function_name =(<<END); |
my $function_name =(<<END); |
function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) { |
function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) { |
END |
END |
|
my ($authnum,%can_assign) = &Apache::loncommon::get_assignable_auth($domain); |
my $auth_checks; |
my $auth_checks; |
if ($mode eq 'createcourse') { |
if ($mode eq 'createcourse') { |
$auth_checks .= (<<END); |
$auth_checks .= (<<END); |
Line 345 END
|
Line 347 END
|
$auth_checks .= (<<END); |
$auth_checks .= (<<END); |
var foundatype=0; |
var foundatype=0; |
if (founduname==0) { |
if (founduname==0) { |
alert('$alert{'username'}'); |
alert('$alert{'username'}'); |
return; |
return; |
} |
} |
|
|
|
END |
|
if ($authnum > 1) { |
|
$auth_checks .= (<<END); |
// alert('current.radiovalue = '+current.radiovalue); |
// alert('current.radiovalue = '+current.radiovalue); |
if (current.radiovalue == null || current.radiovalue == '' || current.radiovalue == 'nochange') { |
if (current.radiovalue == null || current.radiovalue == '' || current.radiovalue == 'nochange') { |
// They did not check any of the login radiobuttons. |
// They did not check any of the login radiobuttons. |
Line 355 END
|
Line 361 END
|
return; |
return; |
} |
} |
END |
END |
|
} |
} |
} |
if ($mode eq 'createcourse') { |
if ($mode eq 'createcourse') { |
$auth_checks .= " |
$auth_checks .= " |
Line 416 END
|
Line 423 END
|
} |
} |
END |
END |
} else { |
} else { |
$section_checks = §ion_check_js(); |
$section_checks = &Apache::lonuserutils::section_check_js(); |
$optional_checks = (<<END); |
$optional_checks = (<<END); |
var message=''; |
var message=''; |
if (foundname==0) { |
if (foundname==0) { |
Line 752 sub enroll_single_student {
|
Line 759 sub enroll_single_student {
|
# in the course is entirely separate from the action of enrolling the |
# in the course is entirely separate from the action of enrolling the |
# student. Also, a failure in setting the dates as default is not fatal |
# student. Also, a failure in setting the dates as default is not fatal |
# to the process of enrolling / modifying a student. |
# to the process of enrolling / modifying a student. |
my ($startdate,$enddate) = &get_dates_from_form(); |
my ($startdate,$enddate) = &Apache::lonuserutils::get_dates_from_form(); |
if ($env{'form.makedatesdefault'}) { |
if ($env{'form.makedatesdefault'}) { |
$r->print(&make_dates_default($startdate,$enddate)); |
$r->print(&Apache::lonuserutils::make_dates_default($startdate, |
|
$enddate)); |
} |
} |
|
|
$r->print('<h3>'.&mt('Enrolling Student').'</h3>'); |
$r->print('<h3>'.&mt('Enrolling Student').'</h3>'); |
Line 799 sub enroll_single_student {
|
Line 807 sub enroll_single_student {
|
$env{'form.lcdomain'}); |
$env{'form.lcdomain'}); |
if ((($amode) && ($genpwd)) || ($home ne 'no_host')) { |
if ((($amode) && ($genpwd)) || ($home ne 'no_host')) { |
# Clean out any old roles the student has in this class. |
# Clean out any old roles the student has in this class. |
&modifystudent($env{'form.lcdomain'},$env{'form.cuname'}, |
&Apache::lonuserutils::modifystudent($env{'form.lcdomain'},$env{'form.cuname'}, |
$env{'request.course.id'},$env{'form.csec'}, |
$env{'request.course.id'},$env{'form.csec'}, |
$desiredhost); |
$desiredhost); |
my $login_result = &Apache::lonnet::modifystudent |
my $login_result = &Apache::lonnet::modifystudent |
Line 1058 sub print_enroll_single_student_form {
|
Line 1066 sub print_enroll_single_student_form {
|
# Set up authentication forms |
# Set up authentication forms |
my ($krbdef,$krbdefdom) = |
my ($krbdef,$krbdefdom) = |
&Apache::loncommon::get_kerberos_defaults($ccdomain); |
&Apache::loncommon::get_kerberos_defaults($ccdomain); |
$javascript_validations=&javascript_validations('auth',$krbdefdom); |
$javascript_validations = |
|
&Apache::lonuserutils::javascript_validations('auth',$krbdefdom, |
|
undef,undef,$ccdomain); |
my %param = ( formname => 'document.studentform', |
my %param = ( formname => 'document.studentform', |
kerb_def_dom => $krbdefdom, |
kerb_def_dom => $krbdefdom, |
kerb_def_auth => $krbdef |
kerb_def_auth => $krbdef |
Line 1080 sub print_enroll_single_student_form {
|
Line 1090 sub print_enroll_single_student_form {
|
# |
# |
# |
# |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'udf' => "User Data for", |
'udf' => "Personal Data", |
'fn' => "First Name", |
'fn' => "First Name", |
'mn' => "Middle Name", |
'mn' => "Middle Name", |
'ln' => "Last Name", |
'ln' => "Last Name", |
'gen' => "Generation", |
'gen' => "Generation", |
'hs' => "Home Server", |
'hs' => "Home Server", |
'pswd' => "Password", |
'pswd' => "Login Data", |
'psam' => "Please select an authentication mechanism", |
'psam' => "Please select an authentication mechanism", |
'mail' => "Email Address" |
'mail' => "Email Address" |
); |
); |
Line 1109 sub print_enroll_single_student_form {
|
Line 1119 sub print_enroll_single_student_form {
|
</table> |
</table> |
<h3>$lt{'pswd'}</h3> |
<h3>$lt{'pswd'}</h3> |
$lt{'psam'}$authhelp |
$lt{'psam'}$authhelp |
<table> |
|
<p> |
<p> |
$krbform |
|
<br /> |
|
$intform |
|
<br /> |
|
$locform |
|
</p> |
|
END |
END |
|
if ($krbform ne '') { |
|
$user_data_html .= $krbform.'<br />'; |
|
} |
|
if ($intform ne '') { |
|
$user_data_html .= $intform.'<br />'; |
|
} |
|
if ($locform ne '') { |
|
$user_data_html .= $locform.'<br />'; |
|
} |
|
$user_data_html .= "\n</p>\n" |
} else { |
} else { |
# User already exists. Do not worry about authentication |
# User already exists. Do not worry about authentication |
my %uenv = &Apache::lonnet::dump('environment',$ccdomain,$ccuname); |
my %uenv = &Apache::lonnet::dump('environment',$ccdomain,$ccuname); |
$javascript_validations = &javascript_validations('noauth'); |
$javascript_validations = &Apache::lonuserutils::javascript_validations('noauth'); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'udf' => "User Data for", |
'udf' => "User Data for", |
'fn' => "First Name", |
'fn' => "First Name", |
Line 1147 END
|
Line 1160 END
|
</table> |
</table> |
END |
END |
} |
} |
my $date_table = &date_setting_table(); |
my $date_table = &Apache::lonuserutils::date_setting_table(); |
# Print it all out |
# Print it all out |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'cd' => "Course Data", |
'cd' => "Course Data", |
Line 1796 sub print_modify_student_form {
|
Line 1809 sub print_modify_student_form {
|
&Apache::lonlocal::locallocaltime($endtime)).'<br />'; |
&Apache::lonlocal::locallocaltime($endtime)).'<br />'; |
|
|
} |
} |
my $date_table = &date_setting_table($starttime,$endtime); |
my $date_table = |
|
&Apache::lonuserutils::date_setting_table($starttime,$endtime); |
# |
# |
if (! exists($env{'form.Status'}) || |
if (! exists($env{'form.Status'}) || |
$env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) { |
$env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) { |
Line 1818 sub print_modify_student_form {
|
Line 1832 sub print_modify_student_form {
|
'sm' => "Submit Modifications", |
'sm' => "Submit Modifications", |
); |
); |
# Check if section name is valid |
# Check if section name is valid |
my $section_check = §ion_check_js(); |
my $section_check = &Apache::lonuserutils::section_check_js(); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<script type="text/javascript"> |
<script type="text/javascript"> |
$section_check |
$section_check |
Line 1883 sub modify_single_student {
|
Line 1897 sub modify_single_student {
|
$env{'form.section'} =~ s/\W//g; |
$env{'form.section'} =~ s/\W//g; |
# |
# |
# Do the date defaults first |
# Do the date defaults first |
my ($starttime,$endtime) = &get_dates_from_form(); |
my ($starttime,$endtime) = &Apache::lonuserutils::get_dates_from_form(); |
if ($env{'form.makedatesdefault'}) { |
if ($env{'form.makedatesdefault'}) { |
$r->print(&make_dates_default($starttime,$endtime)); |
$r->print(&Apache::lonuserutils::make_dates_default($starttime, |
|
$endtime)); |
} |
} |
# Get the 'sortby' and 'Status' variables so the user goes back to their |
# Get the 'sortby' and 'Status' variables so the user goes back to their |
# previous screen |
# previous screen |
Line 2031 END
|
Line 2046 END
|
# |
# |
# Send request(s) to modify data (final undef is for 'desiredhost', |
# Send request(s) to modify data (final undef is for 'desiredhost', |
# which is a moot point because the student already has an account. |
# which is a moot point because the student already has an account. |
my $modify_section_results = &modifystudent($sdom,$slogin, |
my $modify_section_results = |
$env{'request.course.id'}, |
&Apache::lonuserutils::modifystudent($sdom,$slogin, |
$section,undef); |
$env{'request.course.id'}, |
|
$section,undef); |
if ($modify_section_results !~ /^ok/) { |
if ($modify_section_results !~ /^ok/) { |
$r->print(&mt('An error occured during the attempt to change the section for this student.')."<br />"); |
$r->print(&mt('An error occured during the attempt to change the section for this student.')."<br />"); |
} |
} |
Line 2493 sub upfile_drop_add {
|
Line 2509 sub upfile_drop_add {
|
$$_ =~ s/(\s+$|^\s+)//g; |
$$_ =~ s/(\s+$|^\s+)//g; |
} |
} |
if ($password || $env{'form.login'} eq 'loc') { |
if ($password || $env{'form.login'} eq 'loc') { |
&modifystudent($domain,$username,$cid,$sec, |
&Apache::lonuserutils::modifystudent($domain, |
$desiredhost); |
$username,$cid, |
|
$sec,$desiredhost); |
my $reply=&Apache::lonnet::modifystudent |
my $reply=&Apache::lonnet::modifystudent |
($domain,$username,$id,$amode,$password, |
($domain,$username,$id,$amode,$password, |
$fname,$mname,$lname,$gen,$sec,$enddate, |
$fname,$mname,$lname,$gen,$sec,$enddate, |
Line 2561 sub drop_student_list {
|
Line 2578 sub drop_student_list {
|
foreach (@droplist) { |
foreach (@droplist) { |
my ($uname,$udom)=split(/\:/,$_); |
my ($uname,$udom)=split(/\:/,$_); |
# drop student |
# drop student |
my $result = &modifystudent($udom,$uname,$env{'request.course.id'}); |
my $result = &Apache::lonuserutils::modifystudent($udom,$uname, |
|
$env{'request.course.id'}); |
if ($result eq 'ok' || $result eq 'ok:') { |
if ($result eq 'ok' || $result eq 'ok:') { |
$r->print(&mt('Dropped [_1]',$uname.'@'.$udom).'<br>'); |
$r->print(&mt('Dropped [_1]',$uname.'@'.$udom).'<br>'); |
$count++; |
$count++; |
Line 2746 sub handler {
|
Line 2764 sub handler {
|
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain'); |
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain'); |
my ($jsback,$elements) = &Apache::loncreateuser::crumb_utilities(); |
my ($jsback,$elements) = &Apache::loncreateuser::crumb_utilities(); |
my $jscript = '<script type="text/javascript">'.$jsback.'</script>'; |
my $jscript = '<script type="text/javascript">'.$jsback.'</script>'; |
|
&Apache::loncreateuser::restore_prev_selections(); |
|
my $srch; |
|
foreach my $item (@search) { |
|
$srch->{$item} = $env{'form.'.$item}; |
|
} |
|
|
if ($env{'form.state'} eq 'gotusername') { |
if ($env{'form.state'} eq 'gotusername') { |
my $srch; |
|
foreach my $item (@search) { |
|
$srch->{$item} = $env{'form.'.$item}; |
|
} |
|
if ($env{'form.phase'} eq 'get_user_info') { |
if ($env{'form.phase'} eq 'get_user_info') { |
my ($currstate,$response,$forcenewuser,$results) = |
my ($currstate,$response,$forcenewuser,$results) = |
&Apache::loncreateuser::user_search_result($srch); |
&Apache::loncreateuser::user_search_result($srch); |
|
if ($env{'form.currstate'} eq 'modify') { |
|
$currstate = $env{'form.currstate'}; |
|
} |
if ($currstate eq 'select') { |
if ($currstate eq 'select') { |
$r->print(&header()); |
$r->print(&header()); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 2797 sub handler {
|
Line 2820 sub handler {
|
&print_enroll_single_student_form($r,$jscript,$ccuname, |
&print_enroll_single_student_form($r,$jscript,$ccuname, |
$ccdomain,$srch); |
$ccdomain,$srch); |
} else { |
} else { |
&get_student_username_domain_form($r,$elements); |
&get_student_username_domain_form($r,$elements,undef,$srch); |
} |
} |
} elsif ($env{'form.state'} eq 'enrolling') { |
} elsif ($env{'form.state'} eq 'enrolling') { |
$r->print(&header($jscript)); |
$r->print(&header($jscript)); |
Line 2818 sub handler {
|
Line 2841 sub handler {
|
'Course_Add_Student')); |
'Course_Add_Student')); |
&enroll_single_student($r,\@search); |
&enroll_single_student($r,\@search); |
} else { |
} else { |
&get_student_username_domain_form($r,$elements); |
&get_student_username_domain_form($r,$elements,undef,$srch); |
} |
} |
} elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) { |
} elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) { |
$r->print(&header()); |
$r->print(&header()); |