Bugzilla – Attachment 112603 Details for
Bug 14242
Use ISBN-field to fill out purchase suggestions using Google Books API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment
Bug-14242-Styling-of-buttons-get-copyright-date-fi.patch (text/plain), 10.62 KB, created by
Aleisha Amohia
on 2020-10-28 02:25:22 UTC
(
hide
)
Description:
Bug 14242: Styling of buttons, get copyright date, fixing plugin comment
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-10-28 02:25:22 UTC
Size:
10.62 KB
patch
obsolete
>From 13569d08f2d72b6af921edc54c2f589566a3ae60 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 21 Apr 2020 01:51:16 +0000 >Subject: [PATCH] Bug 14242: Styling of buttons, get copyright date, fixing > plugin comment > >And other code-y bits. Addressing comments in Comment 59. > >Sponsored-by: Catalyst IT > >Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> >--- > .../mysql/atomicupdate/bug_14242-autofill_syspref.perl | 6 ++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../prog/en/modules/admin/preferences/opac.pref | 2 +- > .../opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 4 ---- > .../opac-tmpl/bootstrap/en/modules/opac-suggestions.tt | 17 ++++++++++++----- > koha-tmpl/opac-tmpl/bootstrap/js/autofill.js | 18 ++++++++---------- > 6 files changed, 28 insertions(+), 21 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_14242-autofill_syspref.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_14242-autofill_syspref.perl b/installer/data/mysql/atomicupdate/bug_14242-autofill_syspref.perl >new file mode 100644 >index 0000000000..c56eae70ef >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14242-autofill_syspref.perl >@@ -0,0 +1,6 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`,`type`) VALUES ('OPACSuggestionAutoFill', '0', NULL, 'Automatically fill OPAC suggestion form with data from Google Books API','YesNo') }); >+ >+ NewVersion( $DBversion, 14242, "Add OPACSuggestionAutoFill system preference"); >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 1597c95d30..2d97def257 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -368,7 +368,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OAI-PMH:DeletedRecord','persistent','Koha\'s deletedbiblio table will never be deleted (persistent), might be deleted (transient), or will never have any data in it (no)','transient|persistent|no','Choice'), > ('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'), > ('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'), >-('OPACSuggestionAutoFill','0',NULL,'Automaticly fill forms with data from Google Books API','YesNo'), >+('OPACSuggestionAutoFill','0',NULL,'Automatically fill OPAC suggestion form with data from Google Books API','YesNo'), > ('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'), > ('OpacAdvSearchMoreOptions','pubdate,itemtype,language,subtype,sorting,location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple'), > ('OpacAdvSearchOptions','pubdate,itemtype,language,sorting,location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 433a5dc191..ef12b4e063 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -536,7 +536,7 @@ OPAC: > choices: > yes: Enable > no: Disable >- - automatic form filling with data from Google Books API. >+ - OPAC suggestions form automatically filling with data from Google Books API. > - > - "Use the following as the OPAC ISBD template:" > - pref: OPACISBD >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 80b435aad1..1641593395 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -279,10 +279,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip); > </script> > [% END %] > >-[% IF ( Koha.Preference('OPACSuggestionAutoFill') ) %] >- <script type="text/javascript" src="[% interface %]/[% theme %]/js/autofill.js"></script> >-[% END %] >- > [% IF ( BakerTaylorEnabled ) %] > [% Asset.js("js/bakertaylorimages.js") | $raw %] > <script> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 4a9230c40e..b02858c0ae 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -65,8 +65,11 @@ > > <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form"> > [% IF Koha.Preference( 'OPACSuggestionAutoFill' ) %] >- <fieldset class="rows well" style="margin-bottom: 3em;padding-top: 5px;"> >- <label for="isbn">Standard number (ISBN, ISSN or other):</label><input type="text" id="isbn" name="isbn" maxlength="80" /> >+ <fieldset class="rows well" style="margin-bottom: 3em;padding: 5px;"> >+ <ol><li> >+ <label for="isbn">Standard number (ISBN, ISSN or other):</label> >+ <input type="text" id="isbn" name="isbn" maxlength="80" style="margin-right:10px;margin-top:10px;" size="15"/> >+ </li></ol> > </fieldset> > [% END %] > <fieldset class="rows [% IF Koha.Preference( 'OPACSuggestionAutoFill' ) %]well[% END %]"> >@@ -98,11 +101,11 @@ > <div title="Copyright or publication year, for example: 2016"> > [% IF ( copyrightdate_required ) %] > <label for="copyrightdate" class="required">Copyright date:</label> >- <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" /> >- <span class="required">Required</span> >+ <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" maxlength="4" value="[% copyrightdate | html %]" required="required" /> >+ <span class="required">Required</span> > [% ELSE %] > <label for="copyrightdate">Copyright date:</label> >- <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" /> >+ <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" maxlength="4" value="[% copyrightdate | html %]" /> > [% END %] > </div> > </li> >@@ -470,6 +473,9 @@ > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >+[% IF ( Koha.Preference("OPACSuggestionAutoFill") ) %] >+ [% Asset.js("js/autofill.js") | $raw %] >+[% END %] > [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > <script> >@@ -495,6 +501,7 @@ > 'volumeInfo.title': {target: 'title', effect: 'flash'}, > 'volumeInfo.authors': {target: 'author', effect: 'flash'}, > 'volumeInfo.publisher': {target: 'publishercode', effect: 'flash'}, >+ 'volumeInfo.publishedDate': {target: 'copyrightdate', effect: 'flash'}, > /* google books api seem to only have books, so if we got a result > * item, type will be a book, so set to BK (book). */ > 'kind': {target: 'itemtype', handle: function(t,v) { t.val('BK'); },}, >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js b/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js >index d3c2e4683d..bdade9a575 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/autofill.js >@@ -1,7 +1,9 @@ > /* >- * jQuery autofill plugin >+ * Plugin dealing with the Google API based on jQuery autofill plugin >+ * https://plugins.jquery.com/autofill/ > * >- * Automaticly fills form inputs with relevant data based on search result >+ * Automatically fills form inputs with relevant data based on search result >+ * Modified for OPAC Suggestion form > */ > > (function ($) { >@@ -26,11 +28,9 @@ > self.fields = fields; > > /* decorate element as autofiller */ >- var $inputgroup = $('<div class="input-prepend">'); >- self.$undo = $('<span class="add-on" style="display:none;cursor:pointer;">' + MSG_UNDO_AUTOFILL_SUGGESTION + '</span>'); >- self.$fillbtn = $('<span class="add-on" style="cursor:pointer;">' + MSG_SEARCH_GOOGLE_BOOKS + '</span>'); >- self.$error = $('<span class="add-on" style="display:none;"></span>'); >- self.$elm.wrap($inputgroup); >+ self.$undo = $('<input type="button" class="btn" style="display:none;margin-left:5px;" value="' + MSG_UNDO_AUTOFILL_SUGGESTION + '" />'); >+ self.$fillbtn = $('<input type="button" class="btn" value="' + MSG_SEARCH_GOOGLE_BOOKS + '" />'); >+ self.$error = $('<span class="add-on" style="display:none;padding-left:5px;"></span>'); > self.$elm.after(self.$error); > self.$elm.after(self.$undo); > self.$elm.after(self.$fillbtn); >@@ -65,13 +65,11 @@ > self.$fillbtn.fadeOut(1000).fadeIn(1000); > if ( self.$elm.val()) { > var gAPI = 'https://www.googleapis.com/books/v1/volumes?q='; >- if(self.type) >- gAPI += self.type + ':'; > gAPI += self.$elm.val().replace(/\-/g, ''); > gAPI += '&maxResults=1'; > $.getJSON(gAPI, function (response) { > if(response.totalItems == 0) { >- self.$error.html('Sorry, nothing found.'); >+ self.$error.html(_('Sorry, nothing found.')); > self.$error.show(); > return; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14242
:
42002
|
55949
|
56061
|
56062
|
56070
|
56071
|
56072
|
56073
|
56074
|
56075
|
84760
|
84761
|
84762
|
84763
|
84764
|
84840
|
85031
|
85032
|
85033
|
85034
|
85035
|
89643
|
89662
|
90157
|
90158
|
90159
|
90160
|
90161
|
90162
|
90250
|
90251
|
90252
|
90253
|
90254
|
90255
|
103527
|
103528
|
103529
|
103530
|
103531
|
103532
|
103533
|
108695
|
108696
|
108697
|
108698
|
108699
|
108700
|
108701
|
110141
|
110142
|
110143
|
110144
|
110145
|
110146
|
110147
|
110148
|
110493
|
110494
|
110495
|
110496
|
110497
|
110498
|
110499
|
110500
|
110501
|
110990
|
112597
|
112598
|
112599
|
112600
|
112601
|
112602
|
112603
|
112604
|
112605
|
112606
|
112607
|
113162
|
113163
|
113164
|
113165
|
113166
|
113167
|
116620
|
116712
|
116968
|
116989
|
125380
|
125381
|
125382
|
131219
|
131220
|
131221
|
131222
|
133985
|
133986
|
133987
|
133988
|
134273
|
134274
|
134275
|
134276
|
134277
|
134278