Bugzilla – Attachment 18361 Details for
Bug 10320
Show results from library's OverDrive collection in OPAC search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10320 - Integrate OverDrive search into OPAC (2/2)
Bug-10320---Integrate-OverDrive-search-into-OPAC-2.patch (text/plain), 3.87 KB, created by
Jesse Weaver
on 2013-05-24 00:08:26 UTC
(
hide
)
Description:
Bug 10320 - Integrate OverDrive search into OPAC (2/2)
Filename:
MIME Type:
Creator:
Jesse Weaver
Created:
2013-05-24 00:08:26 UTC
Size:
3.87 KB
patch
obsolete
>From 94c7ece48daf649f58db675f50dcd30d9f8f57d1 Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Thu, 23 May 2013 18:07:59 -0600 >Subject: [PATCH] Bug 10320 - Integrate OverDrive search into OPAC (2/2) > >This followup adds the sysprefs and copies the relevant JS to CCSR. >--- > installer/data/mysql/updatedatabase.pl | 15 +++++++ > koha-tmpl/opac-tmpl/ccsr/en/js/overdrive.js | 61 +++++++++++++++++++++++++++ > 2 files changed, 76 insertions(+) > create mode 100644 koha-tmpl/opac-tmpl/ccsr/en/js/overdrive.js > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 3134261..aad5a52 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6971,6 +6971,21 @@ if(CheckVersion($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.13.00.XXX"; >+if(CheckVersion($DBversion)) { >+ $dbh->do( >+"INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OverDriveClientKey','','Client key for OverDrive integration','30','Free')" >+ ); >+ $dbh->do( >+"INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OverDriveClientSecret','','Client key for OverDrive integration','30','YesNo')" >+ ); >+ $dbh->do( >+"INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacDriveLibraryID','','Library ID for OverDrive integration','','Integer')" >+ ); >+ print "Upgrade to $DBversion done (Bug 10320 - Show results from library's OverDrive collection in OPAC search)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/opac-tmpl/ccsr/en/js/overdrive.js b/koha-tmpl/opac-tmpl/ccsr/en/js/overdrive.js >new file mode 100644 >index 0000000..0a04a0b >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/ccsr/en/js/overdrive.js >@@ -0,0 +1,61 @@ >+if ( typeof KOHA == "undefined" || !KOHA ) { >+ var KOHA = {}; >+} >+ >+KOHA.OverDrive = ( function() { >+ var proxy_base_url = '/cgi-bin/koha/svc/overdrive_proxy'; >+ var library_base_url = 'http://api.overdrive.com/v1/libraries/'; >+ return { >+ Get: function( url, params, callback ) { >+ $.ajax( { >+ type: 'GET', >+ url: url.replace( /https?:\/\/api.overdrive.com\/v1/, proxy_base_url ), >+ dataType: 'json', >+ data: params, >+ error: function( xhr, error ) { >+ try { >+ callback( JSON.parse( xhr.responseText )); >+ } catch ( e ) { >+ callback( {error: xhr.responseText || true} ); >+ } >+ }, >+ success: callback >+ } ); >+ }, >+ GetCollectionURL: function( library_id, callback ) { >+ if ( KOHA.OverDrive.collection_url ) { >+ callback( KOHA.OverDrive.collection_url ); >+ return; >+ } >+ >+ KOHA.OverDrive.Get( >+ library_base_url + library_id, >+ {}, >+ function ( data ) { >+ if ( data.error ) { >+ callback( data ); >+ return; >+ } >+ >+ KOHA.OverDrive.collection_url = data.links.products.href; >+ >+ callback( data.links.products.href ); >+ } >+ ); >+ }, >+ Search: function( library_id, q, limit, offset, callback ) { >+ KOHA.OverDrive.GetCollectionURL( library_id, function( data ) { >+ if ( data.error ) { >+ callback( data ); >+ return; >+ } >+ >+ KOHA.OverDrive.Get( >+ data, >+ {q: q, limit: limit, offset: offset}, >+ callback >+ ); >+ } ); >+ } >+ }; >+} )(); >-- >1.7.10.4
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 10320
:
18360
|
18361
|
18687
|
18688
|
18970
|
19225
|
19493
|
19773
|
19774
|
19775
|
19884
|
19885
|
19886
|
19887
|
19989
|
20024