version 1.143, 2012/10/04 13:41:10
|
version 1.160, 2013/12/24 19:15:11
|
Line 237 sub domain_roles_select {
|
Line 237 sub domain_roles_select {
|
# Role types |
# Role types |
my @roletypes = ('domain','author','course','community'); |
my @roletypes = ('domain','author','course','community'); |
my %lt = &role_type_names(); |
my %lt = &role_type_names(); |
|
my $onchangefirst = "updateCols('showrole')"; |
|
my $onchangesecond = "updateCols('showrole')"; |
# |
# |
# build up the menu information to be passed to |
# build up the menu information to be passed to |
# &Apache::loncommon::linked_select_forms |
# &Apache::loncommon::linked_select_forms |
Line 283 sub domain_roles_select {
|
Line 285 sub domain_roles_select {
|
my $result = &Apache::loncommon::linked_select_forms |
my $result = &Apache::loncommon::linked_select_forms |
('studentform',(' 'x3).&mt('Role: '),$env{'form.roletype'}, |
('studentform',(' 'x3).&mt('Role: '),$env{'form.roletype'}, |
'roletype','showrole',\%select_menus, |
'roletype','showrole',\%select_menus, |
['domain','author','course','community']); |
['domain','author','course','community'],$onchangefirst, |
|
$onchangesecond); |
return $result; |
return $result; |
} |
} |
|
|
Line 335 sub print_upload_manager_header {
|
Line 338 sub print_upload_manager_header {
|
$env{'request.role.domain'},$context, |
$env{'request.role.domain'},$context, |
$groupslist,$crstype); |
$groupslist,$crstype); |
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':''); |
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':''); |
$r->print('<p>' |
$r->print( |
.&mt('Total number of records found in file: [_1]' |
'<h3>'.&mt('Identify fields in uploaded list')."</h3>\n". |
,'<b>'.$distotal.'</b>') |
'<p class="LC_info">'. |
."</p>\n"); |
&mt('Total number of records found in file: [_1]' |
$r->print('<div class="LC_left_float"><h3>'. |
,'<b>'.$distotal.'</b>'). |
&mt('Identify fields in uploaded list')."</h3>\n"); |
"</p>\n" |
$r->print(&mt('Enter as many fields as you can.<br /> The system will inform you and bring you back to this page, <br /> if the data selected are insufficient to add users.')."<br />\n"); |
); |
|
if ($distotal == 0) { |
|
$r->print('<p class="LC_warning">'.&mt('None found').'</p>'); |
|
} |
|
$r->print( |
|
'<p>'. |
|
&mt('Enter as many fields as you can.').'<br />'. |
|
&mt('The system will inform you and bring you back to this page,[_1]if the data selected are insufficient to add users.','<br />'). |
|
"</p>\n" |
|
); |
$r->print(&hidden_input('action','upload'). |
$r->print(&hidden_input('action','upload'). |
&hidden_input('state','got_file'). |
&hidden_input('state','got_file'). |
&hidden_input('associate',''). |
&hidden_input('associate',''). |
Line 349 sub print_upload_manager_header {
|
Line 361 sub print_upload_manager_header {
|
&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'})); |
$r->print('<br /><label><input type="checkbox" name="noFirstLine"'.$checked.' />'. |
$r->print( |
&mt('Ignore First Line').'</label><br />'); |
'<div class="LC_left_float">'. |
$r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '. |
'<fieldset><legend>'.&mt('Functions').'</legend>'. |
|
'<label><input type="checkbox" name="noFirstLine"'.$checked.' />'. |
|
&mt('Ignore First Line').'</label>'. |
|
' <input type="button" value="'.&mt('Reverse Association').'" '. |
'name="Reverse Association" '. |
'name="Reverse Association" '. |
'onclick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />'); |
'onclick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />'. |
$r->print("<br /><br />\n". |
'</fieldset></div><br clear="all" />' |
'<script type="text/javascript" language="Javascript">'."\n". |
); |
'// <![CDATA['."\n". |
$r->print( |
$javascript."\n".$javascript_validations."\n". |
'<script type="text/javascript" language="Javascript">'."\n". |
'// ]]>'."\n". |
'// <![CDATA['."\n". |
'</script>'); |
$javascript."\n".$javascript_validations."\n". |
|
'// ]]>'."\n". |
|
'</script>' |
|
); |
} |
} |
|
|
############################################################### |
############################################################### |
Line 381 sub javascript_validations {
|
Line 399 sub javascript_validations {
|
$param{'curr_autharg'} = $curr_authfield; |
$param{'curr_autharg'} = $curr_authfield; |
} |
} |
|
|
|
my $showcredits; |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($domain); |
|
if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) { |
|
$showcredits = 1; |
|
} |
|
|
my ($setsection_call,$setsections_js); |
my ($setsection_call,$setsections_js); |
my $finish = " vf.submit();\n"; |
my $finish = " vf.submit();\n"; |
if ($mode eq 'upload') { |
if ($mode eq 'upload') { |
Line 390 sub javascript_validations {
|
Line 414 sub javascript_validations {
|
$setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');'; |
$setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');'; |
$setsections_js = |
$setsections_js = |
&setsections_javascript($param{'formname'},$groupslist, |
&setsections_javascript($param{'formname'},$groupslist, |
$mode,'',$crstype); |
$mode,'',$crstype,$showcredits); |
} else { |
} else { |
$setsection_call = "'ok'"; |
$setsection_call = "'ok'"; |
} |
} |
} elsif ($context eq 'domain') { |
} elsif ($context eq 'domain') { |
$setsection_call = 'setCourse()'; |
$setsection_call = 'setCourse()'; |
$setsections_js = &dc_setcourse_js($param{'formname'},$mode,$context); |
$setsections_js = &dc_setcourse_js($param{'formname'},$mode, |
|
$context,$showcredits); |
} |
} |
$finish = " var checkSec = $setsection_call\n". |
$finish = " var checkSec = $setsection_call\n". |
" if (checkSec == 'ok') {\n". |
" if (checkSec == 'ok') {\n". |
Line 419 sub javascript_validations {
|
Line 444 sub javascript_validations {
|
domain => 'The optional domain field was not specified.', |
domain => 'The optional domain field was not specified.', |
continue => 'Continue adding users?', |
continue => 'Continue adding users?', |
); |
); |
|
if ($showcredits) { |
|
$alert{'credits'} = &mt('The optional credits field was not specified'); |
|
} |
if (($mode eq 'upload') && ($context eq 'domain')) { |
if (($mode eq 'upload') && ($context eq 'domain')) { |
$alert{'inststatus'} = &mt('The optional affiliation field was not specified'); |
$alert{'inststatus'} = &mt('The optional affiliation field was not specified'); |
} |
} |
my $function_name = <<"END"; |
my $function_name = <<"END"; |
$setsections_js |
$setsections_js |
|
|
function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus) { |
function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus,foundcredits) { |
END |
END |
my ($authnum,%can_assign) = &Apache::loncommon::get_assignable_auth($domain); |
my ($authnum,%can_assign) = &Apache::loncommon::get_assignable_auth($domain); |
my $auth_checks; |
my $auth_checks; |
Line 482 END
|
Line 510 END
|
return; |
return; |
} |
} |
} |
} |
|
/* regexp here to check for non \d \. in credits */ |
END |
END |
} else { |
} else { |
$auth_checks .= (<<END); |
$auth_checks .= (<<END); |
Line 554 END
|
Line 583 END
|
message+='$alert{'domain'}'; |
message+='$alert{'domain'}'; |
} |
} |
END |
END |
|
if ($showcredits) { |
|
$optional_checks .= <<END; |
|
if (foundcredits==0) { |
|
if (message!='') { |
|
message+='\\n'; |
|
} |
|
message+='$alert{'credits'}'; |
|
} |
|
END |
|
} |
if (($mode eq 'upload') && ($context eq 'domain')) { |
if (($mode eq 'upload') && ($context eq 'domain')) { |
$optional_checks .= (<<END); |
$optional_checks .= (<<END); |
|
|
Line 603 sub upload_manager_javascript_forward_as
|
Line 642 sub upload_manager_javascript_forward_as
|
$numbuttons ++; |
$numbuttons ++; |
} |
} |
if (!$can_assign->{'int'}) { |
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'). |
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.'); |
&mt('Your current role does not have rights to create users with that authentication type.'); |
$auth_update = <<"END"; |
$auth_update = <<"END"; |
// Currently the initial password field is only supported for internal auth |
// Currently the initial password field is only supported for internal auth |
Line 638 function verify(vf,sec_caller) {
|
Line 677 function verify(vf,sec_caller) {
|
var foundrole=0; |
var foundrole=0; |
var founddomain=0; |
var founddomain=0; |
var foundinststatus=0; |
var foundinststatus=0; |
|
var foundcredits=0; |
var tw; |
var tw; |
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'); |
Line 650 function verify(vf,sec_caller) {
|
Line 690 function verify(vf,sec_caller) {
|
if (tw==11) { foundrole=1; } |
if (tw==11) { foundrole=1; } |
if (tw==12) { founddomain=1; } |
if (tw==12) { founddomain=1; } |
if (tw==13) { foundinststatus=1; } |
if (tw==13) { foundinststatus=1; } |
|
if (tw==14) { foundcredits=1; } |
} |
} |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus); |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus,foundcredits); |
} |
} |
|
|
// |
// |
Line 674 function verify(vf,sec_caller) {
|
Line 715 function verify(vf,sec_caller) {
|
// 11 = role |
// 11 = role |
// 12 = domain |
// 12 = domain |
// 13 = inststatus |
// 13 = inststatus |
|
// 14 = foundcredits |
|
|
function flip(vf,tf) { |
function flip(vf,tf) { |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
var nw=eval('vf.f'+tf+'.selectedIndex'); |
Line 771 function verify(vf,sec_caller) {
|
Line 813 function verify(vf,sec_caller) {
|
var foundrole=0; |
var foundrole=0; |
var founddomain=0; |
var founddomain=0; |
var foundinststatus=0; |
var foundinststatus=0; |
|
var foundcredits=0; |
var tw; |
var tw; |
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'); |
Line 783 function verify(vf,sec_caller) {
|
Line 826 function verify(vf,sec_caller) {
|
if (i==10 && tw!=0) { foundrole=1; } |
if (i==10 && tw!=0) { foundrole=1; } |
if (i==11 && tw!=0) { founddomain=1; } |
if (i==11 && tw!=0) { founddomain=1; } |
if (i==12 && tw!=0) { foundinstatus=1; } |
if (i==12 && tw!=0) { foundinstatus=1; } |
|
if (i==13 && tw!=0) { foundcredits=1; } |
} |
} |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus); |
verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus,foundcredits); |
} |
} |
|
|
function flip(vf,tf) { |
function flip(vf,tf) { |
Line 816 ENDPICK
|
Line 860 ENDPICK
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub print_upload_manager_footer { |
sub print_upload_manager_footer { |
my ($r,$i,$keyfields,$defdom,$today,$halfyear,$context,$permission,$crstype) = @_; |
my ($r,$i,$keyfields,$defdom,$today,$halfyear,$context,$permission,$crstype, |
|
$showcredits) = @_; |
my $form = 'document.studentform'; |
my $form = 'document.studentform'; |
my $formname = 'studentform'; |
my $formname = 'studentform'; |
my ($krbdef,$krbdefdom) = |
my ($krbdef,$krbdefdom) = |
Line 905 sub print_upload_manager_footer {
|
Line 950 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') { |
$Str .= &Apache::lonhtmlcommon::row_title( |
if ($showcredits) { |
|
$Str .= &Apache::lonhtmlcommon::row_title( |
|
&mt('Default role, section and credits')) |
|
.&mt('Choose the role and/or section(s) and/or credits to assign to users without values specified in the uploaded file.'); |
|
} else { |
|
$Str .= &Apache::lonhtmlcommon::row_title( |
&mt('Default role and section')) |
&mt('Default role and section')) |
.&mt('Choose the role and/or section(s) to assign to users without values specified in the uploaded file.'); |
.&mt('Choose the role and/or section(s) to assign to users without values specified in the uploaded file.'); |
|
} |
} else { |
} else { |
$Str .= &Apache::lonhtmlcommon::row_title( |
$Str .= &Apache::lonhtmlcommon::row_title( |
&mt('Default role and/or section(s)')) |
&mt('Default role and/or section(s)')) |
Line 915 sub print_upload_manager_footer {
|
Line 966 sub print_upload_manager_footer {
|
} |
} |
if (($context eq 'domain') || ($context eq 'author')) { |
if (($context eq 'domain') || ($context eq 'author')) { |
$Str .= '<br />'; |
$Str .= '<br />'; |
my ($options,$cb_script,$coursepick) = &default_role_selector($context,1); |
my ($options,$cb_script,$coursepick) = |
|
&default_role_selector($context,1,'',$showcredits); |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$Str .= '<p>' |
$Str .= '<p>' |
.'<b>'.&mt('Domain Level').'</b><br />' |
.'<b>'.&mt('Domain Level').'</b><br />' |
Line 932 sub print_upload_manager_footer {
|
Line 984 sub print_upload_manager_footer {
|
} else { |
} else { |
my ($cnum,$cdom) = &get_course_identity(); |
my ($cnum,$cdom) = &get_course_identity(); |
my $rowtitle = &mt('section'); |
my $rowtitle = &mt('section'); |
my $secbox = §ion_picker($cdom,$cnum,'Any',$rowtitle, |
my $defaultcredits; |
$permission,$context,'upload',$crstype); |
if ($showcredits) { |
|
$defaultcredits = &get_defaultcredits(); |
|
} |
|
my $secbox = §ion_picker($cdom,$cnum,'Any',$rowtitle,$permission, |
|
$context,'upload',$crstype,$showcredits, |
|
$defaultcredits); |
$Str .= $secbox |
$Str .= $secbox |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
my %lt; |
my %lt; |
Line 979 sub print_upload_manager_footer {
|
Line 1036 sub print_upload_manager_footer {
|
return; |
return; |
} |
} |
|
|
|
sub get_defaultcredits { |
|
my ($cdom,$cnum) = @_; |
|
|
|
if ($cdom eq '' || $cnum eq '') { |
|
return unless ($env{'request.course.id'}); |
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
} |
|
return unless(($cdom =~ /^$match_domain$/) && ($cnum =~ /^$match_courseid$/)); |
|
my ($defaultcredits,$domdefcredits); |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); |
|
if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) { |
|
my $instcode = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'}; |
|
if ($instcode) { |
|
$domdefcredits = $domdefaults{'officialcredits'}; |
|
} elsif ($env{'course.'.$cdom.'_'.$cnum.'.internal.textbook'}) { |
|
$domdefcredits = $domdefaults{'textbookcredits'}; |
|
} else { |
|
$domdefcredits = $domdefaults{'unofficialcredits'}; |
|
} |
|
} else { |
|
return; |
|
} |
|
|
|
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
|
$defaultcredits = $env{'course.'.$cdom.'_'.$cnum.'.internal.defaultcredits'}; |
|
} elsif (exists($env{'course.'.$cdom.'_'.$cnum.'.internal.defaultcredits'})) { |
|
$defaultcredits = $env{'course.'.$cdom.'_'.$cnum.'.internal.defaultcredits'}; |
|
} else { |
|
my %crsinfo = |
|
&Apache::lonnet::coursedescription("$cdom/$cnum",{'one_time' => 1}); |
|
$defaultcredits = $crsinfo{'internal.defaultcredits'}; |
|
} |
|
if ($defaultcredits eq '') { |
|
$defaultcredits = $domdefcredits; |
|
} |
|
return $defaultcredits; |
|
} |
|
|
sub forceid_change { |
sub forceid_change { |
my ($context) = @_; |
my ($context) = @_; |
my $output = |
my $output = |
Line 1000 sub forceid_change {
|
Line 1096 sub forceid_change {
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub print_upload_manager_form { |
sub print_upload_manager_form { |
my ($r,$context,$permission,$crstype) = @_; |
my ($r,$context,$permission,$crstype,$showcredits) = @_; |
my $firstLine; |
my $firstLine; |
my $datatoken; |
my $datatoken; |
if (!$env{'form.datatoken'}) { |
if (!$env{'form.datatoken'}) { |
Line 1033 sub print_upload_manager_form {
|
Line 1129 sub print_upload_manager_form {
|
'domain_choice' => 'scalar', |
'domain_choice' => 'scalar', |
'inststatus_choice' => 'scalar', |
'inststatus_choice' => 'scalar', |
}; |
}; |
my $defdom = $env{'request.role.domain'}; |
if ($showcredits) { |
|
$col_setting_names->{'credits_choice'} = 'scalar'; |
|
} |
if ($context eq 'course') { |
if ($context eq 'course') { |
&Apache::loncommon::restore_course_settings('enrollment_upload', |
&Apache::loncommon::restore_course_settings('enrollment_upload', |
$col_setting_names); |
$col_setting_names); |
Line 1041 sub print_upload_manager_form {
|
Line 1139 sub print_upload_manager_form {
|
&Apache::loncommon::restore_settings($context,'user_upload', |
&Apache::loncommon::restore_settings($context,'user_upload', |
$col_setting_names); |
$col_setting_names); |
} |
} |
|
my $defdom = $env{'request.role.domain'}; |
# |
# |
# Determine kerberos parameters as appropriate |
# Determine kerberos parameters as appropriate |
my ($krbdef,$krbdefdom) = |
my ($krbdef,$krbdefdom) = |
Line 1066 sub print_upload_manager_form {
|
Line 1165 sub print_upload_manager_form {
|
['role',&mt('Role'), $env{'form.role_choice'}], |
['role',&mt('Role'), $env{'form.role_choice'}], |
['domain',&mt('Domain'), $env{'form.domain_choice'}], |
['domain',&mt('Domain'), $env{'form.domain_choice'}], |
['inststatus',&mt('Affiliation'), $env{'form.inststatus_choice'}]); |
['inststatus',&mt('Affiliation'), $env{'form.inststatus_choice'}]); |
|
if ($showcredits) { |
|
push(@field, |
|
['credits',&mt('Student Credits'), $env{'form.credits_choice'}]); |
|
} |
if ($env{'form.upfile_associate'} eq 'reverse') { |
if ($env{'form.upfile_associate'} eq 'reverse') { |
&Apache::loncommon::csv_print_samples($r,\@records); |
&Apache::loncommon::csv_print_samples($r,\@records); |
$i=&Apache::loncommon::csv_print_select_table($r,\@records, |
$i=&Apache::loncommon::csv_print_select_table($r,\@records, |
Line 1082 sub print_upload_manager_form {
|
Line 1185 sub print_upload_manager_form {
|
$keyfields=join(',',sort(keys(%sone))); |
$keyfields=join(',',sort(keys(%sone))); |
} |
} |
} |
} |
$r->print('</div>'); |
|
&print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear, |
&print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear, |
$context,$permission,$crstype); |
$context,$permission,$crstype,$showcredits); |
} |
} |
|
|
sub setup_date_selectors { |
sub setup_date_selectors { |
Line 1241 sub make_dates_default {
|
Line 1343 sub make_dates_default {
|
} |
} |
|
|
sub default_role_selector { |
sub default_role_selector { |
my ($context,$checkpriv,$crstype) = @_; |
my ($context,$checkpriv,$crstype,$showcredits) = @_; |
my %customroles; |
my %customroles; |
my ($options,$coursepick,$cb_jscript); |
my ($options,$coursepick,$cb_jscript); |
if ($context ne 'author') { |
if ($context ne 'author') { |
Line 1253 sub default_role_selector {
|
Line 1355 sub default_role_selector {
|
'grs' => "Section", |
'grs' => "Section", |
'exs' => "Existing sections", |
'exs' => "Existing sections", |
'new' => "New section", |
'new' => "New section", |
|
'crd' => "Credits", |
); |
); |
$options = '<select name="defaultrole">'."\n". |
$options = '<select name="defaultrole">'."\n". |
' <option value="">'.&mt('Please select').'</option>'."\n"; |
' <option value="">'.&mt('Please select').'</option>'."\n"; |
Line 1272 sub default_role_selector {
|
Line 1375 sub default_role_selector {
|
} |
} |
my $courseform = &Apache::loncommon::selectcourse_link |
my $courseform = &Apache::loncommon::selectcourse_link |
('studentform','dccourse','dcdomain','coursedesc',"$env{'request.role.domain'}",undef,'Course/Community'); |
('studentform','dccourse','dcdomain','coursedesc',"$env{'request.role.domain'}",undef,'Course/Community'); |
|
my ($credit_elem,$creditsinput); |
|
if ($showcredits) { |
|
$credit_elem = 'credits'; |
|
$creditsinput = '<td><input type="text" name="credits" value="" /></td>'; |
|
} |
$cb_jscript = |
$cb_jscript = |
&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'},'currsec','studentform','courserole','Course/Community'); |
&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'},'currsec','studentform','courserole','Course/Community',$credit_elem); |
$coursepick = &Apache::loncommon::start_data_table(). |
$coursepick = &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th>'. |
'<th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th>'. |
'<th>'.$lt{'grs'}.'</th>'. |
'<th>'.$lt{'grs'}.'</th>'. |
|
'<th>'.$lt{'crd'}.'</th>'. |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::start_data_table_row()."\n". |
&Apache::loncommon::start_data_table_row()."\n". |
'<td><input type="text" name="coursedesc" value="" onfocus="this.blur();opencrsbrowser('."'studentform','dccourse','dcdomain','coursedesc','','','','crstype'".')" /></td>'."\n". |
'<td><input type="text" name="coursedesc" value="" onfocus="this.blur();opencrsbrowser('."'studentform','dccourse','dcdomain','coursedesc','','','','crstype'".')" /></td>'."\n". |
Line 1299 sub default_role_selector {
|
Line 1408 sub default_role_selector {
|
'<input type="hidden" name="dccourse" value="" />'. |
'<input type="hidden" name="dccourse" value="" />'. |
'<input type="hidden" name="dcdomain" value="" />'. |
'<input type="hidden" name="dcdomain" value="" />'. |
'<input type="hidden" name="crstype" value="" />'. |
'<input type="hidden" name="crstype" value="" />'. |
'</td></tr></table></td>'. |
'</td></tr></table></td>'.$creditsinput. |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table()."\n"; |
&Apache::loncommon::end_data_table()."\n"; |
} |
} |
Line 1436 sub my_custom_roles {
|
Line 1545 sub my_custom_roles {
|
|
|
sub print_userlist { |
sub print_userlist { |
my ($r,$mode,$permission,$context,$formname,$totcodes,$codetitles, |
my ($r,$mode,$permission,$context,$formname,$totcodes,$codetitles, |
$idlist,$idlist_titles) = @_; |
$idlist,$idlist_titles,$showcredits) = @_; |
my $format = $env{'form.output'}; |
my $format = $env{'form.output'}; |
if (! exists($env{'form.sortby'})) { |
if (! exists($env{'form.sortby'})) { |
$env{'form.sortby'} = 'username'; |
$env{'form.sortby'} = 'username'; |
Line 1471 sub print_userlist {
|
Line 1580 sub print_userlist {
|
@statuses = ('future'); |
@statuses = ('future'); |
} |
} |
|
|
# if ($context eq 'course') { |
|
# $r->print(&display_adv_courseroles()); |
|
# } |
|
# |
|
# Interface output |
# Interface output |
$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="'. |
'<input type="hidden" name="action" value="'. |
Line 1512 sub print_userlist {
|
Line 1617 sub print_userlist {
|
$r->print(§ion_group_filter($cnum,$cdom)); |
$r->print(§ion_group_filter($cnum,$cdom)); |
} |
} |
$r->print('</div><div class="LC_left_float">'. |
$r->print('</div><div class="LC_left_float">'. |
&column_checkboxes($context,$mode,$formname). |
&column_checkboxes($context,$mode,$formname,$showcredits). |
'</div><br clear="all" />'); |
'</div>'); |
if ($env{'form.phase'} eq '') { |
if ($env{'form.phase'} eq '') { |
$r->print(&list_submit_button(&mt('Display List of Users'))."\n". |
$r->print('<br clear="all" />'. |
|
&list_submit_button(&mt('Display List of Users'))."\n". |
'<input type="hidden" name="phase" value="" /></form>'); |
'<input type="hidden" name="phase" value="" /></form>'); |
return; |
return; |
} |
} |
if (!(($context eq 'domain') && |
if (!(($context eq 'domain') && |
(($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { |
(($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { |
$r->print(&list_submit_button(&mt('Update Display'))."\n"); |
$r->print('<br clear="all" />'. |
|
&list_submit_button(&mt('Update Display'))."\n"); |
} |
} |
|
|
my @cols = &infocolumns($context,$mode); |
my @cols = &infocolumns($context,$mode,$showcredits); |
if (!@cols) { |
if (!@cols) { |
$r->print('<hr /><span class="LC_warning">'. |
$r->print('<hr style="clear:both;" /><span class="LC_warning">'. |
&mt('No user information selected for display.').'</span>'. |
&mt('No user information selected for display.').'</span>'. |
'<input type="hidden" name="phase" value="display" /></form>'."\n"); |
'<input type="hidden" name="phase" value="display" /></form>'."\n"); |
return; |
return; |
} |
} |
my ($indexhash,$keylist) = &make_keylist_array(); |
my ($indexhash,$keylist) = &make_keylist_array(); |
my (%userlist,%userinfo,$clearcoursepick); |
my (%userlist,%userinfo,$clearcoursepick,$needauthorquota,$needauthorusage); |
if (($context eq 'domain') && |
if (($context eq 'domain') && |
($env{'form.roletype'} eq 'course') || |
($env{'form.roletype'} eq 'course') || |
($env{'form.roletype'} eq 'community')) { |
($env{'form.roletype'} eq 'community')) { |
Line 1553 sub print_userlist {
|
Line 1660 sub print_userlist {
|
&Apache::lonhtmlcommon::course_selection($formname,$numcodes, |
&Apache::lonhtmlcommon::course_selection($formname,$numcodes, |
$codetitles,$idlist,$idlist_titles,$crstype, |
$codetitles,$idlist,$idlist_titles,$crstype, |
\@standardnames); |
\@standardnames); |
$r->print('<p>'.&Apache::lonhtmlcommon::start_pick_box()."\n". |
$r->print('<div class="LC_left_float">'. |
&Apache::lonhtmlcommon::start_pick_box()."\n". |
'<fieldset><legend>'.$title.'</legend>'."\n". |
&Apache::lonhtmlcommon::row_title($title,'LC_oddrow_value')."\n". |
|
$courseform."\n". |
$courseform."\n". |
&Apache::lonhtmlcommon::row_closure(1). |
'</fieldset></div><br clear="all" />'. |
&Apache::lonhtmlcommon::end_pick_box().'</p>'. |
|
'<p><input type="hidden" name="origroletype" value="'.$env{'form.roletype'}.'" />'. |
'<p><input type="hidden" name="origroletype" value="'.$env{'form.roletype'}.'" />'. |
&list_submit_button(&mt('Update Display')). |
&list_submit_button(&mt('Update Display')). |
"\n".'</p><span class="LC_warning">'.$warning.'</span>'."\n"); |
"\n".'</p><span class="LC_warning">'.$warning.'</span>'."\n"); |
Line 1568 sub print_userlist {
|
Line 1673 sub print_userlist {
|
$clearcoursepick = 1; |
$clearcoursepick = 1; |
} |
} |
if (($env{'form.coursepick'}) && (!$clearcoursepick)) { |
if (($env{'form.coursepick'}) && (!$clearcoursepick)) { |
$r->print('<hr />'.&mt('Searching').' ...<br /> <br />'); |
$r->print('<hr />'.&mt('Searching ...').'<br /> <br />'); |
} |
} |
} else { |
} else { |
$r->print('<hr /><div id="searching">'.&mt('Searching').' ...</div>'); |
$r->print('<hr style="clear:both;" /><div id="searching">'.&mt('Searching ...').'</div>'); |
} |
} |
$r->rflush(); |
$r->rflush(); |
if ($context eq 'course') { |
if ($context eq 'course') { |
Line 1606 sub print_userlist {
|
Line 1711 sub print_userlist {
|
\%cstr_roles,$permission); |
\%cstr_roles,$permission); |
} elsif ($context eq 'domain') { |
} elsif ($context eq 'domain') { |
if ($env{'form.roletype'} eq 'domain') { |
if ($env{'form.roletype'} eq 'domain') { |
|
if (grep(/^authorusage$/,@cols)) { |
|
$needauthorusage = 1; |
|
} |
|
if (grep(/^authorquota$/,@cols)) { |
|
$needauthorquota = 1; |
|
} |
%dom_roles = &Apache::lonnet::get_domain_roles($env{'request.role.domain'}); |
%dom_roles = &Apache::lonnet::get_domain_roles($env{'request.role.domain'}); |
foreach my $key (keys(%dom_roles)) { |
foreach my $key (keys(%dom_roles)) { |
if (ref($dom_roles{$key}) eq 'HASH') { |
if (ref($dom_roles{$key}) eq 'HASH') { |
Line 1707 sub print_userlist {
|
Line 1818 sub print_userlist {
|
} elsif ($context eq 'course') { |
} elsif ($context eq 'course') { |
$r->print(&mt('There are no course users to display.')."\n"); |
$r->print(&mt('There are no course users to display.')."\n"); |
} |
} |
$r->print('<p class="LC_info"'.$msg.'</p>'."\n") if $msg; |
$r->print('<p class="LC_info">'.$msg.'</p>'."\n") if $msg; |
} else { |
} else { |
# Print out the available choices |
# Print out the available choices |
my $usercount; |
my $usercount; |
if ($env{'form.action'} eq 'modifystudent') { |
if ($env{'form.action'} eq 'modifystudent') { |
($usercount) = &show_users_list($r,$context,'view',$permission, |
($usercount) = &show_users_list($r,$context,'view',$permission, |
$env{'form.Status'},\%userlist,$keylist); |
$env{'form.Status'},\%userlist,$keylist,'', |
|
$showcredits); |
} else { |
} else { |
($usercount) = &show_users_list($r,$context,$env{'form.output'}, |
($usercount) = &show_users_list($r,$context,$env{'form.output'}, |
$permission,$env{'form.Status'},\%userlist,$keylist); |
$permission,$env{'form.Status'},\%userlist, |
|
$keylist,'',$showcredits,$needauthorquota,$needauthorusage); |
} |
} |
if (!$usercount) { |
if (!$usercount) { |
$r->print('<br /><span class="LC_info">' |
$r->print('<br /><span class="LC_info">' |
Line 1837 sub section_group_filter {
|
Line 1950 sub section_group_filter {
|
} |
} |
|
|
sub infocolumns { |
sub infocolumns { |
my ($context,$mode) = @_; |
my ($context,$mode,$showcredits) = @_; |
my @cols; |
my @cols; |
if (($mode eq 'pickauthor') || ($mode eq 'autoenroll')) { |
if (($mode eq 'pickauthor') || ($mode eq 'autoenroll')) { |
@cols = &get_cols_array($context,$mode); |
@cols = &get_cols_array($context,$mode,$showcredits); |
} else { |
} else { |
my @posscols = &get_cols_array($context,$mode); |
my @posscols = &get_cols_array($context,$mode,$showcredits); |
if ($env{'form.phase'} ne '') { |
if ($env{'form.phase'} ne '') { |
my @checkedcols = &Apache::loncommon::get_env_multiple('form.showcol'); |
my @checkedcols = &Apache::loncommon::get_env_multiple('form.showcol'); |
foreach my $col (@checkedcols) { |
foreach my $col (@checkedcols) { |
Line 1858 sub infocolumns {
|
Line 1971 sub infocolumns {
|
} |
} |
|
|
sub get_cols_array { |
sub get_cols_array { |
my ($context,$mode) = @_; |
my ($context,$mode,$showcredits) = @_; |
my @cols; |
my @cols; |
if ($mode eq 'pickauthor') { |
if ($mode eq 'pickauthor') { |
@cols = ('username','fullname','status','email'); |
@cols = ('username','fullname','status','email'); |
Line 1868 sub get_cols_array {
|
Line 1981 sub get_cols_array {
|
push(@cols,'section'); |
push(@cols,'section'); |
} |
} |
push(@cols,('start','end','role')); |
push(@cols,('start','end','role')); |
if ($context eq 'domain') { |
|
push (@cols,'extent'); |
|
} |
|
unless (($mode eq 'autoenroll') && ($env{'form.Status'} ne 'Any')) { |
unless (($mode eq 'autoenroll') && ($env{'form.Status'} ne 'Any')) { |
push(@cols,'status'); |
push(@cols,'status'); |
} |
} |
Line 1879 sub get_cols_array {
|
Line 1989 sub get_cols_array {
|
} |
} |
push(@cols,'email'); |
push(@cols,'email'); |
if (($context eq 'course') && ($mode ne 'autoenroll')) { |
if (($context eq 'course') && ($mode ne 'autoenroll')) { |
|
if ($showcredits) { |
|
push(@cols,'credits'); |
|
} |
push(@cols,'lastlogin','clicker'); |
push(@cols,'lastlogin','clicker'); |
} |
} |
if (($context eq 'course') && ($mode ne 'autoenroll') && |
if (($context eq 'course') && ($mode ne 'autoenroll') && |
($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'})) { |
($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'})) { |
push(@cols,'photos'); |
push(@cols,'photo'); |
|
} |
|
if ($context eq 'domain') { |
|
push (@cols,('authorusage','authorquota','extent')); |
} |
} |
} |
} |
return @cols; |
return @cols; |
} |
} |
|
|
sub column_checkboxes { |
sub column_checkboxes { |
my ($context,$mode,$formname) = @_; |
my ($context,$mode,$formname,$showcredits) = @_; |
my @cols = &get_cols_array($context,$mode); |
my @cols = &get_cols_array($context,$mode,$showcredits); |
my @showncols = &Apache::loncommon::get_env_multiple('form.showcol'); |
my @showncols = &Apache::loncommon::get_env_multiple('form.showcol'); |
my (%disabledchk,%unchecked); |
my (%disabledchk,%unchecked); |
if ($env{'form.phase'} eq '') { |
if ($env{'form.phase'} eq '') { |
Line 1899 sub column_checkboxes {
|
Line 2015 sub column_checkboxes {
|
if ($context eq 'course') { |
if ($context eq 'course') { |
$disabledchk{'role'} = 1; |
$disabledchk{'role'} = 1; |
$unchecked{'photo'} = 1; |
$unchecked{'photo'} = 1; |
|
$unchecked{'clicker'} = 1; |
|
if ($showcredits) { |
|
$unchecked{'credits'} = 1; |
|
} |
|
} elsif ($context eq 'domain') { |
|
$unchecked{'extent'} = 1; |
} |
} |
$unchecked{'clicker'} = 1; |
|
$unchecked{'start'} = 1; |
$unchecked{'start'} = 1; |
$unchecked{'end'} = 1; |
$unchecked{'end'} = 1; |
} else { |
} else { |
if ($env{'form.Status'} ne 'Any') { |
if ($env{'form.Status'} ne 'Any') { |
$disabledchk{'status'} = 1; |
$disabledchk{'status'} = 1; |
} |
} |
if ($env{'form.showrole'} ne 'Any') { |
if (($env{'form.showrole'} ne 'Any') && ($env{'form.showrole'} ne 'cr')) { |
$disabledchk{'role'} = 1; |
$disabledchk{'role'} = 1; |
|
} |
|
if ($context eq 'domain') { |
|
if (($env{'form.roletype'} eq 'course') || |
|
($env{'form.roletype'} eq 'community')) { |
|
$disabledchk{'status'} = 1; |
|
$disabledchk{'authorusage'} = 1; |
|
$disabledchk{'authorquota'} = 1; |
|
} elsif ($env{'form.roletype'} eq 'domain') { |
|
$disabledchk{'extent'} = 1; |
|
} |
} |
} |
} |
} |
my $numposs = scalar(@cols); |
my $numposs = scalar(@cols); |
my $numinrow = 8; |
my $numinrow = 7; |
my %lt = &get_column_names($context); |
my %lt = &get_column_names($context); |
my $output = '<fieldset><legend>'.&mt('Information to show').'</legend>'."\n".'<span class="LC_nobreak">'. |
my $output = '<fieldset><legend>'.&mt('Information to show').'</legend>'."\n".'<span class="LC_nobreak">'. |
'<input type="button" onclick="javascript:checkAll(document.'.$formname.'.showcol);" value="'.&mt('check all').'" />'. |
'<input type="button" onclick="javascript:checkAll(document.'.$formname.'.showcol);" value="'.&mt('check all').'" />'. |
Line 1952 sub column_checkboxes {
|
Line 2083 sub column_checkboxes {
|
} else { |
} else { |
$output .= '<td>'; |
$output .= '<td>'; |
} |
} |
$output .= '<label><input id="showcol'.$cols[$i].'" type="checkbox" name="showcol" value="'.$cols[$i].'"'.$checked.' />'. |
my $style; |
$lt{$cols[$i]}.'</label></td>'; |
if ($cols[$i] eq 'extent') { |
|
if (($env{'form.roletype'} eq 'domain') || ($env{'form.roletype'} eq '')) { |
|
$style = ' style="display: none;"'; |
|
} |
|
} elsif (($cols[$i] eq 'authorusage') || ($cols[$i] eq 'authorquota')) { |
|
if ($env{'form.roletype'} ne 'domain') { |
|
$style = ' style="display: none;"'; |
|
} |
|
} |
|
$output .= '<span id="show'.$cols[$i].'"'.$style.'><label>'. |
|
'<input id="showcol'.$cols[$i].'" type="checkbox" name="showcol" value="'.$cols[$i].'"'.$checked.' /><span id="showcoltext'.$cols[$i].'">'. |
|
$lt{$cols[$i]}.'</span>'. |
|
'</label></span></td>'; |
} |
} |
$output .= '</tr></table></fieldset>'; |
$output .= '</tr></table></fieldset>'; |
return $output; |
return $output; |
Line 1978 sub get_column_names {
|
Line 2120 sub get_column_names {
|
'end' => "end date", |
'end' => "end date", |
'status' => "status", |
'status' => "status", |
'role' => "role", |
'role' => "role", |
|
'credits' => "credits", |
'type' => "enroll type/action", |
'type' => "enroll type/action", |
'email' => "e-mail address", |
'email' => "e-mail address", |
'photo' => "photo", |
'photo' => "photo", |
'lastlogin' => "last login", |
'lastlogin' => "last login", |
'extent' => "extent", |
'extent' => "extent", |
|
'authorusage' => "disk usage (%)", |
|
'authorquota' => "disk quota (MB)", |
'ca' => "check all", |
'ca' => "check all", |
'ua' => "uncheck all", |
'ua' => "uncheck all", |
'clicker' => "clicker-ID", |
'clicker' => "clicker-ID", |
); |
); |
if ($context eq 'domain' && $env{'form.roletype'} eq 'course') { |
if ($context eq 'domain' && $env{'form.roletype'} eq 'course') { |
$lt{'extent'} = &mt('Course(s): description, section(s), status'); |
$lt{'extent'} = &mt('course(s): description, section(s), status'); |
} elsif ($context eq 'domain' && $env{'form.roletype'} eq 'community') { |
} elsif ($context eq 'domain' && $env{'form.roletype'} eq 'community') { |
$lt{'extent'} = &mt('Communities: description, section(s), status'); |
$lt{'extent'} = &mt('community(s): description, section(s), status'); |
} elsif ($context eq 'author') { |
} elsif (($context eq 'author') || |
$lt{'extent'} = &mt('Author'); |
($context eq 'domain' && $env{'form.roletype'} eq 'author')) { |
|
$lt{'extent'} = &mt('author'); |
} |
} |
return %lt; |
return %lt; |
} |
} |
Line 2246 sub instcode_from_coursefilter {
|
Line 2392 sub instcode_from_coursefilter {
|
return $instcode; |
return $instcode; |
} |
} |
|
|
sub display_adv_courseroles { |
|
my $output; |
|
# |
|
# List course personnel |
|
my %coursepersonnel = |
|
&Apache::lonnet::get_course_adv_roles($env{'request.course.id'}); |
|
# |
|
$output = '<br />'.&Apache::loncommon::start_data_table(); |
|
foreach my $role (sort(keys(%coursepersonnel))) { |
|
next if ($role =~ /^\s*$/); |
|
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$role.'</td><td>'; |
|
foreach my $user (split(',',$coursepersonnel{$role})) { |
|
my ($puname,$pudom)=split(':',$user); |
|
$output .= ' '.&Apache::loncommon::aboutmewrapper( |
|
&Apache::loncommon::plainname($puname,$pudom), |
|
$puname,$pudom); |
|
} |
|
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
} |
|
$output .= &Apache::loncommon::end_data_table(); |
|
} |
|
|
|
sub make_keylist_array { |
sub make_keylist_array { |
my ($index,$keylist); |
my ($index,$keylist); |
$index->{'domain'} = &Apache::loncoursedata::CL_SDOM(); |
$index->{'domain'} = &Apache::loncoursedata::CL_SDOM(); |
Line 2287 sub make_keylist_array {
|
Line 2410 sub make_keylist_array {
|
$index->{'extent'} = &Apache::loncoursedata::CL_EXTENT(); |
$index->{'extent'} = &Apache::loncoursedata::CL_EXTENT(); |
$index->{'photo'} = &Apache::loncoursedata::CL_PHOTO(); |
$index->{'photo'} = &Apache::loncoursedata::CL_PHOTO(); |
$index->{'thumbnail'} = &Apache::loncoursedata::CL_THUMBNAIL(); |
$index->{'thumbnail'} = &Apache::loncoursedata::CL_THUMBNAIL(); |
|
$index->{'credits'} = &Apache::loncoursedata::CL_CREDITS(); |
|
$index->{'authorquota'} = &Apache::loncoursedata::CL_AUTHORQUOTA(); |
|
$index->{'authorusage'} = &Apache::loncoursedata::CL_AUTHORUSAGE(); |
foreach my $key (keys(%{$index})) { |
foreach my $key (keys(%{$index})) { |
$keylist->[$index->{$key}] = $key; |
$keylist->[$index->{$key}] = $key; |
} |
} |
Line 2335 sub process_date_info {
|
Line 2461 sub process_date_info {
|
} |
} |
|
|
sub show_users_list { |
sub show_users_list { |
my ($r,$context,$mode,$permission,$statusmode,$userlist,$keylist,$formname)=@_; |
my ($r,$context,$mode,$permission,$statusmode,$userlist,$keylist,$formname, |
|
$showcredits,$needauthorquota,$needauthorusage)=@_; |
if ($formname eq '') { |
if ($formname eq '') { |
$formname = 'studentform'; |
$formname = 'studentform'; |
} |
} |
|
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
# |
# |
# Variables for excel output |
# Variables for excel output |
my ($excel_workbook, $excel_sheet, $excel_filename,$row,$format); |
my ($excel_workbook, $excel_sheet, $excel_filename,$row,$format); |
Line 2350 sub show_users_list {
|
Line 2478 sub show_users_list {
|
my @sortable = ('username','domain','id','fullname','start','end','email','role'); |
my @sortable = ('username','domain','id','fullname','start','end','email','role'); |
if ($context eq 'course') { |
if ($context eq 'course') { |
push(@sortable,('section','groups','type')); |
push(@sortable,('section','groups','type')); |
|
if ($showcredits) { |
|
push(@sortable,'credits'); |
|
} |
} else { |
} else { |
push(@sortable,'extent'); |
push(@sortable,'extent'); |
|
if (($context eq 'domain') && ($env{'form.roletype'} eq 'domain') && |
|
(($env{'form.showrole'} eq 'Any') || ($env{'form.showrole'} eq 'au'))) { |
|
push(@sortable,('authorusage','authorquota')); |
|
} |
} |
} |
if ($mode eq 'pickauthor') { |
if ($mode eq 'pickauthor') { |
@sortable = ('username','fullname','email','status'); |
@sortable = ('username','fullname','email','status'); |
} |
} |
if (!grep(/^\Q$sortby\E$/,@sortable)) { |
my %is_sortable; |
|
map { $is_sortable{$_} = 1; } @sortable; |
|
unless ($is_sortable{$sortby}) { |
$sortby = 'username'; |
$sortby = 'username'; |
} |
} |
my $setting = $env{'form.roletype'}; |
my $setting = $env{'form.roletype'}; |
my ($cid,$cdom,$cnum,$classgroups,$crstype); |
my ($cid,$cdom,$cnum,$classgroups,$crstype,$defaultcredits); |
if ($context eq 'course') { |
if ($context eq 'course') { |
$cid = $env{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
$crstype = &Apache::loncommon::course_type(); |
$crstype = &Apache::loncommon::course_type(); |
($cnum,$cdom) = &get_course_identity($cid); |
($cnum,$cdom) = &get_course_identity($cid); |
|
$defaultcredits = $env{'course.'.$cid.'.internal.defaultcredits'}; |
($classgroups) = &Apache::loncoursedata::get_group_memberships( |
($classgroups) = &Apache::loncoursedata::get_group_memberships( |
$userlist,$keylist,$cdom,$cnum); |
$userlist,$keylist,$cdom,$cnum); |
if ($mode eq 'autoenroll') { |
if ($mode eq 'autoenroll') { |
Line 2457 END
|
Line 2595 END
|
$r->print(<<END); |
$r->print(<<END); |
<input type="hidden" name="sortby" value="$sortby" /> |
<input type="hidden" name="sortby" value="$sortby" /> |
END |
END |
my @cols = &infocolumns($context,$mode); |
my @cols = &infocolumns($context,$mode,$showcredits); |
my %coltxt = &get_column_names($context); |
my %coltxt = &get_column_names($context); |
my %acttxt = &Apache::lonlocal::texthash( |
my %acttxt = &Apache::lonlocal::texthash( |
'pr' => "Proceed", |
'pr' => "Proceed", |
Line 2579 END
|
Line 2717 END
|
if ($env{'form.userwin'}) { |
if ($env{'form.userwin'}) { |
$checkwin = ' checked="checked"'; |
$checkwin = ' checked="checked"'; |
} |
} |
$output .= '</td><td valign="top" style="border-left: 1px solid;"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>'; |
$output .= |
|
'</td><td valign="top" style="border-left: 1px solid;">' |
|
.'<span class="LC_nobreak"><label>' |
|
.'<input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'} |
|
.'</label></span></td></tr></table></fieldset></div>'; |
} |
} |
$output .= "\n".'<br clear="all" />'."\n". |
$output .= "\n".'<br clear="all" />'."\n". |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
Line 2591 END
|
Line 2733 END
|
} else { |
} else { |
$output .= "\n".'<th> </th>'."\n"; |
$output .= "\n".'<th> </th>'."\n"; |
if ($actionselect) { |
if ($actionselect) { |
$output .= '<th>'.&mt('Select').'</th>'."\n"; |
$output .= '<th class="LC_nobreak" valign="top">'.&mt('Select').'</th>'."\n"; |
} |
} |
} |
} |
foreach my $item (@cols) { |
foreach my $item (@cols) { |
$output .= "<th><a href=\"javascript:document.$formname.sortby.value='$item';document.$formname.submit();\">$lt{$item}</a></th>\n"; |
$output .= '<th class="LC_nobreak" valign="top">'; |
|
if ($is_sortable{$item}) { |
|
$output .= "<a href=\"javascript:document.$formname.sortby.value='$item';document.$formname.submit();\" style=\"text-decoration:none;\">$lt{$item}<span class=\"LC_fontsize_small\"> ▼</span></a>"; |
|
} else { |
|
$output .= $lt{$item}; |
|
} |
|
$output .= "</th>\n"; |
} |
} |
my %role_types = &role_type_names(); |
my %role_types = &role_type_names(); |
$output .= &Apache::loncommon::end_data_table_header_row(); |
$output .= &Apache::loncommon::end_data_table_header_row(); |
Line 2755 END
|
Line 2903 END
|
'gif','thumbnail'); |
'gif','thumbnail'); |
} |
} |
} |
} |
|
if (($role eq 'st') && ($defaultcredits)) { |
|
if ($userlist->{$user}->[$index{'credits'}] eq '') { |
|
$userlist->{$user}->[$index{'credits'}] = $defaultcredits; |
|
} |
|
} |
} |
} |
} |
} |
my %emails = &Apache::loncommon::getemails($uname,$udom); |
my %emails = &Apache::loncommon::getemails($uname,$udom); |
if ($emails{'permanentemail'} =~ /\S/) { |
if ($emails{'permanentemail'} =~ /\S/) { |
$userlist->{$user}->[$index{'email'}] = $emails{'permanentemail'}; |
$userlist->{$user}->[$index{'email'}] = $emails{'permanentemail'}; |
} |
} |
|
if (($context eq 'domain') && ($env{'form.roletype'} eq 'domain') && |
|
($role eq 'au')) { |
|
my ($disk_quota,$current_disk_usage,$percent); |
|
if (($needauthorusage) || ($needauthorquota)) { |
|
$disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,'author'); |
|
} |
|
if ($needauthorusage) { |
|
$current_disk_usage = |
|
&Apache::lonnet::diskusage($udom,$uname,"$londocroot/priv/$udom/$uname"); |
|
if ($disk_quota == 0) { |
|
$percent = 100.0; |
|
} else { |
|
$percent = $current_disk_usage/(10 * $disk_quota); |
|
} |
|
$userlist->{$user}->[$index{'authorusage'}] = sprintf("%.0f",$percent); |
|
} |
|
if ($needauthorquota) { |
|
$userlist->{$user}->[$index{'authorquota'}] = sprintf("%.2f",$disk_quota); |
|
} |
|
} |
$usercount ++; |
$usercount ++; |
} |
} |
my $autocount = 0; |
my $autocount = 0; |
Line 2781 END
|
Line 2954 END
|
my $index = $index{$sortby}; |
my $index = $index{$sortby}; |
my $second = $index{'username'}; |
my $second = $index{'username'}; |
my $third = $index{'domain'}; |
my $third = $index{'domain'}; |
my @sorted_users = sort { |
my @sorted_users; |
lc($userlist->{$a}->[$index]) cmp lc($userlist->{$b}->[$index]) |
if (($sortby eq 'authorquota') || ($sortby eq 'authorusage')) { |
|| |
@sorted_users = sort { |
lc($userlist->{$a}->[$second]) cmp lc($userlist->{$b}->[$second]) || |
$userlist->{$b}->[$index] <=> $userlist->{$a}->[$index] || |
lc($userlist->{$a}->[$third]) cmp lc($userlist->{$b}->[$third]) |
lc($userlist->{$a}->[$second]) cmp lc($userlist->{$b}->[$second]) || |
} (keys(%$userlist)); |
lc($userlist->{$a}->[$third]) cmp lc($userlist->{$b}->[$third]) |
|
} (keys(%$userlist)); |
|
} else { |
|
@sorted_users = sort { |
|
lc($userlist->{$a}->[$index]) cmp lc($userlist->{$b}->[$index]) || |
|
lc($userlist->{$a}->[$second]) cmp lc($userlist->{$b}->[$second]) || |
|
lc($userlist->{$a}->[$third]) cmp lc($userlist->{$b}->[$third]) |
|
} (keys(%$userlist)); |
|
} |
my $rowcount = 0; |
my $rowcount = 0; |
foreach my $user (@sorted_users) { |
foreach my $user (@sorted_users) { |
my %in; |
my %in; |
Line 2797 END
|
Line 2978 END
|
} |
} |
my $clickers = (&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1]; |
my $clickers = (&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1]; |
if ($clickers!~/\w/) { $clickers='-'; } |
if ($clickers!~/\w/) { $clickers='-'; } |
$in{'clicker'} = $clickers; |
$in{'clicker'} = $clickers; |
my $role = $in{'role'}; |
my $role = $in{'role'}; |
$in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype); |
$in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype); |
unless ($mode eq 'excel') { |
unless ($mode eq 'excel') { |
Line 2872 END
|
Line 3053 END
|
$checkval .= ':'.$in{'section'}; |
$checkval .= ':'.$in{'section'}; |
if ($role eq 'st') { |
if ($role eq 'st') { |
$checkval .= ':'.$in{'type'}.':'. |
$checkval .= ':'.$in{'type'}.':'. |
$in{'lockedtype'}; |
$in{'lockedtype'}.':'. |
|
$in{'credits'}; |
} |
} |
} |
} |
} |
} |
Line 2919 END
|
Line 3101 END
|
} else { |
} else { |
$r->print('<td> </td>'."\n"); |
$r->print('<td> </td>'."\n"); |
} |
} |
} |
} |
|
} elsif (($item eq 'authorquota') || ($item eq 'authorusage')) { |
|
$r->print('<td align="right">'.$in{$item}.'</td>'."\n"); |
} else { |
} else { |
$r->print('<td>'.$in{$item}.'</td>'."\n"); |
$r->print('<td>'.$in{$item}.'</td>'."\n"); |
} |
} |
Line 3120 sub select_actions {
|
Line 3304 sub select_actions {
|
chgdates => "Change starting/ending dates", |
chgdates => "Change starting/ending dates", |
chgsec => "Change section associated with user roles", |
chgsec => "Change section associated with user roles", |
); |
); |
|
# FIXME Add an option to change credits for student roles. |
my ($output,$options,%choices); |
my ($output,$options,%choices); |
# FIXME Disable actions for now for roletype=course in domain context |
# FIXME Disable actions for now for roletype=course in domain context |
if ($context eq 'domain' && $setting eq 'course') { |
if ($context eq 'domain' && $setting eq 'course') { |
Line 3247 ENDTWO
|
Line 3432 ENDTWO
|
} |
} |
|
|
sub date_section_selector { |
sub date_section_selector { |
my ($context,$permission,$crstype) = @_; |
my ($context,$permission,$crstype,$showcredits) = @_; |
my $callingform = $env{'form.callingform'}; |
my $callingform = $env{'form.callingform'}; |
my $formname = 'dateselect'; |
my $formname = 'dateselect'; |
my $groupslist = &get_groupslist(); |
my $groupslist = &get_groupslist(); |
my $sec_js = &setsections_javascript($formname,$groupslist); |
my $sec_js = |
|
&setsections_javascript($formname,$groupslist,undef,undef,$crstype, |
|
$showcredits); |
my $output = <<"END"; |
my $output = <<"END"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 3383 ENDJS
|
Line 3570 ENDJS
|
$info = '<input type="hidden" name="retainsec" value="0" />'; |
$info = '<input type="hidden" name="retainsec" value="0" />'; |
} |
} |
my $rowtitle = &mt('New section to assign'); |
my $rowtitle = &mt('New section to assign'); |
my $secbox = §ion_picker($cdom,$cnum,$env{'form.showrole'},$rowtitle,$permission,$context,'',$crstype); |
my $secbox = §ion_picker($cdom,$cnum,$env{'form.showrole'},$rowtitle, |
|
$permission,$context,'chgsec',$crstype); |
$output .= $info.$secbox; |
$output .= $info.$secbox; |
} |
} |
$output .= '<p>'. |
$output .= '<p>'. |
Line 3393 ENDJS
|
Line 3581 ENDJS
|
} |
} |
|
|
sub section_picker { |
sub section_picker { |
my ($cdom,$cnum,$role,$rowtitle,$permission,$context,$mode,$crstype) = @_; |
my ($cdom,$cnum,$role,$rowtitle,$permission,$context,$mode,$crstype, |
|
$showcredits,$credits) = @_; |
my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum); |
my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum); |
my $sections_select .= &course_sections(\%sections_count,$role); |
my $sections_select .= &course_sections(\%sections_count,$role); |
my $secbox = '<div>'.&Apache::lonhtmlcommon::start_pick_box()."\n"; |
my $secbox = '<div>'.&Apache::lonhtmlcommon::start_pick_box()."\n"; |
if ($mode eq 'upload') { |
if ($mode eq 'upload') { |
my ($options,$cb_script,$coursepick) = |
my ($options,$cb_script,$coursepick) = |
&default_role_selector($context,1,$crstype); |
&default_role_selector($context,1,$crstype,$showcredits); |
$secbox .= &Apache::lonhtmlcommon::row_title(&mt('role'),'LC_oddrow_value'). |
$secbox .= &Apache::lonhtmlcommon::row_title(&mt('role'),'LC_oddrow_value'). |
$options. &Apache::lonhtmlcommon::row_closure(1)."\n"; |
$options. &Apache::lonhtmlcommon::row_closure(1)."\n"; |
} |
} |
Line 3413 sub section_picker {
|
Line 3602 sub section_picker {
|
'<input type="hidden" name="sections" value="" />'."\n". |
'<input type="hidden" name="sections" value="" />'."\n". |
'</td></tr></table>'."\n"; |
'</td></tr></table>'."\n"; |
} else { |
} else { |
$secbox .= '<input type="hidden" name="sections" value="'. |
$secbox .= '<input type="hidden" name="sections" value="'. |
$env{'request.course.sec'}.'" />'. |
$env{'request.course.sec'}.'" />'. |
$env{'request.course.sec'}; |
$env{'request.course.sec'}; |
} |
} |
$secbox .= &Apache::lonhtmlcommon::row_closure(1)."\n". |
$secbox .= &Apache::lonhtmlcommon::row_closure(1)."\n"; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
unless ($mode eq 'chgsec') { |
|
if ($showcredits) { |
|
$secbox .= |
|
&Apache::lonhtmlcommon::row_title(&mt('credits (students)'), |
|
'LC_evenrow_value')."\n". |
|
'<input type="text" name="credits" size="3" value="'.$credits.'" />'."\n". |
|
&Apache::lonhtmlcommon::row_closure(1)."\n"; |
|
} |
|
} |
|
$secbox .= &Apache::lonhtmlcommon::end_pick_box().'</div>'; |
return $secbox; |
return $secbox; |
} |
} |
|
|
Line 3818 sub print_first_users_upload_form {
|
Line 4016 sub print_first_users_upload_form {
|
$str .= '<input type="hidden" name="action" value="upload" />'; |
$str .= '<input type="hidden" name="action" value="upload" />'; |
$str .= '<input type="hidden" name="state" value="got_file" />'; |
$str .= '<input type="hidden" name="state" value="got_file" />'; |
|
|
|
$str .= &Apache::grades::checkforfile_js(); |
|
|
$str .= '<h2>'.&mt('Upload a file containing information about users').'</h2>'."\n"; |
$str .= '<h2>'.&mt('Upload a file containing information about users').'</h2>'."\n"; |
|
|
# Excel and CSV Help |
# Excel and CSV Help |
$str .= '<div class="LC_left_float">' |
$str .= '<div class="LC_columnSection">' |
.&Apache::loncommon::help_open_topic("Course_Create_Class_List", |
.&Apache::loncommon::help_open_topic("Course_Create_Class_List", |
&mt("How do I create a users list from a spreadsheet")) |
&mt("How do I create a users list from a spreadsheet")) |
.'</div><div class="LC_left_float">'."\n" |
.' '.&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
.&Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
|
&mt("How do I create a CSV file from a spreadsheet")) |
&mt("How do I create a CSV file from a spreadsheet")) |
.'</div><br clear="all" />'."\n"; |
."</div>\n"; |
$str .= &Apache::lonhtmlcommon::start_pick_box() |
$str .= &Apache::lonhtmlcommon::start_pick_box() |
.&Apache::lonhtmlcommon::row_title(&mt('File')); |
.&Apache::lonhtmlcommon::row_title(&mt('File')); |
if (&Apache::lonlocal::current_language() ne 'en') { |
if (&Apache::lonlocal::current_language() ne 'en') { |
Line 3848 sub print_first_users_upload_form {
|
Line 4047 sub print_first_users_upload_form {
|
.&Apache::lonhtmlcommon::end_pick_box(); |
.&Apache::lonhtmlcommon::end_pick_box(); |
|
|
$str .= '<p>' |
$str .= '<p>' |
.'<input type="submit" name="fileupload" value="'.&mt('Next').'" />' |
.'<input type="submit" name="fileupload" value="'.&mt('Next').'"' |
|
.' onclick="javascript:checkUpload(this.form);" />' |
.'</p>'; |
.'</p>'; |
|
|
$r->print($str); |
$r->print($str); |
Line 3857 sub print_first_users_upload_form {
|
Line 4057 sub print_first_users_upload_form {
|
|
|
# ================================================= Drop/Add from uploaded file |
# ================================================= Drop/Add from uploaded file |
sub upfile_drop_add { |
sub upfile_drop_add { |
my ($r,$context,$permission) = @_; |
my ($r,$context,$permission,$showcredits) = @_; |
&Apache::loncommon::load_tmp_file($r); |
&Apache::loncommon::load_tmp_file($r); |
my @userdata=&Apache::loncommon::upfile_record_sep(); |
my @userdata=&Apache::loncommon::upfile_record_sep(); |
if($env{'form.noFirstLine'}){shift(@userdata);} |
if($env{'form.noFirstLine'}){shift(@userdata);} |
Line 3878 sub upfile_drop_add {
|
Line 4078 sub upfile_drop_add {
|
} |
} |
# |
# |
# Store the field choices away |
# Store the field choices away |
foreach my $field (qw/username names |
my @storefields = qw/username names fname mname lname gen id |
fname mname lname gen id sec ipwd email role domain/) { |
sec ipwd email role domain inststatus/; |
|
if ($showcredits) { |
|
push (@storefields,'credits'); |
|
} |
|
my %fieldstype; |
|
foreach my $field (@storefields) { |
$env{'form.'.$field.'_choice'}=$fields{$field}; |
$env{'form.'.$field.'_choice'}=$fields{$field}; |
|
$fieldstype{$field.'_choice'} = 'scalar'; |
} |
} |
&Apache::loncommon::store_course_settings('enrollment_upload', |
&Apache::loncommon::store_course_settings('enrollment_upload',\%fieldstype); |
{ 'username_choice' => 'scalar', |
|
'names_choice' => 'scalar', |
|
'fname_choice' => 'scalar', |
|
'mname_choice' => 'scalar', |
|
'lname_choice' => 'scalar', |
|
'gen_choice' => 'scalar', |
|
'id_choice' => 'scalar', |
|
'sec_choice' => 'scalar', |
|
'ipwd_choice' => 'scalar', |
|
'email_choice' => 'scalar', |
|
'role_choice' => 'scalar', |
|
'domain_choice' => 'scalar', |
|
'inststatus_choice' => 'scalar'}); |
|
# |
|
my ($cid,$crstype,$setting); |
my ($cid,$crstype,$setting); |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$setting = $env{'form.roleaction'}; |
$setting = $env{'form.roleaction'}; |
Line 3964 sub upfile_drop_add {
|
Line 4156 sub upfile_drop_add {
|
$amode = ''; # This causes the loop below to be skipped |
$amode = ''; # This causes the loop below to be skipped |
} |
} |
} |
} |
my ($defaultsec,$defaultrole); |
my ($defaultsec,$defaultrole,$defaultcredits,$commoncredits); |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
if ($setting eq 'domain') { |
if ($setting eq 'domain') { |
$defaultrole = $env{'form.defaultrole'}; |
$defaultrole = $env{'form.defaultrole'}; |
} elsif ($setting eq 'course') { |
} elsif ($setting eq 'course') { |
$defaultrole = $env{'form.courserole'}; |
$defaultrole = $env{'form.courserole'}; |
$defaultsec = $env{'form.sections'}; |
$defaultsec = $env{'form.sections'}; |
} |
if ($showcredits) { |
|
$commoncredits = $env{'form.credits'}; |
|
if ($crstype ne 'Community') { |
|
my %coursehash=&Apache::lonnet::coursedescription($cid); |
|
$defaultcredits = $coursehash{'internal.defaultcredits'}; |
|
} |
|
} |
|
} |
} elsif ($context eq 'author') { |
} elsif ($context eq 'author') { |
$defaultrole = $env{'form.defaultrole'}; |
$defaultrole = $env{'form.defaultrole'}; |
} elsif ($context eq 'course') { |
} elsif ($context eq 'course') { |
$defaultrole = $env{'form.defaultrole'}; |
$defaultrole = $env{'form.defaultrole'}; |
$defaultsec = $env{'form.sections'}; |
$defaultsec = $env{'form.sections'}; |
|
if ($showcredits) { |
|
$commoncredits = $env{'form.credits'}; |
|
$defaultcredits = $env{'course.'.$cid.'.internal.defaultcredits'}; |
|
} |
} |
} |
# Check to see if user information can be changed |
# Check to see if user information can be changed |
my @userinfo = ('firstname','middlename','lastname','generation', |
my @userinfo = ('firstname','middlename','lastname','generation', |
Line 4121 sub upfile_drop_add {
|
Line 4324 sub upfile_drop_add {
|
if ($entries{$fields{'username'}} =~ /\s/) { |
if ($entries{$fields{'username'}} =~ /\s/) { |
$nowhitespace = ' - '.&mt('usernames may not contain spaces.'); |
$nowhitespace = ' - '.&mt('usernames may not contain spaces.'); |
} |
} |
$r->print('<br />'. |
$r->print( |
&mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]', |
'<br />'. |
'<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen). |
&mt('Unacceptable username [_1] for user [_2] [_3] [_4] [_5]', |
$nowhitespace); |
'"<b>'.$entries{$fields{'username'}}.'</b>"', |
|
$fname,$mname,$lname,$gen). |
|
$nowhitespace); |
next; |
next; |
} else { |
} else { |
$entries{$fields{'domain'}} =~ s/^\s+|\s+$//g; |
$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( |
'</b>: '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen)); |
'<br />'. |
next; |
&mt('Unacceptable domain [_1] for user [_2] [_3] [_4] [_5]', |
|
'"<b>'.$entries{$fields{'domain'}}.'</b>"', |
|
$fname,$mname,$lname,$gen)); |
|
next; |
} |
} |
my $username = $entries{$fields{'username'}}; |
my $username = $entries{$fields{'username'}}; |
my $userdomain = $entries{$fields{'domain'}}; |
my $userdomain = $entries{$fields{'domain'}}; |
Line 4236 sub upfile_drop_add {
|
Line 4444 sub upfile_drop_add {
|
foreach (\$id,\$fname,\$mname,\$lname,\$gen,\$inststatus) { |
foreach (\$id,\$fname,\$mname,\$lname,\$gen,\$inststatus) { |
$$_ =~ s/(\s+$|^\s+)//g; |
$$_ =~ s/(\s+$|^\s+)//g; |
} |
} |
|
my $credits; |
|
if ($showcredits) { |
|
if (($role eq 'st') && ($crstype ne 'Community')) { |
|
$credits = $entries{$fields{'credits'}}; |
|
if ($credits ne '') { |
|
$credits =~ s/[^\d\.]//g; |
|
} |
|
if ($credits eq '') { |
|
$credits = $commoncredits; |
|
} |
|
if ($credits eq $defaultcredits) { |
|
undef($credits); |
|
} |
|
} |
|
} |
# check against rules |
# check against rules |
my $checkid = 0; |
my $checkid = 0; |
my $newuser = 0; |
my $newuser = 0; |
Line 4366 sub upfile_drop_add {
|
Line 4589 sub upfile_drop_add {
|
$fname,$mname,$lname,$gen,$sec,$enddate, |
$fname,$mname,$lname,$gen,$sec,$enddate, |
$startdate,$env{'form.forceid'}, |
$startdate,$env{'form.forceid'}, |
$desiredhost,$email,'manual','',$cid, |
$desiredhost,$email,'manual','',$cid, |
'',$context,$inststatus); |
'',$context,$inststatus,$credits); |
$userresult = $roleresult; |
$userresult = $roleresult; |
} else { |
} else { |
if ($role ne '') { |
if ($role ne '') { |
Line 4461 sub upfile_drop_add {
|
Line 4684 sub upfile_drop_add {
|
# Get current classlist |
# Get current classlist |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
if (! defined($classlist)) { |
if (! defined($classlist)) { |
$r->print('<form name="studentform" method="post" action="/adm/createuser" />'. |
$r->print('<form name="studentform" method="post" action="/adm/createuser">'. |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'. |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'. |
'<p class="LC_info">'.&mt('There are no students with current/future access to the course.').'</p>'. |
'<p class="LC_info">'.&mt('There are no students with current/future access to the course.').'</p>'. |
'</form>'."\n"); |
'</form>'."\n"); |
Line 4584 sub print_drop_menu {
|
Line 4807 sub print_drop_menu {
|
$heading = &mt("Drop Students"); |
$heading = &mt("Drop Students"); |
} |
} |
$r->print('<h3>'.$heading.'</h3>'."\n". |
$r->print('<h3>'.$heading.'</h3>'."\n". |
'<form name="studentform" method="post">'."\n"); |
'<form name="studentform" method="post" action="">'."\n"); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
if (! defined($classlist)) { |
if (! defined($classlist)) { |
my $msg = ''; |
my $msg = ''; |
Line 4640 sub update_user_list {
|
Line 4863 sub update_user_list {
|
foreach my $item (@changelist) { |
foreach my $item (@changelist) { |
my ($role,$uname,$udom,$cid,$sec,$scope,$result,$type,$locktype, |
my ($role,$uname,$udom,$cid,$sec,$scope,$result,$type,$locktype, |
@sections,$scopestem,$singlesec,$showsecs,$warn_singlesec, |
@sections,$scopestem,$singlesec,$showsecs,$warn_singlesec, |
$nothingtodo,$keepnosection); |
$nothingtodo,$keepnosection,$credits); |
if ($choice eq 'drop') { |
if ($choice eq 'drop') { |
($uname,$udom,$sec) = split(/:/,$item,-1); |
($uname,$udom,$sec) = split(/:/,$item,-1); |
$role = 'st'; |
$role = 'st'; |
Line 4653 sub update_user_list {
|
Line 4876 sub update_user_list {
|
$scope = $scopestem.'/'.$sec; |
$scope = $scopestem.'/'.$sec; |
} |
} |
} elsif ($context eq 'course') { |
} elsif ($context eq 'course') { |
($uname,$udom,$role,$sec,$type,$locktype) = split(/\:/,$item,-1); |
($uname,$udom,$role,$sec,$type,$locktype,$credits) = |
|
split(/\:/,$item); |
$cid = $env{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
$scopestem = '/'.$cid; |
$scopestem = '/'.$cid; |
$scopestem =~s/\_/\//g; |
$scopestem =~s/\_/\//g; |
Line 4672 sub update_user_list {
|
Line 4896 sub update_user_list {
|
} elsif ($setting eq 'author') { |
} elsif ($setting eq 'author') { |
($uname,$udom,$role,$scope) = split(/\:/,$item); |
($uname,$udom,$role,$scope) = split(/\:/,$item); |
} elsif ($setting eq 'course') { |
} elsif ($setting eq 'course') { |
($uname,$udom,$role,$cid,$sec,$type,$locktype) = |
($uname,$udom,$role,$cid,$sec,$type,$locktype,$credits) = |
split(/\:/,$item); |
split(/\:/,$item); |
$scope = '/'.$cid; |
$scope = '/'.$cid; |
$scope =~s/\_/\//g; |
$scope =~s/\_/\//g; |
Line 4695 sub update_user_list {
|
Line 4919 sub update_user_list {
|
$end = $now; |
$end = $now; |
if ($role eq 'st') { |
if ($role eq 'st') { |
$result = |
$result = |
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context); |
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context,$credits); |
} else { |
} else { |
$result = |
$result = |
&Apache::lonnet::revokerole($udom,$uname,$scope,$role, |
&Apache::lonnet::revokerole($udom,$uname,$scope,$role, |
Line 4703 sub update_user_list {
|
Line 4927 sub update_user_list {
|
} |
} |
} elsif ($choice eq 'delete') { |
} elsif ($choice eq 'delete') { |
if ($role eq 'st') { |
if ($role eq 'st') { |
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$now,$start,$type,$locktype,$cid,'',$context); |
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$now,$start,$type,$locktype,$cid,'',$context,$credits); |
} |
} |
$result = |
$result = |
&Apache::lonnet::assignrole($udom,$uname,$scope,$role,$now, |
&Apache::lonnet::assignrole($udom,$uname,$scope,$role,$now, |
Line 4716 sub update_user_list {
|
Line 4940 sub update_user_list {
|
} |
} |
if ($choice eq 'reenable') { |
if ($choice eq 'reenable') { |
if ($role eq 'st') { |
if ($role eq 'st') { |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context); |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context,$credits); |
} else { |
} else { |
$result = |
$result = |
&Apache::lonnet::assignrole($udom,$uname,$scope,$role,$end, |
&Apache::lonnet::assignrole($udom,$uname,$scope,$role,$end, |
Line 4724 sub update_user_list {
|
Line 4948 sub update_user_list {
|
} |
} |
} elsif ($choice eq 'activate') { |
} elsif ($choice eq 'activate') { |
if ($role eq 'st') { |
if ($role eq 'st') { |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context); |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context,$credits); |
} else { |
} else { |
$result = &Apache::lonnet::assignrole($udom,$uname,$scope,$role,$end, |
$result = &Apache::lonnet::assignrole($udom,$uname,$scope,$role,$end, |
$now,'','',$context); |
$now,'','',$context); |
} |
} |
} elsif ($choice eq 'chgdates') { |
} elsif ($choice eq 'chgdates') { |
if ($role eq 'st') { |
if ($role eq 'st') { |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context); |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,$type,$locktype,$cid,'',$context,$credits); |
} else { |
} else { |
$result = &Apache::lonnet::assignrole($udom,$uname,$scope,$role,$end, |
$result = &Apache::lonnet::assignrole($udom,$uname,$scope,$role,$end, |
$start,'','',$context); |
$start,'','',$context); |
Line 4801 sub update_user_list {
|
Line 5025 sub update_user_list {
|
} else { |
} else { |
if ($role eq 'st') { |
if ($role eq 'st') { |
$result = |
$result = |
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,undef,$end,$start,$type,$locktype,$cid,'',$context); |
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,undef,$end,$start,$type,$locktype,$cid,'',$context,$credits); |
} else { |
} else { |
my $newscope = $scopestem; |
my $newscope = $scopestem; |
$result = &Apache::lonnet::assignrole($udom,$uname,$newscope,$role,$end,$start,'','',$context); |
$result = &Apache::lonnet::assignrole($udom,$uname,$newscope,$role,$end,$start,'','',$context); |
Line 4815 sub update_user_list {
|
Line 5039 sub update_user_list {
|
foreach my $newsec (@newsecs) { |
foreach my $newsec (@newsecs) { |
if (!grep(/^\Q$newsec\E$/,@retained)) { |
if (!grep(/^\Q$newsec\E$/,@retained)) { |
if ($role eq 'st') { |
if ($role eq 'st') { |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$newsec,$end,$start,$type,$locktype,$cid,'',$context); |
$result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$newsec,$end,$start,$type,$locktype,$cid,'',$context,$credits); |
if (@newsecs > 1) { |
if (@newsecs > 1) { |
my $showsingle; |
my $showsingle; |
if ($newsec eq '') { |
if ($newsec eq '') { |
Line 4926 sub update_user_list {
|
Line 5150 sub update_user_list {
|
} |
} |
} |
} |
} |
} |
$r->print('<p><b>'.&mt("$result_text{'ok'}{$choice} for [quant,_1,user role,user roles,no user roles].",$count).'</b></p>'); |
$r->print('<p><b>'.&mt("$result_text{'ok'}{$choice} [quant,_1,user role,user roles,no user roles].",$count).'</b></p>'); |
if ($count > 0) { |
if ($count > 0) { |
if ($choice eq 'revoke' || $choice eq 'drop') { |
if ($choice eq 'revoke' || $choice eq 'drop') { |
$r->print('<p>'.&mt('Re-enabling will re-activate data for the role.').'</p>'); |
$r->print('<p>'.&mt('Re-enabling will re-activate data for the role.').'</p>'); |
Line 4943 sub update_user_list {
|
Line 5167 sub update_user_list {
|
if ($choice eq 'drop') { |
if ($choice eq 'drop') { |
$linktext = &mt('Display current class roster'); |
$linktext = &mt('Display current class roster'); |
} |
} |
$r->print('<a href="javascript:document.studentform.submit()">'.$linktext.'</a></form>'."\n"); |
$r->print( |
|
&Apache::lonhtmlcommon::actionbox( |
|
['<a href="javascript:document.studentform.submit()">'.$linktext.'</a>']) |
|
.'</form>'."\n"); |
} |
} |
|
|
sub dates_feedback { |
sub dates_feedback { |
Line 4951 sub dates_feedback {
|
Line 5178 sub dates_feedback {
|
my $dates; |
my $dates; |
if ($start < $now) { |
if ($start < $now) { |
if ($end == 0) { |
if ($end == 0) { |
$dates .= &mt('role(s) active now; no end date'); |
$dates = &mt('role(s) active now; no end date'); |
} elsif ($end > $now) { |
} elsif ($end > $now) { |
$dates = &mt('role(s) active now; ends [_1].',&Apache::lonlocal::locallocaltime($end)); |
$dates = &mt('role(s) active now; ends [_1].',&Apache::lonlocal::locallocaltime($end)); |
} else { |
} else { |
Line 5104 sub get_groupslist {
|
Line 5331 sub get_groupslist {
|
} |
} |
|
|
sub setsections_javascript { |
sub setsections_javascript { |
my ($formname,$groupslist,$mode,$checkauth,$crstype) = @_; |
my ($formname,$groupslist,$mode,$checkauth,$crstype,$showcredits) = @_; |
my ($checkincluded,$finish,$rolecode,$setsection_js); |
my ($checkincluded,$finish,$rolecode,$setsection_js); |
if ($mode eq 'upload') { |
if ($mode eq 'upload') { |
$checkincluded = 'formname.name == "'.$formname.'"'; |
$checkincluded = 'formname.name == "'.$formname.'"'; |
$finish = "return 'ok';"; |
$finish = "return 'ok';"; |
$rolecode = "var role = formname.defaultrole.options[formname.defaultrole.selectedIndex].value;\n"; |
$rolecode = "var role = formname.defaultrole.options[formname.defaultrole.selectedIndex].value;\n"; |
} elsif ($formname eq 'cu') { |
} elsif ($formname eq 'cu') { |
$checkincluded = 'formname.elements[i-1].checked == true'; |
if (($crstype eq 'Course') && ($showcredits)) { |
|
$checkincluded = "((role == 'st') && (formname.elements[i-2].checked == true)) || ((role != 'st') && (formname.elements[i-1].checked == true))"; |
|
} else { |
|
$checkincluded = 'formname.elements[i-1].checked == true'; |
|
} |
if ($checkauth) { |
if ($checkauth) { |
$finish = "var authcheck = auth_check();\n". |
$finish = "var authcheck = auth_check();\n". |
" if (authcheck == 'ok') {\n". |
" if (authcheck == 'ok') {\n". |
Line 5148 sub setsections_javascript {
|
Line 5379 sub setsections_javascript {
|
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 one member role at a time.', |
inco => 'In each community, each user may only have one 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.', |
mayn => 'may not be used as the name for a section, as it is a reserved word.', |
mayn => 'may not be used as the name for a section, as it is a reserved word.', |
Line 5170 function setSections(formname,crstype) {
|
Line 5401 function setSections(formname,crstype) {
|
var checkcurr = str.match(re1); |
var checkcurr = str.match(re1); |
if (checkcurr != null) { |
if (checkcurr != null) { |
var num = i; |
var num = i; |
|
$rolecode |
if ($checkincluded) { |
if ($checkincluded) { |
$rolecode |
|
if (role == 'cc' || role == 'co') { |
if (role == 'cc' || role == 'co') { |
if (role == 'cc') { |
if (role == 'cc') { |
alert("$alerts{'secd'}\\n$alerts{'accr'}"); |
alert("$alerts{'secd'}\\n$alerts{'accr'}"); |
Line 5544 sub get_course_identity {
|
Line 5775 sub get_course_identity {
|
} |
} |
|
|
sub dc_setcourse_js { |
sub dc_setcourse_js { |
my ($formname,$mode,$context) = @_; |
my ($formname,$mode,$context,$showcredits) = @_; |
my ($dc_setcourse_code,$authen_check); |
my ($dc_setcourse_code,$authen_check); |
my $cctext = &Apache::lonnet::plaintext('cc'); |
my $cctext = &Apache::lonnet::plaintext('cc'); |
my $cotext = &Apache::lonnet::plaintext('co'); |
my $cotext = &Apache::lonnet::plaintext('co'); |
Line 5630 function setCourse() {
|
Line 5861 function setCourse() {
|
} |
} |
SCRIPTTOP |
SCRIPTTOP |
if ($mode ne 'upload') { |
if ($mode ne 'upload') { |
$dc_setcourse_code .= (<<"ENDSCRIPT"); |
$dc_setcourse_code .= (<<"SCRIPTMID"); |
var coursename = "_$env{'request.role.domain'}"+"_"+course+"_"+userrole |
var coursename = "_$env{'request.role.domain'}"+"_"+course+"_"+userrole |
var numcourse = getIndex(document.$formname.dccourse); |
var numcourse = getIndex(document.$formname.dccourse); |
if (numcourse == "-1") { |
if (numcourse == "-1") { |
Line 5656 SCRIPTTOP
|
Line 5887 SCRIPTTOP
|
if (numend != "-1") { |
if (numend != "-1") { |
document.$formname.elements[numend].name = "end"+coursename |
document.$formname.elements[numend].name = "end"+coursename |
} |
} |
|
SCRIPTMID |
|
if ($showcredits) { |
|
$dc_setcourse_code .= <<ENDCRED; |
|
var numcredits = getIndex(document.$formname.credits); |
|
if (numcredits != "-1") { |
|
document.$formname.elements[numcredits].name = "credits"+coursename; |
|
} |
|
ENDCRED |
|
} |
|
$dc_setcourse_code .= <<ENDSCRIPT; |
} |
} |
} |
} |
var authcheck = auth_check(); |
var authcheck = auth_check(); |