--- loncom/interface/lonrequestcourse.pm 2009/09/06 19:09:54 1.29
+++ loncom/interface/lonrequestcourse.pm 2010/01/14 20:08:13 1.43
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.29 2009/09/06 19:09:54 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.43 2010/01/14 20:08:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -52,10 +52,6 @@ described at http://www.lon-capa.org.
=item onload_action()
-=item check_can_request()
-
-=item course_types()
-
=item print_main_menu()
=item request_administration()
@@ -98,8 +94,6 @@ described at http://www.lon-capa.org.
=item print_request_outcome()
-=item get_processtype()
-
=item check_autolimit()
=item retrieve_settings()
@@ -122,6 +116,7 @@ use Apache::lonnet;
use Apache::loncommon;
use Apache::lonlocal;
use Apache::loncoursequeueadmin;
+use Apache::lonuserutils;
use LONCAPA qw(:DEFAULT :match);
sub handler {
@@ -133,7 +128,7 @@ sub handler {
}
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['action','showdom','cnum','state']);
+ ['action','showdom','cnum','state','crstype']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
my $dom = &get_course_dom();
my $action = $env{'form.action'};
@@ -160,7 +155,7 @@ sub handler {
my @invalidcrosslist;
my %trail = (
- crstype => 'Course Request Action',
+ crstype => 'Request Action',
codepick => 'Category',
courseinfo => 'Description',
enrollment => 'Access Dates',
@@ -177,7 +172,7 @@ sub handler {
$trail{'enrollment'} = 'Enrollment';
}
- my ($page,$crumb,$newinstcode,$codechk,$checkedcode) =
+ 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))) {
@@ -195,16 +190,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')) {
@@ -238,7 +247,7 @@ sub handler {
$crosslistcode .= $env{'form.crosslist_'.$i.'_'.$item};
}
if ($crosslistcode ne '') {
- $codechk{$i} =
+ ($codechk{$i}, my $rest) =
&Apache::lonnet::auto_validate_instcode('',$dom,$crosslistcode);
}
unless ($codechk{$i} eq 'valid') {
@@ -262,7 +271,11 @@ sub handler {
if (($state eq 'courseinfo') && ($env{'form.clonedom'} eq '')) {
$env{'form.clonedom'} = $dom;
}
- $jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);
+ if ($state eq 'crstype') {
+ $jscript = &mainmenu_javascript();
+ } else {
+ $jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);
+ }
}
if ($state eq 'personnel') {
@@ -271,27 +284,29 @@ sub handler {
my $loaditems = &onload_action($action,$state);
- my %can_request;
- my $canreq = &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,\@invalidcrosslist);
+ $codechk,$checkedcode,$description,
+ \@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.').
'