--- loncom/interface/lonrequestcourse.pm 2013/05/11 21:10:31 1.67
+++ loncom/interface/lonrequestcourse.pm 2013/12/24 19:15:11 1.69
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.67 2013/05/11 21:10:31 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.69 2013/12/24 19:15:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -136,7 +136,7 @@ sub handler {
my (%states,%stored);
my ($jscript,$uname,$udom,$result,$warning,$showcredits,$instcredits);
my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
- if ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'}) {
+ if ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'} || $domdefs{'textbookcredits'}) {
$showcredits = 1;
}
@@ -614,7 +614,7 @@ sub form_elements {
if ($showcredits && $instcredits eq '') {
$extras{'coursecredits'} = 'text';
}
- } elsif ($env{'form.crstype'} eq 'unofficial') {
+ } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
if ($showcredits) {
$extras{'coursecredits'} = 'text';
}
@@ -721,7 +721,8 @@ $nextstate_setter
function check_can_request(crschoice,actionchoice) {
var official = '';
var unofficial = '';
- var community = '';
+ var community = '';
+ var textbook = '';
END
if (ref($can_request) eq 'HASH') {
foreach my $item (keys(%{$can_request})) {
@@ -733,7 +734,8 @@ END
my %lt = &Apache::lonlocal::texthash(
official => 'You are not permitted to request creation of an official course in this domain.',
unofficial => 'You are not permitted to request creation of an unofficial course in this domain.',
- community => 'You are not permitted to request creation of a community this domain.',
+ community => 'You are not permitted to request creation of a community in this domain.',
+ textbook => 'You are not permitted to request creation of a textbook course in this domain',
all => 'You must choose a specific course type when making a new course request.',
allt => '"All types" is not allowed.',
);
@@ -756,10 +758,17 @@ END
return false;
}
} else {
- if (actionchoice == 'new') {
- alert('$lt{'all'}'+'\\n'+'$lt{'allt'}');
- return false;
- }
+ if (crschoice == 'textbook') {
+ if (textbook != 1) {
+ alert("$lt{'community'}");
+ return false;
+ }
+ } else {
+ if (actionchoice == 'new') {
+ alert('$lt{'all'}'+'\\n'+'$lt{'allt'}');
+ return false;
+ }
+ }
}
}
}
@@ -768,7 +777,7 @@ END
END
my ($pagetitle,$pageinfo,$domaintitle);
if (ref($can_request) eq 'HASH') {
- if (($can_request->{'official'}) || ($can_request->{'unofficial'})) {
+ if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || $can_request->{'textbook'}) {
if ($can_request->{'community'}) {
$pagetitle = 'Course/Community Requests';
$pageinfo = &mt('Request creation of a new course or community, or review your pending requests.');
@@ -945,6 +954,8 @@ END
$title = &mt('Pending requests for official courses');
} elsif ($env{'form.crstype'} eq 'unofficial') {
$title = &mt('Pending requests for unofficial courses');
+ } elsif ($env{'form.crstype'} eq 'textbook') {
+ $title = &mt('Pending requests for textbook courses');
} else {
$title = &mt('Pending course/community requests');
}
@@ -1771,7 +1782,7 @@ sub print_enrollment_menu {
$hascredits = 1;
}
}
- } elsif ($env{'form.crstype'} eq 'unofficial') {
+ } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
if ($showcredits) {
$creditsrow = ''.
' 'Requestor is automatically assigned Course Coordinator role.',
);
$lt{'unofficial'} = $lt{'official'};
+ $lt{'textbook'} = $lt{'textbook'};
$output .= &Apache::lonhtmlcommon::row_headline().
''.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'
';
}
@@ -2306,8 +2318,8 @@ ENDJS
}
sub viewcancel_javascript {
- my $alert = &mt('Are you sure you want to cancel this request?\\n'.
- 'Your request will be removed.');
+ my $alert = &mt('Are you sure you want to cancel this request?').'\\n'.
+ &mt('Your request will be removed.');
return << "ENDJS";
function nextPage(formname,nextstate) {
if (confirm('$alert')) {
@@ -2514,7 +2526,7 @@ sub reqstatus_names {
rejected => 'Request rejected',
cancelled => 'Request cancelled',
);
- if (($crstype eq 'official') || ($crstype eq 'unofficial')) {
+ if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) {
$statusnames{'created'} = &mt('Course created');
} elsif ($crstype eq 'community') {
$statusnames{'created'} = &mt('Community created');
@@ -2731,7 +2743,7 @@ sub print_review {
$section_values .= $xlistinfo;
}
$section_values .= '';
- } elsif ($env{'form.crstype'} eq 'unofficial') {
+ } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
$inst_headers .= '