LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Wednesday, March 10, 2021

Setting up the Koha Coverflow Plugin (Bywater Solutions)

0 comments
Coverflow plugin allows you to display new arrival books of your koha library system. The plugin is developed by Bywater solution

Downloading

From the release page, you can download the relevant *.kpz file

Installing

Koha's Plugin System allows for you to add additional tools and reports to Koha that are specific to your library. Plugins are installed by uploading KPZ ( Koha Plugin Zip ) packages. A KPZ file is just a zip file containing the Perl files, template files, and any other files necessary to make the plugin work.

First, you will need to turn on the koha plugin system

Open the koha-config.xml file

sudo vim /etc/koha/sites/library/koha-conf.xml

Change <enable_plugins>0<enable_plugins> to 

<enable_plugins>1</enable_plugins> in your koha-conf.xml file

Confirm that the path to <pluginsdir> exists, in my case the path is 

<pluginsdir>/var/lib/koha/library/plugins</pluginsdir>

Restart web server and Memcached

sudo systemctl restart apache2 memcached koha-common

Once set up is complete you will need to alter your UseKohaPlugins system preference if you are using version 19.05 and earlier. from v20.05 onward plugin appears in the  Administration --> Plugins --> Manage Plugins and then upload the plugin.

Generate a public report

First, you need to create one or more public reports ( New Arrivals) for your coverflow widget or widgets to be based on. This is how the plugin knows what the content of your widget should contain. Each report needs only three columns; title, biblionumber, and ISBN. It is important that you have a good and valid ISBN, as that is the datum used to actually fetch the cover. Example finding items added in the last 30 days:

SELECT b.biblionumber, SUBSTRING_INDEX(m.isbn, ' ', 1) AS isbn, b.title
FROM items i
LEFT JOIN biblioitems m USING (biblioitemnumber)
LEFT JOIN biblio b ON (i.biblionumber=b.biblionumber)
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= i.dateaccessioned AND m.isbn IS NOT NULL AND m.isbn != ''
GROUP BY biblionumber
HAVING isbn != ""
ORDER BY rand()
LIMIT 30

For New arrivals under branch libraries, use this SQL query

SELECT b.biblionumber, SUBSTRING_INDEX(m.isbn, ' ', 1) AS isbn, b.title
FROM items i
LEFT JOIN biblioitems m USING (biblioitemnumber)
LEFT JOIN biblio b ON (i.biblionumber=b.biblionumber)
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= i.dateaccessioned AND m.isbn IS NOT NULL AND m.isbn != ''
AND i.homebranch = <<Branch|branches>>
GROUP BY biblionumber
HAVING isbn != ""
ORDER BY rand()
LIMIT 30

For Local Cover Images

SELECT DISTINCT biblio.title, biblio.biblionumber, SUBSTRING_INDEX(biblioitems.isbn, ' ', 1) AS isbn, c.imagenumber AS localcover
FROM items
LEFT JOIN biblioitems USING (biblioitemnumber)
LEFT JOIN biblio ON (items.biblionumber=biblio.biblionumber)
LEFT JOIN cover_images c ON (items.biblionumber=c.biblionumber)
WHERE biblioitems.isbn IS NOT NULL AND biblioitems.isbn !=''
ORDER BY RAND()
LIMIT 15;

Configure the plugin   

Administration --> Plugins --> Manage Plugins --> Select the installed plugin --> Click configure and put the below code replacing the New Arrival public report id.


---
- id: 5
  selector: "#coverflow"
  options:
    buttons: true
    autoplay: 4000
    loop: true

Here id: 5 is the public report that we created

Now go to Koha Tools --> News (from v20.05)  and in OpacMainUserBlock add the following html tag

<center><span style="font-family: merriweather; color: #e3031d;">New Arrivals<br /><br /></span></center><span id="coverflow">Loading...</span>

Now check your OPAC page to view the coverflow.

Other styles and configurations

---
- id: 50
  selector: "#coverflow"
  options:
    style: coverflow
    buttons: true
    autoplay: 4000
    loop: true


- id: 59
  selector: "#carousel"
  options:
    style: carousel
    buttons: true
    autoplay: 4000
    loop: true

- id: 44
  selector: "#wheel"
  options:
    style: wheel
    buttons: true
    autoplay: 4000
    loop: true

- id: 133
  selector: "#flat"
  options:
    style: flat
    buttons: true
    autoplay: 4000
    loop: true


<!-- For Coverflow Style -->
<span id="coverflow">Loading Coverflow...</span>

<!-- For Carousel Style -->
<span id="carousel">Loading Carousel...</span>

<!-- For Wheel Style -->
<span id="wheel">Loading Wheel...</span>

<!-- For Flat Style -->
<span id="flat">Loading Flat...</span>

No comments:

Post a Comment