--- loncom/interface/loncoursequeueadmin.pm 2010/03/30 15:23:51 1.23
+++ loncom/interface/loncoursequeueadmin.pm 2012/08/15 14:37:13 1.31
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Utilities to administer domain course requests and course self-enroll requests
#
-# $Id: loncoursequeueadmin.pm,v 1.23 2010/03/30 15:23:51 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.31 2012/08/15 14:37:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -70,6 +70,14 @@ described at http://www.lon-capa.org.
=item process_official_reqs()
+=item is_active_author()
+
+=item author_prompt()
+
+=item reqauthor_check()
+
+=item process_reqauthor()
+
=back
=cut
@@ -90,19 +98,28 @@ sub send_selfserve_notification {
# FIXME locallocaltime needs to be able to take $sender_lh as an argument
# so this can be localized to the recipients date display format/time zone
$timestamp =&Apache::lonlocal::locallocaltime($timestamp);
- my $msgcc;
- my ($rawsubj,@rawmsg,$subject,$message,$reviewer,$msgtxt);
+ my ($msgcc,$rawsubj,@rawmsg,$subject,$message,$reviewer,$msgtxt);
+ my ($senderuname,$senderudom) = split(':',$sender);
if ($context eq 'coursemanagers') {
$rawsubj = 'Self-enrollment requests processed';
push(@rawmsg,{
mt => 'Enrollment requests in the following course: [_1] have been processed.',
- args => ["\n $contextdesc"],
+ args => ["\n$contextdesc"],
});
} elsif ($context eq 'domainmanagers') {
$rawsubj = 'Course/Community requests reviewed';
push(@rawmsg,{
- mt => 'Course/Community creation requests in the following domain: [_1] have been reviewed.',
- args => ["\n $contextdesc"],
+ mt => 'Course/Community creation requests in the following domain: "[_1]" have been reviewed.',
+ args => ["\n$contextdesc"],
+ });
+ if (ref($textstr) eq 'ARRAY') {
+ push(@rawmsg,@{$textstr});
+ }
+ } elsif ($context eq 'authormanagers') {
+ $rawsubj = 'Authoring space requests reviewed';
+ push(@rawmsg,{
+ mt => 'Authoring requests in the following domain: "[_1]" have been reviewed.',
+ args => ["\n$contextdesc"],
});
if (ref($textstr) eq 'ARRAY') {
push(@rawmsg,@{$textstr});
@@ -138,6 +155,15 @@ sub send_selfserve_notification {
if (ref($textstr) eq 'ARRAY') {
push(@rawmsg,@{$textstr});
}
+ } elsif ($context eq 'pendingrequestor') {
+ if ($crstype eq 'Community') {
+ $rawsubj = 'Community request';
+ } else {
+ $rawsubj = 'Processed course request';
+ }
+ if (ref($textstr) eq 'ARRAY') {
+ push(@rawmsg,@{$textstr});
+ }
} elsif ($context eq 'coursereq') {
if ($crstype eq 'community') {
$rawsubj = 'Community request to review';
@@ -152,14 +178,14 @@ sub send_selfserve_notification {
},
{
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.',
- args => ["\n","\n\n ","\n\n"],
+ args => ["\n","\n\n","\n\n"],
});
} elsif ($context eq 'selfenrollreq') {
$rawsubj = 'Self-enrollment request';
if ($crstype eq 'community') {
- $msgtxt = 'Enrollment in the following community: [_1] was requested by [_2] on [_3].'
+ $msgtxt = 'Enrollment in the following community: [_1]was requested by [_2] on [_3].'
} else {
- $msgtxt = 'Enrollment in the following course: [_1] was requested by [_2] on [_3].'
+ $msgtxt = 'Enrollment in the following course: [_1]was requested by [_2] on [_3].'
}
push(@rawmsg,{
mt => $msgtxt,
@@ -176,7 +202,28 @@ sub send_selfserve_notification {
mt => $directions,
args => [" \n\n","\n"],
});
+ } elsif ($context eq 'authorreq') {
+ $rawsubj = 'Authoring space request to review';
+ $msgtxt = 'Assignment of an author role in the [_1] domain[_2]was requested by [_3] on [_4].';
+ push(@rawmsg,{
+ mt => $msgtxt,
+ args => [$contextdesc,"\n",$textstr,$timestamp],
+ },
+ {
+ mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Create users or modify the roles and privileges of users -> Authoring space reqests[_3]to display a list of pending requests, which you can either approve or reject.',
+ args => ["\n","\n\n ","\n\n"],
+ });
+ } elsif ($context eq 'requestauthor') {
+ $rawsubj = 'Authoring space request';
+ $msgtxt = 'Your request for an authoring space requested on [_1]has been reviewed by a Domain Coordinator.';
+ push(@rawmsg,{
+ mt => $msgtxt,
+ args => [$timestamp."\n"],
+ });
+ if (ref($textstr) eq 'ARRAY') {
+ push(@rawmsg,@{$textstr});
+ }
}
my @to_notify = split(/,/,$notifylist);
my $numsent = 0;
@@ -213,7 +260,7 @@ sub send_selfserve_notification {
$message .= &Apache::lonlocal::mt_user($sender_lh,$item->{mt},@{$item->{args}})."\n";
}
}
- &Apache::lonmsg::process_sent_mail($subject,'',$numsent,$stamp,$uname,$udom,$msgcount,$cid,$$,$message,\@recusers,\@recudoms);
+ &Apache::lonmsg::process_sent_mail($subject,'',$numsent,$stamp,$uname,$udom,$msgcount,$cid,$$,$message,\@recusers,\@recudoms,undef,undef,undef,undef,$senderuname,$senderudom);
my ($recipid,$recipstatus) = &Apache::lonmsg::store_recipients($subject,$uname,$udom,\%reciphash);
my $status;
foreach my $recip (sort(keys(%{$msgcc}))) {
@@ -241,6 +288,13 @@ sub send_selfserve_notification {
if ($rejectedlist) {
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected course requests:')."\n".$rejectedlist;
}
+ } elsif ($context eq 'authormanagers') {
+ if ($approvedlist) {
+ $message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved author role requests:')."\n".$approvedlist;
+ }
+ if ($rejectedlist) {
+ $message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected author role requests:')."\n".$rejectedlist;
+ }
}
$status .= &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message,undef,undef,undef,1,\%sentmessage,undef,undef,undef,1,$recipid).',';
}
@@ -256,15 +310,22 @@ sub display_queued_requests {
$namespace = 'selfenrollrequests';
%requesthash = &Apache::lonnet::dump($namespace,$dom,$cnum);
$nextelement = '';
+ } elsif ($context eq 'requestauthor') {
+ $formaction = '/adm/createuser';
+ $namespace = 'requestauthorqueue';
+ %requesthash = &Apache::lonnet::dump_dom($namespace,$dom);
+ $nextelement = '';
} else {
$formaction = '/adm/createcourse';
$namespace = 'courserequestqueue';
my $disposition = 'approval';
+ my $nextphase = 'requestchange';
if ($context eq 'pending') {
$disposition = 'pending';
+ $nextphase = 'requestvalidation';
}
%requesthash = &Apache::lonnet::dump_dom($namespace,$dom,'_'.$disposition);
- $nextelement = '';
+ $nextelement = '';
}
my ($output,%queue_by_date);
if (keys(%requesthash) > 0) {
@@ -276,6 +337,9 @@ sub display_queued_requests {
if ($context eq 'course') {
($timestamp, my $usec) = split(/:/,$requesthash{$item});
$entry = $item.':'.$usec;
+ } elsif ($context eq 'requestauthor') {
+ $timestamp = $requesthash{$item};
+ ($entry) = ($item =~ /^($match_username)_approval$/);
} else {
$timestamp = $requesthash{$item}{'timestamp'};
if (ref($requesthash{$item}) eq 'HASH') {
@@ -305,8 +369,10 @@ sub display_queued_requests {
$output .= '
'.&mt('Requests for official courses queued pending validation').'
'.
'
'.&mt('Requests are validated against institutional data to confirm that the requestor is an instructor of record.').' '.
&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.').'
'.&mt('Requests for authoring space queued pending approval by a Domain Coordinator').'
';
} else {
- $output .= '
'.&mt('Course/Community requests queued pending approval by a Domain Coordinator').'
';
+ $output .= '
'.&mt('Course/Community requests queued pending approval by a Domain Coordinator').'
';
}
$output .= &build_queue_display($dom,$context,\%queue_by_date).
'';
@@ -316,14 +382,16 @@ sub display_queued_requests {
$output .= &mt('There are currently no enrollment requests awaiting approval.');
} elsif ($context eq 'pending') {
$output .= &mt('There are currently no requests for official courses awaiting validation.');
+ } elsif ($context eq 'requestauthor') {
+ $output .= &mt('There are currently no requests for authoring space awaiting approval.');
} elsif ($context eq 'domain') {
$output .= &mt('There are currently no course or community requests awaiting approval.');
}
$output .= '';
}
if ($context eq 'pending') {
- $output .= '
'."\n".
+ $output .= '
'."\n".
'
'.&mt('Any course/community requests which are successfully validated will be created immediately.').' '.&mt('Unvalidated requests will be listed for manual approval/rejection.').'
';
+ foreach my $uname (@rejections) {
+ my $userlink =
+ &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$cdom),$uname,$cdom);
+ $output .= '
'.$userlink.'
';
+ }
+ $output .= '
';
+ }
+ if ($notifylist ne '') {
+ &send_selfserve_notification($notifylist,$chgmsg,undef,$domdesc,
+ $now,'authormanagers',$sender,
+ $approvedlist,$rejectedlist);
+ }
} else {
$chgmsg = "'Action was taken on the following course and community requests by [_1].',$namelink";
if (@completed) {
@@ -861,6 +1080,14 @@ sub update_request_queue {
$output .= '
'.&mt('The following authoring space requests were deleted because the requestor does not have a LON-CAPA account:').'
';
+ foreach my $uname (@invalidusers) {
+ my $userlink =
+ &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$cdom),$uname,$cdom);
+ $output .= '
'.$userlink.'
';
+ }
+ $output .= '
';
}
}
if (@limitexceeded) {
@@ -911,17 +1153,27 @@ sub update_request_queue {
}
}
if (@nopermissions) {
- $output .= '
'.&mt('The following course/community creation requests could not be processed because the owner does not have rights to create this type of course:').'
';
- foreach my $cnum (@nopermissions) {
- my $showcourse;
- if (ref($requesthash{$cnum.'_'.$queue})) {
- $showcourse = $requesthash{$cnum.'_'.$queue}{'description'};
- } else {
- $showcourse = $cnum;
+ if ($context eq 'course') {
+ $output .= '
'.&mt('The following course/community creation requests could not be processed because the owner does not have rights to create this type of course:').'