'.
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- '
'.&mt('Title').' | '.
- '
'.&mt('Author(s)').' | '.
- '
'.&mt('Subject').' | '.
- '
'.&mt('Book').' | '.
- &Apache::loncommon::end_data_table_header_row());
- my @items = sort { $a <=> $b } keys(%ordered);
- foreach my $num (@items) {
- my $item = $ordered{$num};
- my $cleantitle=&HTML::Entities::encode($bookshash->{$item}->{'title'},'<>&"');
- $cleantitle=~s/'/\\'/g;
- $cleantitle =~ s/^\s+//;
- $r->print(&Apache::loncommon::start_data_table_row().
- '
| '.
- '
'.$bookshash->{$item}->{'author'}.' | '.
- '
'.$bookshash->{$item}->{'subject'}.' | '.
- '
| '.
- &Apache::loncommon::end_data_table_row());
+ foreach my $type ('textbooks','templates') {
+ my $divid = 'showtextbook';
+ my $radioid = 'book';
+ if ($type eq 'templates') {
+ $divid = 'showtemplate';
+ $radioid = 'template';
+ }
+ if (ref($ordered{$type}) eq 'HASH') {
+ $r->print('
'.
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ '
'.&mt('Title').' | ');
+ if ($type eq 'textbooks') {
+ $r->print('
'.&mt('Author(s)').' | ');
+ }
+ $r->print('
'.&mt('Subject').' | ');
+ if ($type eq 'textbooks') {
+ $r->print('
'.&mt('Publisher').' | '.
+ '
'.&mt('Book').' | ');
+ }
+ $r->print(&Apache::loncommon::end_data_table_header_row());
+ my @items = sort { $a <=> $b } keys(%{$ordered{$type}});
+ foreach my $num (@items) {
+ my $item = $ordered{$type}{$num};
+ my $cleantitle=&HTML::Entities::encode($prefab{$type}{$item}{'title'},'<>&"');
+ $cleantitle=~s/'/\\'/g;
+ $cleantitle =~ s/^\s+//;
+ $r->print(&Apache::loncommon::start_data_table_row().
+ '
| ');
+ if ($type eq 'textbooks') {
+ $r->print('
'.$prefab{$type}{$item}{'author'}.' | ');
+ }
+ $r->print('
'.$prefab{$type}{$item}{'subject'}.' | ');
+ if ($type eq 'textbooks') {
+ $r->print('
'.$prefab{$type}{$item}{'publisher'}.' | '.
+ '
| ');
+ }
+ $r->print(&Apache::loncommon::end_data_table_row());
+ }
+ $r->print(&Apache::loncommon::end_data_table().
+ '
');
+ }
}
- $r->print(&Apache::loncommon::end_data_table().
- '
');
}
#
@@ -4702,6 +4783,8 @@ sub process_textbook_request {
my ($clonefrom,$clonedom,$clonecrs);
if ($reqtype eq 'textbook') {
$clonefrom = $env{'form.book'};
+ } elsif ($reqtype eq 'template') {
+ $clonefrom = $env{'form.template'};
} elsif ($reqtype eq 'existing') {
$clonefrom = $env{'form.owned'};
}
@@ -4721,7 +4804,11 @@ sub process_textbook_request {
undef($clonedom);
}
}
- $r->print(&header('Course Creation'));
+ my $js = &processing_javascript();
+ my $loaditems = {
+ onload => 'javascript:hideProcessing();',
+ };
+ $r->print(&header('Course Creation',$js,$loaditems));
if (ref($can_request) eq 'HASH') {
unless ((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) {
@@ -4760,7 +4847,8 @@ sub process_textbook_request {
$details->{dateshift} = $env{'form.dateshift'};
}
my $lonhost = $r->dir_config('lonHostID');
- my ($result,$output) = &process_request($lonhost,$dom,$cnum,$crstype,$now,$details,'',
+ $r->rflush();
+ my ($result,$output) = &process_request($r,$lonhost,$dom,$cnum,$crstype,$now,$details,'',
$req_notifylist,[],$domconfig);
$r->print($output);
if (&Apache::loncoursequeueadmin::author_prompt()) {
@@ -4773,21 +4861,23 @@ sub process_textbook_request {
}
sub textbook_request_javascript {
- my ($numbook,$numcurrent) = @_;
+ my ($numprefab,$numcurrent) = @_;
+ return unless (ref($numprefab) eq 'HASH');
+ return if (!$numprefab->{'textbooks'} && !$numprefab->{'templates'} && !$numcurrent);
my %lt = &Apache::lonlocal::texthash(
choose => 'Please select a content option.',
textbook => 'Please select a textbook, or choose a different option.',
+ template => 'Please select a template, or choose a different option.',
existing => 'Please select one of your existing courses to copy, or choose a different option.',
title => 'Please enter a course title.',
);
- return if (!$numbook && !$numcurrent);
return <<"ENDSCRIPT";
function cloneChoice() {
if (document.requestcourse.cloning) {
var radioLength = document.requestcourse.cloning.length;
if (radioLength == undefined) {
var val = document.requestcourse.cloning.value;
- if ((val == 'textbook') || (val == 'existing')) {
+ if ((val == 'textbook') || (val == 'template') || (val == 'existing')) {
var elem = document.getElementById('show'+val);
if (document.requestcourse.cloning.checked) {
elem.style.display = 'block';
@@ -4799,7 +4889,7 @@ function cloneChoice() {
} else {
for (var i=0; i