--- loncom/interface/lonrequestcourse.pm 2009/09/08 13:20:27 1.32
+++ loncom/interface/lonrequestcourse.pm 2009/09/23 15:58:26 1.36.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.32 2009/09/08 13:20:27 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.36.2.1 2009/09/23 15:58:26 gci Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -178,7 +178,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))) {
@@ -238,8 +238,8 @@ sub handler {
foreach my $item (@code_order) {
$crosslistcode .= $env{'form.crosslist_'.$i.'_'.$item};
}
- if ($crosslistcode ne '') {
- $codechk{$i} =
+ if ($crosslistcode ne '') {
+ ($codechk{$i}, my $rest) =
&Apache::lonnet::auto_validate_instcode('',$dom,$crosslistcode);
}
unless ($codechk{$i} eq 'valid') {
@@ -286,7 +286,8 @@ sub handler {
} 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.
@@ -310,7 +311,7 @@ sub handler {
&close_popup_form());
} else {
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript,
- $loaditems,$crumb,'','','','',$uname,$udom);
+ $loaditems,$crumb,'','','','','',$uname,$udom);
}
} elsif ($action eq 'log') {
&print_request_logs($jscript,$loaditems,$crumb);
@@ -346,7 +347,7 @@ END
sub get_breadcrumbs {
my ($dom,$action,$state,$states,$trail) = @_;
- my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles);
+ my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description);
my $page = 0;
if ((ref($states) eq 'HASH') && (ref($trail) eq 'HASH') && (ref($state))) {
if (defined($action)) {
@@ -371,7 +372,7 @@ sub get_breadcrumbs {
$$state = 'codepick';
$page --;
} else {
- $codechk =
+ ($codechk,$description) =
&Apache::lonnet::auto_validate_instcode('',
$dom,$newinstcode);
if ($codechk ne 'valid') {
@@ -416,7 +417,7 @@ sub get_breadcrumbs {
{text=>'Pick Action'});
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
}
- return ($page,$crumb,$newinstcode,$codechk,$checkedcode);
+ return ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description);
}
sub header {
@@ -626,12 +627,12 @@ sub check_can_request {
}
sub course_types {
- my @types = ('official','unofficial','community');
+ my @types = ('unofficial');
my %typename = (
official => 'Official course',
unofficial => 'Unofficial course',
community => 'Community',
- );
+ );
return (\@types,\%typename);
}
@@ -724,15 +725,14 @@ END
END
- $r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb.'
'.
+ $r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb.
+ '
'.&mt('Request creation of a new course, or review your pending course requests.').'
'.
+ '
'.
&Apache::lonhtmlcommon::start_pick_box().
&Apache::lonhtmlcommon::row_title(&mt('Course Domain')).
- ''.&Apache::lonhtmlcommon::row_closure());
my $formname = 'requestcrs';
@@ -742,24 +742,12 @@ END
'.
&Apache::lonhtmlcommon::row_closure(1).
- &Apache::lonhtmlcommon::row_title(&mt('Course Type')).'
-'."\n".
+ &Apache::lonhtmlcommon::row_title(&mt('Course Type')).
+ &mt($typename->{'unofficial'})."\n".
+ ''."\n".
&Apache::lonhtmlcommon::row_closure(1)."\n".
&Apache::lonhtmlcommon::end_pick_box().'
'."\n".
'
'.
+ '
'.&mt('You may also add users later, once the course has been created, by using the "Manage course users" link, accessible from the "Main Menu".').'
';
return $output;
}
@@ -1721,14 +1735,8 @@ sub print_request_status {
my ($dom) = @_;
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'},
$env{'user.name'},'^status:'.$dom);
- my ($output,$formname,%queue_by_date,%typenames);
- if ($env{'form.crstype'} eq 'any') {
- %typenames = &Apache::lonlocal::texthash (
- official => 'Official course',
- unofficial => 'Unofficial course',
- community => 'Community',
- );
- }
+ my ($output,$formname,%queue_by_date);
+ my ($types,$typenames) = &course_types();
foreach my $key (keys(%statusinfo)) {
if (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')) {
(undef,my($cdom,$cnum)) = split(':',$key);
@@ -1799,7 +1807,10 @@ sub print_request_status {
'
'.&unescape($desc).' | '.
'
'.$cdom.' | ';
if ($env{'form.crstype'} eq 'any') {
- my $typename = $typenames{$type};
+ my $typename;
+ if (ref($typenames) eq 'HASH') {
+ $typename = &mt($typenames->{$type});
+ }
if ($typename eq '') {
$typename = &mt('Unknown type');
}
@@ -1952,7 +1963,7 @@ sub print_review {
$crstypename = $env{'form.crstype'};
if (ref($typename) eq 'HASH') {
unless ($typename->{$env{'form.crstype'}} eq '') {
- $crstypename = $typename->{$env{'form.crstype'}};
+ $crstypename = &mt($typename->{$env{'form.crstype'}});
}
}
my $category = 'Course';
@@ -2214,7 +2225,7 @@ sub dates_from_form {
}
sub courseinfo_form {
- my ($dom,$formname,$crstype,$next) = @_;
+ my ($dom,$formname,$crstype,$next,$description) = @_;
my %lt = &Apache::lonlocal::texthash(
official => 'You must provide a (brief) course description.',
community => 'You must provide a (brief) community description.'
@@ -2241,10 +2252,10 @@ ENDJS
}
my $output .= $js_validate."\n".'
'.&Apache::lonhtmlcommon::start_pick_box().
&Apache::lonhtmlcommon::row_headline().
- '
'.$title.'
'.
+ ''.&Apache::loncommon::help_open_topic('Course_Request_Description').' '.$title.'
'.
&Apache::lonhtmlcommon::row_closure(1).
&Apache::lonhtmlcommon::row_title(&mt('Description')).
- '';
+ '';
my ($home_server_pick,$numlib) =
&Apache::loncommon::home_server_form_item($dom,'chome',
'default','hide');
@@ -2255,7 +2266,7 @@ ENDJS
$output .= $home_server_pick.
&Apache::lonhtmlcommon::row_closure().
&Apache::lonhtmlcommon::row_headline().
- ''.&mt('Clone content and settings from an existing course?').'
'.
+ ''.&Apache::loncommon::help_open_topic('Course_Request_Clone').' '.&mt('Clone content and settings from an existing course?').'
'.
&Apache::lonhtmlcommon::row_closure(1).
&clone_form($dom,$formname,$crstype).
&Apache::lonhtmlcommon::end_pick_box().''."\n";
@@ -2268,14 +2279,14 @@ sub clone_form {
if ($crstype eq 'community') {
$type = 'Community';
}
- my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedom').
+ my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedom').' '.
&Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type);
my %lt = &clone_text();
my $output .=
&Apache::lonhtmlcommon::row_title($lt{'cid'}).'
'.&Apache::lonhtmlcommon::row_closure(1).'
'.
+ ''.&Apache::lonhtmlcommon::row_closure(1).
+ &Apache::lonhtmlcommon::row_title($lt{'dmn'}).'
'.&Apache::lonhtmlcommon::row_closure(1).
&Apache::lonhtmlcommon::row_title($lt{'dsh'}).'