--- loncom/interface/lonsearchcat.pm 2017/08/10 22:49:01 1.352 +++ loncom/interface/lonsearchcat.pm 2022/05/29 03:19:00 1.355 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.352 2017/08/10 22:49:01 raeburn Exp $ +# $Id: lonsearchcat.pm,v 1.355 2022/05/29 03:19:00 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -178,6 +178,15 @@ sub handler { if (@allowed_searches ==2) { $crumb_text = 'Portfolio and Catalog Search'; } + my $target = '_top'; + if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || + (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { + if ($env{'form.phase'} =~ /^(sort|run_search)$/) { + $target = '_parent'; + } else { + $target = ''; + } + } &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'. &Apache::loncommon::inhibit_menu_check(). @@ -185,7 +194,7 @@ sub handler { '&launch='.$env{'form.launch'}. '&mode='.$env{'form.mode'}, text=>"$crumb_text", - target=>'_top', + target=>$target, bug=>'Searching',}); # if ($env{'form.phase'} !~ m/(basic|adv|course)_search/) { @@ -687,8 +696,10 @@ function additional_metadata() { $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Domains'))); if ($anydomain) { + my $defdom = &Apache::lonnet::default_login_domain(); + my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('shared',$defdom); $scrout .= &Apache::loncommon::domain_select('domains', - $env{'form.domains'},1); + $env{'form.domains'},1,$trusted,$untrusted); } else { $scrout .= &Apache::loncommon::select_dom_form($env{'user.domain'}, 'domains','','','',[$env{'user.domain'}],'',1); @@ -1881,6 +1892,8 @@ sub build_date_queries { my (undef,undef,undef,$cbday,$cbmon,$cbyear) = localtime($cbefore); # Correct for year being relative to 1900 $cayear+=1900; $cbyear+=1900; + # Correct month; localtime gives month 0..11 but MySQL expects 1..12 + $camon++; $cbmon++; my $cquery= '(creationdate BETWEEN '. "'".$cayear.'-'.$camon.'-'.$caday."'". @@ -1899,6 +1912,8 @@ sub build_date_queries { my (undef,undef,undef,$mbday,$mbmon,$mbyear) = localtime($mbefore); # Correct for year being relative to 1900 $mayear+=1900; $mbyear+=1900; + # Correct month; localtime gives month 0..11 but MySQL expects 1..12 + $mamon++; $mbmon++; my $mquery= '(lastrevisiondate BETWEEN '. "'".$mayear.'-'.$mamon.'-'.$maday."'". @@ -2081,7 +2096,14 @@ sub print_sort_form { &Apache::lonnet::logthis(&Apache::lonmysql::get_error()); return; } - my $start_page = &Apache::loncommon::start_page('Results',undef); + my $target = '_top'; + my $args; + if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || + (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { + $target = '_parent'; + $args = {'links_target' => $target}; + } + my $start_page = &Apache::loncommon::start_page('Results',undef,$args); my $breadcrumbs= &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', $env{'form.catalogmode'} ne 'import'); @@ -2089,7 +2111,7 @@ sub print_sort_form { my $result = < +
END