View | Details | Raw Unified | Return to bug 37570
Collapse All | Expand All

(-)a/catalogue/search.pl (-1 / +13 lines)
Lines 140-146 use Modern::Perl; Link Here
140
140
141
## load Koha modules
141
## load Koha modules
142
use C4::Context;
142
use C4::Context;
143
use C4::Output qw( output_html_with_http_headers pagination_bar );
143
use C4::Output qw( output_html_with_http_headers pagination_bar parametrized_url );
144
use C4::Circulation qw( barcodedecode );
144
use C4::Circulation qw( barcodedecode );
145
use C4::Auth qw( get_template_and_user );
145
use C4::Auth qw( get_template_and_user );
146
use C4::Search qw( searchResults enabled_staff_search_views z3950_search_args new_record_from_zebra );
146
use C4::Search qw( searchResults enabled_staff_search_views z3950_search_args new_record_from_zebra );
Lines 781-786 $template->param( Link Here
781
    add_to_some_public_shelves  => $some_public_shelves,
781
    add_to_some_public_shelves  => $some_public_shelves,
782
);
782
);
783
783
784
if (my $search_also_in = C4::Context->preference('SearchAlsoIn')){
785
    $simple_query =~ s/\/+$//; # remove trailing slash
786
    $simple_query =~ s/\s+$//; # remove trailing space
787
    $search_also_in = parametrized_url(
788
        $search_also_in,
789
        {
790
            QUERY         => $simple_query,
791
        }
792
    );
793
    $template->param('SearchAlsoIn' => $search_also_in);
794
}
795
784
output_html_with_http_headers $cgi, $cookie, $template->output;
796
output_html_with_http_headers $cgi, $cookie, $template->output;
785
797
786
798
(-)a/installer/data/mysql/atomicupdate/bug_37570-add_SearchAlsoIn_syspref.pl (+19 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw( say_success );
3
4
return {
5
    bug_number  => "37570",
6
    description => "Add SearchAlsoIn syspref",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        # Do you stuffs here
12
        $dbh->do(q{
13
             INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES  ('SearchAlsoIn', '<a href=\"https://worldcat.org/search?q={QUERY}\" target=\"_blank\">Other Libraries (WorldCat)</a>\n<br>\n<a href=\"https://scholar.google.com/scholar?q={QUERY}\" target=\"_blank\">Other Databases (Google Scholar)</a>', '', '', 'Textarea');
14
        });
15
16
        # sysprefs
17
        say_success($out, "Added new system preference 'SearchAlsoIn'");
18
    },
19
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 688-693 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
688
('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'),
688
('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'),
689
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
689
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
690
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
690
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
691
('SearchAlsoIn','<a href=\"https://worldcat.org/search?q={QUERY}\" target=\"_blank\">Other Libraries (WorldCat)</a>\n<br><a href=\"https://scholar.google.com/scholar?q={QUERY}\" target=\"_blank\">Other Databases (Google Scholar)</a>','Textarea'),
691
('SearchEngine','Zebra','Elasticsearch|Zebra','Search Engine','Choice'),
692
('SearchEngine','Zebra','Elasticsearch|Zebra','Search Engine','Choice'),
692
('SearchLimitLibrary', 'homebranch', 'homebranch|holdingbranch|both', "When limiting search results with a library or library group, use the item's home library, or holding library, or both.", 'Choice'),
693
('SearchLimitLibrary', 'homebranch', 'homebranch|holdingbranch|both', "When limiting search results with a library or library group, use the item's home library, or holding library, or both.", 'Choice'),
693
('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'),
694
('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-1 / +7 lines)
Lines 362-368 Searching: Link Here
362
                  1: Redirect
362
                  1: Redirect
363
                  0: "Don't redirect"
363
                  0: "Don't redirect"
364
            - to the result if a catalog search via the OPAC or staff interface returns only one record.
364
            - to the result if a catalog search via the OPAC or staff interface returns only one record.
365
365
        -
366
            - 'Include a "Search also in" box on the results page, with the following HTML (leave blank to disable):'
367
            - '<br />Note: The placeholders {QUERY} will be replaced by the request sent previously.'
368
            - pref: SearchAlsoIn
369
              type: textarea
370
              syntax: text/html
371
              class: code
366
    Did you mean/spell checking:
372
    Did you mean/spell checking:
367
        -
373
        -
368
            - "Swedish service for spellchecking.<br/>"
374
            - "Swedish service for spellchecking.<br/>"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (+16 lines)
Lines 788-793 Link Here
788
788
789
        <div class="col-sm-2 col-sm-pull-10">
789
        <div class="col-sm-2 col-sm-pull-10">
790
            <aside>
790
            <aside>
791
                [% IF ( SearchAlsoIn ) %]
792
                    <ul id="action" class="fa-ul">
793
                        <li>
794
                            <div id="search-also-in_menu">
795
                                <div class="dropdown">
796
                                    <a id="furthersearches" class="btn btn-link btn-lg dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
797
                                        <i class="fa fa-fw fa-search" aria-hidden="true"></i> Search also in
798
                                    </a>
799
                                    <div class="dropdown-menu" aria-labelledby="furthersearches">
800
                                        [% SearchAlsoIn | $raw %]
801
                                    </div>
802
                                </div>
803
                            </div>
804
                        </li>
805
                    </ul>
806
                [% END %]
791
                [% INCLUDE 'facets.inc' %]
807
                [% INCLUDE 'facets.inc' %]
792
            </aside>
808
            </aside>
793
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
809
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+17 lines)
Lines 99-104 Link Here
99
        [% END # / UNLESS searchdesc %]
99
        [% END # / UNLESS searchdesc %]
100
100
101
        <div class="container-fluid">
101
        <div class="container-fluid">
102
            [% IF ( SearchAlsoIn ) %]
103
                <ul id="action" class="fa-ul">
104
                    <li>
105
                        <div id="search-also-in_menu">
106
                            <div class="dropdown">
107
                                <a id="furthersearches" class="btn btn-link btn-lg dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
108
                                    <i class="fa fa-fw fa-search" aria-hidden="true"></i> Search also in
109
                                </a>
110
                                <div class="dropdown-menu" aria-labelledby="furthersearches">
111
                                    [% SearchAlsoIn | $raw %]
112
                                </div>
113
                            </div>
114
                        </div>
115
                    </li>
116
                </ul>
117
            [% END %]
118
102
            <div class="row">
119
            <div class="row">
103
                [% IF ( opacfacets && total ) %]
120
                [% IF ( opacfacets && total ) %]
104
                    <div class="col-lg-2">
121
                    <div class="col-lg-2">
(-)a/opac/opac-search.pl (-2 / +14 lines)
Lines 43-49 my ($builder, $searcher); Link Here
43
$builder  = Koha::SearchEngine::QueryBuilder->new({index => 'biblios'});
43
$builder  = Koha::SearchEngine::QueryBuilder->new({index => 'biblios'});
44
$searcher = Koha::SearchEngine::Search->new({index => 'biblios'});
44
$searcher = Koha::SearchEngine::Search->new({index => 'biblios'});
45
45
46
use C4::Output qw( output_html_with_http_headers pagination_bar output_with_http_headers );
46
use C4::Output qw( output_html_with_http_headers pagination_bar output_with_http_headers parametrized_url);
47
use C4::Auth qw( get_template_and_user get_session );
47
use C4::Auth qw( get_template_and_user get_session );
48
use C4::Languages qw( getlanguage getLanguages );
48
use C4::Languages qw( getlanguage getLanguages );
49
use C4::Search qw( searchResults );
49
use C4::Search qw( searchResults );
Lines 923-926 if ($offset == 0) { Link Here
923
}
923
}
924
924
925
    $template->param( borrowernumber    => $borrowernumber);
925
    $template->param( borrowernumber    => $borrowernumber);
926
927
if (my $search_also_in = C4::Context->preference('SearchAlsoIn')){
928
    $simple_query =~ s/\/+$//; # remove trailing slash
929
    $simple_query =~ s/\s+$//; # remove trailing space
930
    $search_also_in = parametrized_url(
931
        $search_also_in,
932
        {
933
            QUERY         => $simple_query,
934
        }
935
    );
936
    $template->param('SearchAlsoIn' => $search_also_in);
937
}
938
926
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
939
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
927
- 

Return to bug 37570