--- loncom/interface/loncoursequeueadmin.pm 2011/08/26 15:57:56 1.28
+++ loncom/interface/loncoursequeueadmin.pm 2013/07/24 18:21:39 1.36
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Utilities to administer domain course requests and course self-enroll requests
#
-# $Id: loncoursequeueadmin.pm,v 1.28 2011/08/26 15:57:56 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.36 2013/07/24 18:21:39 bisitz 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
@@ -96,13 +104,22 @@ sub send_selfserve_notification {
$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});
@@ -161,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,
@@ -185,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;
@@ -250,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).',';
}
@@ -265,6 +310,11 @@ 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';
@@ -287,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') {
@@ -316,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).
'';
@@ -327,6 +382,8 @@ 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.');
}
@@ -367,6 +424,8 @@ sub build_queue_display {
if ($context eq 'course') {
$output .= '
';
+ 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) {
@@ -874,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) {
@@ -924,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:').'