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

(-)a/installer/data/mysql/atomicupdate/bug_25532-add_OPACWikipediaSearchSuggestions_syspref.sql (+7 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ( "OPACWikipediaSearchSuggestions", 0, NULL, "Enable a search suggestion to the OPAC Search box.","YesNo" ) });
4
5
    SetVersion( $DBversion );
6
    print "Upgrade to $DBversion done (Bug 25532 - Add a wikipedia-style search suggestion feature to the OPAC)\n";
7
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 433-438 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
433
('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'),
433
('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'),
434
('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'),
434
('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'),
435
('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'),
435
('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'),
436
('OPACWikipediaSearchSuggestions','0','NULL','Enable search suggestions based on data entered into the search box','YesNo'),
436
('OPACSearchForTitleIn','<li><a href=\"https://worldcat.org/search?q={TITLE}\" target=\"_blank\">Other Libraries (WorldCat)</a></li>\n<li><a href=\"https://scholar.google.com/scholar?q={TITLE}\" target=\"_blank\">Other Databases (Google Scholar)</a></li>\n<li><a href=\"https://www.bookfinder.com/search/?author={AUTHOR}&amp;title={TITLE}&amp;st=xl&amp;ac=qr\" target=\"_blank\">Online Stores (Bookfinder.com)</a></li>\n<li><a href=\"https://openlibrary.org/search?author=({AUTHOR})&title=({TITLE})\" target=\"_blank\">Open Library (openlibrary.org)</a></li>','70|10','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC.  Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','Textarea'),
437
('OPACSearchForTitleIn','<li><a href=\"https://worldcat.org/search?q={TITLE}\" target=\"_blank\">Other Libraries (WorldCat)</a></li>\n<li><a href=\"https://scholar.google.com/scholar?q={TITLE}\" target=\"_blank\">Other Databases (Google Scholar)</a></li>\n<li><a href=\"https://www.bookfinder.com/search/?author={AUTHOR}&amp;title={TITLE}&amp;st=xl&amp;ac=qr\" target=\"_blank\">Online Stores (Bookfinder.com)</a></li>\n<li><a href=\"https://openlibrary.org/search?author=({AUTHOR})&title=({TITLE})\" target=\"_blank\">Open Library (openlibrary.org)</a></li>','70|10','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC.  Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','Textarea'),
437
('OpacSeparateHoldings','0',NULL,'Separate current branch holdings from other holdings (OPAC)','YesNo'),
438
('OpacSeparateHoldings','0',NULL,'Separate current branch holdings from other holdings (OPAC)','YesNo'),
438
('OpacSeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings (OPAC)','Choice'),
439
('OpacSeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings (OPAC)','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 563-568 OPAC: Link Here
563
              syntax: text/html
563
              syntax: text/html
564
              class: code
564
              class: code
565
        -
565
        -
566
            - pref: OPACWikipediaSearchSuggestions
567
              default: 0
568
              choices:
569
                  yes: Enable
570
                  no: Disable
571
            - "search suggestions based on data entered into the search box"
572
        -
566
            - pref: OpacBrowseSearch
573
            - pref: OpacBrowseSearch
567
              default: 0
574
              default: 0
568
              choices:
575
              choices:
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+4 lines)
Lines 121-126 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
121
[% Asset.js("js/amazonimages.js") | $raw %]
121
[% Asset.js("js/amazonimages.js") | $raw %]
122
[% END %]
122
[% END %]
123
123
124
[% IF Koha.Preference( 'OPACWikipediaSearchSuggestions' ) == 1 %]
125
[% Asset.js("js/wikipedia-search.js") | $raw %]
126
[% END %]
127
124
<script>
128
<script>
125
    //<![CDATA[
129
    //<![CDATA[
126
    var MSG_CONFIRM_AGAIN = _("Warning: Cannot be undone. Please confirm once again")
130
    var MSG_CONFIRM_AGAIN = _("Warning: Cannot be undone. Please confirm once again")
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/wikipedia-search.js (-1 / +20 lines)
Line 0 Link Here
0
- 
1
// Wikipedia search auto-complete help
2
    $("#translControl1").autocomplete({
3
        source: function(request, response) {
4
            $.ajax({
5
                url: "https://en.wikipedia.org/w/api.php",
6
                dataType: "jsonp",
7
                data: {
8
                    'action': "opensearch",
9
                    'format': "json",
10
                    'search': request.term
11
                },
12
                success: function(data) {
13
                    response(data[1]);
14
                }
15
            });
16
        },
17
        open: function() {
18
            $('.ui-autocomplete').append('<li style="text-align:right;font-size:80%;padding: 5px 10px;background:rgba(0,0,0,0.1)">Powered by Wikipedia</li>');
19
        }
20
    });

Return to bug 25532