--- loncom/interface/lonpopulate.pm 2003/12/08 17:06:26 1.2
+++ loncom/interface/lonpopulate.pm 2003/12/29 16:34:39 1.8
@@ -1,14 +1,39 @@
+# automated enrollment configuration handler
+# $Id: lonpopulate.pm,v 1.8 2003/12/29 16:34:39 raeburn Exp $
+#
+# Copyright Michigan State University Board of Trustees
+#
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
+#
+# LON-CAPA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LON-CAPA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LON-CAPA; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# /home/httpd/html/adm/gpl.txt
+#
+# http://www.lon-capa.org/
+#
package Apache::lonpopulate;
use strict;
use lib qw(/home/httpd/lib/perl);
-use Apache::lonnet ();
-use Apache::loncommon ();
-use Apache::lonhtmlcommon ();
-use Apache::lonlocal ();
+use Apache::lonnet;
+use Apache::loncommon;
+use Apache::lonhtmlcommon;
+use Apache::lonlocal;
use Apache::Constants qw(:common :http REDIRECT);
use Time::Local;
-use LONCAPA::Enrollment ();
+use LONCAPA::Enrollment;
use localenroll;
###############################################################
@@ -414,76 +439,111 @@ ENDTWO
");
- my $option_str = '';
- my $lastpname = '';
- my $option_count = 0;
-
- my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($dom.'/'.$crs);
- foreach (sort keys %coursepersonnel) {
- if ($_ eq &Apache::lonlocal::mt("Course Coordinator") )
- {
- my @ccs = ();
- if ($coursepersonnel{$_} =~ m/,/) {
- @ccs = split(/,/,$coursepersonnel{$_});
- } else {
- @ccs = $coursepersonnel{$_};
- }
- foreach (@ccs) {
- my ($puname,$pudom)=split(/\:/,$_);
- my $pname = &Apache::loncommon::plainname($puname,$pudom);
- if (grep/^$puname\@$pudom$/,@notified) {
- $option_str .="\n";
+ my @coursepersonnel = &Apache::lonnet::getkeys('nohist_userroles',$dom,$crs);
+ my @ccs = ();
+ my @oldccs = ();
+ my %pname = ();
+ my %notifystate = ();
+ foreach (@coursepersonnel) {
+ my @roleinfo = split/:/,$_;
+ if ($roleinfo[0] eq 'cc') {
+ unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) {
+ my $active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc');
+ if ($active_cc eq 'ok') {
+ push @ccs, "$roleinfo[1]\@$roleinfo[2]";
+ $pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]);
+ if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) {
+ $notifystate{"$roleinfo[1]\@$roleinfo[2]"} = 1;
+ } else {
+ $notifystate{"$roleinfo[1]\@$roleinfo[2]"} = 0;
+ }
} else {
- $option_str .="\n";
+ push @oldccs, "$roleinfo[1]\@$roleinfo[2]";
}
- $option_count ++;
- $lastpname = $pname.'@'.$pudom;
}
}
}
- if ($option_count > 1) {
- my $optionsize = $option_count;
- if ($optionsize > 6) {
- $optionsize = 6;
- }
+ if ($notifycount > 0) {
+ foreach my $person (@notified) {
+ unless ( (grep/^$person$/,@ccs) || ($person eq '') || (grep/^$person$/,@oldccs) ) {
+ push @ccs, $person;
+ my ($puname,$pdom) = split/\@/,$person;
+ $pname{$person} = &Apache::loncommon::plainname($puname,$pdom);
+ $notifystate{$person} = 1;
+ }
+ }
+ }
+ my $viewer = $ENV{'user.name'}.'@'.$ENV{'user.domain'};
+ unless ( (grep/^$viewer$/,@ccs) || ($viewer eq '') ) {
+ push @ccs,$viewer;
+ $pname{$viewer} = &Apache::loncommon::plainname($ENV{'user.name'},$ENV{'user.domain'});
+ $notifystate{$viewer} = 0;
+ }
+
+ my $notifyshow = @ccs;
+
+ if (@ccs > 0) {
+ @ccs = sort @ccs;
$r->print("
-
-Select which course coordinators should receive information about roster changes whenever any adds or drops occur during the nightly enrollment check.
-
+
The table below contains a list of course coordinators in this course. Uncheck the 'Notification?' checkbox for each person who is to be removed from the list of recipients who are currently informed of roster changes whenever any adds or drops occur during the nightly enrollment check. To include individuals who are not currently recipients, simply check the 'Notification?' checkbox. Click 'Go' to store your changes.
- Select more than one recipient by using the following keyboard and mouse combinations:
-
-
Apple-click: MacOS
-
Ctrl-click: Windows
-
Left click: Linux
-
-
-
+
+
+
Name
+
username
+
Current status
+
Notification?
+
");
- } else {
+ for (my $i=0; $i<@ccs; $i++) {
+ my $colflag = $i%2;
+ $r->print("
-As you are the only user with the role of course coordinator in this course, if you choose to enable notification of roster changes, you will be the sole recipient of LON-CAPA messages generated whenever any adds or drops occur during the nightly enrollment check.
-
-
-
+
+
+
+
+
+
+
+
+
+
+
");
+ } else {
+ $r->print("
+
+
+ No course coordinators found.
+
+
");
}
$r->print("
-
-
-
-
-
-
-
-
-
+
+
+
+
+
");
} elsif ($action eq "crosslist") {
my @xlists = ();
@@ -501,7 +561,7 @@ As you are the only user with the role o
");
if ($cross_str > 0) {
$r->print("
- Currently, LON-CAPA course: $realm ($enrollvar{coursecode}) is crosslisted with $cross_str course section(s). 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. For each crosslisting, leave the checkbox checked if you want registered students in that course to be included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise uncheck it. If you wish to change the section/group ID assigned in your LON-CAPA course for a crosslisted course, enter the new section/group ID in the appropriate textbox. 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 crosslisting. If you wish to add new crosslisted courses, enter the number of new courses to add in the textbox at the bottom of the page. You will provide information about each of the new crosslistings on a subsequent page. Click 'Go' to store your changes.
+ Currently, this LON-CAPA course is crosslisted with $cross_str course section(s). 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. For each crosslisting, leave the checkbox checked if you want registered students in that course to be included in the student roster for LON-CAPA course: $realm ($enrollvar{coursecode}); otherwise uncheck it. If you wish to change the section/group ID assigned in your LON-CAPA course for a crosslisted course, enter the new section/group ID in the appropriate textbox. 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 crosslisting. If you wish to add new crosslisted courses, enter the number of new courses to add in the textbox at the bottom of the page. You will provide information about each of the new crosslistings on a subsequent page. Click 'Go' to store your changes.
@@ -585,9 +645,8 @@ As you are the only user with the role o
}
}
if (@sections > 0) {
- if (@sections > 1) {
- my $secshow = @sections;
- $r->print("
+ my $secshow = @sections;
+ $r->print("