--- loncom/interface/lonrequestcourse.pm 2009/10/24 03:24:13 1.37
+++ loncom/interface/lonrequestcourse.pm 2013/05/11 21:10:31 1.67
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.37 2009/10/24 03:24:13 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.67 2013/05/11 21:10:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,8 +94,6 @@ described at http://www.lon-capa.org.
=item print_request_outcome()
-=item get_processtype()
-
=item check_autolimit()
=item retrieve_settings()
@@ -130,17 +128,21 @@ sub handler {
}
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['action','showdom','cnum','state']);
+ ['action','showdom','cnum','state','crstype','queue']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
my $dom = &get_course_dom();
my $action = $env{'form.action'};
my $state = $env{'form.state'};
my (%states,%stored);
- my ($jscript,$uname,$udom,$result,$warning);
+ my ($jscript,$uname,$udom,$result,$warning,$showcredits,$instcredits);
+ my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
+ if ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'}) {
+ $showcredits = 1;
+ }
$states{'display'} = ['details'];
$states{'view'} = ['pick_request','details','cancel','removal'];
- $states{'log'} = ['filter','display'];
+ $states{'log'} = ['display'];
$states{'new'} = ['courseinfo','enrollment','personnel','review','process'];
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) {
@@ -149,6 +151,12 @@ sub handler {
}
}
+ if (($action eq 'new') && (&Apache::loncoursequeueadmin::author_prompt())) {
+ if (ref($states{$action}) eq 'ARRAY') {
+ push(@{$states{$action}},'reqauthor');
+ }
+ }
+
foreach my $key (keys(%states)) {
if (ref($states{$key}) eq 'ARRAY') {
unshift (@{$states{$key}},'crstype');
@@ -157,31 +165,33 @@ sub handler {
my @invalidcrosslist;
my %trail = (
- crstype => 'Course Request Action',
+ crstype => 'Request Action',
codepick => 'Category',
courseinfo => 'Description',
enrollment => 'Access Dates',
personnel => 'Personnel',
review => 'Review',
process => 'Result',
+ reqauthor => 'Authoring Space Result',
pick_request => 'Display Summary',
details => 'Request Details',
cancel => 'Cancel Request',
removal => 'Outcome',
+ display => 'Request Logs',
);
if (($env{'form.crstype'} eq 'official') && (&Apache::lonnet::auto_run('',$dom))) {
$trail{'enrollment'} = 'Enrollment';
}
- my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) =
+ my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) =
&get_breadcrumbs($dom,$action,\$state,\%states,\%trail);
if ($action eq 'display') {
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
- my $namespace = 'courserequestqueue';
if ($env{'form.cnum'} ne '') {
my $cnum = $env{'form.cnum'};
- my $reqkey = $cnum.'_approval';
+ my $queue = $env{'form.queue'};
+ my $reqkey = $cnum.'_'.$queue;
my $namespace = 'courserequestqueue';
my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);
my %queued =
@@ -192,16 +202,30 @@ sub handler {
if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) {
$result = &retrieve_settings($dom,$cnum,$udom,$uname);
} else {
- $warning = &mt('Invalid username or domain for course requestor');
+ if ($env{'form.crstype'} eq 'community') {
+ $warning = &mt('Invalid username or domain for community requestor');
+ } else {
+ $warning = &mt('Invalid username or domain for course requestor');
+ }
}
} else {
- $warning = &mt('No information was found for this course request.');
+ if ($env{'form.crstype'} eq 'community') {
+ $warning = &mt('No information was found for this community request.');
+ } else {
+ $warning = &mt('No information was found for this course request.');
+ }
}
} else {
$warning = &mt('No course request ID provided.');
}
} else {
- $warning = &mt('You do not have rights to view course request information.');
+ if ($env{'form.crstype'} eq 'any') {
+ $warning = &mt('You do not have rights to view course or community request information.');
+ } elsif ($env{'form.crstype'} eq 'community') {
+ $warning = &mt('You do not have rights to view community request information.');
+ } else {
+ $warning = &mt('You do not have rights to view course request information.');
+ }
}
} elsif ((defined($state)) && (defined($action))) {
if (($action eq 'view') && ($state eq 'details')) {
@@ -249,11 +273,11 @@ sub handler {
}
}
}
- my %elements = &form_elements($dom);
+ (my $elements,$instcredits) = &form_elements($dom,$showcredits);
my $elementsref = {};
- if (ref($elements{$action}) eq 'HASH') {
- if (ref($elements{$action}{$state}) eq 'HASH') {
- $elementsref = $elements{$action}{$state};
+ if ((ref($elements) eq 'HASH') && (ref($elements->{$action}) eq 'HASH')) {
+ if (ref($elements->{$action}{$state}) eq 'HASH') {
+ $elementsref = $elements->{$action}{$state};
}
}
if (($state eq 'courseinfo') && ($env{'form.clonedom'} eq '')) {
@@ -263,6 +287,9 @@ sub handler {
$jscript = &mainmenu_javascript();
} else {
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);
+ if ($state eq 'courseinfo') {
+ $jscript .= &cloning_javascript();
+ }
}
}
@@ -272,47 +299,66 @@ sub handler {
my $loaditems = &onload_action($action,$state);
- my %can_request;
- my $canreq = &Apache::lonnet::check_can_request($dom,\%can_request);
+ my (%can_request,%request_domains);
+ my $canreq =
+ &Apache::lonnet::check_can_request($dom,\%can_request,\%request_domains);
if ($action eq 'new') {
if ($canreq) {
if ($state eq 'crstype') {
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems,
- $crumb);
+ $crumb,\%request_domains);
} else {
&request_administration($r,$action,$state,$page,\%states,$dom,
$jscript,$loaditems,$crumb,$newinstcode,
$codechk,$checkedcode,$description,
- \@invalidcrosslist);
+ $showcredits,$instcredits,\@invalidcrosslist);
}
} else {
- $r->print(&header('Course Requests').$crumb.
+ $r->print(&header('Course/Community Requests').$crumb.
'
'.
- &mt('You do not have privileges to request creation of courses.').
+ &mt('You do not have privileges to request creation of courses or communities.').
'