');
+ }
}
#
@@ -4743,17 +4920,26 @@ sub print_textbook_form {
#
# Table of user's current courses (owner and/or course coordinator)
#
- my %lt = &clone_text();
+ my %lt = &clone_text('Course');
if (keys(%cloneable)) {
$r->print('
');
}
#
@@ -4762,13 +4948,20 @@ sub print_textbook_form {
if (keys(%domcloneable)) {
$r->print('
');
}
@@ -4815,15 +5008,24 @@ sub print_textbook_form {
#
# Submit button
#
- $r->print('
'.
+ $r->print('
'.
'
'.
'
');
#
# End request form
#
+
+ if (($crstype eq 'lti') && (ref($formhash) eq 'HASH')) {
+ foreach my $item (keys(%{$formhash})) {
+ $r->print('
'."\n");
+ }
+ }
+
$r->print('');
- &endContentScreen($r).
+ unless ($crstype eq 'lti') {
+ &endContentScreen($r);
+ }
$r->print(&Apache::loncommon::end_page());
return;
}
@@ -4849,19 +5051,12 @@ sub clone_selection_table {
my $cleantitle=&HTML::Entities::encode($title,'<>&"');
$cleantitle=~s/'/\\'/g;
$cleantitle =~ s/^\s+//;
- my ($namestr,$singleowner,$otherowners,@owners,%ownernames);
- if ($name eq 'colleague') {
- $singleowner = $cloneableref->{$cid}{'owner'};
- $otherowners = $cloneableref->{$cid}{'co-owners'};
- } else {
- $singleowner = $cloneableref->{$cid}{'internal.courseowner'};
- $otherowners = $cloneableref->{$cid}{'internal.co-owners'};
- }
- if ($singleowner ne '') {
- push(@owners,$singleowner);
+ my ($namestr,@owners,%ownernames);
+ if ($cloneableref->{$cid}{'owner'} ne '') {
+ push(@owners,$cloneableref->{$cid}{'owner'});
}
- if ($otherowners ne '') {
- foreach my $item (split(/,/,$otherowners)) {
+ if ($cloneableref->{$cid}{'co-owners'} ne '') {
+ foreach my $item (split(/,/,$cloneableref->{$cid}{'co-owners'})) {
if (($item ne '') && (!grep(/^\Q$item\E$/,@owners))) {
push(@owners,$item);
}
@@ -4917,9 +5112,11 @@ sub clone_selection_table {
}
sub process_textbook_request {
- my ($r,$dom,$action,$domdefs,$domconfig,$can_request) = @_;
+ my ($r,$dom,$action,$domdefs,$domconfig,$can_request,$crstype) = @_;
my ($uniquecode,$req_notifylist);
- my $crstype = 'textbook';
+ if ($crstype eq '') {
+ $crstype = 'textbook';
+ }
if (ref($domconfig) eq 'HASH') {
if (ref($domconfig->{'requestcourses'}) eq 'HASH') {
if (ref($domconfig->{'requestcourses'}{'notify'}) eq 'HASH') {
@@ -4960,28 +5157,30 @@ sub process_textbook_request {
undef($clonedom);
}
}
- 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'})) {
- &Apache::lonhtmlcommon::add_breadcrumb(
- { href => '/adm/requestcourse',
- text => 'Pick action',
- });
+ my $args;
+ if ($crstype eq 'lti') {
+ $args = { 'only_body' => 1};
+ }
+ $r->print(&header('Course Creation','','',undef,$args));
+
+ unless ($crstype eq 'lti') {
+ if (ref($can_request) eq 'HASH') {
+ unless ((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/requestcourse',
+ text => 'Pick action',
+ });
+ }
}
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/requestcourse',
+ text => "Create Course",
+ }
+ );
+ &Apache::lonhtmlcommon::add_breadcrumb({text=>'Request Processed'});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'));
+ &startContentScreen($r,'textbookrequests');
}
- &Apache::lonhtmlcommon::add_breadcrumb(
- { href => '/adm/requestcourse',
- text => "Create Course",
- }
- );
- &Apache::lonhtmlcommon::add_breadcrumb({text=>'Request Processed'});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'));
- &startContentScreen($r,'textbookrequests');
my $details = {
owner => $env{'user.name'},
@@ -5006,6 +5205,7 @@ sub process_textbook_request {
} else {
$details->{dateshift} = '';
}
+ $details->{tinyurls} = $env{'form.owntinyurls'};
} elsif ($reqtype eq 'colleague') {
$details->{datemode} = $env{'form.colldatemode'};
if ($details->{datemode} eq 'shift') {
@@ -5013,6 +5213,11 @@ sub process_textbook_request {
} else {
$details->{dateshift} = '';
}
+ $details->{tinyurls} = $env{'form.colltinyurls'};
+ } elsif (($reqtype eq 'textbook') || ($reqtype eq 'template')) {
+ $details->{datemode} = 'delete';
+ $details->{dateshift} = '';
+ $details->{tinyurls} = '';
}
if ($details->{dateshift} ne '') {
$details->{dateshift} =~ s/[^\d\.]+//g;
@@ -5020,13 +5225,28 @@ sub process_textbook_request {
} else {
$details->{datemode} = '';
$details->{dateshift} = '';
+ $details->{tinyurls} = '';
}
my $lonhost = $r->dir_config('lonHostID');
$r->rflush();
my ($result,$output,$customized) = &process_request($r,$lonhost,$dom,$cnum,$crstype,$now,$details,
'',$req_notifylist,[],$domconfig);
$r->print($output);
- if (&Apache::loncoursequeueadmin::author_prompt()) {
+ if ($crstype eq 'lti') {
+ my $storecrs;
+ if ($env{'request.lti.login'}) {
+ my %lti = &Apache::lonnet::get_domain_lti($dom,'provider');
+ if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') {
+ $storecrs = $lti{$env{'request.lti.login'}}{'storecrs'};
+ }
+ if ($storecrs) {
+ my %consumers = &Apache::lonnet::get_dom('lticonsumers',[$env{'form.sourcecrs'}],$dom);
+ if (($env{'form.lti.sourcecrs'} ne '') && ($consumers{$env{'form.lti.sourcecrs'}} eq '') && ($cnum ne '')) {
+ &Apache::lonnet::put_dom('lticonsumers',{ $env{'form.lti.sourcecrs'} => $env{'request.lti.login'}.':'.$cnum },$dom);
+ }
+ }
+ }
+ } elsif (&Apache::loncoursequeueadmin::author_prompt()) {
unless ($customized) {
&print_author_prompt($r,$action,$cnum,$dom,$crstype,$result);
}
@@ -5035,7 +5255,9 @@ sub process_textbook_request {
$r->print('
'.&mt('Create another course').'
');
}
}
- &endContentScreen($r);
+ unless ($crstype eq 'lti') {
+ &endContentScreen($r);
+ }
$r->print(&Apache::loncommon::end_page());
}