--- loncom/interface/loncoursequeueadmin.pm 2009/08/11 00:39:45 1.1
+++ loncom/interface/loncoursequeueadmin.pm 2009/08/16 19:16:16 1.2
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Utilities to administer domain course requests and course self-enroll requests
#
-# $Id: loncoursequeueadmin.pm,v 1.1 2009/08/11 00:39:45 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.2 2009/08/16 19:16:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -62,30 +62,28 @@ use Apache::lonnet;
use Apache::loncommon;
use Apache::lonmsg;
use Apache::lonlocal;
+use Apache::lonuserutils;
use LONCAPA;
sub send_selfserve_notification {
- my ($notifylist,$textstr,$cid,$coursedesc,$timestamp,$context,$sender,
+ my ($notifylist,$textstr,$cid,$contextdesc,$timestamp,$context,$sender,
$approvedlist,$rejectedlist) = @_;
# 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,$namelink);
- $namelink = &Apache::loncommon::aboutmewrapper(
- &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}));
+ my ($rawsubj,@rawmsg,$subject,$message,$reviewer);
if ($context eq 'coursemanagers') {
$rawsubj = 'Self-enrollment requests processed';
push(@rawmsg,{
- mt => 'Enrollment requests in the following course: [_1] have been processed.',
- args => ["\n$coursedesc\n"],
+ mt => 'Enrollment requests in the following course: [_1]have been processed.',
+ args => ["\n $contextdesc\n"],
});
} elsif ($context eq 'domainmanagers') {
- $rawsubj = 'Course request';
+ $rawsubj = 'Course requests reviewed';
push(@rawmsg,{
- mt => 'Your request for creation of the following course: [_1], requested on [_2], has been reviewed by a Domain Coordinator.',
- args => ["\n$coursedesc\n","$timestamp\n"],
-
+ mt => 'Course creation requests in the following domain: [_1]have been reviewed.',
+ args => ["\n $contextdesc\n"],
});
if (ref($textstr) eq 'ARRAY') {
push(@rawmsg,@{$textstr});
@@ -93,8 +91,8 @@ sub send_selfserve_notification {
} elsif ($context eq 'enroller') {
$rawsubj = 'Enrollment request';
push(@rawmsg,{
- mt => 'Your request for enrollment in the following course: [_1], requested on [_2], has been reviewed by a Course Coordinator.',
- args => ["\n$coursedesc\n","$timestamp\n"],
+ mt => 'Your request for enrollment in the following course: [_1]requested on [_2]has been reviewed by a Course Coordinator.',
+ args => ["\n ".$contextdesc.",\n",$timestamp.",\n"],
});
if (ref($textstr) eq 'ARRAY') {
@@ -103,32 +101,43 @@ sub send_selfserve_notification {
} elsif ($context eq 'courserequestor') {
$rawsubj = 'Course request';
push(@rawmsg,{
- mt => 'Your request for creation of the following course: [_1], requested on [_2], has been reviewed by a Domain Coordinator.',
- args => ["\n$coursedesc\n","$timestamp\n"],
+ mt => 'Your request for creation of the following course: [_1]requested on [_2]has been reviewed by a Domain Coordinator.',
+ args => ["\n".$contextdesc.",\n",$timestamp.",\n"],
});
if (ref($textstr) eq 'ARRAY') {
push(@rawmsg,@{$textstr});
}
} elsif ($context eq 'coursereq') {
+ $rawsubj = 'Course request to review',
push(@rawmsg,{
- mt => 'Creation of the following course: [_1] was requested by [_2] on [_3].',
- args => ["\n$coursedesc\n",$textstr,$timestamp],
+ mt => 'Creation of the following course: [_1]was requested by [_2] on [_3].',
+ args => ["\n $contextdesc\n",$textstr,$timestamp],
},
{
- mt =>'As Domain Coordinator, use: [_1]Main Menu -> Create a new course -> Manage Course Requests[_1] to display a list of pending course requests,[_1] which you can either approve or reject.',
- args => ["\n"],
+ mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Create a new course -> Approve or reject course requests[_3]to display a list of pending requests, which you can either approve or reject.',
+ args => ["\n","\n\n ","\n\n"],
});
} elsif ($context eq 'selfenrollreq') {
$rawsubj = 'Self-enrollment request';
push(@rawmsg,{
mt => 'Enrollment in the following course: [_1] was requested by [_2] on [_3].',
- args => ["\n$coursedesc\n",$textstr,$timestamp],
- },
+ args => ["\n $contextdesc\n",$textstr,$timestamp."\n"],
+ });
+ if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') {
+ push(@rawmsg,
+ {
+ mt =>'As 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.',
+ args => [" \n\n","\n"],
+ });
+ } else {
+ push(@rawmsg,
{
- mt =>'As Course Coordinator, use: [_1]Main Menu -> Manage Course Users -> Enrollment Requests[_1] to display a list of pending enrollment requests,[_1] which you can either approve or reject.',
- args => ["\n"],
+ mt =>'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.',
+ args => [" \n\n","\n"],
});
+
+ }
}
my @to_notify = split(/,/,$notifylist);
my $numsent = 0;
@@ -149,7 +158,7 @@ sub send_selfserve_notification {
my ($uname,$udom);
if ($sender =~ /:/) {
($uname,$udom) = split(/:/,$sender);
- } else {
+ } elsif ($context eq 'course') {
$uname = $sender;
my %courseinfo = &Apache::lonnet::coursedescription($cid);
$udom = $courseinfo{'num'};
@@ -202,21 +211,23 @@ sub send_selfserve_notification {
sub display_queued_requests {
my ($context,$dom,$cnum) = @_;
- my ($namespace,$formaction,%requesthash);
+ my ($namespace,$formaction,$nextelement,%requesthash);
if ($context eq 'course') {
$formaction = '/adm/createuser';
$namespace = 'selfenrollrequests';
%requesthash = &Apache::lonnet::dump($namespace,$dom,$cnum);
+ $nextelement = '';
} else {
$formaction = '/adm/createcourse';
$namespace = 'courserequestqueue';
%requesthash = &Apache::lonnet::dump_dom($namespace,$dom,undef,'_approval');
+ $nextelement = '';
}
my ($output,%queue_by_date,%crstypes);
if (keys(%requesthash) > 0) {
- $output = '