version 1.130, 2005/06/03 16:27:26
|
version 1.138, 2006/03/21 18:34:23
|
Line 43 use Apache::lonlocal;
|
Line 43 use Apache::lonlocal;
|
############################################################### |
############################################################### |
############################################################### |
############################################################### |
sub header { |
sub header { |
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page=&Apache::loncommon::start_page('Enrollment Manager'); |
my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager'); |
|
my $title = &mt('LON-CAPA Enrollment Manager'); |
|
return(<<ENDHEAD); |
return(<<ENDHEAD); |
$html |
$start_page |
<head> |
|
<title>$title</title> |
|
</head> |
|
$bodytag |
|
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
action="/adm/dropadd" name="studentform"> |
action="/adm/dropadd" name="studentform"> |
ENDHEAD |
ENDHEAD |
Line 137 sub domain_form {
|
Line 131 sub domain_form {
|
############################################################### |
############################################################### |
# Menu Phase One |
# Menu Phase One |
sub print_main_menu { |
sub print_main_menu { |
my ($r,$enrl_permission,$view_permission)=@_; |
my ($r,$enrl_permission,$view_permission,$grp_manage_permission, |
|
$grp_view_permission)=@_; |
# |
# |
my ($cdom,$cnum) = split/_/,$env{'request.course.id'}; |
my ($cdom,$cnum) = split/_/,$env{'request.course.id'}; |
my @menu = |
my @menu = |
Line 171 sub print_main_menu {
|
Line 166 sub print_main_menu {
|
permission => &Apache::lonnet::auto_run($cnum,$cdom), |
permission => &Apache::lonnet::auto_run($cnum,$cdom), |
url => '/adm/populate', |
url => '/adm/populate', |
}, |
}, |
|
{ text => 'Create a new group', |
|
help => 'Course_Create_Group', |
|
permission => $grp_manage_permission, |
|
url => '/adm/coursegroups?refpage=enrl&action=create', |
|
}, |
|
{ text => 'Modify an existing group', |
|
help => 'Course_Modify_Group', |
|
permission => $grp_manage_permission, |
|
url => '/adm/coursegroups?refpage=enrl&action=modify', |
|
}, |
|
{ text => 'Delete an existing group', |
|
help => 'Course_Delete_Group', |
|
permission => $grp_manage_permission, |
|
url => '/adm/coursegroups?refpage=enrl&action=delete', |
|
}, |
|
{ text => 'Enter an existing group', |
|
help => 'Course_Display_Group', |
|
permission => $grp_view_permission, |
|
url => '/adm/coursegroups?refpage=enrl&action=view', |
|
}, |
); |
); |
my $menu_html = ''; |
my $menu_html = ''; |
foreach my $menu_item (@menu) { |
foreach my $menu_item (@menu) { |
Line 253 sub print_upload_manager_header {
|
Line 268 sub print_upload_manager_header {
|
$r->print('<input type="button" value="Reverse Association" '. |
$r->print('<input type="button" value="Reverse Association" '. |
'name="'.&mt('Reverse Association').'" '. |
'name="'.&mt('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('<input type="checkbox" name="noFirstLine" $checked />'. |
$r->print('<label><input type="checkbox" name="noFirstLine" $checked />'. |
&mt('Ignore First Line')); |
&mt('Ignore First Line').'</label>'); |
$r->print("<hr />\n". |
$r->print("<hr />\n". |
'<script type="text/javascript" language="Javascript">'."\n". |
'<script type="text/javascript" language="Javascript">'."\n". |
$javascript."\n".$javascript_validations.'</script>'); |
$javascript."\n".$javascript_validations.'</script>'); |
Line 617 sub print_upload_manager_footer {
|
Line 632 sub print_upload_manager_footer {
|
$Str .= "<h3>".&mt('Starting and Ending Dates')."</h3>\n"; |
$Str .= "<h3>".&mt('Starting and Ending Dates')."</h3>\n"; |
$Str .= "<p>\n".$date_table."</p>\n"; |
$Str .= "<p>\n".$date_table."</p>\n"; |
$Str .= "<h3>".&mt('Full Update')."</h3>\n"; |
$Str .= "<h3>".&mt('Full Update')."</h3>\n"; |
$Str .= '<input type="checkbox" name="fullup" value="yes">'. |
$Str .= '<label><input type="checkbox" name="fullup" value="yes">'. |
' '.&mt('Full update (also print list of users not enrolled anymore)'). |
' '.&mt('Full update (also print list of users not enrolled anymore)'). |
"</p>\n"; |
"</label></p>\n"; |
$Str .= "<h3>".&mt('Student Number')."</h3>\n"; |
$Str .= "<h3>".&mt('Student Number')."</h3>\n"; |
$Str .= "<p>\n".'<input type="checkbox" name="forceid" value="yes">'; |
$Str .= "<p>\n".'<label><input type="checkbox" name="forceid" value="yes">'; |
$Str .= &mt('Disable ID/Student Number Safeguard and Force Change '. |
$Str .= &mt('Disable ID/Student Number Safeguard and Force Change '. |
'of Conflicting IDs (only do if you know what you are doing)'). |
'of Conflicting IDs (only do if you know what you are doing)'). |
"\n</p><p>\n"; |
"</label>\n</p><p>\n"; |
$Str .= '<input type="button" onClick="javascript:verify(this.form)" '. |
$Str .= '<input type="button" onClick="javascript:verify(this.form)" '. |
'value="Update Class List" />'."<br />\n"; |
'value="Update Class List" />'."<br />\n"; |
$Str .= &mt('Note: for large courses, this operation may be time '. |
$Str .= &mt('Note: for large courses, this operation may be time '. |
Line 853 sub date_setting_table {
|
Line 868 sub date_setting_table {
|
my ($starttime,$endtime,$mode) = @_; |
my ($starttime,$endtime,$mode) = @_; |
my ($startform,$endform)=&setup_date_selectors($starttime,$endtime,$mode); |
my ($startform,$endform)=&setup_date_selectors($starttime,$endtime,$mode); |
my $dateDefault = '<nobr>'. |
my $dateDefault = '<nobr>'. |
'<input type="checkbox" name="makedatesdefault" /> '. |
'<label><input type="checkbox" name="makedatesdefault" /> '. |
&mt('make these dates the default for future enrollment'); |
&mt('make these dates the default for future enrollment').'</label>'; |
if ($mode eq 'create_enrolldates' || $mode eq 'create_defaultdates') { |
if ($mode eq 'create_enrolldates' || $mode eq 'create_defaultdates') { |
$dateDefault = ' '; |
$dateDefault = ' '; |
} |
} |
my $perpetual = '<nobr><input type="checkbox" name="no_end_date"'; |
my $perpetual = '<nobr><label><input type="checkbox" name="no_end_date"'; |
if (defined($endtime) && $endtime == 0) { |
if (defined($endtime) && $endtime == 0) { |
$perpetual .= ' checked'; |
$perpetual .= ' checked'; |
} |
} |
$perpetual.= ' /> '.&mt('no ending date').'</nobr>'; |
$perpetual.= ' /> '.&mt('no ending date').'</label></nobr>'; |
if ($mode eq 'create_enrolldates') { |
if ($mode eq 'create_enrolldates') { |
$perpetual = ' '; |
$perpetual = ' '; |
} |
} |
Line 1117 $date_table
|
Line 1132 $date_table
|
<p> |
<p> |
$lt{'idsn'}: <input type="text" name="cstid" size="10"> |
$lt{'idsn'}: <input type="text" name="cstid" size="10"> |
</p><p> |
</p><p> |
|
<label> |
<input type="checkbox" name="forceid" value="yes"> |
<input type="checkbox" name="forceid" value="yes"> |
$lt{'disn'} |
$lt{'disn'} |
|
</label> |
</p><p> |
</p><p> |
<input type="button" onClick="verify(this.form)" value="$lt{'eas'}"> |
<input type="button" onClick="verify(this.form)" value="$lt{'eas'}"> |
</p> |
</p> |
Line 1235 sub show_class_list {
|
Line 1252 sub show_class_list {
|
if ($sortby !~ /^(username|domain|section|fullname|id|start|end|type)$/) { |
if ($sortby !~ /^(username|domain|section|fullname|id|start|end|type)$/) { |
$sortby = 'username'; |
$sortby = 'username'; |
} |
} |
|
if (! exists($env{'form.displayphotos'})) { |
|
$env{'form.displayphotos'} = 'off'; |
|
} |
|
my $displayphotos = $env{'form.displayphotos'}; |
|
|
# Print out header |
# Print out header |
unless ($mode eq 'autoenroll') { |
unless ($mode eq 'autoenroll') { |
$r->print(<<END); |
$r->print(<<END); |
Line 1243 END
|
Line 1265 END
|
} |
} |
$r->print(<<END); |
$r->print(<<END); |
<input type="hidden" name="sortby" value="$sortby" /> |
<input type="hidden" name="sortby" value="$sortby" /> |
|
<input type="hidden" name="displayphotos" value="$displayphotos" /> |
END |
END |
if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') { |
if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') { |
if ($linkto eq 'aboutme') { |
if ($linkto eq 'aboutme') { |
Line 1257 END
|
Line 1280 END
|
'sec' => "section", |
'sec' => "section", |
'start' => "start date", |
'start' => "start date", |
'end' => "end date", |
'end' => "end date", |
'type' => "enroll type/action" |
'type' => "enroll type/action", |
|
'photo' => "photo", |
); |
); |
unless ($mode eq 'autoenroll') { |
unless ($mode eq 'autoenroll') { |
$r->print(<<END); |
$r->print(<<END); |
Line 1265 END
|
Line 1289 END
|
<input type="hidden" name="sdom" value="" /> |
<input type="hidden" name="sdom" value="" /> |
END |
END |
} |
} |
|
if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) { |
|
$r->print(' |
|
<script type="text/javascript"> |
|
function photowindow(photolink) { |
|
var title = "Photo_Viewer"; |
|
var options = "scrollbars=1,resizable=1,menubar=0"; |
|
options += ",width=240,height=240"; |
|
stdeditbrowser = open(photolink,title,options,"1"); |
|
stdeditbrowser.focus(); |
|
} |
|
</script> |
|
'); |
|
} |
$r->print(" |
$r->print(" |
<p> |
<p> |
<table border=2> |
<table border=2> |
Line 1295 END
|
Line 1332 END
|
</th><th> |
</th><th> |
<a href="javascript:document.studentform.sortby.value='end';document.studentform.submit();">$lt{'end'}</a> |
<a href="javascript:document.studentform.sortby.value='end';document.studentform.submit();">$lt{'end'}</a> |
</th> |
</th> |
</tr> |
|
END |
END |
|
if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) { |
|
my %photo_options = &Apache::lonlocal::texthash( |
|
'on' => 'Show', |
|
'off' => 'Hide', |
|
); |
|
my $photochg = 'on'; |
|
if ($displayphotos eq 'on') { |
|
$photochg = 'off'; |
|
} |
|
$r->print(' <th>'."\n".' '. |
|
'<a href="javascript:document.studentform.displayphotos.value='. |
|
"'".$photochg."'".';document.studentform.submit();">'. |
|
$photo_options{$photochg}.'</a> '.$lt{'photo'}."\n". |
|
' </th>'."\n"); |
|
} |
|
$r->print(" </tr>\n"); |
} elsif ($mode eq 'csv') { |
} elsif ($mode eq 'csv') { |
# |
# |
# Open a file |
# Open a file |
Line 1393 END
|
Line 1445 END
|
$studentcount++; |
$studentcount++; |
my $cellentry; |
my $cellentry; |
if ($type eq 'auto') { |
if ($type eq 'auto') { |
$cellentry = '<b>'.&mt('auto').'</b> <input type="checkbox" name="chgauto" value="'.$username.':'.$domain.'" /> Change'; |
$cellentry = '<b>'.&mt('auto').'</b> <label><input type="checkbox" name="chgauto" value="'.$username.':'.$domain.'" /> Change</label>'; |
$autocount ++; |
$autocount ++; |
} else { |
} else { |
$cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><nobr><input type="checkbox" name="chgmanual" value="'.$username.':'.$domain.'" /> Change</nobr></td></tr><tr><td><nobr>'; |
$cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><nobr><label><input type="checkbox" name="chgmanual" value="'.$username.':'.$domain.'" /> Change</label></nobr></td></tr><tr><td><nobr>'; |
$manualcount ++; |
$manualcount ++; |
if ($lockedtype) { |
if ($lockedtype) { |
$cellentry .= '<input type="checkbox" name="unlockchg" value="'.$username.':'.$domain.'" /> '.&mt('Unlock'); |
$cellentry .= '<label><input type="checkbox" name="unlockchg" value="'.$username.':'.$domain.'" /> '.&mt('Unlock').'</label>'; |
$unlockcount ++; |
$unlockcount ++; |
} else { |
} else { |
$cellentry .= '<input type="checkbox" name="lockchg" value="'.$username.':'.$domain.'" /> '.&mt('Lock'); |
$cellentry .= '<label><input type="checkbox" name="lockchg" value="'.$username.':'.$domain.'" /> '.&mt('Lock').'</label>'; |
$lockcount ++; |
$lockcount ++; |
} |
} |
$cellentry .= '</nobr></td></tr></table>'; |
$cellentry .= '</nobr></td></tr></table>'; |
Line 1434 END
|
Line 1486 END
|
<td>$section</td> |
<td>$section</td> |
<td>$start</td> |
<td>$start</td> |
<td>$end</td> |
<td>$end</td> |
</tr> |
|
END |
END |
|
if ($env{'course.'.$env{'request.course.id'}. |
|
'.internal.showphoto'}) { |
|
if ($displayphotos eq 'on') { |
|
my $imgurl = |
|
&Apache::lonnet::retrievestudentphoto($domain, |
|
$username,'gif', |
|
'thumbnail'); |
|
|
|
$r->print(' <td align="right"><a href="javascript:photowindow('."'".&Apache::lonnet::studentphoto($domain,$username,'jpg')."'".')"><img src="'.$imgurl.'" border="1"></a></td>'); |
|
} else { |
|
$r->print(' <td> </td> '); |
|
} |
|
} |
|
$r->print(' </tr> '); |
} elsif ($mode eq 'csv') { |
} elsif ($mode eq 'csv') { |
next if (! defined($CSVfile)); |
next if (! defined($CSVfile)); |
# no need to bother with $linkto |
# no need to bother with $linkto |
Line 1515 sub print_modify_student_form {
|
Line 1580 sub print_modify_student_form {
|
'<p>'. |
'<p>'. |
&mt('Unable to retrieve environment data for').' '.$sname. |
&mt('Unable to retrieve environment data for').' '.$sname. |
&mt('in domain').' '.$sdom.'</p><p>'. |
&mt('in domain').' '.$sdom.'</p><p>'. |
&mt('Please contact your LON-CAPA administrator regarding this situation.').'</p></body></html>'); |
&mt('Please contact your LON-CAPA administrator regarding this situation.').'</p>'.&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
# determine the students starting and ending times and section |
# determine the students starting and ending times and section |
Line 1594 $info{'lastname'} $info{'generation'}, $
|
Line 1659 $info{'lastname'} $info{'generation'}, $
|
</p><p> |
</p><p> |
<b>$lt{'sid'}</b>: <input type="text" name="id" value="$info{'id'}" size="12"/> |
<b>$lt{'sid'}</b>: <input type="text" name="id" value="$info{'id'}" size="12"/> |
</p><p> |
</p><p> |
|
<label> |
<input type="checkbox" name="forceid" > |
<input type="checkbox" name="forceid" > |
$lt{'disn'} |
$lt{'disn'} |
|
</label> |
</p><p> |
</p><p> |
<b>$lt{'sec'}</b>: <input type="text" name="section" value="$section" size="14"/> |
<b>$lt{'sec'}</b>: <input type="text" name="section" value="$section" size="14"/> |
</p> |
</p> |
<p>$current_date_description</p> |
<p>$current_date_description</p> |
<p>$date_table</p> |
<p>$date_table</p> |
<input type="submit" value="$lt{'sm'}" /> |
<input type="submit" value="$lt{'sm'}" /> |
</body></html> |
|
END |
END |
|
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 1611 END
|
Line 1678 END
|
# modify a single students section |
# modify a single students section |
# |
# |
sub modify_single_student { |
sub modify_single_student { |
my $r = shift; |
my ($r) = @_; |
# |
# |
# Remove non alphanumeric values from the section |
# Remove non alphanumeric values from the section |
$env{'form.section'} =~ s/\W//g; |
$env{'form.section'} =~ s/\W//g; |
Line 1753 END
|
Line 1820 END
|
<input type="hidden" name="sortby" value="$sortby" /> |
<input type="hidden" name="sortby" value="$sortby" /> |
<input type="hidden" name="Status" value="$status" /> |
<input type="hidden" name="Status" value="$status" /> |
<a href="javascript:document.studentform.submit();">$Masd</a> |
<a href="javascript:document.studentform.submit();">$Masd</a> |
</body></html> |
|
END |
END |
|
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 1975 sub print_first_courselist_upload_form {
|
Line 2042 sub print_first_courselist_upload_form {
|
$str .= "<p>\n"; |
$str .= "<p>\n"; |
$str .= '<input type="submit" name="fileupload" value="'. |
$str .= '<input type="submit" name="fileupload" value="'. |
&mt('Upload class list').'">'."\n"; |
&mt('Upload class list').'">'."\n"; |
$str .= '<input type="checkbox" name="noFirstLine" /> '. |
$str .= '<label><input type="checkbox" name="noFirstLine" /> '. |
&mt('Ignore First Line')."</p>\n"; |
&mt('Ignore First Line')."</label></p>\n"; |
$str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List", |
$str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List", |
&mt("How do I create a class list from a spreadsheet")). |
&mt("How do I create a class list from a spreadsheet")). |
"<br />\n"; |
"<br />\n"; |
$str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV", |
$str .= &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")). |
"<br />\n"; |
"<br />\n"; |
$str .= "</body>\n</html>\n"; |
$str .= &Apache::loncommon::end_page(); |
$r->print($str); |
$r->print($str); |
return; |
return; |
} |
} |
Line 2039 sub upfile_drop_add {
|
Line 2106 sub upfile_drop_add {
|
if (! exists($home_servers{$desiredhost})) { |
if (! exists($home_servers{$desiredhost})) { |
$r->print('<font color="#ff0000">'.&mt('Error').'</font>'. |
$r->print('<font color="#ff0000">'.&mt('Error').'</font>'. |
&mt('Invalid home server specified')); |
&mt('Invalid home server specified')); |
$r->print("</body>\n</html>\n"); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
} |
} |
Line 2285 sub handler {
|
Line 2352 sub handler {
|
if (! ($env{'request.course.fn'})) { |
if (! ($env{'request.course.fn'})) { |
# Not in a course |
# Not in a course |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/dropadd:cst:0:0:Cannot drop or add students"; |
"/adm/dropadd:cst:0:0:Cannot manage or view course groups, ". |
|
"or drop or add students"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
# |
# |
Line 2293 sub handler {
|
Line 2361 sub handler {
|
&Apache::lonnet::allowed('vcl',$env{'request.course.id'}); |
&Apache::lonnet::allowed('vcl',$env{'request.course.id'}); |
my $enrl_permission = |
my $enrl_permission = |
&Apache::lonnet::allowed('cst',$env{'request.course.id'}); |
&Apache::lonnet::allowed('cst',$env{'request.course.id'}); |
if (! $view_permission && ! $enrl_permission) { |
|
|
my $grp_view_permission = |
|
&Apache::lonnet::allowed('vcg',$env{'request.course.id'}); |
|
my $grp_manage_permission = |
|
&Apache::lonnet::allowed('mdg',$env{'request.course.id'}); |
|
|
|
|
|
if (! $grp_view_permission && ! $grp_manage_permission && |
|
! $view_permission && ! $enrl_permission) { |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/dropadd:cst:0:0:Cannot drop or add students"; |
"/adm/coursegroups:cst:0:0:Cannot manage or view course groups, ". |
return HTTP_NOT_ACCEPTABLE; |
"or drop or add students"; |
|
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
|
# |
# |
# Only output the header information if they did not request csv format |
# Only output the header information if they did not request csv format |
# |
# |
Line 2310 sub handler {
|
Line 2388 sub handler {
|
if (! exists($env{'form.action'})) { |
if (! exists($env{'form.action'})) { |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(undef,'Enrollment Manager')); |
(undef,'Enrollment Manager')); |
&print_main_menu($r,$enrl_permission,$view_permission); |
&print_main_menu($r,$enrl_permission,$view_permission,$grp_manage_permission, |
|
$grp_view_permission); |
} elsif ($env{'form.action'} eq 'upload' && $enrl_permission) { |
} elsif ($env{'form.action'} eq 'upload' && $enrl_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/dropadd?action=upload&state=', |
({href=>'/adm/dropadd?action=upload&state=', |
Line 2399 sub handler {
|
Line 2478 sub handler {
|
} |
} |
# |
# |
# Finish up |
# Finish up |
$r->print('</form></body></html>'); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|