[LON-CAPA-cvs] cvs: loncom /interface lonpopulate.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Thu, 11 Dec 2003 02:54:51 -0000
This is a MIME encoded message
--raeburn1071111291
Content-Type: text/plain
raeburn Wed Dec 10 21:54:51 2003 EDT
Modified files:
/loncom/interface lonpopulate.pm
Log:
Added support for display of usernames and initial passwords on screen when result of new user enrollment is to create new users with internal authentication.
--raeburn1071111291
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20031210215451.txt"
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.4 loncom/interface/lonpopulate.pm:1.5
--- loncom/interface/lonpopulate.pm:1.4 Tue Dec 9 15:06:37 2003
+++ loncom/interface/lonpopulate.pm Wed Dec 10 21:54:51 2003
@@ -1,5 +1,5 @@
# automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.4 2003/12/09 20:06:37 albertel Exp $
+# $Id: lonpopulate.pm,v 1.5 2003/12/11 02:54:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -622,7 +622,8 @@
</td>
</tr>
<tr>
- <td>For each section, check the checkbox if you want registered students in that section to be included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise uncheck it. If you want to change the section/group designation used for this section in LON-CAPA, delete the currecnt value in the LON-CAPA section/group textbox and enter the new value. The LON-CAPA section/group ID can be left (or set to) empty, if you do not wish to tie a section/group ID to this section. If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to store your changes.</td>
+ <td>For each section, check the checkbox if you want registered students in that section to be included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise uncheck it. If you want to change the section/group designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section/group textbox and enter the new value. The LON-CAPA section/group ID can be left (or set to) empty, if you do not wish to tie a section/group ID to this section. To add a new section, check the 'Enrollment in this course?' checkbox, and enter the desired LON-CAPA section/groupID in the appropriate textbox. Click 'Go' to store
+your changes.</td>
</tr>
</table>
<br/>
@@ -631,7 +632,7 @@
<td>
<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
<tr bgcolor=\"#CCCCFF\">
- <td><b>Course code</b>/td>
+ <td><b>Section</b></td>
<td><b>Current status</b></td>
<td><b>LON-CAPA section/group ID</b></td>
<td><b>Enrollment in this course?</b></td>
@@ -640,8 +641,8 @@
for (my $i=0; $i<@sections; $i++) {
my $colflag = $i%2;
my $shrflag = 0;
- $r->print("<tr bgcolor=\"$bgcolors[$colflag]\" align=\"center\">
- <td>$sections[$i]<input type=\"hidden\" name=\"secnum_$i\" value=\"$sections[$i]\" />/td>
+ $r->print("<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
+ <td>$sections[$i]<input type=\"hidden\" name=\"secnum_$i\" value=\"$sections[$i]\" /></td>
<td>
");
if (grep/^$sections[$i]$/,@currsections) {
@@ -701,7 +702,7 @@
if (@currsections) {
my $secshow = @currsections;
$r->print("
- Currently, LON-CAPA course: $realm ($enrollvar{coursecode}) incorporates enrollment from $secshow sections. Students enrolling in any of these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update. For each section, uncheck the checkbox if you want registered students in that section to cease being included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise leave it checked. If you want to change the section/group designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section/groupID textbox and enter the new value. If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to store your changes.
+ Currently, LON-CAPA course: $realm ($enrollvar{coursecode}) incorporates enrollment from $secshow sections. Students enrolling in any of these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update. For each section, uncheck the checkbox if you want registered students in that section to cease being included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise leave it checked. If you want to change the section/group designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section/groupID textbox and enter the new value. If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to store your changes.
</td>
</tr>
</table>
@@ -1110,7 +1111,7 @@
$response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
} else {
if ($removecount > 0) {
- $response = "A total of $removecount courses are no longer crosslisted with LON-CAPA course: $realm ($coursecode).<br>/<br/>";
+ $response = "A total of $removecount courses are no longer crosslisted with LON-CAPA course: $realm ($coursecode).<br/><br/>";
}
if ($crosscount > 0) {
$response .= "The $crosscount courses listed below remain crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n";
@@ -1168,13 +1169,16 @@
sub print_crosslistings_response () {
my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
- my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode'],$dom,$crs);
+ my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner'],$dom,$crs);
my @currxlists = ();
my @xlists = ();
my @allxlists = ();
+ my @badxlists = ();
+ my @badowner = ();
my $numcross = 0;
my $xliststr = $settings{'internal.crosslistings'};
my $coursecode = $settings{'internal.coursecode'};
+ my $owner = $settings{'internal.courseowner'};
my $response = '';
if ($xliststr =~ m/,/) {
@@ -1192,7 +1196,17 @@
my $xl = "newcross_".$i;
my $gp = "newgroupid_".$i;
if ( exists($ENV{"form.$xl"}) ) {
- push @xlists,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
+ my $coursecheck = &localenroll::validate_courseID($ENV{"form.$xl"});
+ if ($coursecheck eq 'ok') {
+ my $addcheck = &localenroll::new_course($ENV{"form.$xl"},$owner);
+ if ($addcheck eq 'ok') {
+ push @xlists,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
+ } else {
+ push @badowner,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
+ }
+ } else {
+ push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"};
+ }
}
}
push @allxlists, @xlists;
@@ -1218,7 +1232,25 @@
my ($xlist,$gp) = split/:/,$_;
$response .= "<li>$xlist - ID: $gp</li>\n";
}
- $response .= "</ul><br/>\n";
+ $response .= "</ul><br/><br/>\n";
+
+ if (@badxlists > 0) {
+ $response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because they are not valid courses according to your institution's official schedule of classes and sections.<br/><ul>\n";
+ foreach (@badxlists) {
+ my ($xlist,$gp) = split/:/,$_;
+ $response .= "<li>$xlist - ID: $gp</li>\n";
+ }
+ $response .= "</ul><br/><br/>\n";
+ }
+
+ if (@badowner > 0) {
+ $response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n";
+ foreach (@badowner) {
+ my ($xlist,$gp) = split/:/,$_;
+ $response .= "<li>$xlist - ID: $gp</li>\n";
+ }
+ $response .= "</ul><br/><br/>\n";
+ }
&print_reply($r,$response,$$tasktitleref{$action});
return;
@@ -1430,6 +1462,7 @@
my @allcourses = ();
my %LC_code = ();
my $logmsg = '';
+ my $newusermsg = '';
my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg','internal.autostart','internal.autoend'],$dom,$crs);
my $coursecode = $settings{'internal.coursecode'};
@@ -1493,11 +1526,7 @@
@{$affiliates{$crs}} = @allcourses;
&localenroll::fetch_enrollment($dom,\%affiliates,\%reply);
if ($reply{$crs} > 0) {
- ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$autostart,$autoend,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,"updatenow");
- unless ($changecount == 0) {
- my $responselength = length($response);
- $response = substr($response,0,$responselength-4);
- }
+ ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$autostart,$autoend,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow");
} else {
$response = "There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course. No updates have been carried out, and the roster remains unchanged.";
}
@@ -1510,7 +1539,11 @@
$logmsg = substr($logmsg,0,$loglength-4);
$logmsg = "<br/><br/>The following messages were generated by the roster update process: <br/><ul><li>".$logmsg."</ul><br/>";
}
- $response .= $logmsg;
+ unless ($newusermsg eq '') {
+ $newusermsg = substr( $newusermsg,0,rindex($newusermsg,'<li>') );
+ $newusermsg = "<br/><br/>The following new system user(s) who was/were created will be using internal authentication with an initial randomly generated password. A valid e-mail address was not available for this/these user(s) so LON-CAPA account credentials could not be sent via e-mail.<br/><ul><li>".$newusermsg."</ul><br/>";
+ }
+ $response .= $logmsg.$newusermsg;
&print_reply($r,$response,$$tasktitleref{$action});
return;
}
--raeburn1071111291--