Annotation of loncom/interface/loncoursequeueadmin.pm, revision 1.29
1.1 raeburn 1: # The LearningOnline Network
1.19 raeburn 2: # Utilities to administer domain course requests and course self-enroll requests
1.1 raeburn 3: #
1.29 ! golterma 4: # $Id: loncoursequeueadmin.pm,v 1.28 2011/08/26 15:57:56 raeburn Exp $
1.1 raeburn 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: ###
29:
1.23 raeburn 30: =pod
31:
1.1 raeburn 32: =head1 NAME
33:
34: Apache::loncoursequeueadmin.pm
35:
36: =head1 SYNOPSIS
37:
1.14 raeburn 38: Utilities used by domain coordinators to administer queued course creation requests,
39: and by course coordinators for queued self-enrollment requests, and by general
40: users to display their queued self-enrollment requests.
1.1 raeburn 41:
42: This is part of the LearningOnline Network with CAPA project
43: described at http://www.lon-capa.org.
44:
45: =head1 SUBROUTINES
46:
47: =over
48:
49: =item send_selfserve_notification()
50:
51: =item display_queued_requests()
52:
1.23 raeburn 53: =item build_queue_display()
54:
1.1 raeburn 55: =item update_request_queue()
56:
57: =item get_student_counts()
58:
1.13 raeburn 59: =item course_creation()
60:
61: =item build_batchcreatehash()
62:
63: =item can_clone_course()
64:
65: =item get_processtype()
66:
1.14 raeburn 67: =item queued_selfenrollment()
68:
1.23 raeburn 69: =item update_coursereq_status()
70:
71: =item process_official_reqs()
72:
1.1 raeburn 73: =back
74:
75: =cut
76:
77: package Apache::loncoursequeueadmin;
78:
79: use strict;
80: use Apache::lonnet;
81: use Apache::loncommon;
82: use Apache::lonmsg;
83: use Apache::lonlocal;
1.2 raeburn 84: use Apache::lonuserutils;
1.19 raeburn 85: use LONCAPA qw(:DEFAULT :match);
1.1 raeburn 86:
87: sub send_selfserve_notification {
1.2 raeburn 88: my ($notifylist,$textstr,$cid,$contextdesc,$timestamp,$context,$sender,
1.12 raeburn 89: $approvedlist,$rejectedlist,$crstype) = @_;
1.1 raeburn 90: # FIXME locallocaltime needs to be able to take $sender_lh as an argument
91: # so this can be localized to the recipients date display format/time zone
92: $timestamp =&Apache::lonlocal::locallocaltime($timestamp);
1.26 raeburn 93: my ($msgcc,$rawsubj,@rawmsg,$subject,$message,$reviewer,$msgtxt);
94: my ($senderuname,$senderudom) = split(':',$sender);
1.1 raeburn 95: if ($context eq 'coursemanagers') {
96: $rawsubj = 'Self-enrollment requests processed';
97: push(@rawmsg,{
1.10 raeburn 98: mt => 'Enrollment requests in the following course: [_1] have been processed.',
1.3 raeburn 99: args => ["\n $contextdesc"],
1.1 raeburn 100: });
101: } elsif ($context eq 'domainmanagers') {
1.12 raeburn 102: $rawsubj = 'Course/Community requests reviewed';
1.1 raeburn 103: push(@rawmsg,{
1.12 raeburn 104: mt => 'Course/Community creation requests in the following domain: [_1] have been reviewed.',
1.3 raeburn 105: args => ["\n $contextdesc"],
1.1 raeburn 106: });
107: if (ref($textstr) eq 'ARRAY') {
108: push(@rawmsg,@{$textstr});
109: }
110: } elsif ($context eq 'enroller') {
111: $rawsubj = 'Enrollment request';
1.12 raeburn 112: if ($crstype eq 'community') {
113: $msgtxt = 'Your request for enrollment in the following community: [_1]requested on [_2]has been reviewed by a Coordinator.'
114: } else {
115: $msgtxt = 'Your request for enrollment in the following course: [_1]requested on [_2]has been reviewed by a Course Coordinator.';
116: }
1.1 raeburn 117: push(@rawmsg,{
1.12 raeburn 118: mt => $msgtxt,
1.2 raeburn 119: args => ["\n ".$contextdesc.",\n",$timestamp.",\n"],
1.1 raeburn 120:
121: });
122: if (ref($textstr) eq 'ARRAY') {
123: push(@rawmsg,@{$textstr});
124: }
125: } elsif ($context eq 'courserequestor') {
1.12 raeburn 126: if ($crstype eq 'Community') {
127: $rawsubj = 'Community request';
128: $msgtxt = 'Your request for creation of the following community: [_1]requested on [_2]has been reviewed by a Domain Coordinator.';
129: } else {
130: $rawsubj = 'Course request';
131: $msgtxt = 'Your request for creation of the following course: [_1]requested on [_2]has been reviewed by a Domain Coordinator.';
132: }
1.1 raeburn 133: push(@rawmsg,{
1.12 raeburn 134: mt => $msgtxt,
1.2 raeburn 135: args => ["\n".$contextdesc.",\n",$timestamp.",\n"],
1.1 raeburn 136:
137: });
138: if (ref($textstr) eq 'ARRAY') {
139: push(@rawmsg,@{$textstr});
140: }
1.26 raeburn 141: } elsif ($context eq 'pendingrequestor') {
142: if ($crstype eq 'Community') {
143: $rawsubj = 'Community request';
144: } else {
145: $rawsubj = 'Processed course request';
146: }
147: if (ref($textstr) eq 'ARRAY') {
148: push(@rawmsg,@{$textstr});
149: }
1.1 raeburn 150: } elsif ($context eq 'coursereq') {
1.12 raeburn 151: if ($crstype eq 'community') {
152: $rawsubj = 'Community request to review';
153: $msgtxt = 'Creation of the following community: [_1]was requested by [_2] on [_3].';
154: } else {
155: $rawsubj = 'Course request to review';
156: $msgtxt = 'Creation of the following course: [_1]was requested by [_2] on [_3].';
157: }
1.1 raeburn 158: push(@rawmsg,{
1.12 raeburn 159: mt => $msgtxt,
1.2 raeburn 160: args => ["\n $contextdesc\n",$textstr,$timestamp],
1.1 raeburn 161: },
162: {
1.12 raeburn 163: mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Course and community creation -> Approve or reject requests[_3]to display a list of pending requests, which you can either approve or reject.',
1.2 raeburn 164: args => ["\n","\n\n ","\n\n"],
1.1 raeburn 165: });
166: } elsif ($context eq 'selfenrollreq') {
167: $rawsubj = 'Self-enrollment request';
1.12 raeburn 168: if ($crstype eq 'community') {
169: $msgtxt = 'Enrollment in the following community: [_1] was requested by [_2] on [_3].'
170: } else {
171: $msgtxt = 'Enrollment in the following course: [_1] was requested by [_2] on [_3].'
172: }
1.1 raeburn 173: push(@rawmsg,{
1.12 raeburn 174: mt => $msgtxt,
1.2 raeburn 175: args => ["\n $contextdesc\n",$textstr,$timestamp."\n"],
176: });
1.12 raeburn 177: my $directions;
178: if ($crstype eq 'community') {
179: $directions = 'As Coordinator, use: [_1]Main Menu -> Manage Community Users -> Enrollment Requests[_2]to display a list of pending enrollment requests, which you can either approve or reject.';
1.2 raeburn 180: } else {
1.12 raeburn 181: $directions = 'As Course Coordinator, use: [_1]Main Menu -> Manage Course Users -> Enrollment Requests[_2]to display a list of pending enrollment requests, which you can either approve or reject.';
182: }
183: push(@rawmsg,
1.1 raeburn 184: {
1.12 raeburn 185: mt => $directions,
1.2 raeburn 186: args => [" \n\n","\n"],
1.1 raeburn 187: });
1.2 raeburn 188:
1.1 raeburn 189: }
190: my @to_notify = split(/,/,$notifylist);
191: my $numsent = 0;
192: my @recusers;
193: my @recudoms;
194: foreach my $cc (@to_notify) {
195: my ($ccname,$ccdom) = split(/:/,$cc);
196: if (!exists($msgcc->{$ccname.':'.$ccdom})) {
197: push(@recusers,$ccname);
198: push(@recudoms,$ccdom);
199: $msgcc->{$ccname.':'.$ccdom}='';
200: $numsent ++;
201: }
202: }
203: my %reciphash = (
204: cc => $msgcc,
205: );
206: my ($uname,$udom);
207: if ($sender =~ /:/) {
208: ($uname,$udom) = split(/:/,$sender);
1.2 raeburn 209: } elsif ($context eq 'course') {
1.1 raeburn 210: $uname = $sender;
211: my %courseinfo = &Apache::lonnet::coursedescription($cid);
212: $udom = $courseinfo{'num'};
213: }
214: my %sentmessage;
215: my $stamp = time;
216: my $msgcount = &Apache::lonmsg::get_uniq();
217: my $sender_lh = &Apache::loncommon::user_lang($uname,$udom,$cid);
218: $subject = &Apache::lonlocal::mt_user($sender_lh,$rawsubj);
219: $message = '';
220: foreach my $item (@rawmsg) {
221: if (ref($item) eq 'HASH') {
222: $message .= &Apache::lonlocal::mt_user($sender_lh,$item->{mt},@{$item->{args}})."\n";
223: }
224: }
1.26 raeburn 225: &Apache::lonmsg::process_sent_mail($subject,'',$numsent,$stamp,$uname,$udom,$msgcount,$cid,$$,$message,\@recusers,\@recudoms,undef,undef,undef,undef,$senderuname,$senderudom);
1.1 raeburn 226: my ($recipid,$recipstatus) = &Apache::lonmsg::store_recipients($subject,$uname,$udom,\%reciphash);
227: my $status;
228: foreach my $recip (sort(keys(%{$msgcc}))) {
229: my ($ccname,$ccdom) = split(/:/,$recip);
230: my $recip_lh = &Apache::loncommon::user_lang($ccname,$ccdom,$cid);
231: my $subject = &Apache::lonlocal::mt_user($sender_lh,$rawsubj);
232: my $message = '';
233: foreach my $item (@rawmsg) {
234: if (ref($item) eq 'HASH') {
235: $message .= &Apache::lonlocal::mt_user($sender_lh,$item->{mt},
236: @{$item->{args}})."\n";
237: }
238: }
1.10 raeburn 239: if ($context eq 'coursemanagers') {
1.1 raeburn 240: if ($approvedlist) {
241: $message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved enrollments:')."\n".$approvedlist;
242: }
243: if ($rejectedlist) {
244: $message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected enrollments:')."\n".$rejectedlist;
245: }
246: } elsif ($context eq 'domainmanagers') {
247: if ($approvedlist) {
248: $message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved course requests:')."\n".$approvedlist;
249: }
250: if ($rejectedlist) {
251: $message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected course requests:')."\n".$rejectedlist;
252: }
253: }
254: $status .= &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message,undef,undef,undef,1,\%sentmessage,undef,undef,undef,1,$recipid).',';
255: }
256: $status =~ s/,$//;
257: return ($recipstatus,$status);
258: }
259:
260: sub display_queued_requests {
261: my ($context,$dom,$cnum) = @_;
1.2 raeburn 262: my ($namespace,$formaction,$nextelement,%requesthash);
1.1 raeburn 263: if ($context eq 'course') {
264: $formaction = '/adm/createuser';
265: $namespace = 'selfenrollrequests';
266: %requesthash = &Apache::lonnet::dump($namespace,$dom,$cnum);
1.2 raeburn 267: $nextelement = '<input type="hidden" name="state" value="done" />';
1.1 raeburn 268: } else {
269: $formaction = '/adm/createcourse';
270: $namespace = 'courserequestqueue';
1.23 raeburn 271: my $disposition = 'approval';
1.24 raeburn 272: my $nextphase = 'requestchange';
1.23 raeburn 273: if ($context eq 'pending') {
274: $disposition = 'pending';
1.24 raeburn 275: $nextphase = 'requestvalidation';
1.23 raeburn 276: }
277: %requesthash = &Apache::lonnet::dump_dom($namespace,$dom,'_'.$disposition);
1.24 raeburn 278: $nextelement = '<input type="hidden" name="phase" value="'.$nextphase.'" />';
1.1 raeburn 279: }
1.23 raeburn 280: my ($output,%queue_by_date);
1.1 raeburn 281: if (keys(%requesthash) > 0) {
1.2 raeburn 282: $output = '<form method="post" name="changequeue" action="'.$formaction.'" />'."\n".
283: '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n".
1.23 raeburn 284: $nextelement."\n";
1.1 raeburn 285: foreach my $item (keys(%requesthash)) {
1.23 raeburn 286: my ($timestamp,$entry,$pending);
1.1 raeburn 287: if ($context eq 'course') {
288: ($timestamp, my $usec) = split(/:/,$requesthash{$item});
289: $entry = $item.':'.$usec;
290: } else {
291: $timestamp = $requesthash{$item}{'timestamp'};
292: if (ref($requesthash{$item}) eq 'HASH') {
1.2 raeburn 293: my ($cnum,$disposition) = split('_',$item);
294: $entry = $cnum.':'.$requesthash{$item}{'ownername'}.':'.
1.23 raeburn 295: $requesthash{$item}{'ownerdom'}.':';
296: if ($context eq 'pending') {
297: $entry .= $requesthash{$item}{'instcode'};
298: } else {
299: $entry .= $requesthash{$item}{'crstype'};
300: }
301: $entry .= ':'.$requesthash{$item}{'description'};
1.1 raeburn 302: }
303: }
304: if ($entry ne '') {
1.23 raeburn 305: if (ref($queue_by_date{$timestamp}) eq 'ARRAY') {
306: push(@{$queue_by_date{$timestamp}},$entry);
1.1 raeburn 307: } else {
1.23 raeburn 308: $queue_by_date{$timestamp} = [$entry];
1.1 raeburn 309: }
310: }
311: }
1.23 raeburn 312: if (keys(%queue_by_date) > 0) {
313: if ($context eq 'course') {
314: $output .= '<h3>'.&mt('Self-enrollment requests queued pending approval by a Coordinator').'</h3>';
315: } elsif ($context eq 'pending') {
316: $output .= '<h3>'.&mt('Requests for official courses queued pending validation').'</h3>'.
317: '<p>'.&mt('Requests are validated against institutional data to confirm that the requestor is an instructor of record.').'<br />'.
318: &mt('Validation is attempted when the request is submitted.').' '.&mt('If unvalidated, the request will be held in a queue.').' '.&mt('Validation of pending requests is automatically repeated daily.').'</p>';
319: } else {
320: $output .= '<h3>'.&mt('Course/Community requests queued pending approval by a Domain Coordinator').'</h3>';
321: }
322: $output .= &build_queue_display($dom,$context,\%queue_by_date).
323: '<input type="hidden" name="queue" value="approval" />';
324: } else {
325: $output .= '<div class="LC_info">';
326: if ($context eq 'course') {
327: $output .= &mt('There are currently no enrollment requests awaiting approval.');
328: } elsif ($context eq 'pending') {
329: $output .= &mt('There are currently no requests for official courses awaiting validation.');
330: } elsif ($context eq 'domain') {
331: $output .= &mt('There are currently no course or community requests awaiting approval.');
332: }
333: $output .= '</div>';
334: }
335: if ($context eq 'pending') {
1.24 raeburn 336: $output .= '<br /><input type="submit" name="validationcheck" value="'.
337: &mt('Validate').'" /><br />'."\n".
1.23 raeburn 338: '<p>'.&mt('Any course/community requests which are successfully validated will be created immediately.').' '.&mt('Unvalidated requests will be listed for manual approval/rejection.').'</p>';
339: } else {
340: $output .= '<br /><input type="submit" name="processqueue" value="'.&mt('Save').'" />';
341: }
342: $output .= '</form>';
343: } else {
344: $output .= '<div class="LC_info">';
345: if ($context eq 'course') {
346: $output .= &mt('There are currently no enrollment requests awaiting approval.');
347: } elsif ($context eq 'pending') {
348: $output .= &mt('There are currently no requests for official courses awaiting validation.');
349: } else {
350: $output .= &mt('There are currently no course or community requests awaiting approval.');
351: }
352: $output .= '</div>';
353: }
354: return $output;
355: }
1.1 raeburn 356:
1.23 raeburn 357: sub build_queue_display {
358: my ($dom,$context,$queue) = @_;
359: return unless (ref($queue) eq 'HASH');
360: my %crstypes;
361: my $output = &Apache::loncommon::start_data_table().
362: &Apache::loncommon::start_data_table_header_row();
363: unless ($context eq 'pending') {
364: $output .= '<th>'.&mt('Action').'</th>';
365: }
366: $output .= '<th>'.&mt('Requestor').'</th>';
367: if ($context eq 'course') {
368: $output .= '<th>'.&mt('Section').'</th>'.
369: '<th>'.&mt('Date requested').'</th>';
370: } elsif ($context eq 'pending' || $context eq 'stillpending') {
371: $output .= '<th>'.&mt('Institutional code').'</th>'.
372: '<th>'.&mt('Date requested').'</th>'.
373: '<th>'.&mt('Details').'</th>';
374: } else {
375: %crstypes = &Apache::lonlocal::texthash (
376: official => 'Official course',
377: unofficial => 'Unofficial course',
378: community => 'Community',
379: );
380: $output .= '<th>'.&mt('Type').'</th>'.
381: '<th>'.&mt('Date requested').'</th>'.
382: '<th>'.&mt('Details').'</th>';
383: }
384: $output .= &Apache::loncommon::end_data_table_header_row();
385: my @sortedtimes = sort {$a <=> $b} (keys(%{$queue}));
386: my $count = 0;
387: foreach my $item (@sortedtimes) {
388: if (ref($queue->{$item}) eq 'ARRAY') {
389: foreach my $request (sort(@{$queue->{$item}})) {
390: my ($row,$approve,$reject,$showtime,$showsec,$namelink,
391: $detailslink,$crstype,$instcode);
392: $showtime = &Apache::lonlocal::locallocaltime($item);
393: if ($context eq 'course') {
394: my ($puname,$pudom,$pusec) = split(/:/,$request);
395: $approve = $count.':'.$puname.':'.$pudom.':'.$pusec;
396: $reject = $puname.':'.$pudom;
397: $showsec = $pusec;
398: if ($showsec eq '') {
399: $showsec = &mt('none');
400: }
401: $namelink = &Apache::loncommon::aboutmewrapper(
402: &Apache::loncommon::plainname($puname,$pudom),
403: $puname,$pudom);
404: } else {
405: my ($cnum,$ownername,$ownerdom,$type,$cdesc);
406: my $queue = 'approval';
407: if ($context eq 'pending' || $context eq 'stillpending') {
408: ($cnum,$ownername,$ownerdom,$instcode,$cdesc)=split(/:/,$request,5);
409: $queue = 'pending';
1.1 raeburn 410: } else {
1.23 raeburn 411: ($cnum,$ownername,$ownerdom,$type,$cdesc)=split(/:/,$request,5);
1.1 raeburn 412: $crstype = $type;
413: if (defined($crstypes{$type})) {
414: $crstype = $crstypes{$type};
415: }
416: }
1.23 raeburn 417: $detailslink='<a href="javascript:opencoursereqdisplay('.
418: "'$dom','$cnum','$queue'".');">'.$cdesc.'</a>';
419: $approve = $count.':'.$cnum;
420: $reject = $cnum;
421: $namelink = &Apache::loncommon::aboutmewrapper(
422: &Apache::loncommon::plainname($ownername,$ownerdom),
423: $ownername,$ownerdom);
424: }
425: unless ($context eq 'pending') {
1.1 raeburn 426: $row = '<td><span class="LC_nobreak"><label>'.
1.29 ! golterma 427: '<input type="radio" value="'.$approve.'" name="'.$count.'radioreq" />'.&mt('Approve').'</label></span>'.
1.1 raeburn 428: '<span class="LC_nobreak"><label>'.
1.29 ! golterma 429: '<input type="radio" value="'.$reject.'" name="'.$count.'radioreq" />'.&mt('Reject').'</label></span>'.
! 430: '<input type="radio" value="'."later:".$reject.'" name="'.$count.'radioreq" checked />'.&mt('Decide Later').
! 431: '</label></span><br /></td>';
1.1 raeburn 432: }
1.23 raeburn 433: $row .= '<td>'.$namelink.'</td>'."\n";
434: if ($context eq 'course') {
435: $row .= '<td>'.$showsec.'</td>'."\n".
436: '<td>'.$showtime.'</td>'."\n";
437: } else {
438: if ($context eq 'pending' || $context eq 'stillpending') {
439: $row .= '<td>'.$instcode.'</td>'."\n";
440: } else {
441: $row .= '<td>'.$crstype.'</td>'."\n";
442: }
443: $row .= '<td>'.$showtime.'</td>'."\n".
444: '<td>'.$detailslink.'</td>'."\n";
445: }
446: $output .= &Apache::loncommon::start_data_table_row()."\n".
447: $row.
448: &Apache::loncommon::end_data_table_row()."\n";
449: $count ++;
1.1 raeburn 450: }
451: }
452: }
1.23 raeburn 453: $output .= &Apache::loncommon::end_data_table();
1.1 raeburn 454: return $output;
455: }
456:
457: sub update_request_queue {
458: my ($context,$cdom,$cnum,$coursedesc) = @_;
459: my ($output,$access_start,$access_end,$limit,$cap,$notifylist,$namespace,
1.26 raeburn 460: $stucounts,$idx,$classlist,%requesthash,$cid,$domdesc,$now,
461: $sender,$approvedmsg,$rejectedmsg,$beneficiary,
1.2 raeburn 462: @existing,@missingreq,@invalidusers,@limitexceeded,@completed,
1.19 raeburn 463: @processing_errors,@warn_approves,@warn_rejects,@approvals,@warn_dels,
1.5 raeburn 464: @rejections,@rejectionerrors,@nopermissions,%courseroles,
1.25 raeburn 465: %communityroles,%domdefs,%approvalmsg,%rejectionmsg,$crstype,$queue,$firsturl);
1.29 ! golterma 466: my $count=0;
! 467: while (my @course = &Apache::loncommon::get_env_multiple('form.'.$count.'radioreq')) {
! 468: if (@course[0] =~ /^\d+:.*/) {
! 469: push(@approvals,@course[0]);
! 470: } elsif (@course[0] =~ /^later:.*/) {
! 471: #decide later
! 472: } else {
! 473: push(@rejections,@course[0]);
! 474: }
! 475: $count+=1;
! 476: }
! 477:
! 478:
1.1 raeburn 479: $now = time;
480: $sender = $env{'user.name'}.':'.$env{'user.domain'};
481: if ($context eq 'course') {
482: $namespace = 'selfenrollrequests';
483: $beneficiary = 'enroller';
484: $cid = $env{'request.course.id'};
1.12 raeburn 485: $crstype = lc(&Apache::loncommon::course_type());
1.26 raeburn 486: $firsturl = &course_portal_url($cnum,$cdom);
1.1 raeburn 487: %requesthash = &Apache::lonnet::dump($namespace,$cdom,$cnum);
488: $access_start = $env{'course.'.$cid.'.internal.selfenroll_start_access'};
489: $access_end = $env{'course.'.$cid.'.internal.selfenroll_end_access'};
490: $limit = $env{'course.'.$cid.'.internal.selfenroll_limit'};
491: $cap = $env{'course.'.$cid.'.internal.selfenroll_cap'};
492: $notifylist = $env{'course.'.$cid.'.internal.selfenroll_notifylist'};
493: ($stucounts,$idx,$classlist) = &get_student_counts($cdom,$cnum);
494: $approvedmsg = [{
495: mt => 'Your request for enrollment has been approved.',
496: },
497: {
1.28 raeburn 498: mt => 'Visit [_1] to log-in and access the course',
1.25 raeburn 499: args => [$firsturl],
1.1 raeburn 500: }];
501: $rejectedmsg = [{
502: mt => 'Your request for enrollment has not been approved.',
503: }];
504: } else {
1.2 raeburn 505: $domdesc = &Apache::lonnet::domain($cdom);
506: $namespace = 'courserequestqueue';
507: $beneficiary = 'courserequestor';
1.23 raeburn 508: $queue = 'approval';
509: if ($env{'form.queue'} eq 'pending') {
510: $queue = 'pending';
511: }
512: %requesthash = &Apache::lonnet::dump_dom($namespace,$cdom,'_'.$queue);
1.2 raeburn 513: my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$cdom);
514: if (ref($domconfig{'requestcourses'}) eq 'HASH') {
515: if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') {
516: $notifylist = $domconfig{'requestcourses'}{'notify'}{'approval'};
517: }
518: }
1.12 raeburn 519: $approvalmsg{'course'} =
520: [{
1.2 raeburn 521: mt => 'Your course request has been approved.',
522: },
523: {
1.28 raeburn 524: mt => 'Visit [_1] to log-in and access the course',
525: args => [],
1.2 raeburn 526: }];
1.12 raeburn 527: $rejectionmsg{'course'} =
528: [{
1.2 raeburn 529: mt => 'Your course request has not been approved.',
530: }];
1.12 raeburn 531:
532: $approvalmsg{'community'} =
533: [{
534: mt => 'Your community request has been approved.',
535: },
536: {
1.28 raeburn 537: mt => 'Visit [_1] to log-in and access the community',
538: args => [],
1.12 raeburn 539: }];
540:
541: $rejectionmsg{'community'} =
542: [{
543: mt => 'Your community request has not been approved.',
544: }];
545:
1.2 raeburn 546: %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
547: my @roles = &Apache::lonuserutils::roles_by_context('course');
548: foreach my $role (@roles) {
549: $courseroles{$role}=&Apache::lonnet::plaintext($role,'Course');
550: }
551: foreach my $role (@roles) {
552: $communityroles{$role}=&Apache::lonnet::plaintext($role,'Community');
553: }
554:
1.1 raeburn 555: }
556: foreach my $item (sort {$a <=> $b} @approvals) {
557: if ($context eq 'course') {
558: my ($num,$uname,$udom,$usec) = split(/:/,$item);
559: my $uhome = &Apache::lonnet::homeserver($uname,$udom);
560: if ($uhome ne 'no_host') {
561: if (exists($requesthash{$uname.':'.$udom})) {
562: if (exists($classlist->{$uname.':'.$udom})) {
563: if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') {
564: if (($classlist->{$uname.':'.$udom}->[$idx->{'status'}] eq 'Active') ||
565: ($classlist->{$uname.':'.$udom}->[$idx->{'status'}] eq 'Future')) {
566: push(@existing,$uname.':'.$udom);
567: next;
568: }
569: }
570: }
571: } else {
572: push(@missingreq,$uname.':'.$udom);
573: next;
574: }
575: if (!grep(/^\Q$item\E$/,@rejections)) {
576: if ($limit eq 'allstudents') {
577: if ($stucounts->{$limit} >= $cap) {
578: push(@limitexceeded,$uname.':'.$udom);
579: last;
580: }
581: } elsif ($limit eq 'selfenrolled') {
582: if ($stucounts->{$limit} >= $cap) {
583: push(@limitexceeded,$uname.':'.$udom);
584: last;
585: }
586: }
587: my $result =
588: &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$usec,$access_end,$access_start,'selfenroll',undef,$cdom.'_'.$cnum,1);
589: if ($result eq 'ok') {
1.2 raeburn 590: push(@completed,$uname.':'.$udom);
1.1 raeburn 591: $stucounts->{'allstudents'} ++;
592: $stucounts->{'selfenrolled'} ++;
593: &send_selfserve_notification($uname.':'.$udom,$approvedmsg,
1.26 raeburn 594: $cid,$coursedesc,$now,$beneficiary,$sender,
595: undef,undef,$crstype);
1.2 raeburn 596: my %userrequest = (
597: $cdom.'_'.$cnum => {
598: timestamp => $now,
599: section => $usec,
600: adjudicator => $env{'user.name'}.':'.$env{'user.domain'},
601: status => 'approved',
602: }
603: );
1.1 raeburn 604: my $userresult =
605: &Apache::lonnet::put($namespace,\%userrequest,$udom,$uname);
606: if ($userresult ne 'ok') {
607: push(@warn_approves,$uname.':'.$udom);
608: }
609: } else {
1.2 raeburn 610: push(@processing_errors,$uname.':'.$udom);
1.1 raeburn 611: }
612: }
613: } else {
614: push(@invalidusers,$uname.':'.$udom);
615: }
616: } else {
1.2 raeburn 617: my ($num,$cnum) = split(':',$item);
1.23 raeburn 618: if (ref($requesthash{$cnum.'_'.$queue}) eq 'HASH') {
1.2 raeburn 619: if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
1.23 raeburn 620: my $ownername = $requesthash{$cnum.'_'.$queue}{'ownername'};
621: my $ownerdom = $requesthash{$cnum.'_'.$queue}{'ownerdom'};
622: $crstype = $requesthash{$cnum.'_'.$queue}{'crstype'};
623: my $coursedesc = $requesthash{$cnum.'_'.$queue}{'description'};
1.2 raeburn 624: my $longroles = \%courseroles;
625: if ($crstype eq 'community') {
626: $longroles = \%communityroles;
627: }
1.5 raeburn 628: my $cancreate;
629: if ($cdom eq $ownerdom) {
630: if (&Apache::lonnet::usertools_access($ownername,$ownerdom,$crstype,
631: undef,'requestcourses')) {
632: $cancreate = 1;
633: }
634: } else {
635: my %userenv = &Apache::lonnet::userenvironment($ownerdom,$ownername,'reqcrsotherdom.'.$crstype);
636: if ($userenv{'reqcrsotherdom.'.$crstype}) {
637: my @doms = split(',',$userenv{'reqcrsotherdom.'.$crstype});
638: if (grep(/^\Q$cdom\E:/,@doms)) {
639: $cancreate = 1;
640: }
641: }
642: }
643: if ($cancreate) {
1.2 raeburn 644: my $requestkey = $cdom.'_'.$cnum;
645: my %history =
646: &Apache::lonnet::restore($requestkey,'courserequests',
647: $ownerdom,$ownername);
648: if ((ref($history{'details'}) eq 'HASH') &&
1.23 raeburn 649: ($history{'disposition'} eq $queue)) {
1.2 raeburn 650: my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg);
651: my $result = &course_creation($cdom,$cnum,$context,$history{'details'},\$logmsg,
652: \$newusermsg,\$addresult,\$enrollcount,
653: \$response,\$keysmsg,\%domdefs,$longroles);
654: if ($result eq 'created') {
1.12 raeburn 655: if ($crstype eq 'community') {
656: $approvedmsg = $approvalmsg{'community'};
657: } else {
658: $approvedmsg = $approvalmsg{'course'};
659: }
1.28 raeburn 660: my $firsturl = &course_portal_url($cnum,$cdom);
661: if (ref($approvedmsg) eq 'ARRAY') {
662: if (ref($approvedmsg->[1]) eq 'HASH') {
663: $approvedmsg->[1]->{'args'} = [$firsturl];
664: }
665: }
1.2 raeburn 666: push(@completed,$cnum);
1.19 raeburn 667:
1.23 raeburn 668: unless (&Apache::lonnet::del_dom($namespace,[$cnum.'_'.$queue],$cdom) eq 'ok') {
1.19 raeburn 669: push(@warn_dels,$cnum);
670: }
1.26 raeburn 671: &send_selfserve_notification($ownername.':'.$ownerdom,
672: $approvedmsg,$cid,$coursedesc,$now,
673: $beneficiary,$sender,undef,undef,$crstype);
1.2 raeburn 674: my %reqhash = (
675: reqtime => $history{'reqtime'},
676: crstype => $history{'crstype'},
677: details => $history{'details'},
678: disposition => $history{'disposition'},
679: status => 'created',
680: adjudicator => $env{'user.name'}.':'.
681: $env{'user.domain'},
682: );
683: my $userresult =
684: &Apache::lonnet::store_userdata(\%reqhash,$requestkey,
685: 'courserequests',$ownerdom,$ownername);
686: if ($userresult eq 'ok') {
687: my %status = (
688: 'status:'.$cdom.':'.$cnum => 'created'
689: );
690: my $statusresult =
691: &Apache::lonnet::put('courserequests',\%status,
692: $ownerdom,$ownername);
693: if ($statusresult ne 'ok') {
694: push(@warn_approves,$cnum);
695: }
696: }
697: if ($userresult ne 'ok') {
698: push(@warn_approves,$cnum);
699: }
700: } else {
701: push(@processing_errors,$cnum);
702: }
703: } else {
704: push(@processing_errors,$cnum);
705: }
706: } else {
1.5 raeburn 707: push(@nopermissions,$cnum);
1.2 raeburn 708: }
709: } else {
710: push(@existing,$cnum);
711: }
712: } else {
713: push(@missingreq,$cnum);
714: }
1.1 raeburn 715: }
716: }
1.2 raeburn 717: my @changes = (@completed,@rejections);
718: if ($context eq 'domain') {
1.23 raeburn 719: @changes = map {$_.'_'.$queue} (@changes);
1.2 raeburn 720: }
1.1 raeburn 721: if (@rejections) {
1.3 raeburn 722: foreach my $item (@rejections) {
1.1 raeburn 723: if ($context eq 'course') {
1.3 raeburn 724: my $user = $item;
1.2 raeburn 725: &send_selfserve_notification($user,$rejectedmsg,$cid,$coursedesc,
1.26 raeburn 726: $now,$beneficiary,$sender,undef,undef,
727: $crstype);
1.1 raeburn 728: my ($uname,$udom) = split(/:/,$user);
729: my %userrequest = (
730: $cdom.'_'.$cnum => {
731: timestamp => $now,
732: adjudicator => $env{'user.name'}.':'.$env{'user.domain'},
733: status => 'rejected',
734: }
735: );
736: my $userresult =
737: &Apache::lonnet::put($namespace,\%userrequest,$udom,$uname);
738: if ($userresult ne 'ok') {
739: push(@warn_rejects,$user);
740: }
741: } else {
1.3 raeburn 742: my $cnum = $item;
1.23 raeburn 743: if (ref($requesthash{$cnum.'_'.$queue}) eq 'HASH') {
1.3 raeburn 744: if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
745: my $requestkey = $cdom.'_'.$cnum;
1.23 raeburn 746: my $ownername = $requesthash{$cnum.'_'.$queue}{'ownername'};
747: my $ownerdom = $requesthash{$cnum.'_'.$queue}{'ownerdom'};
748: my $coursedesc = $requesthash{$cnum.'_'.$queue}{'description'};
749: $crstype = $requesthash{$cnum.'_'.$queue}{'crstype'};
1.12 raeburn 750: if ($crstype eq 'community') {
751: $rejectedmsg = $rejectionmsg{'community'};
752: } else {
753: $rejectedmsg = $rejectionmsg{'course'};
754: }
1.2 raeburn 755: &send_selfserve_notification($ownername.':'.$ownerdom,$rejectedmsg,
756: $cid,$coursedesc,$now,$beneficiary,
1.12 raeburn 757: $sender,undef,undef,$crstype);
1.2 raeburn 758: my %history =
1.3 raeburn 759: &Apache::lonnet::restore($requestkey,'courserequests',
1.2 raeburn 760: $ownerdom,$ownername);
761: if ((ref($history{'details'}) eq 'HASH') &&
1.23 raeburn 762: ($history{'disposition'} eq $queue)) {
1.2 raeburn 763: my %reqhash = (
764: reqtime => $history{'reqtime'},
765: crstype => $history{'crstype'},
766: details => $history{'details'},
767: disposition => $history{'disposition'},
768: status => 'rejected',
769: adjudicator => $env{'user.name'}.':'.$env{'user.domain'},
770: );
771: my $userresult =
1.3 raeburn 772: &Apache::lonnet::store_userdata(\%reqhash,$requestkey,
773: 'courserequests',$ownerdom,$ownername);
774: if ($userresult eq 'ok') {
775: my %status = (
776: 'status:'.$cdom.':'.$cnum => 'rejected'
777: );
778: my $statusresult =
779: &Apache::lonnet::put('courserequests',\%status,
780: $ownerdom,$ownername);
781: if ($statusresult ne 'ok') {
782: push(@warn_rejects,$cnum);
783: }
784: } else {
785: push(@warn_rejects,$cnum);
1.2 raeburn 786: }
1.23 raeburn 787: unless (&Apache::lonnet::del_dom($namespace,[$cnum.'_'.$queue],$cdom) eq 'ok') {
1.19 raeburn 788: push(@warn_dels,$cnum);
789: }
1.3 raeburn 790: } else {
791: push(@warn_rejects,$cnum);
1.2 raeburn 792: }
1.3 raeburn 793: } else {
794: push(@existing,$cnum);
1.2 raeburn 795: }
1.3 raeburn 796: } else {
797: push(@rejectionerrors,$cnum);
1.2 raeburn 798: }
1.1 raeburn 799: }
800: }
801: }
802: if (@changes) {
803: my $delresult;
804: if ($context eq 'course') {
805: $delresult = &Apache::lonnet::del($namespace,\@changes,$cdom,$cnum);
806: } else {
807: $delresult = &Apache::lonnet::del_dom($namespace,\@changes,$cdom);
808: }
809: if ($delresult eq 'ok') {
810: my $namelink =
811: &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}).' ('.$env{'user.name'}.':'.$env{'user.domain'}.')';
812: my ($chgmsg,$approvedlist,$rejectedlist);
813: if ($context eq 'course') {
814: $chgmsg = "'Action was taken on the following enrollment requests by [_1].',$namelink";
1.2 raeburn 815: if (@completed) {
816: $approvedlist = join("\n",@completed);
1.12 raeburn 817: if ($crstype eq 'community') {
818: $output .= '<p>'.&mt('The following were enrolled in the community:').'<ul>';
819: } else {
820: $output .= '<p>'.&mt('The following were enrolled in the course:').'<ul>';
821: }
1.2 raeburn 822: foreach my $user (@completed) {
1.1 raeburn 823: my ($uname,$udom) = split(/:/,$user);
824: my $userlink =
825: &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom);
826: $output .= '<li>'.$userlink.'</li>';
827: }
828: $output .= '</ul></p>';
829: }
830: if (@rejections) {
831: $rejectedlist = join("\n",@rejections);
832: $output .= '<p>'.&mt('The following enrollment requests were rejected:').'<ul>';
833: foreach my $user (@rejections) {
834: $output .= '<li>'.$user.'</li>';
835: }
836: $output .= '</ul></p>';
837: }
1.2 raeburn 838: if ($notifylist ne '') {
839: &send_selfserve_notification($notifylist,$chgmsg,$cid,$coursedesc,
840: $now,'coursemanagers',$sender,
1.12 raeburn 841: $approvedlist,$rejectedlist,$crstype);
1.2 raeburn 842: }
1.1 raeburn 843: } else {
1.12 raeburn 844: $chgmsg = "'Action was taken on the following course and community requests by [_1].',$namelink";
1.2 raeburn 845: if (@completed) {
846: $approvedlist = join("\n",@completed);
1.12 raeburn 847: $output .= '<p>'.&mt('The following courses/communities were created:').'<ul>';
1.2 raeburn 848: foreach my $cnum (@completed) {
849: my $showcourse;
1.23 raeburn 850: if (ref($requesthash{$cnum.'_'.$queue})) {
851: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.2 raeburn 852: } else {
853: $showcourse = $cnum;
854: }
855: my $syllabuslink =
856: &Apache::loncommon::syllabuswrapper($showcourse,$cnum,$cdom);
857: $output .= '<li>'.$syllabuslink.'</li>';
858: }
859: $output .= '</ul></p>';
860: }
861: if (@rejections) {
862: $rejectedlist = join("\n",@rejections);
863: $output .= '<p>'.&mt('The following requests were rejected:').'<ul>';
864: foreach my $cnum (@rejections) {
865: my $showcourse;
1.23 raeburn 866: if (ref($requesthash{$cnum.'_'.$queue})) {
867: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.2 raeburn 868: } else {
869: $showcourse = $cnum;
870: }
871: $output .= '<li>'.$showcourse.'</li>';
872: }
873: $output .= '</ul></p>';
874: }
875: if ($notifylist ne '') {
876: &send_selfserve_notification($notifylist,$chgmsg,$cid,$domdesc,
877: $now,'domainmanagers',$sender,
1.12 raeburn 878: $approvedlist,$rejectedlist,$crstype);
1.2 raeburn 879: }
1.1 raeburn 880: }
881: }
882: }
883: if (@existing) {
884: if ($context eq 'course') {
885: $output .= '<p>'.&mt('The following enrollment requests were deleted because the user is already enrolled in the course:').'<ul>';
886: foreach my $user (@existing) {
887: $output .= '<li>'.$user.'</li>';
888: }
889: $output .= '</ul></p>';
890: } else {
1.12 raeburn 891: $output .= '<p>'.&mt('The following course/community creation requests were deleted because the course or community has already been created:').'<ul>';
1.2 raeburn 892: foreach my $cnum (@existing) {
893: my $showcourse;
894: my %coursehash = &Apache::lonnet::coursedescription($cdom.'/'.$cnum);
895: if ($coursehash{'description'} ne '') {
896: $showcourse = $coursehash{'description'};
897: } else {
898: $showcourse = $cnum;
899: }
900: $output .= '<li>'.$showcourse.'</li>';
901: }
902: $output .= '</ul></p>';
1.1 raeburn 903: }
904: }
905: if (@missingreq) {
906: if ($context eq 'course') {
907: $output .= '<p>'.&mt('The following enrollment requests were ignored because the request is no longer in the enrollment queue:').'<ul>';
908: foreach my $user (@missingreq) {
909: $output .= '<li>'.$user.'</li>';
910: }
911: $output .= '</ul></p>';
1.2 raeburn 912: } else {
1.12 raeburn 913: $output .= '<p>'.&mt('The following course/community creation requests were ignored because the request is no longer in the queue:').'<ul>';
1.2 raeburn 914: foreach my $cnum (@missingreq) {
915: $output .= '<li>'.$cnum.'</li>';
916: }
917: $output .= '</ul></p>';
918:
1.1 raeburn 919: }
920: }
921: if (@invalidusers) {
922: if ($context eq 'course') {
923: $output .= '<p>'.&mt('The following enrollment requests were deleted because the requestor does not have a LON-CAPA account:').'<ul>';
924: foreach my $user (@invalidusers) {
925: $output .= '<li>'.$user.'</li>';
926: }
927: $output .= '</ul></p>';
928: }
929: }
930: if (@limitexceeded) {
931: if ($context eq 'course') {
932: $output .= '<p>'.&mt('The following enrollment requests were skipped because the enrollment limit has been reached for the course:').'<ul>';
933: foreach my $user (@limitexceeded) {
934: $output .= '<li>'.$user.'</li>';
935: }
936: $output .= '</ul></p>';
937: }
938: }
1.5 raeburn 939: if (@nopermissions) {
1.12 raeburn 940: $output .= '<p>'.&mt('The following course/community creation requests could not be processed because the owner does not have rights to create this type of course:').'<ul>';
1.5 raeburn 941: foreach my $cnum (@nopermissions) {
942: my $showcourse;
1.23 raeburn 943: if (ref($requesthash{$cnum.'_'.$queue})) {
944: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.5 raeburn 945: } else {
946: $showcourse = $cnum;
947: }
948: $output .= '<li>'.$showcourse.'</li>';
949: }
950: $output .= '</ul></p>';
951: }
1.2 raeburn 952: if (@processing_errors) {
1.1 raeburn 953: if ($context eq 'course') {
954: $output .= '<p>'.&mt('The following enrollment requests could not be processed because an error occurred:').'<ul>';
1.2 raeburn 955: foreach my $user (@processing_errors) {
1.1 raeburn 956: $output .= '<li>'.$user.'</li>';
957: }
958: $output .= '</ul></p>';
959: } else {
1.12 raeburn 960: $output .= '<p>'.&mt('The following course/community creation requests could not be processed because an error occurred:').'<ul>';
1.2 raeburn 961: foreach my $cnum (@processing_errors) {
962: my $showcourse;
1.23 raeburn 963: if (ref($requesthash{$cnum.'_'.$queue})) {
964: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.2 raeburn 965: } else {
966: $showcourse = $cnum;
967: }
968: $output .= '<li>'.$showcourse.'</li>';
969: }
970: $output .= '</ul></p>';
1.1 raeburn 971: }
972: }
1.3 raeburn 973: if (@rejectionerrors) {
1.12 raeburn 974: $output .= '<p>'.&mt('The following course/community creation request rejections could not be fully processed because an error occurred:').'<ul>';
1.3 raeburn 975: foreach my $cnum (@rejectionerrors) {
976: my $showcourse;
1.23 raeburn 977: if (ref($requesthash{$cnum.'_'.$queue})) {
978: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.3 raeburn 979: } else {
980: $showcourse = $cnum;
981: }
982: $output .= '<li>'.$showcourse.'</li>';
983: }
984: $output .= '</ul></p>';
985: }
1.2 raeburn 986: if (@warn_approves || @warn_rejects) {
1.1 raeburn 987: if ($context eq 'course') {
988: $output .= '<p>'.&mt("For the following users, an error occurred when updating the user's own self-enroll requests record:").'<ul>';
989: foreach my $user (@warn_approves) {
990: $output .= '<li>'.$user.'</li>';
991: }
992: $output .= '</ul></p>';
993: } else {
1.12 raeburn 994: $output .= '<p>'.&mt("For the following course/community requests an error occurred when updating the requestor's own requests record:").'<ul>';
1.2 raeburn 995: foreach my $cnum (@warn_approves,@warn_rejects) {
996: my $showcourse;
1.23 raeburn 997: if (ref($requesthash{$cnum.'_'.$queue})) {
998: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.2 raeburn 999: } else {
1000: $showcourse = $cnum;
1001: }
1002: $output .= '<li>'.$showcourse.'</li>';
1.1 raeburn 1003: }
1004: $output .= '</ul></p>';
1005: }
1006: }
1.19 raeburn 1007: if (@warn_dels) {
1008: $output .= '<p>'.&mt("For the following course/community requests an error occurred when removing requests for the following from the pending queue:").'<ul>';
1009: foreach my $cnum (@warn_dels) {
1010: my $showcourse;
1.23 raeburn 1011: if (ref($requesthash{$cnum.'_'.$queue})) {
1012: $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
1.19 raeburn 1013: } else {
1014: $showcourse = $cnum;
1015: }
1016: $output .= '<li>'.$showcourse.'</li>';
1017: }
1018: $output .= '</ul></p>';
1019: }
1.1 raeburn 1020: return $output;
1021: }
1022:
1.26 raeburn 1023: sub course_portal_url {
1024: my ($cnum,$cdom) = @_;
1025: my $chome = &Apache::lonnet::homeserver($cnum,$cdom);
1026: my $hostname = &Apache::lonnet::hostname($chome);
1027: my $protocol = $Apache::lonnet::protocol{$chome};
1028: $protocol = 'http' if ($protocol ne 'https');
1029: my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom);
1030: my $firsturl;
1031: if ($domdefaults{'portal_def'}) {
1032: $firsturl = $domdefaults{'portal_def'};
1033: } else {
1034: $firsturl = $protocol.'://'.$hostname;
1035: }
1036: return $firsturl;
1037: }
1038:
1.1 raeburn 1039: sub get_student_counts {
1040: my ($cdom,$cnum) = @_;
1041: my (%idx,%stucounts);
1042: my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cnum);
1043: $idx{'type'} = &Apache::loncoursedata::CL_TYPE();
1044: $idx{'status'} = &Apache::loncoursedata::CL_STATUS();
1045: while (my ($student,$data) = each(%$classlist)) {
1046: if (($data->[$idx{'status'}] eq 'Active') ||
1047: ($data->[$idx{'status'}] eq 'Future')) {
1048: if ($data->[$idx{'type'}] eq 'selfenroll') {
1049: $stucounts{'selfenroll'} ++;
1050: }
1051: $stucounts{'allstudents'} ++;
1052: }
1053: }
1054: return (\%stucounts,\%idx,$classlist);
1055: }
1056:
1.2 raeburn 1057: sub course_creation {
1058: my ($dom,$cnum,$context,$details,$logmsg,$newusermsg,$addresult,$enrollcount,$output,
1059: $keysmsg,$domdefs,$longroles) = @_;
1060: unless ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH') &&
1061: (ref($longroles) eq 'HASH')) {
1062: return 'error: Invalid request';
1063: }
1064: my ($result,$ownername,$ownerdom);
1065: my $crstype = $details->{'crstype'};
1066: if ($context eq 'domain') {
1067: $ownername = $details->{'owner'};
1068: $ownerdom = $details->{'domain'};
1069: } else {
1070: $ownername = $env{'user.name'};
1071: $ownerdom = $env{'user.domain'};
1072: }
1073: my $owneremail;
1074: my %emails = &Apache::loncommon::getemails($ownername,$ownerdom);
1075: foreach my $email ('permanentemail','critnotification','notification') {
1076: $owneremail = $emails{$email};
1077: last if ($owneremail ne '');
1078: }
1.8 raeburn 1079: my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs);
1.2 raeburn 1080: my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses',
1.22 raeburn 1081: \%reqdetails,$longroles,$logmsg,$newusermsg,$addresult,
1082: $enrollcount,$output,$keysmsg,$ownerdom,$ownername,$cnum,$crstype);
1.2 raeburn 1083: if ($cid eq "/$dom/$cnum") {
1084: $result = 'created';
1085: } else {
1086: $result = 'error: '.$cid;
1087: }
1088: return $result;
1089: }
1090:
1091: sub build_batchcreatehash {
1.8 raeburn 1092: my ($dom,$context,$details,$owneremail,$domdefs) = @_;
1.2 raeburn 1093: my %batchhash;
1094: my @items = qw{owner domain coursehome clonecrs clonedom datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users};
1095: if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) {
1.17 raeburn 1096: my $emailenc = &escape($owneremail);
1.2 raeburn 1097: my $owner = $details->{'owner'}.':'.$details->{'domain'};
1098: foreach my $item (@items) {
1099: $batchhash{$item} = $details->{$item};
1100: }
1101: $batchhash{'title'} = $details->{'cdescr'};
1102: $batchhash{'coursecode'} = $details->{'instcode'};
1103: $batchhash{'emailenc'} = $emailenc;
1104: $batchhash{'adds'} = $details->{'autoadds'};
1105: $batchhash{'drops'} = $details->{'autodrops'};
1106: $batchhash{'authtype'} = $domdefs->{'auth_def'};
1107: $batchhash{'authparam'} = $domdefs->{'auth_arg_def'};
1108: if ($details->{'crstype'} eq 'community') {
1109: $batchhash{'crstype'} = 'Community';
1110: } else {
1111: $batchhash{'crstype'} = 'Course';
1112: }
1.8 raeburn 1113: my ($owner_firstname,$owner_lastname);
1114: if ($context eq 'domain') {
1115: my %userenv = &Apache::lonnet::userenvironment($details->{'domain'},
1116: $details->{'owner'},
1117: 'firstname','lastname');
1118: $owner_firstname = $userenv{'firstname'};
1119: $owner_lastname = $userenv{'lastname'};
1120: } else {
1121: $owner_firstname = $env{'environment.firstname'};
1122: $owner_lastname = $env{'environment.lastname'};
1123: }
1124: if (ref($details->{'personnel'}) eq 'HASH') {
1125: %{$batchhash{'users'}} = %{$details->{'personnel'}};
1126: if (ref($batchhash{'users'}) eq 'HASH') {
1127: foreach my $userkey (keys(%{$batchhash{'users'}})) {
1128: if (ref($batchhash{'users'}{$userkey}) eq 'HASH') {
1129: if (ref($batchhash{'users'}{$userkey}{'roles'}) eq 'ARRAY') {
1130: foreach my $role (@{$batchhash{'users'}{$userkey}{'roles'}}) {
1131: my $start = '';
1132: my $end = '';
1133: if ($role eq 'st') {
1134: $start = $details->{'accessstart'};
1135: $end = $details->{'accessend'};
1136: }
1137: $batchhash{'users'}{$userkey}{$role}{'start'} = $start;
1138: $batchhash{'users'}{$userkey}{$role}{'end'} = $end;
1139: }
1140: }
1141: }
1142: }
1143: }
1144: }
1145: $batchhash{'users'}{$owner}{firstname} = $owner_firstname;
1146: $batchhash{'users'}{$owner}{lastname} = $owner_lastname;
1147: $batchhash{'users'}{$owner}{emailenc} = $emailenc;
1148: $batchhash{'users'}{$owner}{owneremail} = $owneremail;
1.2 raeburn 1149: }
1150: return %batchhash;
1151: }
1152:
1.4 raeburn 1153: sub can_clone_course {
1.11 raeburn 1154: my ($uname,$udom,$clonecrs,$clonedom,$crstype) = @_;
1.4 raeburn 1155: my $canclone;
1.11 raeburn 1156: my $ccrole = 'cc';
1.12 raeburn 1157: if ($crstype eq 'community') {
1.11 raeburn 1158: $ccrole = 'co';
1159: }
1.4 raeburn 1160: my %roleshash = &Apache::lonnet::get_my_roles($uname,$udom,'userroles',['active'],
1.11 raeburn 1161: [$ccrole],[$clonedom]);
1162: if (exists($roleshash{$clonecrs.':'.$clonedom.':'.$ccrole})) {
1.4 raeburn 1163: $canclone = 1;
1164: } else {
1165: my %courseenv = &Apache::lonnet::userenvironment($clonedom,$clonecrs,('cloners'));
1166: my $cloners = $courseenv{'cloners'};
1167: if ($cloners ne '') {
1168: my @cloneable = split(',',$cloners);
1169: if (grep(/^\*$/,@cloneable)) {
1170: $canclone = 1;
1171: }
1172: if (grep(/^\*:\Q$udom\E$/,@cloneable)) {
1173: $canclone = 1;
1174: }
1175: if (grep(/^\Q$uname\E:\Q$udom\E$/,@cloneable)) {
1176: $canclone = 1;
1177: }
1178: }
1.18 raeburn 1179: unless ($canclone) {
1180: if (&Apache::lonnet::is_course_owner($clonedom,$clonecrs,$uname,$udom)) {
1.20 bisitz 1181: $canclone = 1;
1.18 raeburn 1182: }
1183: }
1.4 raeburn 1184: }
1185: return $canclone;
1186: }
1187:
1.13 raeburn 1188: sub get_processtype {
1189: my ($uname,$udom,$isadv,$dom,$crstype,$inststatuses,$domconfig) = @_;
1190: return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH'));
1191: if ($uname eq '' || $udom eq '') {
1192: $uname = $env{'user.name'};
1193: $udom = $env{'user.domain'};
1194: $isadv = $env{'user.adv'};
1195: }
1196: my (%userenv,%settings,$val);
1197: my @options = ('autolimit','validate','approval');
1198: if ($dom eq $udom) {
1199: %userenv =
1200: &Apache::lonnet::userenvironment($udom,$uname,'requestcourses.'.$crstype,'inststatus');
1201: if ($userenv{'requestcourses.'.$crstype}) {
1202: $val = $userenv{'requestcourses.'.$crstype};
1203: @{$inststatuses} = ('_custom_');
1204: } else {
1205: my ($task,%alltasks);
1206: if (ref($domconfig->{'requestcourses'}) eq 'HASH') {
1207: %settings = %{$domconfig->{'requestcourses'}};
1208: if (ref($settings{$crstype}) eq 'HASH') {
1209: if (($isadv) && ($settings{$crstype}{'_LC_adv'} ne '')) {
1210: $val = $settings{$crstype}{'_LC_adv'};
1211: @{$inststatuses} = ('_LC_adv_');
1212: } else {
1213: if ($userenv{'inststatus'} ne '') {
1214: @{$inststatuses} = split(',',$userenv{'inststatus'});
1215: } else {
1216: @{$inststatuses} = ('default');
1217: }
1218: foreach my $status (@{$inststatuses}) {
1219: if (exists($settings{$crstype}{$status})) {
1220: my $value = $settings{$crstype}{$status};
1221: next unless ($value);
1222: unless (exists($alltasks{$value})) {
1223: if (ref($alltasks{$value}) eq 'ARRAY') {
1224: unless(grep(/^\Q$status\E$/,@{$alltasks{$value}})) {
1225: push(@{$alltasks{$value}},$status);
1226: }
1227: } else {
1228: @{$alltasks{$value}} = ($status);
1229: }
1230: }
1231: }
1232: }
1233: my $maxlimit = 0;
1234:
1235: foreach my $key (sort(keys(%alltasks))) {
1236: if ($key =~ /^autolimit=(\d*)$/) {
1237: if ($1 eq '') {
1238: $val ='autolimit=';
1239: last;
1240: } elsif ($1 > $maxlimit) {
1241: $maxlimit = $1;
1242: }
1243: }
1244: }
1245: if ($maxlimit) {
1246: $val = 'autolimit='.$maxlimit;
1247: } else {
1248: foreach my $option (@options) {
1249: if ($alltasks{$option}) {
1250: $val = $option;
1251: last;
1252: }
1253: }
1254: }
1255: }
1256: }
1257: }
1258: }
1259: } else {
1260: %userenv = &Apache::lonnet::userenvironment($udom,$uname,'reqcrsotherdom.'.$crstype);
1261: if ($userenv{'reqcrsotherdom.'.$crstype}) {
1262: my @doms = split(',',$userenv{'reqcrsotherdom.'.$crstype});
1263: my $optregex = join('|',@options);
1264: foreach my $item (@doms) {
1265: my ($extdom,$extopt) = split(':',$item);
1266: if ($extdom eq $dom) {
1267: if ($extopt =~ /^($optregex)(=?\d*)$/) {
1268: $val = $1.$2;
1269: }
1270: last;
1271: }
1272: }
1273: @{$inststatuses} = ('_external_');
1274: }
1275: }
1276: return $val;
1277: }
1278:
1.14 raeburn 1279: sub queued_selfenrollment {
1280: my ($notitle) = @_;
1281: my $output;
1282: my %selfenrollrequests = &Apache::lonnet::dump('selfenrollrequests');
1283: my %reqs_by_date;
1284: foreach my $item (keys(%selfenrollrequests)) {
1285: if (ref($selfenrollrequests{$item}) eq 'HASH') {
1286: if ($selfenrollrequests{$item}{'status'} eq 'request') {
1287: if ($selfenrollrequests{$item}{'timestamp'}) {
1288: push(@{$reqs_by_date{$selfenrollrequests{$item}{'timestamp'}}},$item);
1289: }
1290: }
1291: }
1292: }
1293: if (keys(%reqs_by_date)) {
1294: unless ($notitle) {
1295: $output .= '<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />';
1296: }
1297: $output .= &Apache::loncommon::start_data_table().
1298: &Apache::loncommon::start_data_table_header_row().
1299: '<th>'.&mt('Date requested').'</th><th>'.&mt('Course title').'</th>'.
1300: '<th>'.&mt('User role').'</th><th>'.&mt('Section').'</th>'.
1301: &Apache::loncommon::end_data_table_header_row();
1302: my @sorted = sort { $a <=> $b } (keys(%reqs_by_date));
1303: foreach my $item (@sorted) {
1304: if (ref($reqs_by_date{$item}) eq 'ARRAY') {
1305: foreach my $crs (@{$reqs_by_date{$item}}) {
1306: my %courseinfo = &Apache::lonnet::coursedescription($crs);
1307: my $usec = $selfenrollrequests{$crs}{'section'};
1.16 raeburn 1308: my $rolename = &Apache::lonnet::plaintext('st',$courseinfo{'type'},$crs);
1.14 raeburn 1309: if ($usec eq '') {
1310: $usec = &mt('No section');
1311: }
1312: $output .= &Apache::loncommon::start_data_table_row().
1313: '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'.
1314: '<td>'.$courseinfo{'description'}.'</td>'.
1315: '<td>'.$rolename.'</td><td>'.$usec.'</td>'.
1316: &Apache::loncommon::end_data_table_row();
1317: }
1318: }
1319: }
1320: $output .= &Apache::loncommon::end_data_table();
1321: }
1322: return $output;
1323: }
1324:
1.19 raeburn 1325: sub update_coursereq_status {
1.26 raeburn 1326: my ($reqhash,$dom,$cnum,$reqstatus,$context,$udom,$uname) = @_;
1.19 raeburn 1327: my ($storeresult,$statusresult,$output);
1328: my $requestkey = $dom.'_'.$cnum;
1329: if ($requestkey =~ /^($match_domain)_($match_courseid)$/) {
1330: $storeresult = &Apache::lonnet::store_userdata($reqhash,$requestkey,
1.26 raeburn 1331: 'courserequests',$udom,$uname);
1.19 raeburn 1332: if ($storeresult eq 'ok') {
1333: my %status = (
1334: 'status:'.$dom.':'.$cnum => $reqstatus,
1335: );
1.26 raeburn 1336: $statusresult = &Apache::lonnet::put('courserequests',\%status,$udom,$uname);
1.19 raeburn 1337: }
1338: } else {
1339: $storeresult = 'error: invalid requestkey format';
1340: }
1341: if ($storeresult ne 'ok') {
1342: $output = &mt('An error occurred saving a record of the details of your request: [_1].',$storeresult);
1343: if ($context eq 'domain') {
1344: $output .= "\n";
1345: } else {
1346: $output = '<span class="LC_warning">'.$output.'</span><br />';
1347: }
1.26 raeburn 1348: &Apache::lonnet::logthis("Error saving course request - $requestkey for $uname:$udom - $storeresult");
1.19 raeburn 1349: } elsif ($statusresult ne 'ok') {
1350: $output = &mt('An error occurred saving a record of the status of your request: [_1].',$statusresult);
1351: if ($context eq 'domain') {
1352: $output .= "\n";
1353: } else {
1354: $output = '<span class="LC_warning">'.$output.'</span><br />';
1355: }
1.26 raeburn 1356: &Apache::lonnet::logthis("Error saving course request status for $requestkey (for $uname:$udom) - $statusresult");
1.19 raeburn 1357: }
1358: return ($storeresult,$output);
1359: }
1360:
1.23 raeburn 1361: sub process_official_reqs {
1.26 raeburn 1362: my ($context,$dom,$dcname,$dcdom) = @_;
1.23 raeburn 1363: my $reqsnamespace = 'courserequestqueue';
1364: my %requesthash =
1.24 raeburn 1365: &Apache::lonnet::dump_dom($reqsnamespace,$dom,'_pending');
1.23 raeburn 1366: my (%newcids,%longroles,%stillpending);
1367: my @courseroles = ('cc','in','ta','ep','ad','st');
1368: foreach my $role (@courseroles) {
1369: $longroles{$role}=&Apache::lonnet::plaintext($role);
1370: }
1371: my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
1372: my ($output,$linefeed);
1373: if ($context eq 'auto') {
1374: $linefeed = "\n";
1375: } else {
1376: $linefeed = '<br />'."\n";
1377: }
1378: foreach my $key (keys(%requesthash)) {
1379: my ($cnum,$status) = split('_',$key);
1380: next if (&Apache::lonnet::homeserver($cnum,$dom) ne 'no_host');
1381: if (ref($requesthash{$key}) eq 'HASH') {
1382: my $ownername = $requesthash{$key}{'ownername'};
1383: my $ownerdom = $requesthash{$key}{'ownerdom'};
1384: next if (&Apache::lonnet::homeserver($ownername,$ownerdom) eq 'no_host');
1385: my $inststatus;
1386: my %userenv =
1387: &Apache::lonnet::get('environment',['inststatus'],
1388: $ownerdom,$ownername);
1389: my ($tmp) = keys(%userenv);
1390: if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
1391: $inststatus = $userenv{'inststatus'};
1392: } else {
1393: undef(%userenv);
1394: }
1395: my $reqkey = $dom.'_'.$cnum;
1396: my %history = &Apache::lonnet::restore($reqkey,'courserequests',
1397: $ownerdom,$ownername);
1398: if (ref($history{'details'}) eq 'HASH') {
1399: my $instcode = $history{'details'}{'instcode'};
1400: my $crstype = $history{'details'}{'crstype'};
1401: my $reqtime = $history{'details'}{'reqtime'};
1402: my $cdescr = $history{'details'}{'cdescr'};
1403: my @currsec;
1404: my $sections = $history{'details'}{'sections'};
1405: if (ref($sections) eq 'HASH') {
1406: foreach my $i (sort(keys(%{$sections}))) {
1407: if (ref($sections->{$i}) eq 'HASH') {
1408: my $sec = $sections->{$i}{'inst'};
1409: if (!grep(/^\Q$sec\E$/,@currsec)) {
1410: push(@currsec,$sec);
1411: }
1412: }
1413: }
1414: }
1415: my $instseclist = join(',',@currsec);
1416: my ($validationchk,$disposition,$reqstatus,$message,
1417: $validation,$validationerror);
1418: $validationchk =
1419: &Apache::lonnet::auto_courserequest_validation($dom,
1420: $ownername.':'.$ownerdom,$crstype,$inststatus,
1421: $instcode,$instseclist);
1422: if ($validationchk =~ /:/) {
1423: ($validation,$message) = split(':',$validationchk);
1424: } else {
1425: $validation = $validationchk;
1426: }
1427: if ($validation =~ /^error(.*)$/) {
1428: $disposition = 'approval';
1429: $validationerror = $1;
1430: } else {
1431: $disposition = $validation;
1432: }
1433: $reqstatus = $disposition;
1434: if ($disposition eq 'process') {
1435: my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg);
1436: my $result = &course_creation($dom,$cnum,'domain',$history{'details'},\$logmsg,\$newusermsg,\$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles);
1437: if ($result eq 'created') {
1438: $disposition = 'created';
1439: $reqstatus = 'created';
1.26 raeburn 1440: my $cid = $dom.'_'.$cnum;
1441: push(@{$newcids{$instcode}},$cid);
1442: if ($dcname && $dcdom) {
1443: my $firsturl = &course_portal_url($cnum,$dom);
1444: my $beneficiary = 'pendingrequestor';
1445: my $now = time;
1446: my $owner = $ownername.':'.$ownerdom;
1447: my $approvedmsg =
1448: [{
1.27 raeburn 1449: mt => 'Your requested course: [_1], (queued pending validation) has now been created.',
1450: args => [$cdescr],
1.26 raeburn 1451: },
1452: {
1.28 raeburn 1453: mt => 'Visit [_1] to log-in and access the course.',
1.26 raeburn 1454: args => [$firsturl],
1.27 raeburn 1455: },
1456: {
1457: mt => 'If currently logged-in to LON-CAPA, log-out and log-in again to select your new course role.'
1.26 raeburn 1458: }];
1459: my $sender = $dcname.':'.$dcdom;
1460: &send_selfserve_notification($owner,$approvedmsg,
1461: $cid,$cdescr,$now,
1462: $beneficiary,$sender,
1463: undef,undef,$crstype);
1464: }
1.23 raeburn 1465: }
1466: } elsif ($disposition eq 'rejected') {
1467: $output .= &mt('Queued course request for [_1] submitted by [_2] with status [_3] rejected when validating.',$instcode,$ownername.':'.$ownerdom,$inststatus).$linefeed;
1468: } elsif ($disposition eq 'approval') {
1469: $output .= &mt('Queued course request for [_1] submitted by [_2] with status [_3] switched to "approval by DC" because of validation error: [_4].',$instcode,$ownername.':'.$ownerdom,$inststatus,$validationerror).$linefeed;
1470:
1471: my $requestid = $cnum.'_'.$disposition;
1472: my $request = {
1473: $requestid => {
1474: timestamp => $reqtime,
1475: crstype => $crstype,
1476: ownername => $ownername,
1477: ownerdom => $ownerdom,
1478: description => $cdescr,
1479: },
1480: };
1481: my $putresult = &Apache::lonnet::newput_dom('courserequestqueue',$request,$dom);
1482: unless ($putresult eq 'ok') {
1483: $output .= &mt("An error occurred saving the modified course request for [_1] submitted by [_2] in the domain's courserequestqueue.db.",$instcode,$ownername.':'.$ownerdom).$linefeed;
1484: }
1485: } elsif ($disposition eq 'pending') {
1486: my $instcode = $requesthash{$key}{'instcode'};
1487: my $description = $requesthash{$key}{'description'};
1488: my $timestamp = $requesthash{$key}{'timestamp'};
1489: my $entry = $cnum.':'.$ownername.':'.$ownerdom.':'.
1490: $instcode.':'.$description;
1491: if (ref($stillpending{$timestamp}) eq 'ARRAY') {
1492: push(@{$stillpending{$timestamp}},$entry);
1493: } else {
1494: $stillpending{$timestamp} = [$entry];
1495: }
1496: }
1497: unless ($disposition eq 'pending') {
1498: my ($statusresult,$output) =
1499: &update_coursereq_status(\%requesthash,$dom,$cnum,
1.26 raeburn 1500: $reqstatus,'domain',$ownerdom,
1501: $ownername);
1.23 raeburn 1502: unless (&Apache::lonnet::del_dom($reqsnamespace,[$cnum.'_pending'],$dom) eq 'ok') {
1503: $output .= &mt('An error occurred when removing the request for [_1] submitted by [_2] from the pending queue.',$instcode,$ownername.':'.$ownerdom).$linefeed;
1504: }
1505: }
1506: }
1507: }
1508: }
1509: foreach my $key (sort(keys(%newcids))) {
1510: if (ref($newcids{$key}) eq 'ARRAY') {
1511: $output .= "created course from queued request: $key - ".join(', ',@{$newcids{$key}}).$linefeed;
1512: my $newcourse = &LONCAPA::escape($key.':'.$newcids{$key});
1513: }
1514: }
1515: unless ($context eq 'auto') {
1516: if (keys(%stillpending) > 0) {
1517: $output .= '<form method="post" name="changequeue" action="/adm/createcourse" />'."\n".
1518: '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n".
1519: '<input type="hidden" name="phase" value="requestchange" />'.
1520: '<p>'.&mt('For the following requests, the requestor could [_1]not[_2] be validated as official course personnel, so the request remains in the pending queue.','<b>','</b>').'<br />'.&mt('Requests may be left in the queue, or you can manually approve or reject them.').'</p>'.
1521: &build_queue_display($dom,'stillpending',\%stillpending).
1522: '<br /><input type="hidden" name="queue" value="pending" />'."\n".
1523: '<input type="submit" name="processqueue" value="'.&mt('Save').'" />'.
1524: '</form>';
1525: }
1526: }
1527: return $output;
1528: }
1529:
1.1 raeburn 1530: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>