Annotation of loncom/interface/lonpopulate.pm, revision 1.19
1.4 albertel 1: # automated enrollment configuration handler
1.19 ! raeburn 2: # $Id: lonpopulate.pm,v 1.18 2004/08/23 16:32:35 raeburn Exp $
1.4 albertel 3: #
4: # Copyright Michigan State University Board of Trustees
5: #
6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
7: #
8: # LON-CAPA is free software; you can redistribute it and/or modify
9: # it under the terms of the GNU General Public License as published by
10: # the Free Software Foundation; either version 2 of the License, or
11: # (at your option) any later version.
12: #
13: # LON-CAPA is distributed in the hope that it will be useful,
14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: # GNU General Public License for more details.
17: #
18: # You should have received a copy of the GNU General Public License
19: # along with LON-CAPA; if not, write to the Free Software
20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: #
22: # /home/httpd/html/adm/gpl.txt
23: #
24: # http://www.lon-capa.org/
25: #
1.1 raeburn 26: package Apache::lonpopulate;
27:
28: use strict;
29: use lib qw(/home/httpd/lib/perl);
1.7 raeburn 30: use Apache::lonnet;
31: use Apache::loncommon;
32: use Apache::lonhtmlcommon;
1.3 albertel 33: use Apache::lonlocal;
1.14 raeburn 34: use Apache::loncoursedata;
1.1 raeburn 35: use Apache::Constants qw(:common :http REDIRECT);
36: use Time::Local;
1.7 raeburn 37: use LONCAPA::Enrollment;
1.1 raeburn 38:
39: ###############################################################
40: sub header {
41: my $bodytag=&Apache::loncommon::bodytag('Classlist Manager');
42: return(<<ENDHEAD);
43: <html>
44: <head>
45: <title>LON-CAPA Classlist Manager</title>
46: </head>
47: $bodytag
48: ENDHEAD
49: }
50:
51: ###############################################################
52:
53: sub choose_header {
1.16 raeburn 54: my $action = shift;
1.1 raeburn 55: my $bodytag=&Apache::loncommon::bodytag('Classlist Manager');
56: my $scripttag = qq|
57: <script language='javascript' type='text/javascript'>
58: <!--
1.16 raeburn 59: function process(calling,numauto,nummanual,numlock,numunlock) {
1.1 raeburn 60: var checker = 1
61: var rad1 = 0
62: var rad2 = 0
63: var formName = document.forms.enter
1.14 raeburn 64: if (calling == "viewclass") {
65: formName = document.forms.studentform
66: }
1.1 raeburn 67: formName.action.value = calling
68: if (calling == "chgsettings") {
69: for (var j=0; j<formName.autoadds.length; j++) {
70: if (formName.autoadds[j].checked) {
71: rad1 = 1
72: }
73: }
74: for (var k=0; k<formName.autodrops.length; k++) {
75: if (formName.autodrops[k].checked) {
76: rad2 = 1
77: }
78: }
79: if (rad1 == 0) {
1.17 raeburn 80: alert("You must select either 'Enable' or 'Disable' for nightly additions based on classlist changes")
1.1 raeburn 81: checker = 0
82: }
83: if (rad2 == 0) {
1.17 raeburn 84: alert("You must select either 'Enable' or 'Disable' for nightly removals based on classlist changes")
1.1 raeburn 85: checker = 0
86: }
87: }
88: if (calling == "updatenow") {
89: var enrolldis
90: var unenrolldis
91: for (var j=0; j<formName.updateadds.length; j++) {
92: if (formName.updateadds[j].value == 0) {
93: enrolldis = j
94: }
95: if (formName.updateadds[j].checked) {
96: rad1 = 1
97: }
98: }
99: for (var k=0; k<formName.updatedrops.length; k++) {
100: if (formName.updatedrops[k].value == 0) {
101: unenrolldis = k
102: }
103: if (formName.updatedrops[k].checked) {
104: rad2 = 1
105: }
106: }
107: if (rad1 == 0) {
1.17 raeburn 108: alert("You must select either 'Yes' or 'No' for immediate addition of newly registered students to the roster")
1.1 raeburn 109: checker = 0
110: }
111: if (rad2 == 0) {
1.17 raeburn 112: alert("You must select either 'Yes' or 'No' for immediate removal of unregistered students from the roster")
1.1 raeburn 113: checker = 0
114: }
115: if (formName.updatedrops[unenrolldis].checked && formName.updateadds[enrolldis].checked ) {
1.17 raeburn 116: alert("You have selected 'No' for both addition and removal of students\\n in the Registrar's classlist but not in your LON-CAPA course. \\nHence there is no update to carry out")
1.1 raeburn 117: checker = 0
118: }
119: }
1.14 raeburn 120: if (calling == "viewclass") {
121: document.forms.studentform.state.value = "process";
1.16 raeburn 122: var totcheck = 0
123: if (numauto > 0) {
124: for (var i=0; i<document.studentform.chgauto.length; i++) {
125: if (document.studentform.chgauto[i].checked == true) {
126: totcheck ++
127: }
128: }
129: }
130: if (nummanual > 0) {
131: for (var i=0; i<document.studentform.chgmanual.length; i++) {
132: if (document.studentform.chgmanual[i].checked == true) {
133: totcheck ++
134: }
135: }
136: }
137: if (numlock > 0) {
138: for (var i=0; i<document.studentform.lockchg.length; i++) {
139: if (document.studentform.lockchg[i].checked == true) {
140: totcheck ++
141: }
142: }
143: }
144: if (numunlock > 0) {
145: for (var i=0; i<document.studentform.unlockchg.length; i++) {
146: if (document.studentform.unlockchg[i].checked == true) {
147: totcheck ++
148: }
149: }
150: }
151: if (totcheck > 0) {
152: checker = 1
153: } else {
154: alert("You must check at least one checkbox, before proceeding to the next page")
155: checker = 0
156: }
1.14 raeburn 157: }
1.1 raeburn 158: if (checker == 1) {
159: formName.submit();
160: }
161: }
1.16 raeburn 162: |;
163: if ($action eq 'viewclass') {
164: $scripttag .= qq|
165: function checkAll(field) {
166: for (i = 0; i < field.length; i++)
167: field[i].checked = true ;
168: }
169:
170: function uncheckAll(field) {
171: for (i = 0; i < field.length; i++)
172: field[i].checked = false ;
173: }
174: |;
175: }
176: $scripttag .= qq|
1.1 raeburn 177: // End hiding -->
178: </script>
179: |;
180: return(<<ENDHEAD);
181: <html>
182: <head>
183: <title>LON-CAPA Classlist Manager</title>
184: $scripttag
185: $bodytag
186: ENDHEAD
187: }
188:
189: sub print_mainbox {
190: my ($r,$tasklongref,$realm,$reply) = @_;
191: my $action = "information";
192: if ( exists($ENV{'form.action'}) ) {
193: $action = $ENV{'form.action'};
194: }
195: my $page = '';
196: if ($action eq "information") {
197: $page = "<b>Automated Enrollment</b>";
198: } else {
199: $page = '<a href="/adm/populate">Automated Enrollment</a>';
200: if ($reply) {
201: if ($action eq "newcross") {
202: $action = "crosslist";
203: } elsif ($action eq "newsections") {
204: $action = "sections";
205: }
206: $page .= "-> <a href=\"/adm/populate?action=$action\">".$$tasklongref{$action}."</a> -> <b>result</b>";
207: } else {
208: $page .= " -> <b>".$$tasklongref{$action}."</b>";
209: }
210: }
211: $r->print(<<ENDTHIS);
212: <table width="100%" border="0" cellpadding="0" cellspacing="0">
213: <tr>
214: <td bgcolor="#CCCCFF">
215: <font size="2"><a href="/adm/menu">$realm</a> -> <a href="/adm/dropadd">Enrollment Manager</a> -> $page</font><br/>
216: </td>
217: <td align="right" bgcolor="#CCCCFF" valign="top">
218: <font size="+1">Automated Enrollment Manager </font>
219: </td>
220: </tr>
221: </table>
222: <table width="100%" border="0" cellpadding="0" cellspacing="0">
223: <tr>
224: ENDTHIS
225: }
226:
227: sub print_navmenu {
228: my ($r,$tasksref,$tasklongref) = @_;
229: my $action = "information";
230: if (exists($ENV{'form.action'}) ) {
231: $action = $ENV{'form.action'};
232: }
233: $r->print(<<ENDONE);
234: <td width="10" valign="top" bgcolor="#DDFFFF"> </td>
235: <td width="20%" valign="top" bgcolor="#DDFFFF">
236: <br/>
237: ENDONE
238: foreach my $task (@{$tasksref}) {
239: if ($task eq $action) {
240: $r->print("
241: <p>
242: <font color=\"#999999\">
243: <b>$$tasklongref{$task}</b><br/>
244: </font>
245: </p>");
246: } else {
247: $r->print("
248: <p>
249: <font color=\"#004263\">
250: <b><a href=\"/adm/populate?action=$task\">$$tasklongref{$task}</a></b><br/>
251: </font>
252: </p>");
253:
254: }
255: }
256: $r->print("
257: <p> </p>
258: </td>
259: <td width=\"10\" valign=\"top\" bgcolor=\"#CCCCFF\"> </td>
260: <td width=\"10\" valign=\"top\" bgcolor=\"#FFFFFF\"> </td>
261: <td bgcolor=\"#ffffff\" valign=\"top\">");
262: }
263:
264: ###############################################################
265:
266: sub print_main_frame {
1.13 raeburn 267: my ($r,$realm,$dom,$crs,$tasktitleref) = @_;
1.1 raeburn 268: my $action = "information";
269: if (exists($ENV{'form.action'}) ) {
270: $action = $ENV{'form.action'};
271: }
272:
273: # Get course settings
274: my %enrollvar;
275: my @bgcolors=("#eeeeee","#cccccc");
276: my %settings = &Apache::lonnet::dump('environment',$dom,$crs);
277: foreach my $item (keys %settings) {
278: if ($item =~ m/^internal\.(.+)$/) {
279: $enrollvar{$1} = $settings{$item};
1.14 raeburn 280: } elsif ($item =~ /^default_enrollment_(start|end)_date$/) {
281: $enrollvar{$item} = $settings{$item};
1.1 raeburn 282: }
283: }
284:
285: if ($action eq "information") {
286: $r->print(<<ENDONE);
1.2 raeburn 287: <br/><table border='0' width='100%'>
1.1 raeburn 288: <tr>
289: <td> </td>
290: <td><b>Use the menu on the left to choose an enrollment management task.</b><br/><br/></td>
291: <tr>
292: <td> </td>
1.16 raeburn 293: <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>
1.1 raeburn 294: </tr>
295: <tr>
296: <td> </td>
297: <td>Use <i>"Change enrollment dates"</i> to change the date of first automated enrollment and/or the date of last automated enrollment for registered students.</td>
298: </tr>
299: <tr>
300: <td> </td>
1.14 raeburn 301: <td>Use <i>"Change access dates"</i> to change the default start and/or end dates for student roles created by automated enrollment.</td>
302: </tr>
303: <tr>
304: <td> </td>
1.1 raeburn 305: <td>Use <i>"Notification of changes"</i> to enable or disable notification of enrollment changes and to add or remove course coordinators from the recipient list.</td>
306: </tr>
307: <tr>
308: <td> </td>
309: <td>Use <i>"Change crosslisting"</i> to include or exclude enrollment from crosslisted classes.</td>
310: </tr>
311: <tr>
312: <td> </td>
313: <td>Use <i>"Section settings"</i> to make changes to the choice of sections included for enrollment in your LON-CAPA course.</td>
314: </tr>
315: <td> </td>
1.2 raeburn 316: <td>Use <i>"Student photos"</i> to enable or disable automatic upload of student photos to your course.</td>
1.1 raeburn 317: </tr>
318: <tr>
319: <td> </td>
320: <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>
321: </tr>
322: <tr>
1.16 raeburn 323: <td> </td>
324: <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>
325: </tr>
326: <tr>
1.1 raeburn 327: <td colspan='2'> </td>
328: </tr>
329: <tr>
330: <td> </td>
331: <td><b>Note: if automated adds and/or drops are enabled, the nightly enrollment update will ONLY occur once the first enrollment date has been reached.</b></td>
332: </tr>
333: </table>
334: ENDONE
335: } elsif ($action eq "chgsettings") {
336: my @autosets = ("OFF","ON");
337: $r->print(<<ENDTWO);
338: <form name="enter" method="post"><br/>
339: <table width="100%" border="0" cellpadding="2" cellspacing="2">
340: <tr>
341: <td align="left"><b>$$tasktitleref{$action}</b><br/>
342: Currently: Nightly adds: <i>$autosets[$enrollvar{autoadds}]</i>, Nightly drops: <i>$autosets[$enrollvar{autodrops}]</i>
343: </td>
344: </tr>
345: </table>
346: <table width="100%" border="0" cellpadding="3" cellspacing="3">
347: <tr>
348: <td>
349: Additions based on classlist changes:
350: ENDTWO
351: if ($enrollvar{autoadds}) {
352: $r->print("
353: <input type=\"radio\" name=\"autoadds\" value=\"1\" checked=\"true\" /> Enable
354: <input type=\"radio\" name=\"autoadds\" value=\"0\" /> Disable
355: ");
356: } else {
357: $r->print("
358: <input type=\"radio\" name=\"autoadds\" value=\"1\" /> Enable
359: <input type=\"radio\" name=\"autoadds\" value=\"0\" checked=\"true\" /> Disable
360: ");
361: }
362: $r->print("
363: </td>
364: </tr>
365: <tr>
366: <td>
367: Removals based on classlist changes: ");
368: if ($enrollvar{autodrops}) {
369: $r->print("
370: <input type=\"radio\" name=\"autodrops\" value=\"1\" checked=\"true\" /> Enable
371: <input type=\"radio\" name=\"autodrops\" value=\"0\" /> Disable");
372: } else {
373: $r->print("
374: <input type=\"radio\" name=\"autodrops\" value=\"1\" /> Enable
375: <input type=\"radio\" name=\"autodrops\" value=\"0\" checked=\"true\" /> Disable");
376: }
377: $r->print("
378: </td>
379: </tr>
380: <tr>
381: <td>
382: <font color=\"#888888\">
383: Note: Any students added manually by course coordinators using the Enrollment Manager will be unaffected by the nightly removal process if you choose to enable it.
384: </font>
385: </td>
386: </tr>
387: <tr>
388: <td align=\"right\">
389: <input type=\"button\" name=\"chgsettings\" value=\"Go\" onClick=\"process('chgsettings')\" />
390: </td>
391: </tr>
392: </table>
393: <input type=\"hidden\" name=\"action\" value=\"$action\">
394: <input type=\"hidden\" name=\"state\" value=\"process\">
395: </form>
396: ");
397: } elsif ($action eq "setdates") {
1.14 raeburn 398: my ($start_table,$end_table) = &date_setting_table($enrollvar{autostart},$enrollvar{autoend},$action);
1.10 raeburn 399: my $oldstartshow = '';
400: my $oldendshow = '';
401: if ( defined($enrollvar{autostart}) ) {
1.14 raeburn 402: $oldstartshow = &Apache::lonlocal::locallocaltime($enrollvar{autostart});
1.10 raeburn 403: }
404: if ( defined($enrollvar{autoend}) ) {
1.14 raeburn 405: $oldendshow = &Apache::lonlocal::locallocaltime($enrollvar{autoend});
1.10 raeburn 406: if ($enrollvar{autoend} == 0) {
407: $oldendshow = "No ending date";
408: }
409: }
410: my $dateshow;
411: if ( ($oldendshow eq '') && ($oldstartshow eq '') ) {
1.14 raeburn 412: $dateshow = "<br/><font size='+1'>Warning</font>. Currently <b>NO</b> first enrollment or last enrollment dates are set. You <b>must</b> use this menu to set a start date and an end date if you plan to utilise automated adds and/or drops in this course.\n";
1.10 raeburn 413: } else {
414: $dateshow = "Currently: First enrollment: <b><i>$oldstartshow</i></b>, Last enrollment: <b><i>$oldendshow</i></b>\n";
1.1 raeburn 415: }
416: $r->print(<<ENDTWO);
417: <form name="enter" method="post"><br/>
418: <table width="100%" border="0" cellpadding="2" cellspacing="2">
419: <tr>
1.10 raeburn 420: <td align="left"><b>$$tasktitleref{$action}</b><br/><br/>
421: $dateshow
1.1 raeburn 422: </td>
423: </tr>
424: </table>
425: <table width="100%" border="0" cellpadding="3" cellspacing="3">
426: <tr>
427: <td align="left" colspan="2">
428: <table border="0" cellspacing="0" cellpadding="2">
429: <tr>
430: <td colspan="3">
431: <i>Set date of first automated enrollment for registered students</i>
432: </td>
433: </tr>
434: <tr>
435: <td>$start_table
436: </td>
437: </tr>
438: </table>
439: </td>
440: </tr>
441: <tr>
442: <td colspan="2"><font color="#888888">If automated adds and/or drops are enabled, then your class roster will be automatically updated nightly, once the first enrollment date has been reached. Prior to this date, the class roster will only contain students you have added directly using the standard LON-CAPA enrollment tools</font></td>
443: </tr>
444: <tr>
445: <td align="left" colspan="2">
446: <table border="0' cellspacing="0" cellpadding="2">
447: <tr>
448: <td colspan="3">
449: <i>Set date of last automated enrollment for registered students</i>
450: </td>
451: </tr>
452: <tr>
453: <td>$end_table
454: </td>
455: </tr>
456: </table>
457: </td>
458: </tr>
459: <tr>
460: <td colspan="2"><font color="#888888">If automated adds and/or drops are enabled, then your class roster will be automatically updated nightly, until the last enrollment date has been reached.</font></td>
461: </tr>
462: </table>
463: <table width="100%">
464: <tr>
465: <td align="right">
466: <input type="button" name="setdates" value="Go" onClick="process('setdates')" />
467: </td>
468: </tr>
469: </table>
1.14 raeburn 470: <input type="hidden" name="action" value="$action">
471: <input type="hidden" name="state" value="process">
472: </form>
473: ENDTWO
474: } elsif ($action eq "setaccess") {
475: &print_accessdate_table($r,\%enrollvar,$tasktitleref,$action);
476: $r->print(<<ENDTWO);
477: <table width="100%">
478: <tr>
479: <td align="right">
480: <input type="button" name="$action" value="Go" onClick="process('$action')" />
481: </td>
482: </tr>
483: </table>
484: <input type="hidden" name="action" value="$action">
485: <input type="hidden" name="state" value="process">
1.1 raeburn 486: </form>
487: ENDTWO
488: } elsif ($action eq "notify") {
489: my @notified = ();
490: if ($enrollvar{notifylist} =~ m/,/) {
491: @notified = split/,/,$enrollvar{notifylist};
492: } else {
493: @notified = $enrollvar{notifylist};
494: }
495: my $notifycount = 0;
496: foreach (@notified) {
497: unless ($_ eq '') { $notifycount ++; }
498: }
499: my $noteset = '';
500: if ($notifycount) {
501: $noteset = "ON";
502: } else {
503: $noteset = "OFF";
504: }
505:
506: $r->print("
507: <form name=\"enter\" method=\"post\"><br/>
508: <table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">
509: <tr>
510: <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
511: Currently: Notification: $noteset
512: </td>
513: </tr>
514: </table>
515: <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
516: <tr>
517: <td>
518: Notification of LON-CAPA course roster changes resulting from nightly automated enrollment process?
519: ");
520: if ($notifycount) {
521: $r->print("
522: <input type=\"radio\" name=\"notify\" value=\"1\" checked=\"true\" /> Yes
523: <input type=\"radio\" name=\"notify\" value=\"0\" /> No
524: ");
525: } else {
526: $r->print("
527: <input type=\"radio\" name=\"notify\" value=\"1\" /> Yes
528: <input type=\"radio\" name=\"notify\" value=\"0\" checked=\"true\" /> No
529: ");
530: }
531: $r->print("
532: </td>
533: </tr>
534: ");
1.7 raeburn 535: my @coursepersonnel = &Apache::lonnet::getkeys('nohist_userroles',$dom,$crs);
536: my @ccs = ();
537: my @oldccs = ();
538: my %pname = ();
539: my %notifystate = ();
540: foreach (@coursepersonnel) {
541: my @roleinfo = split/:/,$_;
542: if ($roleinfo[0] eq 'cc') {
543: unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) {
544: my $active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc');
545: if ($active_cc eq 'ok') {
546: push @ccs, "$roleinfo[1]\@$roleinfo[2]";
547: $pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]);
548: if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) {
549: $notifystate{"$roleinfo[1]\@$roleinfo[2]"} = 1;
550: } else {
551: $notifystate{"$roleinfo[1]\@$roleinfo[2]"} = 0;
552: }
1.1 raeburn 553: } else {
1.7 raeburn 554: push @oldccs, "$roleinfo[1]\@$roleinfo[2]";
1.1 raeburn 555: }
556: }
557: }
558: }
1.7 raeburn 559: if ($notifycount > 0) {
560: foreach my $person (@notified) {
561: unless ( (grep/^$person$/,@ccs) || ($person eq '') || (grep/^$person$/,@oldccs) ) {
562: push @ccs, $person;
563: my ($puname,$pdom) = split/\@/,$person;
564: $pname{$person} = &Apache::loncommon::plainname($puname,$pdom);
565: $notifystate{$person} = 1;
566: }
567: }
568: }
569: my $viewer = $ENV{'user.name'}.'@'.$ENV{'user.domain'};
570: unless ( (grep/^$viewer$/,@ccs) || ($viewer eq '') ) {
571: push @ccs,$viewer;
572: $pname{$viewer} = &Apache::loncommon::plainname($ENV{'user.name'},$ENV{'user.domain'});
573: $notifystate{$viewer} = 0;
574: }
575:
576: my $notifyshow = @ccs;
577:
578: if (@ccs > 0) {
579: @ccs = sort @ccs;
1.1 raeburn 580: $r->print("
581: <tr>
1.7 raeburn 582: <td>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.
1.1 raeburn 583: </td>
584: </tr>
585: <tr>
586: <td>
1.7 raeburn 587: <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
588: <tr bgcolor=\"#CCCCFF\">
589: <td><b>Name</b></td>
590: <td><b>username</b></td>
591: <td><b>Current status</b></td>
592: <td><b>Notification?</b></td>
593: </tr>
594: ");
595: for (my $i=0; $i<@ccs; $i++) {
596: my $colflag = $i%2;
597: $r->print("<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
598: <td>$pname{$ccs[$i]}</td>
599: <td><input type=\"hidden\" name=\"notifyname_$i\" value=\"$ccs[$i]\" />$ccs[$i]</td>
600: <td>
601: ");
602: if ($notifystate{$ccs[$i]} == 1) {
603: $r->print("Notification active");
604: } else {
605: $r->print("Notification inactive");
606: }
607: if ($notifystate{$ccs[$i]} == 1) {
608: $r->print("</td><td><input type=\"checkbox\" name=\"note_$i\" checked=\"true\" /></td></tr>");
609: } else {
610: $r->print("</td><td><input type=\"checkbox\" name=\"note_$i\" /></td></tr>");
611: }
612: }
613: $r->print("
614: </table>
615: <br/>
616: <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
617: <tr>
618: <td align=\"right\">
619: <input type=\"button\" name=\"notifyset\" value=\"Go\" onClick=\"process('notify')\" />
620: </td>
621: </tr>
622: </table>
623: </td>
624: </tr>
1.1 raeburn 625: ");
1.7 raeburn 626: } else {
1.1 raeburn 627: $r->print("
1.7 raeburn 628: <tr>
629: <td>
630: No course coordinators found.
1.1 raeburn 631: </td>
1.7 raeburn 632: </tr>");
1.1 raeburn 633: }
634: $r->print("
1.7 raeburn 635: </table>
636: <input type=\"hidden\" name=\"notifyshow\" value=\"$notifyshow\">
637: <input type=\"hidden\" name=\"action\" value=\"$action\">
638: <input type=\"hidden\" name=\"state\" value=\"process\">
639: </form>
1.1 raeburn 640: ");
641: } elsif ($action eq "crosslist") {
642: my @xlists = ();
643: if ($enrollvar{crosslistings} =~ m/,/) {
644: @xlists = split/,/,$enrollvar{crosslistings};
645: } elsif ($enrollvar{crosslistings} ne '') {
646: $xlists[0] = $enrollvar{crosslistings};
647: }
648: my $cross_str = @xlists;
649: $r->print("
650: <form name=\"enter\" method=\"post\"><br/>
651: <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
652: <tr>
653: <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
654: ");
655: if ($cross_str > 0) {
656: $r->print("
1.7 raeburn 657: 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: <b>$realm ($enrollvar{coursecode})</b>; 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.
1.1 raeburn 658: </td>
659: </tr>
660: </table>
661: <br/>
662: <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
663: <tr>
664: <td>
665: <table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">
666: <tr bgcolor=\"#CCCCFF\" align=\"left\">
667: <td><b>Enrollment?</b></td>
668: <td><b>Crosslisted course</b></td>
669: <td><b>LON-CAPA section/groupID</b></td>
670: </tr>
671: ");
672: for (my $i=0; $i<@xlists; $i++) {
673: my $xl = ' ';
674: my $gp = ' ';
1.14 raeburn 675: if ($xlists[$i] =~ /(\w+):?(.*)$/) {
1.1 raeburn 676: $xl = $1;
677: $gp = $2;
678: }
679: my $colflag = $i%2;
680: $r->print("
681: <tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
682: <td><input type=\"checkbox\" name=\"cross_$i\" checked=\"true\"/></td>
683: <td>$xl</td>
684: <td><input type =\"text\" size=\"10\" name=\"gp_$i\" value=\"$gp\"></td>
685: </tr>
686: ");
687: }
688: $r->print(" </table>
689: </td>
690: </tr>
691: </table>
692: ");
693: }
694: else {
695: $r->print("
696: Currently no crosslisted courses are recorded for $enrollvar{coursecode}.
697: </td>
698: </tr>
699: </table>
700: ");
701: }
702: $r->print("
703: <br/>
704: <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
705: <tr>
706: <td align=\"left\">
707: <b>Add new crosslistings.</b><br/>
708: Number of new crosslistings to add: <input type=\"text\" size=\"2\" name=\"numcross\" value=\"0\" />
709: </td>
710: </tr>
711: </table>
712: <br/>
713: <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
714: <tr>
715: <td align=\"right\">
716: <input type=\"button\" name=\"crosslist\" value=\"Go\" onClick=\"process('crosslist')\" />
717: </td>
718: </tr>
719: </table>
720: <input type=\"hidden\" name=\"action\" value=\"$action\">
721: <input type=\"hidden\" name=\"state\" value=\"process\">
722: </form>
723: ");
724: } elsif ($action eq "sections") {
1.12 raeburn 725: my @sections = ();
1.13 raeburn 726: @sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode});
1.1 raeburn 727: my @storedsections = ();
728: my @currsections = ();
729: my %sec_id = ();
730: if ($enrollvar{sectionnums} =~ m/,/) {
731: @storedsections = split/,/,$enrollvar{sectionnums};
732: } else {
733: $storedsections[0] = $enrollvar{sectionnums};
734: }
735: foreach (@storedsections) {
736: if ($_ =~ m/^(\w+):(\w*)$/) {
737: push @currsections, $1;
738: $sec_id{$1} = $2;
739: }
740: }
741: if (@sections > 0) {
1.8 raeburn 742: my $secshow = @sections;
743: $r->print("
1.1 raeburn 744: <form name=\"enter\" method=\"post\"><br/>
745: <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
746: <tr>
747: <td align=\"left\">
748: <b>$$tasktitleref{$action}</b><br/>
749: Your institution's course catalog includes $secshow sections for course code: $enrollvar{coursecode}.
750: </td>
751: </tr>
752: <tr>
1.5 raeburn 753: <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
754: your changes.</td>
1.1 raeburn 755: </tr>
756: </table>
757: <br/>
1.7 raeburn 758: <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
759: <tr bgcolor=\"#CCCCFF\">
760: <td><b>Section</b></td>
761: <td><b>Current status</b></td>
762: <td><b>LON-CAPA section/group ID</b></td>
763: <td><b>Enrollment in this course?</b></td>
764: </tr>
1.8 raeburn 765: ");
766: for (my $i=0; $i<@sections; $i++) {
767: my $colflag = $i%2;
768: my $shrflag = 0;
769: $r->print("<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
1.5 raeburn 770: <td>$sections[$i]<input type=\"hidden\" name=\"secnum_$i\" value=\"$sections[$i]\" /></td>
1.1 raeburn 771: <td>
1.8 raeburn 772: ");
773: if (grep/^$sections[$i]$/,@currsections) {
774: $r->print("Enrollment active");
775: $shrflag = 1;
776: } else {
777: $r->print("Enrollment inactive");
778: }
779: if ($shrflag) {
780: $r->print("</td><td><input type=\"text\" size=\"10\" name=\"loncapasec_$i\" value=\"$sec_id{$sections[$i]}\"></td><td><input type=\"checkbox\" name=\"sec_$i\" checked=\"true\" /></td></tr>");
781: } else {
782: $r->print("</td><td><input type=\"text\" size=\"10\" name=\"loncapasec_$i\" value=\"\"><td><input type=\"checkbox\" name=\"sec_$i\" /></td></tr>");
1.1 raeburn 783: }
1.8 raeburn 784: }
785: $r->print("
1.7 raeburn 786: </table>
787: <br/>
788: <table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">
789: <tr>
790: <td align=\"right\">
791: <input type=\"hidden\" name=\"secshow\" value=\"$secshow\" />
792: <input type=\"button\" name=\"sections\" value=\"Go\" onClick=\"process('sections')\" />
793: </td>
794: </tr>
795: </table>
796: <input type=\"hidden\" name=\"action\" value=\"$action\">
797: <input type=\"hidden\" name=\"state\" value=\"process\">
798: </form>
1.8 raeburn 799: ");
1.1 raeburn 800: } else {
801: $r->print("
802: <form name=\"enter\" method=\"post\"><br/>
803: <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
804: <tr>
805: <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
806: ");
807: if (@currsections) {
808: my $secshow = @currsections;
809: $r->print("
1.7 raeburn 810: Currently, this LON-CAPA course 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.
1.1 raeburn 811: </td>
812: </tr>
813: </table>
814: <br/>
815: <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
816: <tr>
817: <td>
818: <table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">
819: <tr bgcolor=\"#CCCCFF\">
820: <td><b>Enrollment?</b></td>
821: <td><b>Section</b></td>
822: <td><b>LON-CAPA section/groupID</b></td>
823: </tr>
824: ");
825: for (my $j=0; $j<@currsections; $j++) {
826: my $colflag = $j%2;
827: $r->print("
828: <tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
829: <td><input type=\"checkbox\" name=\"sec_$j\" checked=\"true\"/></td>
830: <td>$currsections[$j]</td>
831: <td><input type=\"text\" name=\"secgp_$j\" size=\"10\" value=\"$sec_id{$currsections[$j]}\"></td>
832: </tr>
833: ");
834: }
835: $r->print(" </table>
836: </td>
837: </tr>
838: </table>
839: ");
840: } else {
841: $r->print("
842: Currently no sections of $realm ($enrollvar{coursecode}) are contributing enrollment to the LON-CAPA class roster.
843: </td>
844: </tr>
845: </table>
846: ");
847: }
848: $r->print("
849: <br/>
850: <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
851: <tr>
852: <td align=\"left\">
853: <b>Add enrollment from additional sections.</b><br/>
854: Number of new sections to add: <input type=\"text\" size=\"2\" name=\"numsec\" value=\"0\" />
855: </td>
856: </tr>
857: </table>
858: <br/>
859: <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
860: <tr>
861: <td align=\"right\">
862: <input type=\"button\" name=\"sections\" value=\"Go\" onClick=\"process('sections')\" />
863: </td>
864: </tr>
865: </table>
866: <input type=\"hidden\" name=\"action\" value=\"$action\">
867: <input type=\"hidden\" name=\"state\" value=\"process\">
868: </form>
869: ");
870: }
871: } elsif ($action eq "photos") {
872: my @photosets = ("OFF","ON");
873: $r->print("
874: <form name=\"enter\" method=\"post\"><br/>
875: <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
876: <tr>
877: <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
878: Currently: Student photo import: <i>$photosets[$enrollvar{showphotos}]</i>
879: </td>
880: </tr>
881: </table>
882: <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
883: <tr>
884: <td>
885: Automatic import of student photos from institutional data repository:
886:
887: ");
888: if ($enrollvar{showphotos}) {
889: $r->print("
890: <input type=\"radio\" name=\"showphotos\" value=\"1\" checked=\"true\" /> Yes
891: <input type=\"radio\" name=\"showphotos\" value=\"0\" /> No
892: ");
893: } else {
894: $r->print("
895: <input type=\"radio\" name=\"showphotos\" value=\"1\" /> Yes
896: <input type=\"radio\" name=\"showphotos\" value=\"0\" checked=\"true\" /> No
897: ");
898: }
899: $r->print("
900: </td>
901: </tr>
902: <tr>
903: <td>
904: <font color=\"#888888\">
905: Note: if you enable automatic import of student photos, your course will automatically have access to photos stored by your institution for all officially registered students, via a conduit established by your LON-CAPA domain coordinator.
906: </font>
907: </td>
908: </tr>
909: <tr>
910: </td> </td>
911: </tr>
912: <tr>
913: <td align=\"right\">
914: <input type=\"button\" name=\"showphotos\" value=\"Go\" onClick=\"process('photos')\">
915: </td>
916: </tr>
917: </table>
918: <input type=\"hidden\" name=\"action\" value=\"$action\">
919: <input type=\"hidden\" name=\"state\" value=\"process\">
920: </form>
921: ");
922: } elsif ($action eq "updatenow") {
923: $r->print("
924: <form name=\"enter\" method=\"post\"><br/>
925: <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
926: <tr>
927: <td align=\"left\"><b>$$tasktitleref{$action}</b>
928: </td>
929: </tr>
930: </table>
931: <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
932: <tr>
933: <td>
1.17 raeburn 934: Add any students currently included in institutional classlist(s) but not enrolled in your LON-CAPA course.<br />
935: <input type=\"radio\" name=\"updateadds\" value=\"1\"> Yes <input type=\"radio\" name=\"updateadds\" value=\"0\"> No
1.1 raeburn 936: </td>
937: </tr>
938: <tr>
939: <td>
1.17 raeburn 940: Expire students previously added by nightly enrollment process, but no longer listed in institutional classlist(s).<br />
1.14 raeburn 941: <input type=\"radio\" name=\"updatedrops\" value=\"1\"> Yes
942: <input type=\"radio\" name=\"updatedrops\" value=\"0\"> No <br/>
943: </td>
944: </tr>
945: <tr>
946: <td><font color=\"#888888\">
1.1 raeburn 947: Note: Any students previously added manually by course coordinator(s) using either 'Upload classlist CSV file' or 'Enroll a single user' will be unaffected by the removal process.
1.14 raeburn 948: </font>
949: </td>
950: </tr>
951: <tr>
952: <td>
953: ");
954: &print_accessdate_table($r,\%enrollvar,$tasktitleref,$action);
955: $r->print("
956: </td>
957: </tr>
958: <tr>
959: <td align=\"right\">
960: <input type=\"button\" name=\"updatenow\" value=\"Go\" onClick=\"process('updatenow')\" />
961: </td>
962: </tr>
963: </table>
964: <input type=\"hidden\" name=\"action\" value=\"$action\" />
965: <input type=\"hidden\" name=\"state\" value=\"process\" />
966: </form>
967: ");
968: } elsif ($action eq 'viewclass') {
969: $r->print("
970: <form name=\"studentform\" method=\"post\"><br/>
971: <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
972: <tr>
973: <td align=\"left\"><b>$$tasktitleref{$action}</b>
974: </td>
975: </tr>
1.16 raeburn 976: <tr>
977: <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>
978: </tr>
979: <tr><td> </td></tr>
1.14 raeburn 980: </table>
981: <table>
982: <tr>
983: <td>
1.1 raeburn 984: ");
1.14 raeburn 985: if (! exists($ENV{'form.sortby'})) {
986: $ENV{'form.sortby'} = 'username';
987: }
988: if ($ENV{'form.Status'} !~ /^(Any|Expired|Active)$/) {
989: $ENV{'form.Status'} = 'Active';
990: }
991: my $status_select = &Apache::lonhtmlcommon::StatusOptions($ENV{'form.Status'});
992: # Get current classlist
993: my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
994: if (! defined($classlist)) {
995: $r->print(&mt('There are no students either currently or previously enrolled.').
996: "\n");
997: } else {
998: $r->print(&mt('Student Status: [_1]',$status_select)."\n");
999: $r->print('<input type="submit" value="'.&mt('Update Display').'" />'.
1000: "\n</p>\n");
1001:
1.16 raeburn 1002: my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::londropadd::show_class_list($r,'autoenroll','nothing',$ENV{'form.Status'},$classlist,$keylist);
1.14 raeburn 1003: $r->print("
1004: </td>
1005: </tr>
1006: ");
1007: if ($studentcount > 0) {
1008: $r->print("
1.16 raeburn 1009: <tr><td><table border=\"0\" cellpadding=\"5\"><tr>
1010: ");
1011: my $cellcount = 0;
1012: if ($autocount > 0) {
1013: $cellcount ++;
1014: $r->print(<<END);
1015: <td><fieldset><legend> <b>Change auto</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.chgauto)" />
1016: <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.chgauto)" /></fieldset></td>
1017: END
1018: }
1019: if ($manualcount > 0) {
1020: $cellcount ++;
1021: $r->print(<<END);
1022: <td><fieldset><legend> <b>Change manual</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.chgmanual)" />
1023: <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.chgmanual)" /></fieldset></td>
1024: END
1025: }
1026: if ($lockcount > 0) {
1027: if ($cellcount == 2) {
1028: $r->print("</tr><tr>");
1029: }
1030: $cellcount ++;
1031: $r->print(<<END);
1032: <td><fieldset><legend> <b>Lock manual</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.lockchg)" />
1033: <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.lockchg)" /></fieldset></td>
1034: END
1035: }
1036: if ($unlockcount > 0) {
1037: if ($cellcount == 2) {
1038: $r->print("</tr><tr>");
1039: }
1040: $cellcount ++;
1041: $r->print(<<END);
1042: <td><fieldset><legend> <b>Unlock manual</b></legend><input type="button" value="check all" onclick="javascript:checkAll(document.studentform.unlockchg)" />
1043: <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.unlockchg)" /></fieldset></td>
1044: END
1045: }
1046: $r->print("
1047: </tr>
1048: </table>
1.14 raeburn 1049: <td> </td>
1050: </tr>
1051: <tr>
1052: <td align=\"right\">
1.16 raeburn 1053: <input type=\"button\" name=\"viewclass\" value=\"Go\" onClick=\"process('viewclass','$autocount','$manualcount','$lockcount','$unlockcount')\" />
1.14 raeburn 1054: </td>
1055: </tr>
1056: ");
1057: }
1058: $r->print("
1059: </table>
1060: <input type=\"hidden\" name=\"action\" value=\"$action\" />
1061: <input type=\"hidden\" name=\"state\" value=\"choose\" />
1062: </form>
1063: ");
1064: }
1.1 raeburn 1065: }
1066: }
1067:
1.14 raeburn 1068: sub print_accessdate_table {
1069: my ($r,$enrollvar,$tasktitleref,$action) = @_;
1070: my ($start_table,$end_table) = &date_setting_table($$enrollvar{'default_enrollment_start_date'},$$enrollvar{'default_enrollment_end_date'},$action);
1071: my $oldstartshow = '';
1072: my $oldendshow = '';
1073: if ( defined($$enrollvar{'default_enrollment_start_date'}) ) {
1074: $oldstartshow = &Apache::lonlocal::locallocaltime($$enrollvar{'default_enrollment_start_date'});
1075: }
1076: if ( defined($$enrollvar{'default_enrollment_end_date'}) ) {
1077: $oldendshow = &Apache::lonlocal::locallocaltime($$enrollvar{default_enrollment_end_date});
1078: if ($$enrollvar{'default_enrollment_end_date'} eq '0') {
1079: $oldendshow = "No ending date";
1080: }
1081: }
1082: my %lt =&Apache::lonlocal::texthash(
1083: 'cuno' => 'Currently NO default first access or last access dates are set.',
1084: 'ifyo' => 'If you do not set a start date and an end date, then student roles for students added by the automated enrollment process will start immediately when the student is added and will never become inactive.',
1085: 'ifyd' => 'If you do not set an access start date and an end date, then student roles for new students added when you click "Go" will become active immediately and will never become inactive.',
1086: 'setf' => 'Set date of first access',
1087: 'setl' => 'Set date of last access',
1088: 'freg' => 'for registered students added via automated enrollment',
1089: 'fnew' => 'for new students added when you update the class roster',
1.16 raeburn 1090: '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.',
1091: '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.'
1092:
1.14 raeburn 1093: );
1094: my $dateshow;
1095: if ( ($oldendshow eq '') && ($oldstartshow eq '') ) {
1096: $dateshow = "<br/><font size='+1'>".&mt('Warning')."</font>. ".$lt{'cuno'}." ";
1097: if ($action eq 'setaccess') {
1098: $dateshow .= $lt{'ifyo'}."\n";
1099: } elsif ($action eq 'updatenow') {
1100: $dateshow .= $lt{'ifyd'}."\n";
1101: }
1102: } else {
1103: $dateshow = &mt('Currently: default first access').": <b><i>$oldstartshow</i></b>, ".&mt('default last access').": <b><i>$oldendshow</i></b>\n";
1104: }
1105: if ($action eq 'setaccess') {
1106: $r->print(<<ENDONE);
1107: <form name="enter" method="post"><br/>
1108: <table width="100%" border="0" cellpadding="2" cellspacing="2">
1109: <tr>
1110: <td align="left"><b>$$tasktitleref{$action}</b>
1111: <br /><br />
1112: $dateshow
1113: </td>
1114: </tr>
1115: </table>
1116: ENDONE
1117: } elsif ($action eq 'updatenow') {
1118: $r->print("
1119: <br /><br />$dateshow\n");
1120: }
1121: $r->print(<<ENDTWO);
1122: <table width="100%" border="0" cellpadding="3" cellspacing="3">
1123: <tr>
1124: <td align="left" colspan="2">
1125: <table border="0" cellspacing="0" cellpadding="2">
1126: <tr>
1127: <td colspan="3">
1128: ENDTWO
1129: if ($action eq 'setaccess') {
1130: $r->print("<i>$lt{'setf'} $lt{'freg'}</i>");
1131: } elsif ($action eq 'updatenow') {
1132: $r->print("<i>$lt{'setf'} $lt{'fnew'}</i>");
1133: }
1134: $r->print(<<ENDTHREE);
1135: </td>
1136: </tr>
1137: <tr>
1138: <td>$start_table
1139: </td>
1140: </tr>
1141: </table>
1142: </td>
1143: </tr>
1144: <tr>
1145: <td align="left" colspan="2">
1.15 albertel 1146: <table border="0" cellspacing="0" cellpadding="2">
1.14 raeburn 1147: <tr>
1148: <td colspan="3">
1149: ENDTHREE
1150: if ($action eq 'setaccess') {
1151: $r->print("<i>$lt{'setl'} $lt{'freg'}</i>");
1152: } elsif ($action eq 'updatenow') {
1153: $r->print("<i>$lt{'setl'} $lt{'fnew'}</i>");
1154: }
1155: $r->print(<<ENDFOUR);
1156: </td>
1157: </tr>
1158: <tr>
1159: <td>$end_table
1160: </td>
1161: </tr>
1162: </table>
1163: </td>
1164: </tr>
1165: ENDFOUR
1166: if ($action eq 'setaccess') {
1167: $r->print("
1168: <tr>
1169: <td colspan=\"2\"><font color=\"#888888\">$lt{'ifad'}</font></td>
1170: </tr>
1.16 raeburn 1171: <tr>
1172: <td colspan=\"2\"> </td>
1173: </tr>
1174: <tr>
1175: <td colspan=\"2\"><b>".&mt('Note').":</b> ".$lt{'ncds'}."</td>
1176: </tr>
1.14 raeburn 1177: </table>
1178: ");
1179: } elsif ($action eq 'updatenow') {
1180: $r->print("
1181: </tr>
1182: </table>
1183: ");
1184: }
1185: }
1186:
1.1 raeburn 1187: ###############################################################
1188: sub print_doc_base {
1.15 albertel 1189: my $r = shift;
1190: $r->print(<<ENDBASE);
1.1 raeburn 1191: </td>
1192: </tr>
1193: </table>
1194: <br/>
1195: </body>
1196: </html>
1197: ENDBASE
1198: }
1199:
1200: ###################################################################
1201: sub print_chgsettings_response {
1.15 albertel 1202: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1203: my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.crosslistings','internal.autostart','internal.autoend','internal.autoadds','internal.autodrops'],$dom,$crs);
1204: my $currend = '';
1205: my $currstart = '';
1206: my $currsecs = '';
1207: my $currxlists = '';
1208: my $curradds = '';
1209: my $currdrops = '';
1210: if ( defined($settings{'internal.autoadds'}) ) {
1211: $curradds = $settings{'internal.autoadds'};
1212: }
1213: if ( defined($settings{'internal.autodrops'}) ) {
1214: $currdrops = $settings{'internal.autodrops'};
1215: }
1216: if ( defined($settings{'internal.autostart'}) ) {
1217: $currstart = $settings{'internal.autostart'};
1218: }
1219: if ( defined($settings{'internal.autoend'}) ) {
1220: $currend = $settings{'internal.autoend'};
1221: }
1222: if ( defined($settings{'internal.sectionnums'}) ) {
1223: $currsecs = $settings{'internal.sectionnums'};
1224: }
1225: if ( defined($settings{'internal.crosslistings'}) ) {
1226: $currxlists = $settings{'internal.crosslistings'}
1227: }
1228: my $autoadds = '';
1229: my $autodrops = '';
1.1 raeburn 1230:
1.15 albertel 1231: if ( exists($ENV{'form.autoadds'}) ) {
1232: $autoadds=$ENV{'form.autoadds'};
1233: }
1234: if ( exists($ENV{'form.autodrops'}) ) {
1235: $autodrops=$ENV{'form.autodrops'};
1236: }
1237:
1238: my $response = "";
1239: my $warning = "";
1240: my $warn_prefix = "";
1241: my $warn_suffix = "";
1242: my $warnfiller = "";
1243: my %cenv = ('internal.autoadds' => $autoadds,
1244: 'internal.autodrops' => $autodrops);
1245: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
1246: if ($reply !~ /^ok$/) {
1247: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
1248: } else {
1249: if ($autoadds) {
1250: if ($curradds) {
1251: $response = "Nightly additions based on classlist changes still <b>enabled</b><br/>";
1252: } else {
1253: $response = "Nightly additions based on classlist changes now <b>enabled</b><br/>";
1254: }
1255: } else {
1256: if ($curradds) {
1257: $response = "Nightly additions based on classlist changes now <b>disabled</b><br/>";
1258: } else {
1259: $response = "Nightly additions based on classlist changes still <b>disabled</b><br/>";
1260: }
1261: }
1262: if ($autodrops) {
1263: if ($currdrops) {
1264: $response .= "Nightly removals based on classlist changes still <b>enabled</b><br>";
1265: } else {
1266: $response .= "Nightly removals based on classlist changes now <b>enabled</b><br/>";
1267: }
1268: } else {
1269: if ($currdrops) {
1270: $response .= "Nightly removals based on classlist changes now <b>disabled</b><br>";
1271: } else {
1272: $response .= "Nightly removals based on classlist changes still <b>disabled</b>";
1273: }
1274: }
1275: if ($autoadds || $autodrops) {
1276: $warning = &warning_message($dom,$crs,$action);
1277: $warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you indicated that nightly ";
1278: $warn_suffix = " should be enabled, additional action is required.<br/>";
1279: }
1280: if ($autoadds) {
1281: if ($autodrops) {
1282: $warnfiller = "adds and drops";
1283: } else {
1284: $warnfiller = "adds";
1285: }
1286: } else {
1287: if ($autodrops) {
1288: $warnfiller = "drops";
1289: }
1290: }
1291: unless ($warning eq '') {
1292: $response = $warn_prefix.$warnfiller.$warn_suffix.$warning;
1293: }
1294: }
1295: &print_reply($r,$response,$$tasktitleref{$action});
1296: return;
1.1 raeburn 1297: }
1298:
1299: sub print_setdates_response {
1.15 albertel 1300: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1301: my %settings = &Apache::lonnet::get('environment',['internal.autostart','internal.autoend'],$dom,$crs);
1302: my $currstart = $settings{'internal.autostart'};
1303: my $currend = $settings{'internal.autoend'};
1304: my $response = '';
1.19 ! raeburn 1305: my $showstart = '';
1.15 albertel 1306: my $showend = '';
1307: my $warning = '';
1308: my $warn_prefix = '';
1.19 ! raeburn 1309: my ($autostart,$autoend) = &get_dates_from_form();
! 1310: if ( ($autostart eq '') || ($autoend eq '') ) {
! 1311: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
! 1312: } elsif (($autoend > 0) && ($autoend <= $autostart)) {
! 1313: $response = 'The date/time selected for starting auto-enrollment was the same or later than the date/time selected for ending auto-enrollment. As this means auto-enrollment will never be active, your requested changes have not been processed, and the existing values remain in effect. Please <a href="javascript:history.go(-1)">go back</a> to the previous page to try your changes again.'."\n";
! 1314: } else {
! 1315: $showstart = &Apache::lonlocal::locallocaltime($autostart);
! 1316: if ($autoend) {
! 1317: $showend = &Apache::lonlocal::locallocaltime($autoend);
! 1318: } else {
! 1319: $showend = "'No end date'";
! 1320: }
1.15 albertel 1321:
1.19 ! raeburn 1322: my %cenv = ('internal.autostart' => $autostart,
! 1323: 'internal.autoend' => $autoend);
! 1324: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
! 1325: if ($reply !~ /^ok$/) {
! 1326: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
! 1327: } else {
! 1328: if ($currstart == $autostart) {
! 1329: $response = "The first date for automated enrollment has been left unchanged as $showstart.<br/>";
! 1330: } else {
! 1331: $response = "The first date for automated enrollment has been changed to $showstart.<br/>";
! 1332: }
! 1333: if ($currend == $autoend) {
! 1334: $response .= "The last date for automated enrollment has been left unchanged as $showend.<br/>";
! 1335: } else {
! 1336: $response .= "The last date for automated enrollment has been changed to $showend.<br/>";
! 1337: }
1.1 raeburn 1338:
1.14 raeburn 1339: # Generate message in case where old first enrollment date was later than today, but new first enrollment date is now today or earlier.
1.1 raeburn 1340:
1.19 ! raeburn 1341: my $rosterupdated = 0;
! 1342: my $firstaccess = "";
! 1343: my $nextupdate = "";
! 1344: my $lastupdate = "";
! 1345:
! 1346: my $nowstamp = time;
! 1347: my @date_list=localtime(time);
! 1348: my $cur_year = $date_list[5];
! 1349: my $curday = $date_list[3];
! 1350: my $curmonth = $date_list[4];
! 1351: my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]);
! 1352: my $nextmidnt = 86400 + $lastmidnt;
! 1353:
! 1354: my $todayupdate = timelocal(0,30,1,$date_list[3],$date_list[4],$date_list[5]);
! 1355: my $lastupdate = $todayupdate - 86400;
! 1356: if ($nowstamp < $todayupdate) {
! 1357: $nextupdate = "today";
1.15 albertel 1358: } else {
1.19 ! raeburn 1359: $nextupdate = "tomorrow";
1.15 albertel 1360: }
1.19 ! raeburn 1361: if ($currstart < $lastupdate) {
! 1362: $rosterupdated = 1;
1.15 albertel 1363: }
1.19 ! raeburn 1364: if ($autostart < $nextmidnt ) {
! 1365: if ( $autostart >= $lastmidnt) {
! 1366: $firstaccess = "today";
! 1367: } else {
! 1368: $firstaccess = "a date prior to today";
! 1369: }
! 1370: if (($nowstamp >= $autostart) && ($rosterupdated == 0)) {
! 1371: $response .= qq|<br>Although you have now set the first enrollment date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses at 1.30 am $nextupdate. If you wish to immediately enroll registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|;
! 1372: }
! 1373: }
! 1374: $warning = &warning_message($dom,$crs,$action);
! 1375: $warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you set a start and end date for auto-enrollment, additional action is required.<br/>";
! 1376: unless ($warning eq '') {
! 1377: $response .= $warn_prefix.$warning;
! 1378: }
! 1379: }
1.15 albertel 1380: }
1381: &print_reply($r,$response,$$tasktitleref{$action});
1382: return;
1.1 raeburn 1383: }
1384:
1.14 raeburn 1385: sub print_setaccess_response {
1.15 albertel 1386: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1387: my %settings = &Apache::lonnet::get('environment',['default_enrollment_start_date','default_enrollment_end_date','internal.autostart'],$dom,$crs);
1388: my $currstart = $settings{'default_enrollment_start_date'};
1389: my $currend = $settings{'default_enrollment_end_date'};
1390: my $autostart = $settings{'internal.autostart'};
1391: my $response = '';
1392: my ($startaccess,$endaccess) = &get_dates_from_form();
1.19 ! raeburn 1393: if (($startaccess eq '') || ($endaccess eq '')) {
! 1394: $response = "There was a problem processing your requested changes. The default
! 1395: start and end access dates for this course have been left unchanged.<br/>";
! 1396: } elsif (($endaccess > 0) && ($endaccess <= $startaccess)) {
! 1397: $response = 'The default start access date/time you chose was the same or later than the default end access date/time. As this means that roles will never be active, your requested changes have not been processed, and the existing values remain in effect. Please <a href="javascript:history.go(-1)">go back</a> to the previous page to try your changes again.'."\n";
1.15 albertel 1398: } else {
1.19 ! raeburn 1399: my $showstart = &Apache::lonlocal::locallocaltime($startaccess);
! 1400: my $showend = '';
! 1401: my $warning = '';
! 1402: my $warn_prefix = '';
! 1403: if ($endaccess) {
! 1404: $showend = &Apache::lonlocal::locallocaltime($endaccess);
! 1405: } else {
! 1406: $showend = "'No end date'";
! 1407: }
1.15 albertel 1408:
1.19 ! raeburn 1409: my %cenv = ('default_enrollment_start_date' => $startaccess,
1.15 albertel 1410: 'default_enrollment_end_date' => $endaccess);
1.19 ! raeburn 1411: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
! 1412: if ($reply !~ /^ok$/) {
! 1413: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
! 1414: } else {
! 1415: if ($currstart == $startaccess) {
! 1416: $response = "The first access date for students added via automated enrollment has been left unchanged as $showstart.<br/>";
! 1417: } else {
! 1418: $response = "The first access date for students added via automated enrollment has been changed to
1.14 raeburn 1419: $showstart.<br/>";
1.19 ! raeburn 1420: }
! 1421: if ($currend == $endaccess) {
! 1422: $response .= "The last access date for students added via automated enrollment has been left unchanged as $showend.<br/>";
! 1423: } else {
! 1424: $response .= "The last access date for students automated enrollment has been changed to
1.14 raeburn 1425: $showend.<br/>";
1.19 ! raeburn 1426: }
1.15 albertel 1427:
1.14 raeburn 1428: # Generate message in case where old first access date was later than today, but new first access date is now today or earlier.
1.15 albertel 1429:
1.19 ! raeburn 1430: my $accessgiven= 0;
! 1431: my $firstaccess = "";
! 1432: my $nextupdate = "";
! 1433: my $lastupdate = "";
! 1434:
! 1435: my $nowstamp = time;
! 1436: my @date_list=localtime(time);
! 1437: my $cur_year = $date_list[5];
! 1438: my $curday = $date_list[3];
! 1439: my $curmonth = $date_list[4];
! 1440: my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]);
! 1441: my $nextmidnt = 86400 + $lastmidnt;
! 1442:
! 1443: my $todayupdate = timelocal(0,30,1,$date_list[3],$date_list[4],$date_list[5]);
! 1444: my $tomorrowupdate = $todayupdate + 86400;
! 1445: my $lastupdate = $todayupdate - 86400;
! 1446:
! 1447: if ($autostart < $nextmidnt) {
! 1448: if ($nowstamp < $todayupdate) {
! 1449: $nextupdate = "at 1.30 am today";
! 1450: } else {
! 1451: $nextupdate = "at 1.30 am tomorrow";
! 1452: }
1.15 albertel 1453: } else {
1.19 ! raeburn 1454: my @enrollstart = localtime($autostart);
! 1455: $nextupdate = timelocal(0,30,1,$enrollstart[3],$enrollstart[4],$enrollstart[5]);
! 1456: unless (($enrollstart[2] < 1) || ($enrollstart[2] == 1 && $enrollstart[1] <=30)) {
! 1457: $nextupdate += 86400;
! 1458: }
! 1459: $nextupdate = &Apache::lonlocal::locallocaltime($nextupdate);
! 1460: }
! 1461: if (($currstart < $lastupdate) && ($autostart < $lastupdate)) {
! 1462: $accessgiven = 1;
! 1463: }
! 1464: if ($startaccess < $nextmidnt ) {
! 1465: if ( $startaccess >= $lastmidnt) {
! 1466: $firstaccess = "today";
! 1467: } else {
! 1468: $firstaccess = "a date prior to today";
! 1469: }
! 1470: if (($nowstamp >= $startaccess) && ($accessgiven == 0)) {
! 1471: $response .= qq|<br>Although you have now set the first access date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses $nextupdate. If you wish to grant immediate course access for registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|;
! 1472: }
1.15 albertel 1473: }
1.19 ! raeburn 1474: $warning = &warning_message($dom,$crs,$action);
! 1475: $warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have set default first and last access dates for students who are added via automatic enrollment, additional action is required.<br/>";
! 1476: unless ($warning eq '') {
! 1477: $response .= $warn_prefix.$warning;
1.15 albertel 1478: }
1.19 ! raeburn 1479: }
1.15 albertel 1480: }
1481: &print_reply($r,$response,$$tasktitleref{$action});
1482: return;
1.14 raeburn 1483: }
1484:
1.1 raeburn 1485: sub print_notify_response {
1.15 albertel 1486: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1.1 raeburn 1487:
1488: # Get current settings
1.15 albertel 1489: my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs);
1490: my $notifylist = $settings{'internal.notifylist'};
1491: my $coursecode = $settings{'internal.coursecode'};
1492: my @currpeople = ();
1493: my $notify = 0;
1494: my @people = ();
1495: my $peoplestr = "";
1496: my $response = "";
1497: my $noprocess = 0;
1.1 raeburn 1498:
1.15 albertel 1499: if ($notifylist =~ m/,/) {
1500: @currpeople = split/,/,$notifylist;
1501: } else {
1502: $currpeople[0] = $notifylist;
1503: }
1504: my $currcount = 0;
1505: foreach (@currpeople) {
1506: unless ($_ eq '') { $currcount ++; }
1507: }
1508:
1509: if ( exists($ENV{'form.notify'}) ) {
1510: $notify=$ENV{'form.notify'};
1511: }
1512: if ( exists($ENV{'form.notifyshow'}) ) {
1513: my $notifyshow = $ENV{'form.notifyshow'};
1514: for (my $i=0; $i<$notifyshow; $i++) {
1515: if ( exists($ENV{"form.note_$i"}) ) {
1516: if ( exists($ENV{"form.notifyname_$i"}) ) {
1517: unless ( $ENV{"form.notifyname_$i"} eq '' ) {
1518: push @people, $ENV{"form.notifyname_$i"};
1519: }
1520: }
1521: }
1522: }
1523: if ($notify) { $peoplestr = join(",",@people); }
1524: } else {
1525: if ($notify) {
1526: if ($currcount) {
1527: $response = "There was a problem retrieving the updated list of recipients of notification messages. The notification settings for this course have been left unchanged.<br/>.";
1528: $peoplestr = $notifylist;
1529: @people = @currpeople;
1530: $noprocess = 1;
1531: }
1532: }
1533: }
1534: unless ($noprocess == 1) {
1535: my %cenv = ('internal.notifylist' => $peoplestr);
1536: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
1537: if ($reply !~ /^ok$/) {
1538: $response = "There was a problem processing your requested changes. The notification settings for this course have been left unchanged.<br/>";
1539: } else {
1540: if ($notify) {
1541: if (@people) {
1542: if ($currcount) {
1543: $response .= "Notification of enrollment changes still <b>enabled</b><br/>";
1544: } else {
1545: $response .= "Notification of enrollment changes now <b>enabled</b><br/>";
1546: }
1547: $response .= "<br/>The following will receive notification if there are any changes in enrollment in LON-CAPA course: $realm ($coursecode) as a result of the nightly enrollment check: <br/><ul>\n";
1548: foreach my $person (@people) {
1549: $response .= "<li>$person</li>\n";
1550: }
1551: $response .= "</ul>\n";
1552: } else {
1553: $response = "Notification of enrollment changes was <b> not enabled</b> as no course coordinators were selected as recipients.<br/>";
1554: }
1555: } else {
1556: if ($currcount) {
1557: $response = "Notification of enrollment changes now <b>disabled</b><br/>";
1558: } else {
1559: $response = "Notification of enrollment changes still <b>disabled</b><br/>";
1560: }
1561: }
1562: }
1563: }
1564: &print_reply($r,$response,$$tasktitleref{$action});
1565: return;
1.1 raeburn 1566: }
1567:
1568: sub print_crosslistings_menu () {
1.15 albertel 1569: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1570: my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode'],$dom,$crs);
1571: my @currxlists = ();
1572: my @xlists = ();
1573: my $crosscount = 0;
1574: my $removecount = 0;
1575: my $xliststr = '';
1576: my $response = '';
1577: my $coursecode = $settings{'internal.coursecode'};
1578: if ($settings{'internal.crosslistings'} =~ m/,/) {
1579: @currxlists = split/,/,$settings{'internal.crosslistings'};
1580: } elsif ($settings{'internal.crosslistings'} ne '') {
1581: $currxlists[0] = $settings{'internal.crosslistings'};
1582: }
1583:
1584: if (@currxlists > 0) {
1585: for (my $i=0; $i<@currxlists; $i++) {
1586: my $xlist = "cross_".$i;
1587: my $gp = "gp_".$i;
1588: if ( exists($ENV{"form.$xlist"}) ) {
1589: my $xlistentry = '';
1590: if ($currxlists[$i] =~ m/^([^:]+)/) {
1591: $xlistentry = $1.':';
1592: }
1593: if ( exists($ENV{"form.$gp"}) ) {
1594: $xlistentry .= $ENV{"form.$gp"};
1595: }
1596: push @xlists,$xlistentry;
1597: $crosscount ++;
1598: } else {
1599: $removecount ++;
1600: }
1601: }
1602: }
1.1 raeburn 1603:
1.15 albertel 1604: if ($crosscount > 1) {
1605: $xliststr = join(",",@xlists);
1606: } else {
1607: $xliststr = $xlists[0];
1608: }
1609: my %cenv = ('internal.crosslistings' => $xliststr);
1610: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
1611: if ($reply !~ /^ok$/) {
1612: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
1613: } else {
1614: if ($removecount > 0) {
1615: $response = "A total of $removecount courses are no longer crosslisted with LON-CAPA course: $realm ($coursecode).<br/><br/>";
1616: }
1617: if ($crosscount > 0) {
1618: $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";
1619: foreach (@xlists) {
1620: my ($xlist,$gp) = split/:/,$_;
1621: $response .= "<li>$xlist - ID: $gp</li>\n";
1622: }
1623: $response .= "</ul><br/>\n";
1624: }
1625: }
1626: if ( exists($ENV{'form.numcross'}) ) {
1627: my $numcross = $ENV{'form.numcross'};
1628: if ($numcross > 0) {
1629: my @bgcolors=("#eeeeee","#cccccc");
1630: $response .= qq(You indicated that you wish to add an additional $numcross crosslisting(s). For each new crosslisting enter the insititutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in the crosslisted course section. The LON-CAPA section/group ID can be left blank, if you do not wish to tie a section/group ID to this crosslisting. The institutional course section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course codes (and section numbers) to your institution\'s student information system.<br/><br/>
1.1 raeburn 1631: <form name="enter" method="post">
1632: <table border="0" cellpadding="2" cellspacing="2" width="100%">
1633: <tr>
1634: <td>
1635: <table border="0" cellspacing="3" cellpadding="3">
1636: <tr bgcolor="#CCCCFF" align="left">
1637: <td><b>Crosslisting</b></td>
1638: <td><b>LON-CAPA section/groupID</b></td>
1639: </tr>
1.15 albertel 1640: );
1641: for (my $i=0; $i<$numcross; $i++) {
1642: my $colflag = $i%2;
1643: $response .= qq(
1.1 raeburn 1644: <tr bgcolor="$bgcolors[$colflag]" align="left">
1645: <td><input type="text" size="15" name="newcross_$i" /></td>
1646: <td><input type="text" size="10" name="newgroupid_$i" /></td>
1647: </tr>
1.15 albertel 1648: );
1649: }
1650: $response .= qq( </table>
1.1 raeburn 1651: </td>
1652: </tr>
1653: <tr>
1654: <td align="right">
1655: <input type="button" name="newcross" value="Go" onClick="process('newcross')" />
1656: </td>
1657: </tr>
1658: </table>
1659: <input type=\"hidden\" name=\"numcross\" value=\"$numcross\">
1660: <input type=\"hidden\" name=\"action\" value=\"newcross\">
1661: <input type=\"hidden\" name=\"state\" value=\"process\">
1662: </form>
1.15 albertel 1663: );
1664: }
1665: }
1666: &print_reply($r,$response,$$tasktitleref{$action});
1667: return;
1.1 raeburn 1668: }
1669:
1670: sub print_crosslistings_response () {
1.15 albertel 1671: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1672: my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner'],$dom,$crs);
1673: my @currxlists = ();
1674: my @xlists = ();
1675: my @allxlists = ();
1676: my @badxlists = ();
1677: my @badowner = ();
1678: my $numcross = 0;
1679: my $xliststr = $settings{'internal.crosslistings'};
1680: my $coursecode = $settings{'internal.coursecode'};
1681: my $owner = $settings{'internal.courseowner'};
1682: my $response = '';
1683: my $warning = '';
1684: my $warn_prefix = '';
1.1 raeburn 1685:
1.15 albertel 1686: if ($xliststr =~ m/,/) {
1687: @allxlists = split/,/,$xliststr;
1688: } else {
1689: unless ($xliststr eq '') { $allxlists[0] = $xliststr; }
1690: }
1.1 raeburn 1691:
1.15 albertel 1692: if ( exists($ENV{'form.numcross'}) ) {
1693: $numcross = $ENV{'form.numcross'};
1694: }
1.1 raeburn 1695:
1.15 albertel 1696: if ($numcross > 0) {
1697: for (my $i=0; $i<$numcross; $i++) {
1698: my $xl = "newcross_".$i;
1699: my $gp = "newgroupid_".$i;
1700: if ( exists($ENV{"form.$xl"}) ) {
1701: my $coursecheck = '';
1702: $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$ENV{"form.$xl"});
1703: if ($coursecheck eq 'ok') {
1704: my $addcheck = '';
1705: $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$ENV{"form.$xl"},$owner);
1706: if ($addcheck eq 'ok') {
1707: push @xlists,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
1708: } else {
1709: push @badowner,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
1710: }
1711: } else {
1712: push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"}.":".$coursecheck;
1713: }
1714: }
1715: }
1716: push @allxlists, @xlists;
1717: }
1718:
1719: if (@xlists > 0 ) {
1720: unless ($xliststr eq '') { $xliststr .= ","; }
1721: if (@xlists > 1) {
1722: $xliststr .= join(",",@xlists);
1723: } else {
1724: $xliststr .= $xlists[0];
1725: }
1726: my %cenv = ('internal.crosslistings' => $xliststr);
1727: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
1728: if ($reply !~ /^ok$/) {
1729: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>";
1730: } else {
1731: $response = "The courses listed below are now 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";
1732: foreach (@allxlists) {
1733: my ($xlist,$gp) = split/:/,$_;
1734: $response .= "<li>$xlist - ID: $gp</li>\n";
1735: }
1736: $response .= "</ul><br/><br/>\n";
1737: }
1738: } else {
1739: if ($xliststr =~ m/:/) {
1740: my @oldxlists = ();
1741: if ($xliststr =~ m/,/) {
1742: @oldxlists = split/,/,$xliststr;
1743: } else {
1744: $oldxlists[0] = $xliststr;
1745: }
1746: $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n";
1747: foreach (@oldxlists) {
1748: my ($xlist,$gp) = split/:/,$_;
1749: $response .= "<li>$xlist - ID: $gp</li>\n";
1750: }
1751: $response .= "</ul><br/><br/>\n";
1752: }
1753: }
1754: if (@badxlists > 0) {
1755: $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";
1756: foreach (@badxlists) {
1757: my ($xlist,$gp,$prob) = split/:/,$_;
1758: $response .= "<li>$xlist - ID: $gp - Error: $prob</li>\n";
1759: }
1760: $response .= "</ul><br/><br/>\n";
1761: }
1762:
1763: if (@badowner > 0) {
1764: $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";
1765: foreach (@badowner) {
1766: my ($xlist,$gp) = split/:/,$_;
1767: $response .= "<li>$xlist - ID: $gp</li>\n";
1768: }
1769: $response .= "</ul><br/><br/>\n";
1770: }
1.5 raeburn 1771:
1.15 albertel 1772: if (@allxlists > 0) {
1773: $warning = &warning_message($dom,$crs,$action);
1774: $warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected crosslisted courses to contribute enrollment to this course, additional action is required.<br/>";
1775: unless ($warning eq '') {
1776: $response .= $warn_prefix.$warning;
1777: }
1778: }
1.1 raeburn 1779:
1.15 albertel 1780: &print_reply($r,$response,$$tasktitleref{$action});
1781: return;
1.1 raeburn 1782: }
1783:
1784: sub print_sections_menu () {
1.15 albertel 1785: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1786: my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs);
1787: my @currsections = ();
1788: my @sections = ();
1789: my @badowner = ();
1790: my @badsections = ();
1791: my $seccount = 0;
1792: my $removecount = 0;
1793: my $addcount = 0;
1794: my $secstr = '';
1795: my $response = '';
1796: my $warning = "";
1797: my $warn_prefix = "";
1798: my $coursecode = $settings{'internal.coursecode'};
1799: my $owner = $settings{'internal.courseowner'};
1800: if ($settings{'internal.sectionnums'} =~ m/,/) {
1801: @currsections = split/,/,$settings{'internal.sectionnums'};
1802: } elsif ($settings{'internal.sectionnums'} ne '') {
1803: $currsections[0] = $settings{'internal.sectionnums'};
1804: }
1805:
1806: if ( exists($ENV{'form.secshow'}) ) {
1807: for (my $i=0; $i<$ENV{'form.secshow'}; $i++) {
1808: my $gp = "loncapasec_".$i;
1809: my $secnum = "secnum_".$i;
1810: my $sec = "sec_".$i;
1811: if ( exists( $ENV{"form.$sec"} ) ) {
1812: my $secentry;
1813: if ( exists( $ENV{"form.$secnum"} ) ) {
1814: $secentry = $ENV{"form.$secnum"}.':';
1815: }
1816: if ( exists( $ENV{"form.$gp"} ) ) {
1817: $secentry .= $ENV{"form.$gp"};
1818: }
1819: if ( grep/^$ENV{"form.$secnum"}:/,@currsections) {
1820: push @sections, $secentry;
1821: $seccount ++;
1822: } else {
1823: my $newsec = $coursecode.$ENV{"form.$secnum"};
1824: my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
1825: if ($coursecheck eq 'ok') {
1826: my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner);
1827: if ($addcheck eq 'ok') {
1828: push @sections,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"};
1829: $seccount ++;
1830: $addcount ++;
1831: } else {
1832: push @badowner,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"};
1833: }
1834: } else {
1835: push @badsections, $ENV{"form.$secnum"}.":".$ENV{"form.$gp"}.":".$coursecheck;
1836: }
1837: }
1838: }
1839: }
1840: if (@currsections > 0) {
1841: for (my $i=0; $i<@currsections; $i++) {
1842: if ($currsections[$i] =~ m/^(\w+:)/ ) {
1843: my $oldsec = $1;
1844: unless (grep/^$oldsec/,@sections) {
1845: $removecount ++;
1846: }
1847: }
1848: }
1849: }
1850: } elsif (@currsections > 0) {
1851: for (my $i=0; $i<@currsections; $i++) {
1852: my $sec = "sec_".$i;
1853: my $gp = "secgp_".$i;
1854: if ( exists($ENV{"form.$sec"}) ) {
1855: my $secentry = '';
1856: if ($currsections[$i] =~ m/^(\w+:)/ ) {
1857: $secentry = $1;
1858: }
1859: if ( exists($ENV{"form.$gp"}) ) {
1860: $secentry .= $ENV{"form.$gp"};
1861: }
1862: push @sections,$secentry;
1863: $seccount ++;
1864: } else {
1865: $removecount ++;
1866: }
1867: }
1868: }
1869:
1870: if ($seccount > 1) {
1871: $secstr = join(",",@sections);
1872: } else {
1873: $secstr = $sections[0];
1874: }
1875: my %cenv = ('internal.sectionnums' => $secstr);
1876: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
1877: if ($reply !~ /^ok$/) {
1878: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
1879: } else {
1880: if ($removecount > 0) {
1881: $response = "A total of $removecount sections have been removed from the list of sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>";
1882: }
1883: if ($addcount > 0) {
1884: $response .= "A total of $addcount sections have been added to the list of
1.6 raeburn 1885: sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>";
1.15 albertel 1886: }
1887: if ($seccount > 0) {
1888: $response .= "Students enrolling in the $seccount section(s) listed below 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";
1889: foreach (@sections) {
1890: my ($sec,$gp) = split/:/,$_;
1891: $response .= "<li>$sec - ID: $gp</li>\n";
1892: }
1893: $response .= "</ul><br/>\n";
1894: }
1895: }
1896:
1897: if (@badsections > 0) {
1898: $response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n";
1899: foreach (@badsections) {
1900: my ($secnum,$gp,$prob) = split/:/,$_;
1901: $response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n";
1902: }
1903: $response .= "</ul><br/><br/>\n";
1904: }
1905:
1906: if (@badowner > 0) {
1907: $response .= "The sections listed below could not be included in the sections 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";
1908: foreach (@badowner) {
1909: my ($secnum,$gp) = split/:/,$_;
1910: $response .= "<li>$secnum - ID: $gp</li>\n";
1911: }
1912: $response .= "</ul><br/><br/>\n";
1913: }
1914:
1915: if ($seccount > 0) {
1916: $warning = &warning_message($dom,$crs,$action);
1917: $warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected sections to contribute enrollment to this course, additional action is required.<br/>";
1918: unless ($warning eq '') {
1919: $response .= $warn_prefix.$warning;
1920: }
1921: }
1922:
1923: if ( exists($ENV{'form.numsec'}) ) {
1924: my $numsec = $ENV{'form.numsec'};
1925: if ($numsec > 0) {
1926: my @bgcolors=("#eeeeee","#cccccc");
1927: $response .= qq(
1928: You indicated that you wish to incorporate student enrollment in your LON-CAPA course from an additional $numsec section(s). For each new section enter the insititutional section code (e.g., 004), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in this particular section. The LON-CAPA section/group ID can be left blank, if you do not wish to designate a section/group ID for this course section. The institutional section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course section numbers to your institution\'s student information system.<br/><br/>
1.1 raeburn 1929: <form name="enter" method="post">
1930: <table border="0" cellpadding="2" cellspacing="2" width="100%">
1931: <tr>
1932: <td>
1933: <table border="0" cellspacing="3" cellpadding="3">
1934: <tr bgcolor="#CCCCFF" align="left">
1935: <td><b>Section number</b></td>
1936: <td><b>LON-CAPA section/groupID</b></td>
1937: </tr>
1.15 albertel 1938: );
1939: for (my $i=0; $i<$numsec; $i++) {
1940: my $colflag = $i%2;
1941: $response .= qq(
1.1 raeburn 1942: <tr bgcolor="$bgcolors[$colflag]" align="left">
1943: <td><input type="text" size="15" name="newsec_$i" /></td>
1944: <td><input type="text" size="10" name="newsecgp_$i" /></td>
1945: </tr>
1.15 albertel 1946: );
1947: }
1948: $response .= qq( </table>
1.1 raeburn 1949: </td>
1950: </tr>
1951: <tr>
1952: <td align="right">
1953: <input type="button" name="newsections" value="Go" onClick="process('newsections')" />
1954: </td>
1955: </tr>
1956: </table>
1957: <input type=\"hidden\" name=\"numsec\" value=\"$numsec\">
1958: <input type=\"hidden\" name=\"action\" value=\"newsections\">
1959: <input type=\"hidden\" name=\"state\" value=\"process\">
1960: </form>
1.15 albertel 1961: );
1962: }
1963: }
1964: &print_reply($r,$response,$$tasktitleref{$action});
1965: return;
1.1 raeburn 1966: }
1967:
1968: sub print_sections_response () {
1.15 albertel 1969: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1970: my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs);
1971: my @currsections = ();
1972: my @sections = ();
1973: my @allsections = ();
1974: my @badowner = ();
1975: my @badsections = ();
1976: my $numsec = 0;
1977: my $secstr = $settings{'internal.sectionnums'};
1978: my $coursecode = $settings{'internal.coursecode'};
1979: my $owner = $settings{'internal.courseowner'};
1980: my $response = '';
1981: my $putreply = '';
1982: my $warning = '';
1983: my $warn_prefix = '';
1984: if ($secstr =~ m/,/) {
1985: @allsections = split/,/,$secstr;
1986: } else {
1987: unless ($secstr eq '') { $allsections[0] = $secstr; }
1988: }
1989:
1990: if ( exists($ENV{'form.numsec'}) ) {
1991: $numsec = $ENV{'form.numsec'};
1992: }
1993:
1994: if ($numsec > 0) {
1995: for (my $i=0; $i<$numsec; $i++) {
1996: my $sec = "newsec_".$i;
1997: my $gp = "newsecgp_".$i;
1998: if ( exists($ENV{"form.$sec"}) ) {
1999: unless ( (grep/^$ENV{"form.$sec"}:/,@allsections) || (grep/^$ENV{"form.$sec"}:/,@sections) ) {
2000: my $newsec = $coursecode.$ENV{"form.$sec"};
2001: my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
2002: if ($coursecheck eq 'ok') {
2003: my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner);
2004: if ($addcheck eq 'ok') {
2005: push @sections,$ENV{"form.$sec"}.":".$ENV{"form.$gp"};
2006: } else {
2007: push @badowner,$ENV{"form.$sec"}.":".$ENV{"form.$gp"};
2008: }
2009: } else {
2010: push @badsections, $ENV{"form.$sec"}.":".$ENV{"form.$gp"}.":".$coursecheck;
2011: }
2012: }
2013: }
2014: }
2015: push @allsections, @sections;
2016: }
2017:
2018: if (@sections > 0 ) {
2019: unless ($secstr eq '') { $secstr .= ","; }
2020: if (@sections > 1) {
2021: $secstr .= join(",",@sections);
2022: } else {
2023: $secstr .= $sections[0];
2024: }
2025: my %cenv = ('internal.sectionnums' => $secstr);
2026: $putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
2027: if ($putreply !~ /^ok$/) {
2028: $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>";
2029: }
2030: }
2031:
2032: if ($putreply =~ /^ok/) {
2033: $response = "Students enrolling in the sections listed below will be automatically added to the class roster for LON-CAPA course $realm ($coursecode), if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n";
2034: foreach (@allsections) {
2035: my ($sec,$gp) = split/:/,$_;
2036: $response .= "<li>$sec - ID: $gp</li>\n";
2037: }
2038: $response .= "</ul><br/><br/>\n";
2039: }
2040:
2041: if (@badsections > 0) {
2042: $response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n";
2043: foreach (@badsections) {
2044: my ($secnum,$gp,$prob) = split/:/,$_;
2045: $response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n";
2046: }
2047: $response .= "</ul><br/><br/>\n";
2048: }
2049:
2050: if (@badowner > 0) {
2051: $response .= "The sections listed below could not be included in the sections 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";
2052: foreach (@badowner) {
2053: my ($secnum,$gp) = split/:/,$_;
2054: $response .= "<li>$secnum - ID: $gp</li>\n";
2055: }
2056: $response .= "</ul><br/><br/>\n";
2057: }
2058:
2059: if (@allsections > 0) {
2060: $warning = &warning_message($dom,$crs,$action);
2061: $warn_prefix = "<br/><font size ='+1'><b>Warning</b></font>. Although you have selected sections to contribute enrollment to this course, additional action is required.<br/>";
2062: unless ($warning eq '') {
2063: $response .= $warn_prefix.$warning;
2064: }
2065: }
1.1 raeburn 2066:
1.15 albertel 2067: &print_reply($r,$response,$$tasktitleref{$action});
2068: return;
1.1 raeburn 2069: }
2070:
2071: sub print_photos_response () {
1.15 albertel 2072: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
2073: my %settings = &Apache::lonnet::get('environment',['internal.showphotos'],$dom,$crs);
2074: my $currphotos = $settings{'internal.showphotos'};
2075: my $showphotos = '';
2076: if ( exists($ENV{'form.showphotos'}) ) {
2077: $showphotos=$ENV{'form.showphotos'};
2078: }
2079:
2080: my $response = "";
2081: my %cenv = ('internal.showphotos' => $showphotos);
2082: my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
2083: if ($reply !~ /^ok$/) {
2084: $response = "There was a problem processing your requested change. The student photo import setting for this course has been left unchanged.<br/>";
2085: } else {
2086: if ($showphotos) {
2087: if ($currphotos) {
2088: $response = "Retrieval of student photos is still <b>enabled</b><br/>";
2089: } else {
2090: $response = "Retrieval of student photos in now <b>enabled</b><br/>";
2091: }
2092: } else {
2093: if ($currphotos) {
2094: $response = "Retrieval of student photos is now <b>disabled</b><br/>";
2095: } else {
2096: $response = "Retrieval of student photos is still <b>disabled</b><br/>";
2097: }
2098: }
2099: }
2100: &print_reply($r,$response,$$tasktitleref{$action});
2101: return;
1.1 raeburn 2102: }
2103:
2104: sub print_update_result () {
1.15 albertel 2105: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
2106: my $response = '';
2107: my $updateadds = 0;
2108: my $updatedrops = 0;
2109: my $changecount = 0;
2110: my %affiliates = ();
2111: my %reply = ();
2112: my @allcourses = ();
2113: my %LC_code = ();
2114: my $logmsg = '';
2115: my $newusermsg = '';
2116:
2117: my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg'],$dom,$crs);
2118: my $coursecode = $settings{'internal.coursecode'};
2119: my $authtype = $settings{'internal.authtype'};
2120: my $autharg = $settings{'internal.autharg'};
2121: my ($startaccess,$endaccess) = &get_dates_from_form();
2122: if ( exists($ENV{'form.updateadds'}) ) {
1.19 ! raeburn 2123: $updateadds = $ENV{'form.updateadds'};
1.15 albertel 2124: }
2125: if ( exists($ENV{'form.updatedrops'}) ) {
1.19 ! raeburn 2126: $updatedrops = $ENV{'form.updatedrops'};
1.15 albertel 2127: }
1.19 ! raeburn 2128: if (($startaccess eq '') || ($endaccess eq '')) {
! 2129: $response = "There was a problem processing your requested roster update because start and and access dates could not be determined. No changes have been made to the class roster.<br />";
! 2130: } elsif ($updateadds && (($endaccess > 0) && ($endaccess <= $startaccess))) {
! 2131: $response = 'The start access date/time is the same or later than the end access date/time. As this means that new roles will never be active, your requested roster update has not been carried out, and the roster remains unchanged. Please <a href="javascript:history.go(-1)">go back</a> to the previous page to try your changes again.'."\n";
! 2132: } elsif (!$updateadds && !$updatedrops) {
1.15 albertel 2133: $response = "An update of the class roster has not been carried out because you indicated that you wanted to neither add new students, nor expire dropped students based on a comparison between the institutional class lists for the course sections and crosslisted courses that contribure enrollment to this LON-CAPA course.";
2134: } elsif ($coursecode eq '') {
2135: $response = "There was a problem retrieving the course code for this LON-CAPA course. An update of the class roster has not been carried out, and enrollment remains unchanged";
2136: } else {
1.1 raeburn 2137: # Get complete list of course sections to update
1.15 albertel 2138: my @currsections = ();
2139: my @currxlists = ();
2140:
2141: if ($settings{'internal.sectionnums'} =~ m/,/) {
2142: @currsections = split/,/,$settings{'internal.sectionnums'};
2143: } elsif ($settings{'internal.sectionnums'} ne '') {
2144: $currsections[0] = $settings{'internal.sectionnums'};
2145: }
2146:
2147: if ($settings{'internal.crosslistings'} =~ m/,/) {
2148: @currxlists = split/,/,$settings{'internal.crosslistings'};
2149: } elsif ($settings{'internal.crosslistings'} ne '') {
2150: $currxlists[0] = $settings{'internal.crosslistings'};
2151: }
2152:
2153: if (@currxlists > 0) {
2154: foreach (@currxlists) {
2155: if (m/^(\w+):(\w*)$/) {
2156: unless (grep/^$1$/,@allcourses) {
2157: push @allcourses,$1;
2158: $LC_code{$1} = $2;
2159: }
2160: }
2161: }
2162: }
2163:
2164: if (@currsections > 0) {
2165: foreach (@currsections) {
2166: if (m/^(\w+):(\w*)$/) {
2167: my $sec = $coursecode.$1;
2168: my $gp = $2;
2169: unless (grep/^$sec$/,@allcourses) {
2170: push @allcourses,$sec;
2171: $LC_code{$sec} = $gp;
2172: }
2173: }
2174: }
2175: }
2176:
2177: if (@allcourses > 0) {
2178: @{$affiliates{$crs}} = @allcourses;
2179: my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs);
1.19 ! raeburn 2180: unless ($outcome eq 'ok') {
! 2181: &Apache::lonnet::logthis("lonpopulate:update roster".
! 2182: "failed to retrieve classlist".
! 2183: " data for ".$crs."\@".$dom." by ".
! 2184: $ENV{'user.name'}." \@ ".$ENV{'user.domain'}.
! 2185: ": ".$outcome);
! 2186: }
1.15 albertel 2187: if ($reply{$crs} > 0) {
2188: ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow");
2189: } else {
2190: $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.";
2191: }
2192: } else {
2193: $response = "There are currently no course sections or crosslisted courses designated as contributors to enrollment in this LON-CAPA course. As a result a student roster update has not been carried out for $realm ($coursecode)";
2194: }
2195: }
2196: unless ($logmsg eq '') {
2197: my $loglength = length($logmsg);
2198: $logmsg = substr($logmsg,0,$loglength-4);
2199: $logmsg = "<br/><br/>The following messages were generated by the roster update process: <br/><ul><li>".$logmsg."</ul><br/>";
2200: }
2201: unless ($newusermsg eq '') {
2202: $newusermsg = substr( $newusermsg,0,rindex($newusermsg,'<li>') );
1.19 ! raeburn 2203: $newusermsg = "<br/><br/>The following new system user(s) who was/were created will be using local or 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/>";
1.15 albertel 2204: }
2205: $response .= $logmsg.$newusermsg;
2206: &print_reply($r,$response,$$tasktitleref{$action});
2207: return;
1.10 raeburn 2208: }
2209:
1.14 raeburn 2210: sub print_viewclass_response {
2211: my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
2212: my $response;
2213: my $chgtotal = 0;
2214: my $chgok = 0;
2215: my $chgfail = 0;
2216: my $othdom = 0;
1.16 raeburn 2217: my $locktotal = 0;
2218: my $lockok = 0;
2219: my $lockfail = 0;
1.14 raeburn 2220: my $cid = $dom."_".$crs;
2221: my %chg = ();
2222: my %nochg = ();
2223: my %otherdom = ();
1.16 raeburn 2224: my %lockchg = ();
2225: my %nolockchg = ();
1.14 raeburn 2226: my $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
2227: my $endidx = &Apache::loncoursedata::CL_END;
2228: my $startidx = &Apache::loncoursedata::CL_START;
2229: my $ididx=&Apache::loncoursedata::CL_ID;
2230: my $secidx=&Apache::loncoursedata::CL_SECTION;
2231: my $typeidx=&Apache::loncoursedata::CL_TYPE;
1.16 raeburn 2232: my $lockedidx=&Apache::loncoursedata::CL_LOCKEDTYPE;
2233: my @typechglist = ();
2234: my @lockchglist = ();
2235: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chgauto','chgmanual','lockchg','unlockchg']);
2236: if ($ENV{'form.chgauto'}) {
2237: if (ref($ENV{'form.chgauto'}) eq 'ARRAY') {
2238: push @typechglist, @{$ENV{'form.chgauto'}};
2239: } else {
2240: push @typechglist, $ENV{'form.chgauto'};
2241: }
2242: }
2243: if ($ENV{'form.chgmanual'}) {
2244: if (ref($ENV{'form.chgmanual'}) eq 'ARRAY') {
2245: push @typechglist, @{$ENV{'form.chgmanual'}};
2246: } else {
2247: push @typechglist, $ENV{'form.chgmanual'};
2248: }
2249: }
2250: if ($ENV{'form.lockchg'}) {
2251: if (ref($ENV{'form.lockchg'}) eq 'ARRAY') {
2252: push @lockchglist, @{$ENV{'form.lockchg'}};
2253: } else {
2254: push @lockchglist, $ENV{'form.lockchg'};
2255: }
2256: }
2257: if ($ENV{'form.unlockchg'}) {
2258: if (ref($ENV{'form.unlockchg'}) eq 'ARRAY') {
2259: push @lockchglist, @{$ENV{'form.unlockchg'}};
2260: } else {
2261: push @lockchglist, $ENV{'form.unlockchg'};
2262: }
2263: }
2264: foreach my $student (sort @typechglist) {
2265: my ($uname,$udom) = split/:/,$student;
2266: my $sdata = $classlist->{$student};
2267: my $section = $sdata->[$secidx];
2268: my $uid = $sdata->[$ididx];
2269: my $start = $sdata->[$startidx];
2270: my $end = $sdata->[$endidx];
2271: my $type = $sdata->[$typeidx];
2272: my $lock = $sdata->[$lockedidx];
2273: my $newlock = $lock;
2274: $chgtotal ++;
2275: my $newtype = 'auto';
2276: my $change = 'auto';
2277: my $oldtype = 'manual';
2278: if ($type eq 'auto') {
2279: $oldtype = 'auto';
2280: $newtype = '';
2281: $change = 'manual';
2282: }
2283: if ($udom eq $dom) {
2284: if ($newtype eq 'auto') {
2285: $newlock = '';
2286: } elsif ($newtype eq '') {
2287: $newlock = '1';
1.14 raeburn 2288: }
1.16 raeburn 2289: my $modreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$newtype,$newlock,$cid);
2290: if ($modreply eq 'ok') {
2291: $chgok ++;
2292: $chg{$student} = "Changed to $change";
2293: } else {
2294: $chgfail ++;
2295: $nochg{$student} = "Still set to $oldtype";
2296: }
2297: } else {
2298: $othdom ++;
2299: $otherdom{$student} = "Still set to $oldtype";
2300: }
2301: }
2302: foreach my $student (@lockchglist) {
2303: my ($uname,$udom) = split/:/,$student;
2304: my $sdata = $classlist->{$student};
2305: my $section = $sdata->[$secidx];
2306: my $uid = $sdata->[$ididx];
2307: my $start = $sdata->[$startidx];
2308: my $end = $sdata->[$endidx];
2309: my $type = $sdata->[$typeidx];
2310: my $lock = $sdata->[$lockedidx];
2311: my $newlock = 1;
2312: my $oldlockname = &mt('unlocked');
2313: my $newlockname = &mt('locked');
2314: $locktotal++;
2315: unless ($type eq 'auto') {
2316: if ($lock) {
2317: $newlock = '';
2318: $newlockname = &mt('unlocked');
2319: $oldlockname = &mt('locked');
2320: }
2321: my $lockreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$type,$newlock,$cid);
2322: if ($lockreply eq 'ok') {
2323: $lockok ++;
2324: $lockchg{$student} = 'Changed to '.$newlockname;
1.14 raeburn 2325: } else {
1.16 raeburn 2326: $lockfail ++;
2327: $nolockchg{$student} = 'Still set to '.$oldlockname;
1.14 raeburn 2328: }
2329: }
2330: }
2331: if ($chgtotal > 0) {
2332: $response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n";
2333: $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
2334: if ($chgok > 0) {
2335: $response .= "The following $chgok changes were successful:<br />";
2336: $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
2337: }
2338: if ($chgfail > 0) {
2339: $response .= "The following $chgfail students were not modified successfully: <br />";
2340: $response .= &enrolltype_result(\%nochg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
2341: }
2342: if ($othdom > 0) {
2343: $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 />";
2344: $response .= &enrolltype_result(\%otherdom,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
2345: }
1.16 raeburn 2346: $response .= "<br /><br />";
2347: }
2348: if ($locktotal > 0) {
2349: $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";
2350: $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);
2351: if ($lockok > 0) {
2352: $response .= "The following $lockok changes were successful:<br />";
2353: $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
2354: }
2355: if ($lockfail > 0) {
2356: $response .= "The following $lockfail students were not modified successfully: <br />";
2357: $response .= &enrolltype_result(\%nolockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
2358: }
1.14 raeburn 2359: }
2360: &print_reply($r,$response,$$tasktitleref{$action});
2361: return;
2362: }
2363:
2364: sub enrolltype_result {
1.16 raeburn 2365: my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx) = @_;
1.14 raeburn 2366: my $reply = "
2367: <table border='2'>
2368: <tr>
2369: <th>username</th>
2370: <th>domain</th>
2371: <th>ID</th>
2372: <th>student name</th>
2373: <th>section</th>
2374: <th>start date</th>
2375: <th>end date</th>
2376: <th>enrollment change</th>
2377: </tr>";
2378: foreach (sort keys %{$changes}) {
2379: my $sdata = $classlist->{$_};
2380: my ($uname,$udom) = split/:/,$_;
2381: my $section = $sdata->[$secidx];
2382: my $uid = $sdata->[$ididx];
2383: my $start = $sdata->[$startidx];
2384: my $end = $sdata->[$endidx];
2385: my $type = $sdata->[$typeidx];
2386: if (! defined($start) || $start == 0) {
2387: $start = &mt('none');
2388: } else {
2389: $start = &Apache::lonlocal::locallocaltime($start);
2390: }
2391: if (! defined($end) || $end == 0) {
2392: $end = &mt('none');
2393: } else {
2394: $end = &Apache::lonlocal::locallocaltime($end);
2395: }
2396: if (!defined($section) || ($section eq '')) {
2397: $section eq ' ';
2398: }
2399: if (!defined($uid) || ($uid eq '')) {
2400: $uid = ' ';
2401: }
2402: $reply .= "
2403: <tr>
2404: <td>$uname</td>
2405: <td>$udom</td>
2406: <td>$uid</td>
2407: <td>".&Apache::loncommon::plainname($uname,$udom)."</td>
2408: <td>$section</td>
2409: <td>$start</td>
2410: <td>$end</td>
2411: <td>$$changes{$_}</td>
2412: </tr>";
2413: }
2414: $reply .= "</table>";
2415: return $reply;
2416: }
2417:
1.10 raeburn 2418: sub warning_message {
2419: my ($dom,$crs,$caller) = @_;
2420: my %settings = &Apache::lonnet::get('environment',['internal.autoadds','internal.autodrops','internal.sectionnums','internal.crosslistings','internal.autostart','internal.autoend'],$dom,$crs);
2421: my $currend = '';
2422: my $currstart = '';
2423: my $currsecs = '';
2424: my $currxlists = '';
2425: my $warning = '';
2426: my $curradds = '';
2427: my $currdrops = '';
2428: if ( defined($settings{'internal.autoadds'}) ) {
2429: $curradds = $settings{'internal.autoadds'};
2430: }
2431: if (defined($settings{'internal.autodrops'}) ) {
2432: $currdrops = $settings{'internal.autodrops'};
2433: }
2434: if ( defined($settings{'internal.autostart'}) ) {
2435: $currstart = $settings{'internal.autostart'};
2436: }
2437: if ( defined($settings{'internal.autoend'}) ) {
2438: $currend = $settings{'internal.autoend'};
2439: }
2440: if ( defined($settings{'internal.sectionnums'}) ) {
2441: $currsecs = $settings{'internal.sectionnums'};
2442: }
2443: if ( defined($settings{'internal.crosslistings'}) ) {
2444: $currxlists = $settings{'internal.crosslistings'}
2445: }
2446: unless ($caller eq 'setdates') {
2447: if ( ($currstart eq '') && ($currend eq '') ) {
2448: $warning = "You <b>must</b> now use <a href='/adm/populate?action=setdates'>Change enrollment dates</a> to set a start date <i>and</i> an end date for the enrollment (or check the 'No end date' checkbox) for the nightly adds process to actually occur.</br></br>";
2449: }
2450: }
2451: unless ( ($caller eq 'sections') || ($caller eq 'crosslist') ) {
2452: if ( ($currsecs eq '') && ($currxlists eq '') ) {
2453: $warning .= "You <b>must</b> now use <a href='/adm/populate?action=sections'>Section settings</a> and/or <a href='/adm/populate?action=crosslist'>Change crosslistings</a> to choose at least one section of the course, or at least one crosslisted course which will contribute enrollment to this LON-CAPA course. At present there are <b>NO</b> sections or crosslisted courses that are affiliated with this course that are set to contribute to the automated enrollment process.<br/><br/>";
2454: }
2455: }
2456: unless ( $caller eq 'chgsettings') {
2457: if ( (!$curradds) && (!$currdrops) ) {
2458: $warning .= "You <b>must</b> now use <a href='/adm/populate?action=chgsettings'>Automated adds/drops</a> to enable automated adds and/or drops if you want automatic enrollment updates to occur in this course.<br/><br/>.";
2459: }
2460: }
2461: return $warning;
1.1 raeburn 2462: }
2463:
2464: sub print_reply () {
2465: my ($r,$response,$caller) = @_;
2466: $r->print("
2467: <br/><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
2468: <tr>
1.14 raeburn 2469: <td align=\"left\"><b>$caller</b> - result<br/><br/>$response</td>
1.1 raeburn 2470: </tr>
2471: </table>
2472: ");
2473: return;
2474: }
2475:
2476: sub setup_date_selectors {
1.14 raeburn 2477: my ($starttime,$endtime,$action) = @_;
1.1 raeburn 2478: if (! defined($starttime)) {
2479: $starttime = time;
1.14 raeburn 2480: if ($action eq 'setdates') {
2481: if (exists($ENV{'course.'.$ENV{'request.course.id'}.
1.1 raeburn 2482: '.default_enrollment_start_date'})) {
1.14 raeburn 2483: $starttime = $ENV{'course.'.$ENV{'request.course.id'}.
1.1 raeburn 2484: '.default_enrollment_start_date'};
1.14 raeburn 2485: }
1.1 raeburn 2486: }
2487: }
2488: if (! defined($endtime)) {
2489: $endtime = time+(6*30*24*60*60); # 6 months from now, approx
1.14 raeburn 2490: if ($action eq 'setdates') {
2491: if (exists($ENV{'course.'.$ENV{'request.course.id'}.
1.1 raeburn 2492: '.default_enrollment_end_date'})) {
1.14 raeburn 2493: $endtime = $ENV{'course.'.$ENV{'request.course.id'}.
1.1 raeburn 2494: '.default_enrollment_end_date'};
1.14 raeburn 2495: }
1.1 raeburn 2496: }
2497: }
2498: my $startdateform = &Apache::lonhtmlcommon::date_setter('enter',
2499: 'startdate',
2500: $starttime);
2501: my $enddateform = &Apache::lonhtmlcommon::date_setter('enter',
2502: 'enddate',
2503: $endtime);
2504: return ($startdateform,$enddateform);
2505: }
2506:
2507: sub get_dates_from_form {
1.14 raeburn 2508: my $startdate;
2509: my $enddate;
2510: $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate');
2511: $enddate = &Apache::lonhtmlcommon::get_date_from_form('enddate');
1.1 raeburn 2512: if ( exists ($ENV{'form.no_end_date'}) ) {
2513: $enddate = 0;
2514: }
2515: return ($startdate,$enddate);
2516: }
2517:
2518: sub date_setting_table {
1.14 raeburn 2519: my ($starttime,$endtime,$action) = @_;
2520: my ($startform,$endform) = &setup_date_selectors($starttime,$endtime,$action);
1.1 raeburn 2521: my $perpetual = '<nobr><input type="checkbox" name="no_end_date"';
1.14 raeburn 2522: if (($action eq 'setdates' && defined($endtime) && $endtime == 0) || (($action eq 'setaccess' || $action eq 'updatenow') && ($endtime eq '' || $endtime == 0)) ) {
1.1 raeburn 2523: $perpetual .= ' checked';
2524: }
2525: $perpetual.= ' />'.' no ending date</nobr>';
2526: my $start_table = '';
2527: $start_table .= "<table>\n";
2528: $start_table .= '<tr><td align="right">Starting Date</td>'.
2529: '<td>'.$startform.'</td>'.
2530: '<td> </td>'."</tr>\n";
2531: $start_table .= "</table>";
2532: my $end_table = '';
2533: $end_table .= "<table>\n";
2534: $end_table .= '<tr><td align="right">Ending Date</td>'.
2535: '<td>'.$endform.'</td>'.
2536: '<td>'.$perpetual.'</td>'."</tr>\n";
2537: $end_table .= "</table>\n";
2538: return ($start_table, $end_table);
2539: }
2540:
2541: ###################################################################
2542: sub handler {
2543: my $r = shift;
2544: if ($r->header_only) {
2545: $r->content_type('text/html');
2546: $r->send_http_header;
2547: return OK;
2548: }
2549: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','state']);
2550: # Needs to be in a course
2551: if (! (($ENV{'request.course.fn'}) && (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'})))) {
2552: # Not in a course, or not allowed to modify parms
2553: $ENV{'user.error.msg'}="/adm/populate:cst:0:0:Cannot drop or add students";
2554: return HTTP_NOT_ACCEPTABLE;
2555: }
2556: # Start page
2557: $r->content_type('text/html');
2558: $r->send_http_header;
2559:
1.14 raeburn 2560: my @tasks = ("information","chgsettings","setdates","setaccess","notify","crosslist","sections","photos","updatenow","viewclass");
1.1 raeburn 2561:
2562: my %tasklong = (
2563: information => "Task information",
2564: chgsettings => "Automated adds/drops",
2565: setdates => "Change enrollment dates",
1.14 raeburn 2566: setaccess => "Change access dates",
1.1 raeburn 2567: notify => "Notification of changes",
2568: crosslist => "Change crosslistings",
2569: sections => "Section settings",
2570: photos => "Student photos",
2571: updatenow => "Update roster now",
2572: newcross => "Add crosslistings",
1.14 raeburn 2573: newsections => "Add sections",
1.16 raeburn 2574: viewclass => "View students and change type",
1.1 raeburn 2575: );
2576:
2577: my %tasktitle = (
2578: chgsettings => "Changes to nightly automated enrollments",
2579: setdates => "Changes to first and/or last automated enrollment dates",
1.14 raeburn 2580: setaccess => "Changes to default start and/or end dates for student access",
1.1 raeburn 2581: notify => "Notification of enrollment changes",
2582: crosslist => "Changes to crosslistings",
2583: sections => "Changes to section settings",
2584: photos => "Automatic import of student photos",
2585: updatenow => "Immediate course roster update",
2586: newcross => "Adding new crosslisted courses",
1.14 raeburn 2587: newsections => "Adding new course sections",
2588: viewclass => "Viewing class roster and enrollment type"
1.1 raeburn 2589: );
2590:
2591: my $realm = '';
2592: if ( exists($ENV{'request.course.id'}) ) {
2593: $realm= $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
2594: }
2595: unless ($realm) { $realm=' '; }
2596: my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
2597: my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
2598:
2599: #
2600: # Main switch on form.action and form.state, as appropriate
2601: #
2602:
2603: my $action = "information";
2604: if ( exists($ENV{'form.action'}) ) {
2605: $action = $ENV{'form.action'};
2606: }
2607: my $state = "choose";
2608:
2609: if ( exists($ENV{'form.state'}) ) {
2610: $state = $ENV{'form.state'};
2611: }
2612:
2613: if ($action eq "information") {
2614: $r->print(&header());
2615: } else {
2616: if ($state eq "choose") {
1.16 raeburn 2617: $r->print(&choose_header($action));
1.1 raeburn 2618: } else {
2619: if ($action eq "crosslist") {
2620: if ( exists($ENV{'form.numcross'}) ) {
2621: if ( $ENV{'form.numcross'} > 0 ) {
1.16 raeburn 2622: $r->print(&choose_header($action));
1.1 raeburn 2623: } else {
2624: $r->print(&header());
2625: }
2626: } else {
2627: $r->print(&header());
2628: }
2629: } elsif ($action eq "sections") {
2630: if ( exists($ENV{'form.numsec'}) ) {
2631: if ( $ENV{'form.numsec'} > 0 ) {
1.16 raeburn 2632: $r->print(&choose_header($action));
1.1 raeburn 2633: } else {
2634: $r->print(&header());
2635: }
2636: } else {
2637: $r->print(&header());
2638: }
2639: } else {
2640: $r->print(&header());
2641: }
2642: }
2643: }
1.12 raeburn 2644:
1.1 raeburn 2645: my $reply = 0;
2646: unless ($state eq "choose") { $reply = 1; }
2647:
2648: &print_mainbox($r,\%tasklong,$realm,$reply);
2649: &print_navmenu($r,\@tasks,\%tasklong);
2650:
2651: if (($state eq "choose") || ($action eq "information")) {
1.13 raeburn 2652: &print_main_frame($r,$realm,$dom,$crs,\%tasktitle);
1.1 raeburn 2653: } elsif ($action eq "chgsettings") {
2654: &print_chgsettings_response($r,$realm,$dom,$crs,$action,\%tasktitle);
2655: } elsif ($action eq "setdates") {
2656: &print_setdates_response($r,$realm,$dom,$crs,$action,\%tasktitle);
1.14 raeburn 2657: } elsif ($action eq "setaccess") {
2658: &print_setaccess_response($r,$realm,$dom,$crs,$action,\%tasktitle);
1.1 raeburn 2659: } elsif ($action eq "notify") {
2660: &print_notify_response($r,$realm,$dom,$crs,$action,\%tasktitle);
2661: } elsif ($action eq "sections") {
1.13 raeburn 2662: &print_sections_menu($r,$realm,$dom,$crs,$action,\%tasktitle);
1.1 raeburn 2663: } elsif ($action eq "crosslist") {
1.13 raeburn 2664: &print_crosslistings_menu($r,$realm,$dom,$crs,$action,\%tasktitle);
1.1 raeburn 2665: } elsif ($action eq "updatenow") {
1.13 raeburn 2666: &print_update_result($r,$realm,$dom,$crs,$action,\%tasktitle);
1.1 raeburn 2667: } elsif ($action eq "photos") {
2668: &print_photos_response($r,$realm,$dom,$crs,$action,\%tasktitle);
2669: } elsif ($action eq "newcross") {
1.13 raeburn 2670: &print_crosslistings_response($r,$realm,$dom,$crs,$action,\%tasktitle);
1.1 raeburn 2671: } elsif ($action eq "newsections") {
1.13 raeburn 2672: &print_sections_response($r,$realm,$dom,$crs,$action,\%tasktitle);
1.14 raeburn 2673: } elsif ($action eq "viewclass") {
2674: &print_viewclass_response($r,$realm,$dom,$crs,$action,\%tasktitle);
1.1 raeburn 2675: }
2676: &print_doc_base($r);
2677: return OK;
2678: }
2679: ###################################################################
2680: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>