version 1.140, 2012/08/21 01:50:34
|
version 1.148, 2013/02/05 16:22:27
|
Line 335 sub print_upload_manager_header {
|
Line 335 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 358 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 603 sub upload_manager_javascript_forward_as
|
Line 618 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 1082 sub print_upload_manager_form {
|
Line 1097 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); |
} |
} |
Line 1553 sub print_userlist {
|
Line 1567 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 1580 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 /><div id="searching">'.&mt('Searching ...').'</div>'); |
} |
} |
$r->rflush(); |
$r->rflush(); |
if ($context eq 'course') { |
if ($context eq 'course') { |
Line 1691 sub print_userlist {
|
Line 1703 sub print_userlist {
|
} |
} |
} |
} |
if (keys(%userlist) == 0) { |
if (keys(%userlist) == 0) { |
|
my $msg = ''; |
if ($context eq 'author') { |
if ($context eq 'author') { |
$r->print(&mt('There are no co-authors to display.')."\n"); |
$msg = &mt('There are no co-authors to display.'); |
} elsif ($context eq 'domain') { |
} elsif ($context eq 'domain') { |
if ($env{'form.roletype'} eq 'domain') { |
if ($env{'form.roletype'} eq 'domain') { |
$r->print(&mt('There are no users with domain roles to display.')."\n"); |
$msg = &mt('There are no users with domain roles to display.'); |
} elsif ($env{'form.roletype'} eq 'author') { |
} elsif ($env{'form.roletype'} eq 'author') { |
$r->print(&mt('There are no authors or co-authors to display.')."\n"); |
$msg = &mt('There are no authors or co-authors to display.'); |
} elsif ($env{'form.roletype'} eq 'course') { |
} elsif ($env{'form.roletype'} eq 'course') { |
$r->print(&mt('There are no course users to display')."\n"); |
$msg = &mt('There are no course users to display'); |
} elsif ($env{'form.roletype'} eq 'community') { |
} elsif ($env{'form.roletype'} eq 'community') { |
$r->print(&mt('There are no community users to display')."\n"); |
$msg = &mt('There are no community users to display'); |
} |
} |
} 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; |
} else { |
} else { |
# Print out the available choices |
# Print out the available choices |
my $usercount; |
my $usercount; |
Line 1717 sub print_userlist {
|
Line 1731 sub print_userlist {
|
$permission,$env{'form.Status'},\%userlist,$keylist); |
$permission,$env{'form.Status'},\%userlist,$keylist); |
} |
} |
if (!$usercount) { |
if (!$usercount) { |
$r->print('<br /><span class="LC_warning">' |
$r->print('<br /><span class="LC_info">' |
.&mt('There are no users matching the search criteria.') |
.&mt('There are no users matching the search criteria.') |
.'</span>' |
.'</span>' |
); |
); |
Line 1905 sub column_checkboxes {
|
Line 1919 sub column_checkboxes {
|
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; |
} |
} |
} |
} |
my $numposs = scalar(@cols); |
my $numposs = scalar(@cols); |
Line 2539 END
|
Line 2553 END
|
if (&Apache::lonnet::allowed('c'.$role,$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
if (&Apache::lonnet::allowed('c'.$role,$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
$canchangesec{$role} = $env{'request.course.sec'}; |
$canchangesec{$role} = $env{'request.course.sec'}; |
} |
} |
|
} elsif ((($role eq 'co') && ($crstype eq 'Community')) || |
|
(($role eq 'cc') && ($crstype eq 'Course'))) { |
|
if (&is_courseowner($env{'request.course.id'}, |
|
$env{'course.'.$env{'request.course.id'}.'.internal.courseowner'})) { |
|
$canchange{$role} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2571 END
|
Line 2591 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 2854 END
|
Line 2878 END
|
if ($showcheckbox) { |
if ($showcheckbox) { |
$checkval = $user; |
$checkval = $user; |
if ($context eq 'course') { |
if ($context eq 'course') { |
if ($role eq 'st') { |
if (($role eq 'co' || $role eq 'cc') && |
$checkval .= ':st'; |
($user =~ /^\Q$env{'user.name'}:$env{'user.domain'}:$role\E/)) { |
} |
$showcheckbox = 0; |
$checkval .= ':'.$in{'section'}; |
} else { |
if ($role eq 'st') { |
if ($role eq 'st') { |
$checkval .= ':'.$in{'type'}.':'. |
$checkval .= ':st'; |
$in{'lockedtype'}; |
} |
} |
$checkval .= ':'.$in{'section'}; |
|
if ($role eq 'st') { |
|
$checkval .= ':'.$in{'type'}.':'. |
|
$in{'lockedtype'}; |
|
} |
|
} |
|
} |
|
if ($showcheckbox) { |
|
$r->print('<td><input type="checkbox" name="'. |
|
'actionlist" value="'.$checkval.'" /></td>'); |
|
} else { |
|
$r->print('<td> </td>'); |
} |
} |
$r->print('<td><input type="checkbox" name="'. |
|
'actionlist" value="'.$checkval.'" /></td>'); |
|
} else { |
} else { |
$r->print('<td> </td>'); |
$r->print('<td> </td>'); |
} |
} |
Line 3110 sub select_actions {
|
Line 3143 sub select_actions {
|
} |
} |
if ($context eq 'course') { |
if ($context eq 'course') { |
if ($env{'form.showrole'} ne 'Any') { |
if ($env{'form.showrole'} ne 'Any') { |
if (!&Apache::lonnet::allowed('c'.$env{'form.showrole'}, |
my $showactions; |
$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('c'.$env{'form.showrole'}, |
if ($env{'request.course.sec'} eq '') { |
$env{'request.course.id'})) { |
return; |
$showactions = 1; |
} else { |
} elsif ($env{'request.course.sec'} ne '') { |
if (!&Apache::lonnet::allowed('c'.$env{'form.showrole'},$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
if (&Apache::lonnet::allowed('c'.$env{'form.showrole'},$env{'request.course.id'}.'/'.$env{'request.course.sec'})) { |
return; |
$showactions = 1; |
} |
} |
} |
} |
|
unless ($showactions) { |
|
unless (&is_courseowner($env{'request.course.id'}, |
|
$env{'course.'.$env{'request.course.id'}.'.internal.courseowner'})) { |
|
return; |
|
} |
} |
} |
} |
} |
} |
} |
Line 3644 END
|
Line 3682 END
|
} |
} |
} |
} |
if (!$studentcount) { |
if (!$studentcount) { |
|
my $msg = ''; |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$r->print(&mt('There are no members to drop.')); |
$msg = &mt('There are no members to drop.'); |
} else { |
} else { |
$r->print(&mt('There are no students to drop.')); |
$msg = &mt('There are no students to drop.'); |
} |
} |
|
$r->print('<p class="LC_info">'.$msg.'</p>'); |
return; |
return; |
} |
} |
my ($classgroups) = &Apache::loncoursedata::get_group_memberships( |
my ($classgroups) = &Apache::loncoursedata::get_group_memberships( |
Line 3794 sub print_first_users_upload_form {
|
Line 3834 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 3824 sub print_first_users_upload_form {
|
Line 3865 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 4107 sub upfile_drop_add {
|
Line 4149 sub upfile_drop_add {
|
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'}}. |
'</b>: '.&mt('Unacceptable domain for user [_2] [_3] [_4] [_5]',$fname,$mname,$lname,$gen)); |
'</b>: '.&mt('Unacceptable domain for user [_1] [_2] [_3] [_4]',$fname,$mname,$lname,$gen)); |
next; |
next; |
} |
} |
my $username = $entries{$fields{'username'}}; |
my $username = $entries{$fields{'username'}}; |
Line 4439 sub upfile_drop_add {
|
Line 4481 sub upfile_drop_add {
|
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'}.'" />'. |
&mt('There are no students with current/future access to the course.'). |
'<p class="LC_info">'.&mt('There are no students with current/future access to the course.').'</p>'. |
'</form>'."\n"); |
'</form>'."\n"); |
} elsif (ref($classlist) eq 'HASH') { |
} elsif (ref($classlist) eq 'HASH') { |
# Remove the students we just added from the list of students. |
# Remove the students we just added from the list of students. |
Line 4563 sub print_drop_menu {
|
Line 4605 sub print_drop_menu {
|
'<form name="studentform" method="post">'."\n"); |
'<form name="studentform" method="post">'."\n"); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
if (! defined($classlist)) { |
if (! defined($classlist)) { |
|
my $msg = ''; |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$r->print(&mt('There are no members currently enrolled.')."\n"); |
$msg = &mt('There are no members currently enrolled.'); |
} else { |
} else { |
$r->print(&mt('There are no students currently enrolled.')."\n"); |
$msg = &mt('There are no students currently enrolled.'); |
} |
} |
|
$r->print('<p class="LC_info">'.$msg."</p>\n"); |
} else { |
} else { |
&show_drop_list($r,$classlist,'nosort',$permission,$crstype); |
&show_drop_list($r,$classlist,'nosort',$permission,$crstype); |
} |
} |
Line 4900 sub update_user_list {
|
Line 4944 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 4917 sub update_user_list {
|
Line 4961 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 4925 sub dates_feedback {
|
Line 4972 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 5122 sub setsections_javascript {
|
Line 5169 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 5751 sub authcheck_alerts {
|
Line 5798 sub authcheck_alerts {
|
return %alerts; |
return %alerts; |
} |
} |
|
|
|
sub is_courseowner { |
|
my ($thiscourse,$courseowner) = @_; |
|
if ($courseowner eq '') { |
|
if ($env{'request.course.id'} eq $thiscourse) { |
|
$courseowner = $env{'course.'.$env{'request.course.id'}.'.internal.courseowner'}; |
|
} |
|
} |
|
if ($courseowner ne '') { |
|
if ($courseowner eq $env{'user.name'}.':'.$env{'user.domain'}) { |
|
return 1; |
|
} |
|
} |
|
return; |
|
} |
|
|
1; |
1; |
|
|