[LON-CAPA-cvs] cvs: loncom /enrollment Enrollment.pm /interface loncoursedata.pm londropadd.pm lonpopulate.pm /lonnet/perl lonnet.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Tue, 29 Jun 2004 04:30:02 -0000
This is a MIME encoded message
--raeburn1088483402
Content-Type: text/plain
raeburn Tue Jun 29 00:30:02 2004 EDT
Modified files:
/loncom/interface londropadd.pm lonpopulate.pm loncoursedata.pm
/loncom/lonnet/perl lonnet.pm
/loncom/enrollment Enrollment.pm
Log:
AUtomated Enrollment Manager now provides automatic switching from 'manual' to 'auto' enrollment type when a manually enrolled student is detected in the institution's classlist. Auto switching can be prevented on a per-student basis by 'locking' the type to 'manual'. Also changes to Enrollment.pm to make it more modular.
--raeburn1088483402
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20040629003002.txt"
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.114 loncom/interface/londropadd.pm:1.115
--- loncom/interface/londropadd.pm:1.114 Thu Jun 17 14:31:24 2004
+++ loncom/interface/londropadd.pm Tue Jun 29 00:30:00 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.114 2004/06/17 18:31:24 raeburn Exp $
+# $Id: londropadd.pm,v 1.115 2004/06/29 04:30:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1231,8 +1231,7 @@
'sec' => "section",
'start' => "start date",
'end' => "end date",
- 'type' => "enroll type",
- 'chan' => "change"
+ 'type' => "enroll type/action"
);
unless ($mode eq 'autoenroll') {
$r->print(<<END);
@@ -1240,11 +1239,22 @@
<input type="hidden" name="sdom" value="" />
END
}
- $r->print(<<END);
+ $r->print("
<p>
<table border=2>
-<tr><th>Count
- </th><th>
+<tr>
+ ");
+ if ($mode eq 'autoenroll') {
+ $r->print("
+ <th><a href=\"javascript:document.studentform.sortby.value='type';document.studentform.submit();\">$lt{'type'}</a></th>
+ ");
+ } else {
+ $r->print("
+<th>Count</th>
+ ");
+ }
+ $r->print(<<END);
+ <th>
<a href="javascript:document.studentform.sortby.value='username';document.studentform.submit();">$lt{'usrn'}</a>
</th><th>
<a href="javascript:document.studentform.sortby.value='domain';document.studentform.submit();">$lt{'dom'}</a>
@@ -1259,16 +1269,8 @@
</th><th>
<a href="javascript:document.studentform.sortby.value='end';document.studentform.submit();">$lt{'end'}</a>
</th>
+ </tr>
END
- if ($mode eq 'autoenroll') {
- $r->print(" <th>
- <a href=\"javascript:document.studentform.sortby.value='type';document.studentform.submit();\">$lt{'type'}</a>
- </th><th>
- $lt{'chan'}?</th>");
- }
- $r->print("
- </tr>
- ");
} elsif ($mode eq 'csv') {
#
# Open a file
@@ -1337,6 +1339,10 @@
lc($classlist->{$a}->[$third]) cmp lc($classlist->{$b}->[$third])
} (keys(%$classlist));
my $studentcount = 0;
+ my $autocount = 0;
+ my $manualcount = 0;
+ my $unlockcount = 0;
+ my $lockcount = 0;
foreach my $student (@Sorted_Students) {
my $sdata = $classlist->{$student};
my $username = $sdata->[$index{'username'}];
@@ -1347,7 +1353,7 @@
my $status = $sdata->[$index{'status'}];
my $start = $sdata->[$index{'start'}];
my $end = $sdata->[$index{'end'}];
- my $type = $sdata->[$index{'type'}];
+ my $type = $sdata->[$index{'type'}];
next if (($statusmode ne 'Any') && ($status ne $statusmode));
if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
if (! defined($start) || $start == 0) {
@@ -1360,7 +1366,30 @@
} else {
$end = &Apache::lonlocal::locallocaltime($end);
}
- $r->print("<tr>\n <td>".(++$studentcount)."</td><td>\n ");
+ $r->print("<tr>\n ");
+ if ($mode eq 'autoenroll') {
+ my $lockedtype = $sdata->[$index{'lockedtype'}];
+ $studentcount++;
+ my $cellentry;
+ if ($type eq 'auto') {
+ $cellentry = '<b>'.&mt('auto').'</b> <input type="checkbox" name="chgauto" value="'.$username.':'.$domain.'" /> Change';
+ $autocount ++;
+ } else {
+ $cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><input type="checkbox" name="chgmanual" value="'.$username.':'.$domain.'" /> Change</td></tr><tr><td>';
+ $manualcount ++;
+ if ($lockedtype) {
+ $cellentry .= '<input type="checkbox" name="unlockchg" value="'.$username.':'.$domain.'" /> '.&mt('Unlock');
+ $unlockcount ++;
+ } else {
+ $cellentry .= '<input type="checkbox" name="lockchg" value="'.$username.':'.$domain.'" /> '.&mt('Lock');
+ $lockcount ++;
+ }
+ $cellentry .= '</td></tr></table>';
+ }
+ $r->print("<td>$cellentry<td>\n ");
+ } else {
+ $r->print("<td>".(++$studentcount)."</td><td>\n ");
+ }
if ($linkto eq 'nothing') {
$r->print($username);
} elsif ($linkto eq 'aboutme') {
@@ -1384,17 +1413,8 @@
<td>$section</td>
<td>$start</td>
<td>$end</td>
+ </tr>
END
- if ($mode eq 'autoenroll') {
- my $longtype = &mt('manual').' ';
- if ($type eq 'auto') {
- $longtype = &mt('auto').' ';
- }
- $r->print("<td><b>$longtype</b></td><td><input type=\"checkbox\" name=\"switch:$username:$domain\" /></td>");
- }
- $r->print("
-</tr>
- ");
} elsif ($mode eq 'csv') {
next if (! defined($CSVfile));
# no need to bother with $linkto
@@ -1443,8 +1463,9 @@
$r->rflush();
}
if ($mode eq 'autoenroll') {
- return $studentcount;
+ return ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount);
}
+ return;
}
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.15 loncom/interface/lonpopulate.pm:1.16
--- loncom/interface/lonpopulate.pm:1.15 Mon Jun 28 11:41:20 2004
+++ loncom/interface/lonpopulate.pm Tue Jun 29 00:30:00 2004
@@ -1,5 +1,5 @@
# automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.15 2004/06/28 15:41:20 albertel Exp $
+# $Id: lonpopulate.pm,v 1.16 2004/06/29 04:30:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -52,11 +52,12 @@
###############################################################
sub choose_header {
+ my $action = shift;
my $bodytag=&Apache::loncommon::bodytag('Classlist Manager');
my $scripttag = qq|
<script language='javascript' type='text/javascript'>
<!--
-function process(calling) {
+function process(calling,numauto,nummanual,numlock,numunlock) {
var checker = 1
var rad1 = 0
var rad2 = 0
@@ -119,12 +120,61 @@
}
if (calling == "viewclass") {
document.forms.studentform.state.value = "process";
- checker = 1;
+ var totcheck = 0
+ if (numauto > 0) {
+ for (var i=0; i<document.studentform.chgauto.length; i++) {
+ if (document.studentform.chgauto[i].checked == true) {
+ totcheck ++
+ }
+ }
+ }
+ if (nummanual > 0) {
+ for (var i=0; i<document.studentform.chgmanual.length; i++) {
+ if (document.studentform.chgmanual[i].checked == true) {
+ totcheck ++
+ }
+ }
+ }
+ if (numlock > 0) {
+ for (var i=0; i<document.studentform.lockchg.length; i++) {
+ if (document.studentform.lockchg[i].checked == true) {
+ totcheck ++
+ }
+ }
+ }
+ if (numunlock > 0) {
+ for (var i=0; i<document.studentform.unlockchg.length; i++) {
+ if (document.studentform.unlockchg[i].checked == true) {
+ totcheck ++
+ }
+ }
+ }
+ if (totcheck > 0) {
+ checker = 1
+ } else {
+ alert("You must check at least one checkbox, before proceeding to the next page")
+ checker = 0
+ }
}
if (checker == 1) {
formName.submit();
}
}
+|;
+ if ($action eq 'viewclass') {
+ $scripttag .= qq|
+function checkAll(field) {
+ for (i = 0; i < field.length; i++)
+ field[i].checked = true ;
+}
+
+function uncheckAll(field) {
+ for (i = 0; i < field.length; i++)
+ field[i].checked = false ;
+}
+|;
+ }
+ $scripttag .= qq|
// End hiding -->
</script>
|;
@@ -241,7 +291,7 @@
<td><b>Use the menu on the left to choose an enrollment management task.</b><br/><br/></td>
<tr>
<td> </td>
- <td>Use <i>"Automated adds/drops"</i> to enable or disable automatic nightly adds or drops in your LON-CAPA course based on instututional enrollment information.</td>
+ <td>Use <i>"Automated adds/drops"</i> to enable or disable automatic nightly adds or drops in your LON-CAPA course based on institutional enrollment information.</td>
</tr>
<tr>
<td> </td>
@@ -271,6 +321,10 @@
<td>Use <i>"Update roster now"</i> to add and/or drop students from your course based on the <b>most current</b> institutional classlist information.</td>
</tr>
<tr>
+ <td> </td>
+ <td>Use <i>"View students and change type"</i> to display the current course roster, and (optionally) change enrollment type for selected students from 'auto' to 'manual' and vice versa.</td>
+ </tr>
+ <tr>
<td colspan='2'> </td>
</tr>
<tr>
@@ -921,6 +975,10 @@
<td align=\"left\"><b>$$tasktitleref{$action}</b>
</td>
</tr>
+ <tr>
+ <td>Section changes, name changes, and class drops that can be set to occur either automatically or when using the <b>'Update roster now'</b> feature, will affect only those students with an enroll type of <b>'auto'</b>. Students with an enroll type of <b>'manual'</b>, will be converted automatically to the 'auto' type, when they first appear in the institutional classlist for the course - as long as nightly adds are enabled and active, or the update roster utility is used. Use the 'Lock' checkbox for any manually enrolled students for whom you wish to prevent type conversion. Use the 'Change' checkbox to switch the enroll type from auto to manual, and vice versa. Use the 'Unlock' checkbox for any maually enrolled students for whom you no longer wish to lock the enroll type. Click the 'Go' button at the end of the page to process your desired changes.</td>
+ </tr>
+ <tr><td> </td></tr>
</table>
<table>
<tr>
@@ -943,19 +1001,58 @@
$r->print('<input type="submit" value="'.&mt('Update Display').'" />'.
"\n</p>\n");
- my $studentcount = &Apache::londropadd::show_class_list($r,'autoenroll','nothing',$ENV{'form.Status'},$classlist,$keylist);
+ my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::londropadd::show_class_list($r,'autoenroll','nothing',$ENV{'form.Status'},$classlist,$keylist);
$r->print("
</td>
</tr>
");
if ($studentcount > 0) {
$r->print("
- <tr>
+ <tr><td><table border=\"0\" cellpadding=\"5\"><tr>
+ ");
+ my $cellcount = 0;
+ if ($autocount > 0) {
+ $cellcount ++;
+ $r->print(<<END);
+ <td><fieldset><legend> <b>Change auto</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.chgauto)" />
+ <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.chgauto)" /></fieldset></td>
+END
+ }
+ if ($manualcount > 0) {
+ $cellcount ++;
+ $r->print(<<END);
+ <td><fieldset><legend> <b>Change manual</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.chgmanual)" />
+ <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.chgmanual)" /></fieldset></td>
+END
+ }
+ if ($lockcount > 0) {
+ if ($cellcount == 2) {
+ $r->print("</tr><tr>");
+ }
+ $cellcount ++;
+ $r->print(<<END);
+ <td><fieldset><legend> <b>Lock manual</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.lockchg)" />
+ <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.lockchg)" /></fieldset></td>
+END
+ }
+ if ($unlockcount > 0) {
+ if ($cellcount == 2) {
+ $r->print("</tr><tr>");
+ }
+ $cellcount ++;
+ $r->print(<<END);
+ <td><fieldset><legend> <b>Unlock manual</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.unlockchg)" />
+ <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.unlockchg)" /></fieldset></td>
+END
+ }
+ $r->print("
+ </tr>
+ </table>
<td> </td>
</tr>
<tr>
<td align=\"right\">
- <input type=\"button\" name=\"viewclass\" value=\"Go\" onClick=\"process('viewclass')\" />
+ <input type=\"button\" name=\"viewclass\" value=\"Go\" onClick=\"process('viewclass','$autocount','$manualcount','$lockcount','$unlockcount')\" />
</td>
</tr>
");
@@ -992,7 +1089,9 @@
'setl' => 'Set date of last access',
'freg' => 'for registered students added via automated enrollment',
'fnew' => 'for new students added when you update the class roster',
- 'ifad' => 'If automated adds are enabled, then when students are added their student roles will become active on the date set here for first access, and their roles will become inactive on the date set here for last access. These default access dates will be overridden for specific students if the institutional classlist data supplied to the automatic enrollment process includes entries for the startdate and enddate fields for those students.'
+ 'ifad' => 'If automated adds are enabled, then when students are added their student roles will become active on the date set here for first access, and their roles will become inactive on the date set here for last access. These default access dates will be overridden for specific students if the institutional classlist data supplied to the automatic enrollment process includes entries for the startdate and enddate fields for those students.',
+ 'ncds' => 'changing default start and end access dates will affect future enrollments and ALSO currently inactive students (i.e., those for whom access will begin in the future). To change access dates for currently active students, you should change the access dates via this screen, then use Enrollment manager -> Drop Students to drop the students, and then use Automated Enrollment Manager -> Update roster now to re-enroll them with the new access dates.'
+
);
my $dateshow;
if ( ($oldendshow eq '') && ($oldstartshow eq '') ) {
@@ -1071,6 +1170,12 @@
<tr>
<td colspan=\"2\"><font color=\"#888888\">$lt{'ifad'}</font></td>
</tr>
+ <tr>
+ <td colspan=\"2\"> </td>
+ </tr>
+ <tr>
+ <td colspan=\"2\"><b>".&mt('Note').":</b> ".$lt{'ncds'}."</td>
+ </tr>
</table>
");
} elsif ($action eq 'updatenow') {
@@ -2087,48 +2192,117 @@
my $chgok = 0;
my $chgfail = 0;
my $othdom = 0;
+ my $locktotal = 0;
+ my $lockok = 0;
+ my $lockfail = 0;
my $cid = $dom."_".$crs;
my %chg = ();
my %nochg = ();
my %otherdom = ();
- my $modreply = '';
+ my %lockchg = ();
+ my %nolockchg = ();
my $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
my $endidx = &Apache::loncoursedata::CL_END;
my $startidx = &Apache::loncoursedata::CL_START;
my $ididx=&Apache::loncoursedata::CL_ID;
my $secidx=&Apache::loncoursedata::CL_SECTION;
my $typeidx=&Apache::loncoursedata::CL_TYPE;
- foreach (sort keys %ENV) {
- if (/^form\.switch:(.+)$/) {
- my $student = $1;
- my ($uname,$udom) = split/:/,$student;
- my $sdata = $classlist->{$student};
- my $section = $sdata->[$secidx];
- my $uid = $sdata->[$ididx];
- my $start = $sdata->[$startidx];
- my $end = $sdata->[$endidx];
- my $type = $sdata->[$typeidx];
- $chgtotal ++;
- my $newtype = 'auto';
- my $change = 'auto';
- my $oldtype = 'manual';
- if ($type eq 'auto') {
- $oldtype = 'auto';
- $newtype = '';
- $change = 'manual';
+ my $lockedidx=&Apache::loncoursedata::CL_LOCKEDTYPE;
+ my @typechglist = ();
+ my @lockchglist = ();
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chgauto','chgmanual','lockchg','unlockchg']);
+ if ($ENV{'form.chgauto'}) {
+ if (ref($ENV{'form.chgauto'}) eq 'ARRAY') {
+ push @typechglist, @{$ENV{'form.chgauto'}};
+ } else {
+ push @typechglist, $ENV{'form.chgauto'};
+ }
+ }
+ if ($ENV{'form.chgmanual'}) {
+ if (ref($ENV{'form.chgmanual'}) eq 'ARRAY') {
+ push @typechglist, @{$ENV{'form.chgmanual'}};
+ } else {
+ push @typechglist, $ENV{'form.chgmanual'};
+ }
+ }
+ if ($ENV{'form.lockchg'}) {
+ if (ref($ENV{'form.lockchg'}) eq 'ARRAY') {
+ push @lockchglist, @{$ENV{'form.lockchg'}};
+ } else {
+ push @lockchglist, $ENV{'form.lockchg'};
+ }
+ }
+ if ($ENV{'form.unlockchg'}) {
+ if (ref($ENV{'form.unlockchg'}) eq 'ARRAY') {
+ push @lockchglist, @{$ENV{'form.unlockchg'}};
+ } else {
+ push @lockchglist, $ENV{'form.unlockchg'};
+ }
+ }
+ foreach my $student (sort @typechglist) {
+ my ($uname,$udom) = split/:/,$student;
+ my $sdata = $classlist->{$student};
+ my $section = $sdata->[$secidx];
+ my $uid = $sdata->[$ididx];
+ my $start = $sdata->[$startidx];
+ my $end = $sdata->[$endidx];
+ my $type = $sdata->[$typeidx];
+ my $lock = $sdata->[$lockedidx];
+ my $newlock = $lock;
+ $chgtotal ++;
+ my $newtype = 'auto';
+ my $change = 'auto';
+ my $oldtype = 'manual';
+ if ($type eq 'auto') {
+ $oldtype = 'auto';
+ $newtype = '';
+ $change = 'manual';
+ }
+ if ($udom eq $dom) {
+ if ($newtype eq 'auto') {
+ $newlock = '';
+ } elsif ($newtype eq '') {
+ $newlock = '1';
}
- if ($udom eq $dom) {
- $modreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$newtype,$cid);
- if ($modreply eq 'ok') {
- $chgok ++;
- $chg{$student} = "Changed to $change";
- } else {
- $chgfail ++;
- $nochg{$student} = "Still set to $oldtype";
- }
+ my $modreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$newtype,$newlock,$cid);
+ if ($modreply eq 'ok') {
+ $chgok ++;
+ $chg{$student} = "Changed to $change";
} else {
- $othdom ++;
- $otherdom{$student} = "Still set to $oldtype";
+ $chgfail ++;
+ $nochg{$student} = "Still set to $oldtype";
+ }
+ } else {
+ $othdom ++;
+ $otherdom{$student} = "Still set to $oldtype";
+ }
+ }
+ foreach my $student (@lockchglist) {
+ my ($uname,$udom) = split/:/,$student;
+ my $sdata = $classlist->{$student};
+ my $section = $sdata->[$secidx];
+ my $uid = $sdata->[$ididx];
+ my $start = $sdata->[$startidx];
+ my $end = $sdata->[$endidx];
+ my $type = $sdata->[$typeidx];
+ my $lock = $sdata->[$lockedidx];
+ my $newlock = 1;
+ my $oldlockname = &mt('unlocked');
+ my $newlockname = &mt('locked');
+ $locktotal++;
+ unless ($type eq 'auto') {
+ if ($lock) {
+ $newlock = '';
+ $newlockname = &mt('unlocked');
+ $oldlockname = &mt('locked');
+ }
+ my $lockreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$type,$newlock,$cid);
+ if ($lockreply eq 'ok') {
+ $lockok ++;
+ $lockchg{$student} = 'Changed to '.$newlockname;
+ } else {
+ $lockfail ++;
+ $nolockchg{$student} = 'Still set to '.$oldlockname;
}
}
}
@@ -2147,13 +2321,26 @@
$response .= "The following $othdom students were not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto':<br />";
$response .= &enrolltype_result(\%otherdom,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
}
+ $response .= "<br /><br />";
+ }
+ if ($locktotal > 0) {
+ $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";
+ $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
+ if ($lockok > 0) {
+ $response .= "The following $lockok changes were successful:<br />";
+ $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
+ }
+ if ($lockfail > 0) {
+ $response .= "The following $lockfail students were not modified successfully: <br />";
+ $response .= &enrolltype_result(\%nolockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
+ }
}
&print_reply($r,$response,$$tasktitleref{$action});
return;
}
sub enrolltype_result {
- my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx) = @_;
+ my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx) = @_;
my $reply = "
<table border='2'>
<tr>
@@ -2362,7 +2549,7 @@
updatenow => "Update roster now",
newcross => "Add crosslistings",
newsections => "Add sections",
- viewclass => "View students and type",
+ viewclass => "View students and change type",
);
my %tasktitle = (
@@ -2405,12 +2592,12 @@
$r->print(&header());
} else {
if ($state eq "choose") {
- $r->print(&choose_header());
+ $r->print(&choose_header($action));
} else {
if ($action eq "crosslist") {
if ( exists($ENV{'form.numcross'}) ) {
if ( $ENV{'form.numcross'} > 0 ) {
- $r->print(&choose_header());
+ $r->print(&choose_header($action));
} else {
$r->print(&header());
}
@@ -2420,7 +2607,7 @@
} elsif ($action eq "sections") {
if ( exists($ENV{'form.numsec'}) ) {
if ( $ENV{'form.numsec'} > 0 ) {
- $r->print(&choose_header());
+ $r->print(&choose_header($action));
} else {
$r->print(&header());
}
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.135 loncom/interface/loncoursedata.pm:1.136
--- loncom/interface/loncoursedata.pm:1.135 Tue Jun 15 10:12:56 2004
+++ loncom/interface/loncoursedata.pm Tue Jun 29 00:30:00 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.135 2004/06/15 14:12:56 matthew Exp $
+# $Id: loncoursedata.pm,v 1.136 2004/06/29 04:30:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2879,7 +2879,7 @@
Returns a reference to a hash which contains:
keys '$sname:$sdom'
- values [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type]
+ values [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,$lockedtype]
The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used
as indices into the returned list to future-proof clients against
@@ -2899,6 +2899,7 @@
sub CL_FULLNAME { return 6; }
sub CL_STATUS { return 7; }
sub CL_TYPE { return 8; }
+sub CL_LOCKEDTYPE { return 9; }
sub get_classlist {
my ($cid,$cdom,$cnum) = @_;
@@ -2915,9 +2916,9 @@
}
my ($sname,$sdom) = split(/:/,$student);
my @Values = split(/:/,$info);
- my ($end,$start,$id,$section,$fullname,$type);
+ my ($end,$start,$id,$section,$fullname,$type,$lockedtype);
if (@Values > 2) {
- ($end,$start,$id,$section,$fullname,$type) = @Values;
+ ($end,$start,$id,$section,$fullname,$type,$lockedtype) = @Values;
} else { # We have to get the data ourselves
($end,$start) = @Values;
$section = &Apache::lonnet::getsection($sdom,$sname,$cid);
@@ -2954,11 +2955,11 @@
$status='Active';
}
$classlist{$student} =
- [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type];
+ [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,$lockedtype];
}
if (wantarray()) {
return (\%classlist,['domain','username','end','start','id',
- 'section','fullname','status','type']);
+ 'section','fullname','status','type','lockedtype']);
} else {
return \%classlist;
}
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.514 loncom/lonnet/perl/lonnet.pm:1.515
--- loncom/lonnet/perl/lonnet.pm:1.514 Mon Jun 28 11:59:50 2004
+++ loncom/lonnet/perl/lonnet.pm Tue Jun 29 00:30:00 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.514 2004/06/28 15:59:50 albertel Exp $
+# $Id: lonnet.pm,v 1.515 2004/06/29 04:30:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3076,8 +3076,13 @@
unless ($queryid=~/^\Q$host\E\_/) { return 'error: '.$queryid; }
my $reply = &get_query_reply($queryid);
unless ( ($reply =~/^timeout/) || ($reply =~/^error/) ) {
- unless ($homeserver eq $perlvar{'lonHostID'}) {
- my @responses = split/:/,$reply;
+ my @responses = split/:/,$reply;
+ if ($homeserver eq $perlvar{'lonHostID'}) {
+ foreach (@responses) {
+ my ($key,$value) = split/=/,$_;
+ $$replyref{$key} = $value;
+ }
+ } else {
my $pathname = $perlvar{'lonDaemons'}.'/tmp';
foreach (@responses) {
my ($key,$value) = split/=/,$_;
@@ -3169,7 +3174,7 @@
sub auto_new_course {
my ($cnum,$cdom,$inst_course_id,$owner) = @_;
my $homeserver = &homeserver($cnum,$cdom);
- my $response=&unescape(&reply('autonewcourse:'.$inst_course_id.':'.$owner,':'.$cdom,$homeserver));
+ my $response=&unescape(&reply('autonewcourse:'.$inst_course_id.':'.$owner.':'.$cdom,$homeserver));
return $response;
}
@@ -3384,7 +3389,7 @@
sub modifystudent {
my ($udom,$uname,$uid,$umode,$upass,$first,$middle,$last,$gene,$usec,
- $end,$start,$forceid,$desiredhome,$email,$type,$cid)=@_;
+ $end,$start,$forceid,$desiredhome,$email,$type,$locktype,$cid)=@_;
if (!$cid) {
unless ($cid=$ENV{'request.course.id'}) {
return 'not_in_class';
@@ -3399,13 +3404,12 @@
# students environment
$uid = undef if (!$forceid);
$reply = &modify_student_enrollment($udom,$uname,$uid,$first,$middle,$last,
- $gene,$usec,$end,$start,$type,$cid);
+ $gene,$usec,$end,$start,$type,$locktype,$cid);
return $reply;
}
sub modify_student_enrollment {
- my ($udom,$uname,$uid,$first,$middle,$last,$gene,$usec,$end,$start,$type,
- $cid) = @_;
+ my ($udom,$uname,$uid,$first,$middle,$last,$gene,$usec,$end,$start,$type,$locktype,$cid) = @_;
my ($cdom,$cnum,$chome);
if (!$cid) {
unless ($cid=$ENV{'request.course.id'}) {
@@ -3451,7 +3455,7 @@
$first,$middle);
my $reply=cput('classlist',
{"$uname:$udom" =>
- join(':',$end,$start,$uid,$usec,$fullname,$type) },
+ join(':',$end,$start,$uid,$usec,$fullname,$type,$locktype) },
$cdom,$cnum);
unless (($reply eq 'ok') || ($reply eq 'delayed')) {
return 'error: '.$reply;
Index: loncom/enrollment/Enrollment.pm
diff -u loncom/enrollment/Enrollment.pm:1.15 loncom/enrollment/Enrollment.pm:1.16
--- loncom/enrollment/Enrollment.pm:1.15 Thu Jun 17 14:31:24 2004
+++ loncom/enrollment/Enrollment.pm Tue Jun 29 00:30:00 2004
@@ -1,5 +1,5 @@
# Automated Enrollment manager
-# $Id: Enrollment.pm,v 1.15 2004/06/17 18:31:24 raeburn Exp $
+# $Id: Enrollment.pm,v 1.16 2004/06/29 04:30:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -48,6 +48,7 @@
my $sec=&Apache::loncoursedata::CL_SECTION;
my $status=&Apache::loncoursedata::CL_STATUS;
my $type=&Apache::loncoursedata::CL_TYPE;
+ my $lockedtype=&Apache::loncoursedata::CL_LOCKEDTYPE;
my @localstudents = ();
my @futurestudents = ();
my @activestudents = ();
@@ -189,25 +190,30 @@
$$logmsg .= "Change in ID for $uname. StudentID in LON-CAPA system is $uidhash{$uname}; StudentID in institutional data is $stuinfo[ $place{studentID} ]".$linefeed;
}
}
+# Check for switch from manual to auto
+ unless (($$currlist{$uname}[$type] eq "auto") || ($$currlist{$uname}[$lockedtype] eq "1") || (!$adds) ) {
+# drop manually added student
+ my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid);
+# re-enroll as auto student
+ if ($drop_reply !~ /^ok/) {
+ $$logmsg .= "An error occured during the attempt to convert $uname from a manual type to an auto type student - $drop_reply.".$linefeed;
+ } else {
+# re-enroll as auto student
+ my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc);
+ &prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc);
+ if ($$currlist{$uname}[$sec] ne $usec) {
+ $$logmsg .= "Section for $uname switched from $$currlist{$uname}[$sec] to $usec".$linefeed;
+ }
+ &execute_add($context,'switchtype',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);
+ }
+ }
# Check for section changes
if ($$currlist{$uname}[$sec] eq $stuinfo[ $place{groupID} ]) {
# Check for access date changes for students with access starting in the future.
if ( (grep/^$uname$/,@futurestudents) && ($$currlist{$uname}[$type] eq "auto") && ($adds == 1) ) {
- my $datechange = 0;
- unless ($$currlist{$uname}[$cstart] eq $startdate) {
- $datechange = 1;
- }
- if (!$datechange) {
- if (!$$currlist{$uname}[$cend]) {
- if ($enddate) {
- $datechange = 1;
- }
- } elsif ($$currlist{$uname}[$cend] ne $enddate) {
- $datechange = 1;
- }
- }
+ my $datechange = &datechange_check($$currlist{$uname}[$cstart],$$currlist{$uname}[$cend],$startdate,$enddate);
if ($datechange) {
- my $modify_access_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto',$cid);
+ my $modify_access_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid);
$access = &showaccess($enddate,$startdate);
if ($modify_access_result =~ /^ok/) {
$$logmsg .= "Change in access dates for $uname.".$access.$linefeed;
@@ -229,9 +235,9 @@
if ($expire_role_result eq 'ok') {
my $modify_section_result;
if (grep/^$uname$/,@activestudents) {
- $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$$currlist{$uname}[$cend],$$currlist{$uname}[$cstart],'auto',$cid);
+ $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$$currlist{$uname}[$cend],$$currlist{$uname}[$cstart],'auto','',$cid);
} else {
- $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto',$cid);
+ $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid);
$access = &showaccess($enddate,$startdate);
}
if ($modify_section_result =~ /^ok/) {
@@ -255,43 +261,8 @@
}
}
} elsif ($adds == 1) {
-# Add student to LON-CAPA classlist
- my $auth = $stuinfo[ $place{'authtype'} ];
- my $authparam = $stuinfo[ $place{'autharg'} ];
- my $first = $stuinfo[ $place{'firstname'} ];
- my $middle = $stuinfo[ $place{'middlename'} ];
- my $last = $stuinfo[ $place{'lastname'} ];
- my $gene = $stuinfo[ $place{'generation'} ];
- my $usec = $stuinfo[ $place{'groupID'} ];
- my $end = $stuinfo[ $place{'enddate'} ];
- my $start = $stuinfo[ $place{'startdate'} ];
- my $emailaddr = $stuinfo[ $place{'email'} ];
- my $pid = $stuinfo[ $place{'studentID'} ];
-
-# remove non alphanumeric values from section
- $usec =~ s/\W//g;
-
- unless ($emailaddr =~/^[^\@]+\@[^\@]+$/) { $emailaddr =''; }
- my $emailenc = &HTML::Entities::encode($emailaddr,'<>&"');
-
-# Use course defaults where entry is absent
- if ( ($auth eq '') || (!defined($auth)) ) {
- $auth = $authtype;
- }
- if ( ($authparam eq '') || (!defined($authparam)) ) {
- $authparam = $autharg;
- }
- if ( ($end eq '') || (!defined($end)) ) {
- $end = $enddate;
- }
- if ( ($start eq '') || (!defined($start)) ) {
- $start = $startdate;
- }
-# Clean up whitespace
- foreach (\$dom,\$uname,\$pid,\$first,\$middle,\$last,\$gene,\$usec) {
- $$_ =~ s/(\s+$|^\s+)//g;
- }
-
+ my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc);
+ &prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc);
# Check for existing account in this LON-CAPA domain for this username
my $uhome=&Apache::lonnet::homeserver($uname,$dom);
if ($uhome eq 'no_host') { # User does not exist
@@ -322,7 +293,7 @@
}
if ($authchk eq 'ok') {
# Now create user.
- my $reply=&Apache::lonnet::modifystudent($dom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,'',undef,$emailaddr,'auto',$cid);
+ my $reply=&Apache::lonnet::modifystudent($dom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,'',undef,$emailaddr,'auto','',$cid);
if ($reply eq 'ok') {
$access = &showaccess($end,$start);
$enrollcount ++;
@@ -360,75 +331,7 @@
}
}
} else {
-# Get the user's information and authentication
- my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification'],$dom,$uname);
- my ($tmp) = keys(%userenv);
- if ($tmp =~ /^(con_lost|error)/i) {
- %userenv = ();
- }
-# Get the user's e-mail address
- if ($userenv{critnotification} =~ m/%40/) {
- unless ($emailenc eq $userenv{critnotification}) {
- $$logmsg .= "Current critical notification e-mail - ".$userenv{critnotification}." for $uname is different to e-mail address in Institutional classlist - ".$emailenc.$linefeed;
- }
- }
- if ($userenv{notification} =~ m/%40/) {
- unless ($emailenc eq $userenv{critnotification}) {
- $$logmsg .= "Current standard notification e-mail - ".$userenv{notification}." for $uname is different to e-mail address in institutional classlist - ".$emailenc.$linefeed;
- }
- }
- my $krbdefdom = '';
- my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);
- if ($currentauth=~/^(krb[45]):(.*)/) {
- $currentauth = $1;
- $krbdefdom = $2;
- } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
- $currentauth = $1;
- } else {
- $$logmsg .= "Invalid authentication method $currentauth for $uname.".$linefeed;
- }
-# Report if authentication methods are different.
- if ($currentauth ne $auth) {
- $$logmsg .= "Authentication type mismatch for $uname - '$currentauth' in system, '$auth' based on information in classlist or default for this course.".$linefeed;
- } elsif ($auth =~ m/^krb/) {
- if ($krbdefdom ne $authparam) {
- $$logmsg .= "Kerberos domain mismatch for $uname - '$krbdefdom' in system, '$authparam' based on information in classlist or default for this course.".$linefeed;
- }
- }
-
-# Check user data
- if ($first ne $userenv{'firstname'} ||
- $middle ne $userenv{'middlename'} ||
- $last ne $userenv{'lastname'} ||
- $gene ne $userenv{'generation'} ||
- $pid ne $userenv{'id'} ) {
-# Make the change(s)
- my %changeHash;
- $changeHash{'firstname'} = $first;
- $changeHash{'middlename'} = $middle;
- $changeHash{'lastname'} = $last;
- $changeHash{'generation'} = $gene;
- $changeHash{'id'} = $pid;
- my $putresult = &Apache::lonnet::put('environment',\%changeHash,$dom,$uname);
- if ($putresult eq 'ok') {
- $$logmsg .= "User information updated for user: $uname prior to enrollment.".$linefeed;
- } else {
- $$logmsg .= "There was a problem modifying user data for existing user - $uname -error: $putresult, enrollment will still be attempted.".$linefeed;
- }
- }
-
-# Assign the role of student in the course.
- my $classlist_reply = &Apache::lonnet::modify_student_enrollment($dom,$uname,$pid,$first,$middle,$last,$gene,$usec,$end,$start,'auto',$cid);
- if ($classlist_reply eq 'ok') {
- $access = &showaccess($end,$start);
- $enrollcount ++;
- $addresult .= "$first $last ($pid) - $uname enrolled in section/group $usec.".$access.$linefeed;
- if ($context eq 'automated') {
- $$logmsg .= "Existing $dom user $uname enrolled successfully.".$linefeed;
- }
- } else {
- $$logmsg .= "There was a problem updating the classlist db file for user $uname to show the new enrollment -error: $classlist_reply, so no enrollment occurred for this user.".$linefeed;
- }
+ &execute_add($context,'newstudent',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);
}
}
}
@@ -447,7 +350,7 @@
push @saved,$uname;
}
} elsif (@saved == 0) {
- my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto',$cid);
+ my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid);
if ($drop_reply !~ /^ok/) {
$$logmsg .= "An error occured during the attempt to expire the $uname from the old section $$currlist{$uname}[$sec] - $drop_reply.".$linefeed;
} else {
@@ -504,6 +407,144 @@
return ($changecount,$addresult.$dropresult);
}
+sub prepare_add {
+ my ($authtype,$autharg,$enddate,$startdate,$stuinfo,$place,$dom,$uname,$auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc) = @_;
+ $$auth = $$stuinfo[ $$place{'authtype'} ];
+ $$authparam = $$stuinfo[ $$place{'autharg'} ];
+ $$first = $$stuinfo[ $$place{'firstname'} ];
+ $$middle = $$stuinfo[ $$place{'middlename'} ];
+ $$last = $$stuinfo[ $$place{'lastname'} ];
+ $$gene = $$stuinfo[ $$place{'generation'} ];
+ $$usec = $$stuinfo[ $$place{'groupID'} ];
+ $$end = $$stuinfo[ $$place{'enddate'} ];
+ $$start = $$stuinfo[ $$place{'startdate'} ];
+ $$emailaddr = $$stuinfo[ $$place{'email'} ];
+ $$pid = $$stuinfo[ $$place{'studentID'} ];
+
+# remove non alphanumeric values from section
+ $$usec =~ s/\W//g;
+
+ unless ($$emailaddr =~/^[^\@]+\@[^\@]+$/) { $$emailaddr =''; }
+ $$emailenc = &HTML::Entities::encode($$emailaddr,'<>&"');
+
+# Use course defaults where entry is absent
+ if ( ($$auth eq '') || (!defined($$auth)) ) {
+ $$auth = $authtype;
+ }
+ if ( ($$authparam eq '') || (!defined($$authparam)) ) {
+ $$authparam = $autharg;
+ }
+ if ( ($$end eq '') || (!defined($$end)) ) {
+ $$end = $enddate;
+ }
+ if ( ($$start eq '') || (!defined($$start)) ) {
+ $$start = $startdate;
+ }
+# Clean up whitespace
+ foreach ($dom,$uname,$pid,$first,$middle,$last,$gene,$usec) {
+ $$_ =~ s/(\s+$|^\s+)//g;
+ }
+ return;
+}
+
+sub execute_add {
+ my ($context,$caller,$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,$addresult,$enrollcount,$linefeed,$logmsg) = @_;
+# Get the user's information and authentication
+ my %userenv = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id','critnotification','notification'],$dom,$uname);
+ my ($tmp) = keys(%userenv);
+ if ($tmp =~ /^(con_lost|error)/i) {
+ %userenv = ();
+ }
+# Get the user's e-mail address
+ if ($userenv{critnotification} =~ m/%40/) {
+ unless ($emailenc eq $userenv{critnotification}) {
+ $$logmsg .= "Current critical notification e-mail
+- ".$userenv{critnotification}." for $uname is different to e-mail address in institutional classlist - ".$emailenc.$linefeed;
+ }
+ }
+ if ($userenv{notification} =~ m/%40/) {
+ unless ($emailenc eq $userenv{critnotification}) {
+ $$logmsg .= "Current standard notification e-mail
+- ".$userenv{notification}." for $uname is different to e-mail address in institutional classlist - ".$emailenc.$linefeed;
+ }
+ }
+ my $krbdefdom = '';
+ my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);
+ if ($currentauth=~/^(krb[45]):(.*)/) {
+ $currentauth = $1;
+ $krbdefdom = $2;
+ } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
+ $currentauth = $1;
+ } else {
+ $$logmsg .= "Invalid authentication method $currentauth for $uname.".$linefeed;
+ }
+# Report if authentication methods are different.
+ if ($currentauth ne $auth) {
+ $$logmsg .= "Authentication type mismatch for $uname - '$currentauth' in system, '$auth' based on information in classlist or default for this course.".$linefeed;
+ } elsif ($auth =~ m/^krb/) {
+ if ($krbdefdom ne $authparam) {
+ $$logmsg .= "Kerberos domain mismatch for $uname - '$krbdefdom' in system, '$authparam' based on information in classlist or default for this course.".$linefeed;
+ }
+ }
+
+# Check user data
+ if ($first ne $userenv{'firstname'} ||
+ $middle ne $userenv{'middlename'} ||
+ $last ne $userenv{'lastname'} ||
+ $gene ne $userenv{'generation'} ||
+ $pid ne $userenv{'id'} ) {
+# Make the change(s)
+ my %changeHash;
+ $changeHash{'firstname'} = $first;
+ $changeHash{'middlename'} = $middle;
+ $changeHash{'lastname'} = $last;
+ $changeHash{'generation'} = $gene;
+ $changeHash{'id'} = $pid;
+ my $putresult = &Apache::lonnet::put('environment',\%changeHash,$dom,$uname);
+ if ($putresult eq 'ok') {
+ $$logmsg .= "User information updated for user: $uname prior to enrollment.".$linefeed;
+ } else {
+ $$logmsg .= "There was a problem modifying user data for existing user - $uname -error: $putresult, enrollment will still be attempted.".$linefeed;
+ }
+ }
+
+# Assign the role of student in the course.
+ my $classlist_reply = &Apache::lonnet::modify_student_enrollment($dom,$uname,$pid,$first,$middle,$last,$gene,$usec,$end,$start,'auto','',$cid);
+ if ($classlist_reply eq 'ok') {
+ my $access = &showaccess($end,$start);
+ if ($caller eq 'switchtype') {
+ $$logmsg .= "Existing user $uname detected in institutional classlist - switched from 'manual' to 'auto' enrollment in section/group $usec.".$access.$linefeed;
+ } elsif ($caller eq 'newstudent') {
+ $$enrollcount ++;
+ $$addresult .= "$first $last ($pid) - $uname enrolled in section/group $usec.".$access.$linefeed;
+ }
+ if ($context eq 'automated') {
+ $$logmsg .= "Existing $dom user $uname enrolled successfully.".$linefeed;
+ }
+ } else {
+ $$logmsg .= "There was a problem updating the classlist db file for user $uname to show the new enrollment -error: $classlist_reply, so no enrollment occurred for this user.".$linefeed;
+ }
+ return;
+}
+
+sub datechange_check {
+ my ($oldstart,$oldend,$startdate,$enddate) = @_;
+ my $datechange = 0;
+ unless ($oldstart eq $startdate) {
+ $datechange = 1;
+ }
+ if (!$datechange) {
+ if (!$oldend) {
+ if ($enddate) {
+ $datechange = 1;
+ }
+ } elsif ($oldend ne $enddate) {
+ $datechange = 1;
+ }
+ }
+ return $datechange;
+}
+
sub showaccess {
my ($end,$start) = @_;
my $showstart;
--raeburn1088483402--