version 1.109.2.5, 2010/09/20 00:26:44
|
version 1.109.2.12, 2010/12/05 17:28:10
|
Line 330 sub print_upload_manager_header {
|
Line 330 sub print_upload_manager_header {
|
my ($sectionjs,$groupslist); |
my ($sectionjs,$groupslist); |
if ($context eq 'course') { |
if ($context eq 'course') { |
$groupslist = &get_groupslist(); |
$groupslist = &get_groupslist(); |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$sectionjs = <<"ENDJS"; |
$sectionjs = <<"ENDJS"; |
|
|
function toggleSectionsDefault() { |
function toggleSectionsDefault() { |
Line 375 ENDJS
|
Line 375 ENDJS
|
&hidden_input('fileupload',$env{'form.fileupload'}). |
&hidden_input('fileupload',$env{'form.fileupload'}). |
&hidden_input('upfiletype',$env{'form.upfiletype'}). |
&hidden_input('upfiletype',$env{'form.upfiletype'}). |
&hidden_input('upfile_associate',$env{'form.upfile_associate'}). |
&hidden_input('upfile_associate',$env{'form.upfile_associate'}). |
&hidden_input('caller',$env{'form.caller'})); |
&hidden_input('context',$env{'form.context'})); |
$r->print('<br /><label><input type="checkbox" name="noFirstLine"'.$checked.' />'. |
$r->print('<br /><label><input type="checkbox" name="noFirstLine"'.$checked.' />'. |
&mt('Ignore First Line').'</label><br />'); |
&mt('Ignore First Line').'</label><br />'); |
$r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '. |
$r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '. |
Line 415 sub javascript_validations {
|
Line 415 sub javascript_validations {
|
if ($context eq 'course') { |
if ($context eq 'course') { |
if ($env{'request.course.sec'} eq '') { |
if ($env{'request.course.sec'} eq '') { |
$setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');'; |
$setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');'; |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$setsections_js = &newsections_javascript($param{'formname'}); |
$setsections_js = &newsections_javascript($param{'formname'}); |
} else { |
} else { |
$setsections_js = |
$setsections_js = |
Line 550 END
|
Line 550 END
|
} else { |
} else { |
$section_checks = §ion_check_js(); |
$section_checks = §ion_check_js(); |
|
|
unless ($env{'form.caller'} eq 'requestcrs') { |
unless ($env{'form.context'} eq 'requestcrs') { |
$optional_checks = (<<END); |
$optional_checks = (<<END); |
var message=''; |
var message=''; |
if (foundname==0) { |
if (foundname==0) { |
Line 566 END
|
Line 566 END
|
if (message!='') { |
if (message!='') { |
message+='\\n'; |
message+='\\n'; |
} |
} |
|
message+='$alert{'section'}'; |
} |
} |
if (foundemail==0) { |
if (foundemail==0) { |
if (message!='') { |
if (message!='') { |
Line 598 END
|
Line 599 END
|
} |
} |
END |
END |
} |
} |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$optional_checks .= (<<END); |
$optional_checks .= (<<END); |
vf.state.value='enrolling'; |
vf.state.value='enrolling'; |
$finish |
$finish |
Line 629 END
|
Line 630 END
|
############################################################### |
############################################################### |
sub upload_manager_javascript_forward_associate { |
sub upload_manager_javascript_forward_associate { |
my ($can_assign) = @_; |
my ($can_assign) = @_; |
my $auth_update; |
my ($auth_update,$numbuttons,$argreset); |
if (ref($can_assign) eq 'HASH') { |
if (ref($can_assign) eq 'HASH') { |
if (keys(%{$can_assign}) > 1) { |
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==2) { |
|
eval('vf.f'+tf+'.selectedIndex=0;') |
|
alert('$warning'); |
|
} |
|
END |
|
} elsif ($numbuttons > 1) { |
$auth_update = <<"END"; |
$auth_update = <<"END"; |
// If we set the password, make the password form below correspond to |
// If we set the password, make the password form below correspond to |
// the new value. |
// the new value. |
if (nw==9) { |
if (nw==2) { |
changed_radio('int',document.studentform); |
changed_radio('int',document.studentform); |
set_auth_radio_buttons('int',document.studentform); |
set_auth_radio_buttons('int',document.studentform); |
|
$argreset |
|
} |
|
|
END |
END |
} |
} |
if ($can_assign->{'krb'}) { |
|
$auth_update .= " vf.krbarg.value='';\n"; |
|
} |
|
if ($can_assign->{'int'}) { |
|
$auth_update .= " vf.intarg.value='';\n"; |
|
} |
|
if ($can_assign->{'loc'}) { |
|
$auth_update .= " vf.locarg.value='';\n"; |
|
} |
|
$auth_update .= " |
|
}\n"; |
|
} |
} |
|
|
return(<<ENDPICK); |
return(<<ENDPICK); |
Line 668 function verify(vf,sec_caller) {
|
Line 684 function verify(vf,sec_caller) {
|
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
tw=eval('vf.f'+i+'.selectedIndex'); |
tw=eval('vf.f'+i+'.selectedIndex'); |
if (tw==1) { founduname=1; } |
if (tw==1) { founduname=1; } |
if ((tw>=2) && (tw<=6)) { foundname=1; } |
if (tw==2) { foundpwd=1; } |
if (tw==7) { foundid=1; } |
if ((tw>=3) && (tw<=7)) { foundname=1; } |
if (tw==8) { foundsec=1; } |
if (tw==8) { foundid=1; } |
if (tw==9) { foundpwd=1; } |
if (tw==9) { foundsec=1; } |
if (tw==10) { foundemail=1; } |
if (tw==10) { foundemail=1; } |
if (tw==11) { foundrole=1; } |
if (tw==11) { foundrole=1; } |
if (tw==12) { founddomain=1; } |
if (tw==12) { founddomain=1; } |
Line 688 function verify(vf,sec_caller) {
|
Line 704 function verify(vf,sec_caller) {
|
// |
// |
// 0 = none |
// 0 = none |
// 1 = username |
// 1 = username |
// 2 = names (lastname, firstnames) |
// 2 = ipwd (password) |
// 3 = fname (firstname) |
// 3 = names (lastname, firstnames) |
// 4 = mname (middlename) |
// 4 = fname (firstname) |
// 5 = lname (lastname) |
// 5 = mname (middlename) |
// 6 = gen (generation) |
// 6 = lname (lastname) |
// 7 = id |
// 7 = gen (generation) |
// 8 = section |
// 8 = id |
// 9 = ipwd (password) |
// 9 = section |
// 10 = email address |
// 10 = email address |
// 11 = role |
// 11 = role |
// 12 = domain |
// 12 = domain |
Line 711 function flip(vf,tf) {
|
Line 727 function flip(vf,tf) {
|
} |
} |
} |
} |
// If we set this to 'lastname, firstnames', clear out all the ones |
// If we set this to 'lastname, firstnames', clear out all the ones |
// set to 'fname','mname','lname','gen' (3,4,5,6) currently. |
// set to 'fname','mname','lname','gen' (4,5,6,7) currently. |
if (nw==2) { |
if (nw==3) { |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
if ((eval('vf.f'+i+'.selectedIndex')>=3) && |
if ((eval('vf.f'+i+'.selectedIndex')>=4) && |
(eval('vf.f'+i+'.selectedIndex')<=6)) { |
(eval('vf.f'+i+'.selectedIndex')<=7)) { |
eval('vf.f'+i+'.selectedIndex=0;') |
eval('vf.f'+i+'.selectedIndex=0;') |
} |
} |
} |
} |
} |
} |
// If we set this to one of 'fname','mname','lname','gen' (3,4,5,6), |
// If we set this to one of 'fname','mname','lname','gen' (4,5,6,7), |
// clear out any that are set to 'lastname, firstnames' (2) |
// clear out any that are set to 'lastname, firstnames' (3) |
if ((nw>=3) && (nw<=6)) { |
if ((nw>=4) && (nw<=7)) { |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
if (eval('vf.f'+i+'.selectedIndex')==2) { |
if (eval('vf.f'+i+'.selectedIndex')==3) { |
eval('vf.f'+i+'.selectedIndex=0;') |
eval('vf.f'+i+'.selectedIndex=0;') |
} |
} |
} |
} |
Line 735 function flip(vf,tf) {
|
Line 751 function flip(vf,tf) {
|
function clearpwd(vf) { |
function clearpwd(vf) { |
var i; |
var i; |
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
if (eval('vf.f'+i+'.selectedIndex')==9) { |
if (eval('vf.f'+i+'.selectedIndex')==2) { |
eval('vf.f'+i+'.selectedIndex=0;') |
eval('vf.f'+i+'.selectedIndex=0;') |
} |
} |
} |
} |
Line 748 ENDPICK
|
Line 764 ENDPICK
|
############################################################### |
############################################################### |
sub upload_manager_javascript_reverse_associate { |
sub upload_manager_javascript_reverse_associate { |
my ($can_assign) = @_; |
my ($can_assign) = @_; |
my $auth_update; |
my ($auth_update,$numbuttons,$argreset); |
if (ref($can_assign) eq 'HASH') { |
if (ref($can_assign) eq 'HASH') { |
if (keys(%{$can_assign}) > 1) { |
if ($can_assign->{'krb4'} || $can_assign->{'krb5'}) { |
$auth_update = <<"END"; |
$argreset .= " vf.krbarg.value='';\n"; |
// initial password specified, pick internal authentication |
$numbuttons ++ ; |
if (tf==8 && nw!=0) { |
|
changed_radio('int',document.studentform); |
|
set_auth_radio_buttons('int',document.studentform); |
|
END |
|
} |
|
if ($can_assign->{'krb'}) { |
|
$auth_update .= " vf.krbarg.value='';\n"; |
|
} |
} |
if ($can_assign->{'int'}) { |
if ($can_assign->{'int'}) { |
$auth_update .= " vf.intarg.value='';\n"; |
$argreset .= " vf.intarg.value='';\n"; |
|
$numbuttons ++; |
} |
} |
if ($can_assign->{'loc'}) { |
if ($can_assign->{'loc'}) { |
$auth_update .= " vf.locarg.value='';\n"; |
$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==1 && 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==1 && nw!=0) { |
|
changed_radio('int',document.studentform); |
|
set_auth_radio_buttons('int',document.studentform); |
|
$argreset |
|
} |
|
|
|
END |
} |
} |
$auth_update .= " |
|
}\n"; |
|
} |
} |
|
|
return(<<ENDPICK); |
return(<<ENDPICK); |
function verify(vf,sec_caller) { |
function verify(vf,sec_caller) { |
var founduname=0; |
var founduname=0; |
Line 777 function verify(vf,sec_caller) {
|
Line 809 function verify(vf,sec_caller) {
|
var foundname=0; |
var foundname=0; |
var foundid=0; |
var foundid=0; |
var foundsec=0; |
var foundsec=0; |
|
var foundemail=0; |
var foundrole=0; |
var foundrole=0; |
var founddomain=0; |
var founddomain=0; |
var foundinststatus=0; |
var foundinststatus=0; |
Line 784 function verify(vf,sec_caller) {
|
Line 817 function verify(vf,sec_caller) {
|
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
tw=eval('vf.f'+i+'.selectedIndex'); |
tw=eval('vf.f'+i+'.selectedIndex'); |
if (i==0 && tw!=0) { founduname=1; } |
if (i==0 && tw!=0) { founduname=1; } |
if (((i>=1) && (i<=5)) && tw!=0 ) { foundname=1; } |
if (i==1 && tw!=0) { foundpwd=1; } |
if (i==6 && tw!=0) { foundid=1; } |
if (((i>=2) && (i<=6)) && tw!=0 ) { foundname=1; } |
if (i==7 && tw!=0) { foundsec=1; } |
if (i==7 && tw!=0) { foundid=1; } |
if (i==8 && tw!=0) { foundpwd=1; } |
if (i==8 && tw!=0) { foundsec=1; } |
if (i==9 && tw!=0) { foundrole=1; } |
if (i==9 && tw!=0) { foundemail=1; } |
if (i==10 && tw!=0) { founddomain=1; } |
if (i==10 && tw!=0) { foundrole=1; } |
if (i==13 && tw!=0) { foundinstatus=1; } |
if (i==11 && tw!=0) { founddomain=1; } |
|
if (i==12 && tw!=0) { foundinstatus=1; } |
} |
} |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundrole,founddomain,foundinststatus); |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus); |
} |
} |
|
|
function flip(vf,tf) { |
function flip(vf,tf) { |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var i; |
var i; |
// picked the all one name field, reset the other name ones to blank |
// picked the all one name field, reset the other name ones to blank |
if (tf==1 && nw!=0) { |
if (tf==2 && nw!=0) { |
for (i=2;i<=5;i++) { |
for (i=3;i<=6;i++) { |
eval('vf.f'+i+'.selectedIndex=0;') |
eval('vf.f'+i+'.selectedIndex=0;') |
} |
} |
} |
} |
//picked one of the piecewise name fields, reset the all in |
//picked one of the piecewise name fields, reset the all in |
//one field to blank |
//one field to blank |
if ((tf>=2) && (tf<=5) && (nw!=0)) { |
if ((tf>=3) && (tf<=6) && (nw!=0)) { |
eval('vf.f1.selectedIndex=0;') |
eval('vf.f2.selectedIndex=0;') |
} |
} |
$auth_update |
$auth_update |
} |
} |
|
|
function clearpwd(vf) { |
function clearpwd(vf) { |
var i; |
var i; |
if (eval('vf.f8.selectedIndex')!=0) { |
if (eval('vf.f1.selectedIndex')!=0) { |
eval('vf.f8.selectedIndex=0;') |
eval('vf.f1.selectedIndex=0;') |
} |
} |
} |
} |
ENDPICK |
ENDPICK |
Line 838 sub print_upload_manager_footer {
|
Line 872 sub print_upload_manager_footer {
|
$env{'form.ipwd_choice'} ne '') { |
$env{'form.ipwd_choice'} ne '') { |
$param{'curr_authtype'} = 'int'; |
$param{'curr_authtype'} = 'int'; |
} |
} |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$param{'caller'} = $env{'form.caller'}; |
$param{'context'} = $env{'form.context'}; |
} |
} |
my $krbform = &Apache::loncommon::authform_kerberos(%param); |
my $krbform = &Apache::loncommon::authform_kerberos(%param); |
my $intform = &Apache::loncommon::authform_internal(%param); |
my $intform = &Apache::loncommon::authform_internal(%param); |
Line 853 sub print_upload_manager_footer {
|
Line 887 sub print_upload_manager_footer {
|
|
|
$Str .= '<h3>'.&mt('Options').'</h3>' |
$Str .= '<h3>'.&mt('Options').'</h3>' |
.&Apache::lonhtmlcommon::start_pick_box(); |
.&Apache::lonhtmlcommon::start_pick_box(); |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default password')); |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default password')); |
} else { |
} else { |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Login Type')); |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Login Type')); |
Line 879 sub print_upload_manager_footer {
|
Line 913 sub print_upload_manager_footer {
|
$Str .= "</p>\n"; |
$Str .= "</p>\n"; |
} |
} |
$Str .= &set_login($defdom,$krbform,$intform,$locform); |
$Str .= &set_login($defdom,$krbform,$intform,$locform); |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$Str .= '<input type="hidden" name="defaultdomain" value="gcitest" />'; |
$Str .= '<input type="hidden" name="defaultdomain" value="'.$defdom.'" />'; |
} |
} |
my ($home_server_pick,$numlib) = |
my ($home_server_pick,$numlib) = |
&Apache::loncommon::home_server_form_item($defdom,'lcserver', |
&Apache::loncommon::home_server_form_item($defdom,'lcserver', |
Line 897 sub print_upload_manager_footer {
|
Line 931 sub print_upload_manager_footer {
|
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
} |
} |
|
|
unless ($env{'form.caller'} eq 'requestcrs') { |
unless ($env{'form.context'} eq 'requestcrs') { |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain')) |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain')) |
.&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1) |
.&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1) |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_closure() |
Line 924 sub print_upload_manager_footer {
|
Line 958 sub print_upload_manager_footer {
|
&mt('Default role')) |
&mt('Default role')) |
.&mt('Choose the role to assign to users without a value specified in the uploaded file.') |
.&mt('Choose the role to assign to users without a value specified in the uploaded file.') |
} elsif ($context eq 'course') { |
} elsif ($context eq 'course') { |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default section')). |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Default section')). |
&mt('Students can be assigned to different sections.').'<br />'. |
&mt('Students can be assigned to different sections.').'<br />'. |
&mt('Will you be using sections?').' '. |
&mt('Will you be using sections?').' '. |
Line 964 sub print_upload_manager_footer {
|
Line 998 sub print_upload_manager_footer {
|
} else { |
} else { |
my ($cnum,$cdom) = &get_course_identity(); |
my ($cnum,$cdom) = &get_course_identity(); |
my ($rowtitle,$closure); |
my ($rowtitle,$closure); |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$closure = 1; |
$closure = 1; |
$rowtitle = &mt('default section name (letters/numbers only)'); |
$rowtitle = &mt('default section name (letters/numbers only)'); |
} else { |
} else { |
Line 972 sub print_upload_manager_footer {
|
Line 1006 sub print_upload_manager_footer {
|
} |
} |
my $secbox = §ion_picker($cdom,$cnum,'Any',$rowtitle, |
my $secbox = §ion_picker($cdom,$cnum,'Any',$rowtitle, |
$permission,$context,'upload',$crstype, |
$permission,$context,'upload',$crstype, |
$env{'form.caller'}). |
$env{'form.context'}). |
&Apache::lonhtmlcommon::row_closure($closure); |
&Apache::lonhtmlcommon::row_closure($closure); |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$Str .= '<div id ="defaultsec" style="display: none" />'.$secbox.'</div>'; |
$Str .= '<div id ="defaultsec" style="display: none" />'.$secbox.'</div>'; |
} else { |
} else { |
$Str .= $secbox; |
$Str .= $secbox; |
Line 991 sub print_upload_manager_footer {
|
Line 1025 sub print_upload_manager_footer {
|
stus => 'Students selected from this list can be dropped.' |
stus => 'Students selected from this list can be dropped.' |
); |
); |
} |
} |
unless ($env{'form.caller'} eq 'requestcrs') { |
unless ($env{'form.context'} eq 'requestcrs') { |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Full Update')) |
$Str .= &Apache::lonhtmlcommon::row_title(&mt('Full Update')) |
.'<label><input type="checkbox" name="fullup" value="yes" />' |
.'<label><input type="checkbox" name="fullup" value="yes" />' |
.' '.$lt{'disp'} |
.' '.$lt{'disp'} |
Line 1001 sub print_upload_manager_footer {
|
Line 1035 sub print_upload_manager_footer {
|
} |
} |
} |
} |
if ($context eq 'course' || $context eq 'domain') { |
if ($context eq 'course' || $context eq 'domain') { |
unless ($env{'form.caller'} eq 'requestcrs') { |
unless ($env{'form.context'} eq 'requestcrs') { |
$Str .= &forceid_change($context); |
$Str .= &forceid_change($context); |
} |
} |
} |
} |
Line 1189 sub setup_date_selectors {
|
Line 1223 sub setup_date_selectors {
|
|
|
|
|
sub get_dates_from_form { |
sub get_dates_from_form { |
my ($startname,$endname) = @_; |
my ($startname,$endname,$timezone) = @_; |
if ($startname eq '') { |
if ($startname eq '') { |
$startname = 'startdate'; |
$startname = 'startdate'; |
} |
} |
if ($endname eq '') { |
if ($endname eq '') { |
$endname = 'enddate'; |
$endname = 'enddate'; |
} |
} |
my $startdate = &Apache::lonhtmlcommon::get_date_from_form($startname); |
my $startdate = &Apache::lonhtmlcommon::get_date_from_form($startname,$timezone); |
my $enddate = &Apache::lonhtmlcommon::get_date_from_form($endname); |
my $enddate = &Apache::lonhtmlcommon::get_date_from_form($endname,$timezone); |
if ($env{'form.no_end_date'}) { |
if ($env{'form.no_end_date'}) { |
$enddate = 0; |
$enddate = 0; |
} |
} |
Line 2676 END
|
Line 2710 END
|
); |
); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
if (defined($navmap)) { |
if (defined($navmap)) { |
my @allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/default_1261144274.sequence',sub { $_[0]->is_problem() },0); |
my $sequence = &Apache::loncommon::get_citest_map($cdom); |
|
my @allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/'.$sequence,sub { $_[0]->is_problem() },0); |
foreach my $resource (@allres) { |
foreach my $resource (@allres) { |
my @parts = $resource->parts(); |
my @parts = $resource->parts(); |
my $count = scalar(@parts); |
my $count = scalar(@parts); |
Line 3910 sub print_first_users_upload_form {
|
Line 3945 sub print_first_users_upload_form {
|
.&Apache::lonhtmlcommon::end_pick_box(); |
.&Apache::lonhtmlcommon::end_pick_box(); |
|
|
$str .= '<p>' |
$str .= '<p>' |
.'<input type="hidden" name=caller" value="'.$caller.'" />' |
.'<input type="hidden" name="context" value="'.$caller.'" />' |
.'<input type="submit" name="fileupload" value="'.&mt('Next').'" />' |
.'<input type="submit" name="fileupload" value="'.&mt('Next').'" />' |
.'</p>'; |
.'</p>'; |
|
|
Line 3935 sub upfile_drop_add {
|
Line 3970 sub upfile_drop_add {
|
$fields{$env{'form.f'.$i}}=$keyfields[$i]; |
$fields{$env{'form.f'.$i}}=$keyfields[$i]; |
} |
} |
} |
} |
if ($env{'form.fullup'} ne 'yes') { |
if (($env{'form.fullup'} ne 'yes') && ($env{'form.context'} ne 'requestcrs')) { |
$r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n". |
$r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n". |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'); |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'); |
} |
} |
Line 3974 sub upfile_drop_add {
|
Line 4009 sub upfile_drop_add {
|
} |
} |
} |
} |
my ($startdate,$enddate); |
my ($startdate,$enddate); |
if ($env{'form.caller'} eq 'requestcrs') { |
if ($env{'form.context'} eq 'requestcrs') { |
$startdate = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_start_date'}; |
$startdate = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_start_date'}; |
$enddate = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_end_date'}; |
$enddate = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_end_date'}; |
} else { |
} else { |
Line 4150 sub upfile_drop_add {
|
Line 4185 sub upfile_drop_add {
|
my (%curr_rules,%got_rules,%alerts,%cancreate); |
my (%curr_rules,%got_rules,%alerts,%cancreate); |
my %customroles = &my_custom_roles($crstype); |
my %customroles = &my_custom_roles($crstype); |
my @permitted_roles = |
my @permitted_roles = |
&roles_on_upload($context,$setting,$crstype,%customroles); |
&roles_on_upload($context,$setting,$crstype,%customroles); |
my %longtypes = &Apache::lonlocal::texthash( |
my %longtypes = &Apache::lonlocal::texthash( |
official => 'Institutional', |
official => 'Institutional', |
unofficial => 'Non-institutional', |
unofficial => 'Non-institutional', |
Line 4161 sub upfile_drop_add {
|
Line 4196 sub upfile_drop_add {
|
my @secs; |
my @secs; |
my %entries=&Apache::loncommon::record_sep($line); |
my %entries=&Apache::loncommon::record_sep($line); |
# Determine user name |
# Determine user name |
|
$entries{$fields{'username'}} =~ s/^\s+|\s+$//g; |
unless (($entries{$fields{'username'}} eq '') || |
unless (($entries{$fields{'username'}} eq '') || |
(!defined($entries{$fields{'username'}}))) { |
(!defined($entries{$fields{'username'}}))) { |
my ($fname, $mname, $lname,$gen) = ('','','',''); |
my ($fname, $mname, $lname,$gen) = ('','','',''); |
Line 4181 sub upfile_drop_add {
|
Line 4217 sub upfile_drop_add {
|
$gen=$entries{$fields{'gen'}}; |
$gen=$entries{$fields{'gen'}}; |
} |
} |
} |
} |
|
|
if ($entries{$fields{'username'}} |
if ($entries{$fields{'username'}} |
ne &LONCAPA::clean_username($entries{$fields{'username'}})) { |
ne &LONCAPA::clean_username($entries{$fields{'username'}})) { |
|
my $nowhitespace; |
|
if ($entries{$fields{'username'}} =~ /\s/) { |
|
$nowhitespace = ' - '.&mt('usernames may not contain spaces.'); |
|
} |
$r->print('<br />'. |
$r->print('<br />'. |
&mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]', |
&mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]', |
'<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen)); |
'<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen). |
|
$nowhitespace); |
next; |
next; |
} else { |
} else { |
|
$entries{$fields{'domain'}} =~ s/^\s+|\s+$//g; |
if ($entries{$fields{'domain'}} |
if ($entries{$fields{'domain'}} |
ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) { |
ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) { |
$r->print('<br />'. '<b>'.$entries{$fields{'domain'}}. |
$r->print('<br />'. '<b>'.$entries{$fields{'domain'}}. |
Line 4246 sub upfile_drop_add {
|
Line 4289 sub upfile_drop_add {
|
# determine email address |
# determine email address |
my $email=''; |
my $email=''; |
if (defined($fields{'email'})) { |
if (defined($fields{'email'})) { |
|
$entries{$fields{'email'}} =~ s/^\s+|\s+$//g; |
if (defined($entries{$fields{'email'}})) { |
if (defined($entries{$fields{'email'}})) { |
$email=$entries{$fields{'email'}}; |
$email=$entries{$fields{'email'}}; |
unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; } |
unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; } |
Line 4292 sub upfile_drop_add {
|
Line 4336 sub upfile_drop_add {
|
$role = $defaultrole; |
$role = $defaultrole; |
} |
} |
# Clean up whitespace |
# Clean up whitespace |
foreach (\$id,\$fname,\$mname,\$lname,\$gen) { |
foreach (\$id,\$fname,\$mname,\$lname,\$gen,\$inststatus) { |
$$_ =~ s/(\s+$|^\s+)//g; |
$$_ =~ s/(\s+$|^\s+)//g; |
} |
} |
# check against rules |
# check against rules |
Line 4310 sub upfile_drop_add {
|
Line 4354 sub upfile_drop_add {
|
} |
} |
$checkid = 1; |
$checkid = 1; |
$newuser = 1; |
$newuser = 1; |
my $user = $username.':'.$domain; |
|
if ($username =~/^[^\@]+\@[^\@]+$/) { |
if ($username =~/^[^\@]+\@[^\@]+$/) { |
if ($email eq '') { |
if ($email eq '') { |
$email = $username; |
$email = $username; |
Line 4334 sub upfile_drop_add {
|
Line 4377 sub upfile_drop_add {
|
} |
} |
} |
} |
} |
} |
|
my $user = $username.':'.$userdomain; |
if ($newuser) { |
if ($newuser) { |
my $checkhash; |
my $checkhash; |
my $checks = { 'username' => 1 }; |
my $checks = { 'username' => 1 }; |
Line 4351 sub upfile_drop_add {
|
Line 4395 sub upfile_drop_add {
|
} |
} |
} |
} |
} |
} |
} |
my $usertype = 'unofficial'; |
my $usertype = 'unofficial'; |
if (ref($rulematch{$user}) eq 'HASH') { |
if (ref($rulematch{$user}) eq 'HASH') { |
if ($rulematch{$user}{'username'}) { |
if ($rulematch{$user}{'username'}) { |
$usertype = 'official'; |
$usertype = 'official'; |
} |
|
} |
|
if (!$cancreate{$usertype}) { |
|
my $showtype = $longtypes{$usertype}; |
|
if ($usertype eq 'unofficial') { |
|
$r->print('<br />'. |
|
&mt("[_1]: The user does not exist, and the new user's username must be an e-mail address.",'<b>'.$username.'</b>')); |
|
} else { |
|
$r->print('<br />'. |
|
&mt("[_1]: The user does not exist, and you are not permitted to create users of type: [_2].",'<b>'.$username.'</b>',$showtype)); |
|
} |
|
next; |
} |
} |
} |
|
if (!$cancreate{$usertype}) { |
|
r->print('<br />'. |
|
&mt("[_1]: The user does not exist, and you are not permitted to create users of type: $longtypes{$usertype}.",'<b>'.$username.'</b>')); |
|
next; |
|
} |
|
} else { |
} else { |
if ($context eq 'course' || $context eq 'author') { |
if ($context eq 'course' || $context eq 'author') { |
if ($userdomain eq $domain ) { |
if ($userdomain eq $domain ) { |
Line 5119 sub setsections_javascript {
|
Line 5168 sub setsections_javascript {
|
accr => 'A course coordinator role will be added with access to all sections.', |
accr => 'A course coordinator role will be added with access to all sections.', |
acor => 'A coordinator role will be added with access to all sections', |
acor => 'A coordinator role will be added with access to all sections', |
inea => 'In each course, each user may only have one student role at a time.', |
inea => 'In each course, each user may only have one student role at a time.', |
inco => 'In each community, each user may only have on member role at a time.', |
inec => 'In each community, each user may only have on member role at a time.', |
youh => 'You had selected ', |
youh => 'You had selected ', |
secs => 'sections.', |
secs => 'sections.', |
plmo => 'Please modify your selections so they include no more than one section.', |
plmo => 'Please modify your selections so they include no more than one section.', |
Line 5184 function setSections(formname,crstype) {
|
Line 5233 function setSections(formname,crstype) {
|
if (crstype == 'Community') { |
if (crstype == 'Community') { |
alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
} else { |
} else { |
alert("$alerts{'inco'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
alert("$alerts{'inec'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
} |
} |
return; |
return; |
} |
} |