'."\n".$form."\n".
+ my $title;
+ if ($env{'form.crstype'} eq 'community') {
+ $title = &mt('Pending community requests');
+ } elsif ($env{'form.crstype'} eq 'official') {
+ $title = &mt('Pending requests for official courses');
+ } elsif ($env{'form.crstype'} eq 'unofficial') {
+ $title = &mt('Pending requests for unofficial courses');
+ } else {
+ $title = &mt('Pending course/community requests');
+ }
+ $r->print('
'.$title.' '."\n".$form."\n".
&print_request_status($dom).'
');
} elsif ($state eq 'details') {
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk);
@@ -847,7 +885,13 @@ END
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
\%cat_order,\@code_order);
}
- $r->print('
'.&mt('Course Request Details').' '."\n".$form."\n".
+ my $title;
+ if ($env{'form.crstype'} eq 'community') {
+ $title = &mt('Community Request Details');
+ } else {
+ $title = &mt('Course Request Details');
+ }
+ $r->print('
'.$title.' '."\n".$form."\n".
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,
\@code_order)."\n".
'
'."\n");
@@ -864,8 +908,14 @@ END
$navtxt{'next'},$state,$other,$navtxt{'other'});
$r->print('');
} elsif ($state eq 'cancel') {
+ my $title;
+ if ($env{'form.crstype'} eq 'community') {
+ $title = &mt('Cancel community request');
+ } else {
+ $title = &mt('Cancel course request');
+ }
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'});
- $r->print('
'.&mt('Cancel course request').' '."\n".$form."\n".
+ $r->print('
'.$title.' '."\n".$form."\n".
$output);
my @excluded = &get_excluded_elements($dom,$states,'view','cancel');
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'
');
@@ -914,7 +964,11 @@ END
'
'."\n".
'
'."\n");
if ($result eq 'ok') {
- $r->print(&mt('Your course request has been cancelled.'));
+ if ($env{'form.crstype'} eq 'community') {
+ $r->print(&mt('Your community request has been cancelled.'));
+ } else {
+ $r->print(&mt('Your course request has been cancelled.'));
+ }
} else {
$r->print('
'.
&mt('The request cancellation process was not complete.').
@@ -929,8 +983,16 @@ END
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
\%cat_order,\@code_order);
}
- $r->print(&header('Course Request','','','',{ 'only_body' => 1}).
- $crumb."\n".'
'.&mt('Course Request Details').' '.
+ my ($title,$header);
+ if ($env{'form.crstype'} eq 'community') {
+ $title = 'Community Request';
+ $header = &mt('Community Request');
+ } else {
+ $title = 'Course Request';
+ $header = &mt('Course Request');
+ }
+ $r->print(&header($title,'','','',{ 'only_body' => 1}).
+ $crumb."\n".''.$header.' '.
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,
\@code_order,$uname,$udom)."\n".''.
&close_popup_form());
@@ -1286,10 +1348,18 @@ sub print_request_form {
}
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
\%cat_order,\@code_order);
- $r->print('
'.&mt('Review course request details before submission').' '.
- &print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg).
+ if ($crstype eq 'community') {
+ $r->print('
'.&mt('Review community request details before submission').' ');
+ } else {
+ $r->print('
'.&mt('Review course request details before submission').' ');
+ }
+ $r->print(&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg).
'
');
- $navtxt{'next'} = &mt('Submit course request');
+ if ($crstype eq 'community') {
+ $navtxt{'next'} = &mt('Submit community request');
+ } else {
+ $navtxt{'next'} = &mt('Submit course request');
+ }
} elsif ($state eq 'process') {
if ($crstype eq 'official') {
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
@@ -1454,7 +1524,7 @@ sub print_enrollment_menu {
}
if ($crosslist_form) {
$crosslist_form .=
- &Apache::lonhtmlcommon::row_title(&mt('Add another?')).
+ &Apache::lonhtmlcommon::row_title(&mt('Add another')).
'
'.
'
'.$sectionselector.''."\n".
''.&Apache::lonhtmlcommon::row_closure();
}
- $output .= &Apache::lonhtmlcommon::row_title(&mt('Add another?')).
+ $output .= &Apache::lonhtmlcommon::row_title(&mt('Add another')).
'
'.
'
'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(1).
- &Apache::lonhtmlcommon::end_pick_box().'
'.
- '
'.&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".').'
';
+ &Apache::lonhtmlcommon::end_pick_box().'
';
+ if ($crstype eq 'community') {
+ $output .= '
'.&mt('You may also add users later, once the community has been created, by using the "Manage community users" link, accessible from the "Main Menu".').'
';
+ } else {
+ $output .= '
'.&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;
}
@@ -1751,7 +1825,7 @@ sub print_request_status {
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'},
$env{'user.name'},'^status:'.$dom);
my ($output,$formname,%queue_by_date);
- my ($types,$typenames) = &course_types();
+ my ($types,$typenames) = &Apache::loncommon::course_types();
foreach my $key (keys(%statusinfo)) {
if (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')) {
(undef,my($cdom,$cnum)) = split(':',$key);
@@ -1797,10 +1871,18 @@ sub print_request_status {
'
'."\n".
'
'."\n";
if (@sortedtimes > 0) {
+ my $desctitle;
+ if ($env{'form.crstype'} eq 'any') {
+ $desctitle = &mt('Course/Community Description')
+ } elsif ($env{'form.crstype'} eq 'community') {
+ $desctitle = &mt('Community Description')
+ } else {
+ $desctitle = &mt('Course Description');
+ }
$output .= &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
'
'.&mt('Action').' '.
- '
'.&mt('Course Description').' '.
+ '
'.$desctitle.' '.
'
'.&mt('Domain').' ';
if ($env{'form.crstype'} eq 'any') {
$output .= '
'.&mt('Type').' ';
@@ -1848,7 +1930,13 @@ sub print_request_status {
}
$output .= &Apache::loncommon::end_data_table();
} else {
- $output .= '
'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'
';
+ if ($env{'form.crstype'} eq 'any') {
+$output .= '
'.&mt('You have no matching course or community requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'
';
+ } elsif ($env{'form.crstype'} eq 'community') {
+ $output .= '
'.&mt('You have no matching community requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'
';
+ } else {
+ $output .= '
'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'
';
+ }
}
$output .= '
';
@@ -1873,7 +1961,7 @@ sub print_cancel_request {
}
$output = &mt('No further action will be taken');
} elsif (ref($history{'details'}) eq 'HASH') {
- my ($types,$typename) = &course_types();
+ my ($types,$typename) = &Apache::loncommon::course_types();
my $showtype = $crstype;
if (defined($typename->{$crstype})) {
$showtype = $typename->{$crstype};
@@ -1889,8 +1977,12 @@ sub print_cancel_request {
'
'.$showtype.' '.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().
- '
'.
- &mt('Cancelling the request will remove it from the queue of pending course requests').'
';
+ '
';
+ if ($crstype eq 'community') {
+ $output .= &mt('Cancelling the request will remove it from the queue of pending community requests').'
';
+ } else {
+ $output .= &mt('Cancelling the request will remove it from the queue of pending course requests').'
';
+ }
$result = 'ok';
} else {
$output = '
'.&mt('No record exists for the course ID').'
';
@@ -1959,7 +2051,7 @@ sub print_request_logs {
sub print_review {
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom,
$disallowed,$disallowmsg) = @_;
- my ($types,$typename) = &course_types();
+ my ($types,$typename) = &Apache::loncommon::course_types();
my ($owner,$ownername,$owneremail);
if ($uname eq '' || $udom eq '') {
$uname = $env{'user.name'};
@@ -2082,7 +2174,8 @@ sub print_review {
if (($env{'form.clonecrs'} =~ /^$match_name$/) &&
($env{'form.clonedom'} =~ /^$match_domain$/)) {
my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'},
- $env{'user.domain'},$env{'form.clonecrs'}, $env{'form.clonedom'});
+ $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'},
+ $env{'form.crstype'});
if ($canclone) {
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'},
$env{'form.clonecrs'},('description','internal.coursecode'));
@@ -2262,8 +2355,10 @@ function validateForm() {
ENDJS
my $title = &mt('Brief Course Description');
+ my $clonetitle = &mt('Clone content and settings from an existing course?');
if ($crstype eq 'community') {
$title = &mt('Brief Community Description');
+ $clonetitle = &mt('Clone content and settings from an existing community?');
}
my $output .= $js_validate."\n".'
'.&Apache::lonhtmlcommon::start_pick_box().
&Apache::lonhtmlcommon::row_headline().
@@ -2281,7 +2376,7 @@ ENDJS
$output .= $home_server_pick.
&Apache::lonhtmlcommon::row_closure().
&Apache::lonhtmlcommon::row_headline().
- '
'.&Apache::loncommon::help_open_topic('Course_Request_Clone').' '.&mt('Clone content and settings from an existing course?').' '.
+ ''.&Apache::loncommon::help_open_topic('Course_Request_Clone').' '.$clonetitle.' '.
&Apache::lonhtmlcommon::row_closure(1).
&clone_form($dom,$formname,$crstype).
&Apache::lonhtmlcommon::end_pick_box().''."\n";
@@ -2425,7 +2520,7 @@ sub get_course_dom {
}
}
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) {
- my ($types,$typename) = &course_types();
+ my ($types,$typename) = &Apache::loncommon::course_types();
if (ref($types) eq 'ARRAY') {
foreach my $type (@{$types}) {
if (&Apache::lonnet::usertools_access($env{'user.name'},
@@ -2648,7 +2743,8 @@ sub print_request_outcome {
if ($clonehome ne 'no_host') {
my $canclone =
&Apache::loncoursequeueadmin::can_clone_course($env{'user.name'},
- $env{'user.domain'},$env{'form.clonecrs'}, $env{'form.clonedom'});
+ $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'},
+ $crstype);
if ($canclone) {
$clonecrs = $env{'form.clonecrs'};
$clonedom = $env{'form.clonedom'};
@@ -2739,7 +2835,11 @@ sub print_request_outcome {
$reqstatus = $disposition;
my ($modified,$queued);
if ($disposition eq 'rejected') {
- $output = &mt('Your course request was rejected.');
+ if ($crstype eq 'community') {
+ $output = &mt('Your community request was rejected.');
+ } else {
+ $output = &mt('Your course request was rejected.');
+ }
if ($message) {
$output .= '
'.$message.'
';
}
@@ -2763,14 +2863,22 @@ sub print_request_outcome {
$reqstatus = 'created';
my $role_result = &update_requestors_roles($dom,$cnum,$crstype,$details,
\%longroles);
- $output = '
'.&mt('Your course request has been processed and the course has been created.').
- ' '.$role_result.'
';
+ if ($crstype eq 'community') {
+ $output = '
'.&mt('Your community request has been processed and the community has been created.');
+ } else {
+ $output = '
'.&mt('Your course request has been processed and the course has been created.');
+ }
+ $output .= ' '.$role_result.'
';
$creationresult = 'created';
} else {
- $output = '
'.
- &mt('An error occurred when processing your course request.').
- ' '.
- &mt('You may want to review the request details and submit the request again.').
+ $output = '';
+ if ($crstype eq 'community') {
+ $output .= &mt('An error occurred when processing your community request.');
+ } else {
+ $output .= &mt('An error occurred when processing your course request.');
+ }
+ $output .= ' '.
+ &mt('You may want to review the request details and submit the request again.').
' ';
$creationresult = 'error';
}
@@ -2803,7 +2911,12 @@ sub print_request_outcome {
my $putresult = &Apache::lonnet::newput_dom('courserequestqueue',$request,
$dom);
if ($putresult eq 'ok') {
- $output = &mt('Your course request has been recorded.').' '.
+ if ($crstype eq 'community') {
+ $output .= &mt('Your community request has been recorded.');
+ } else {
+ $output .= &mt('Your course request has been recorded.')
+ }
+ $output .= ' '.
¬ification_information($disposition,$req_notifylist,
$cnum,$now);
} else {
@@ -2835,8 +2948,12 @@ sub print_request_outcome {
&Apache::lonnet::logthis("Error saving course request status for $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult");
}
if ($modified && $queued && $storeresult eq 'ok') {
- $output .= ''.&mt('Your course request has been updated').'
'.
- ¬ification_information($disposition,$req_notifylist,$cnum,$now);
+ if ($crstype eq 'community') {
+ $output .= ''.&mt('Your community request has been updated').'
';
+ } else {
+ $output .= ''.&mt('Your course request has been updated').'
';
+ }
+ $output .= ¬ification_information($disposition,$req_notifylist,$cnum,$now);
}
if ($validationerror ne '') {
$output .= ''.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'';
@@ -3090,7 +3207,7 @@ sub check_autolimit {
my ($uname,$udom,$dom,$crstype,$limit,$message) = @_;
my %crsroles = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'},
'userroles',['active','future'],['cc'],[$dom]);
- my ($types,$typename) = &course_types();
+ my ($types,$typename) = &Apache::loncommon::course_types();
my %requests = &Apache::lonnet::dumpstore('courserequests',$udom,$uname);
my %count;
if (ref($types) eq 'ARRAY') {