Bug 10756 - Carousel Display of New Titles on OPAC home page
Summary: Carousel Display of New Titles on OPAC home page
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement with 10 votes (vote)
Assignee: Bob Birchall
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-19 07:12 UTC by Bob Birchall
Modified: 2018-05-16 14:37 UTC (History)
13 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10756 - Carousel Display of New Titles on OPAC home page (265.11 KB, patch)
2016-05-04 03:49 UTC, Mason James
Details | Diff | Splinter Review
Bug 10756 - Carousel Display of New Titles on OPAC home page (26.92 KB, patch)
2016-05-04 03:50 UTC, Mason James
Details | Diff | Splinter Review
Bug 10756 - Carousel Display of New Titles on OPAC home page (264.25 KB, patch)
2016-05-04 06:28 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 10756 - Carousel Display of New Titles on OPAC home page (27.34 KB, patch)
2016-05-04 06:28 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 10756 - Carousel Display - Followup (1.73 KB, patch)
2016-05-04 07:07 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 10756 - Carousel Display - Followup (1.82 KB, patch)
2016-05-04 13:33 UTC, Mason James
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Birchall 2013-08-19 07:12:18 UTC
This feature displays recently added items to your Koha's main OPAC page, using a 'carousel' style display.

This feature can be enabled/disabled via a Koha syspref, and requires memcached.
This feature can be styled and configured using CSS.

A demo of the feature (Koha-3.10) is available at http://demo.calyx.net.au

This feature adds to Koha the ContentFlow library by JacksAsylum.eu (MIT license):  http://jacksasylum.eu/ContentFlow/index.php

Special thanks to Harvest Bible College, Australia for sponsoring this feature. 
Thanks also to Albany Senior High School,New Zealand and KohaAloha for an earlier prototype.
Comment 1 Magnus Enger 2015-02-06 09:03:19 UTC
Any movement here? :-)
Comment 2 Jerwyn 2015-07-09 13:11:21 UTC
Oh yeah! This is a nice feature! 

Its been almost 2 years any update on this?


Thanks!
Comment 3 Eugene Espinoza 2015-07-09 13:44:10 UTC
This will be a nice feature added into Koha ILS, instead of trying out different technologies just to make this work, which can be a migration headache.
Comment 4 Nicole C. Engard 2015-07-11 19:38:40 UTC
The coverflow plugin : http://bywatersolutions.com/koha-plugins/ uses the public reports to generate a responsive carousel of books.
Comment 5 Mason James 2016-05-04 03:49:21 UTC Comment hidden (obsolete)
Comment 6 Mason James 2016-05-04 03:50:07 UTC Comment hidden (obsolete)
Comment 7 Mason James 2016-05-04 04:05:43 UTC
QA note: patchset applied to 68dbe84 'Bug 14632: Add Copyright for the Koha'
Comment 8 Magnus Enger 2016-05-04 06:03:02 UTC
(In reply to Mason James from comment #7)
> QA note: patchset applied to 68dbe84 'Bug 14632: Add Copyright for the Koha'

That bug number and title does not match up.
Comment 9 Magnus Enger 2016-05-04 06:28:43 UTC
Created attachment 51175 [details] [review]
Bug 10756 - Carousel Display of New Titles on OPAC home page

add ContentFlow dir

 http://www.jacksasylum.eu/ContentFlow

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Comment on the other patch.
Comment 10 Magnus Enger 2016-05-04 06:28:58 UTC
Created attachment 51176 [details] [review]
Bug 10756 - Carousel Display of New Titles on OPAC home page

test plan...
1/ import some bibs into your database for testing (important)

 $ wget http://www.loc.gov/catdir/cpso/RDAtest/extra_bib_marc.zip
 $ unzip extra_bib_marc.zip
 $ bulkmarcimport.pl -b -m ISO2709 -file ./formal_extra_all_final.bib

2/ apply patches

3/ execute atomic update to add syspref and 'Carousel' table

 $ perl ./installer/data/mysql/atomicupdate/Bug-10756-carousel.pl

4/ open OPAC homepage in web-browser, observe no change

5/ set 'OpacCarousel' syspref to 'display'

6/ open OPAC homepage in web-browser, observe a new carousel :0)

extra QA tests...

7/ run 5 carousel tests
 $ prove ./t/db_dependent/Carousel.t

8/ run qa-tool on patchset
 $ qa -c 2

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Followed the test plan, everything worked as expected. The front page
displays a nice coverflow widget.

More parameters to control the widget would be nice, but that could
be added later.

On first running this I got a nasty 500 error: "Can't call method
"is_valid" on an undefined value at /home/magnus/scripts/kohaclone/Koha/Carousel.pm
line 128." But I think I found a cure for that and will propose a
followup patch.
Comment 11 Magnus Enger 2016-05-04 07:07:08 UTC Comment hidden (obsolete)
Comment 12 Magnus Enger 2016-05-04 07:10:27 UTC
I have signed off the two original patches from Mason. As noted in the sign off message I found a problem for 13 digit ISBNs that do not start with 978. The third patch attempts to fix this. I think my patch needs a signoff, so I am leaving this bug as "Needs Signoff".
Comment 13 Marcel de Rooy 2016-05-04 11:23:05 UTC
Mason:
Just wondering why you picked ContentFlow?
I once wrote something simple with jquery.jcarousel.min.js and just note that this carousel is considerably larger (18K vs 264K?). BTW I am not saying that we should use the other one :)
On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010? If there is no further development(?), this might be a risk.
Comment 14 Frédéric Demians 2016-05-04 12:09:29 UTC
I don't see the advantage of this implementation against Bywater plugin. I can
rather see disadvantages, including ContentFlow.js obsolescence (not updated
since 2010, when jQuery Flipster used by ByWater plugin is actively
maintained). Reading the code, I don't understand how GetRecentBibs generates
the list of 'recent' bibs. Why a new table (carousel)? Is it necessary to
read/re-read this table each time the OPAC main page is loaded?
Comment 15 Mason James 2016-05-04 13:33:15 UTC
Created attachment 51187 [details] [review]
Bug 10756 - Carousel Display - Followup

On first testing this I got a 500 error saying "Can't call method
"is_valid" on an undefined value at /home/magnus/scripts/kohaclone/Koha/Carousel.pm
line 128." This was caused by a record with an ISBN of "979-10-91414-01-2".
The relevant code looks like this:
    my $isbn_obj = Business::ISBN->new($ii);
    my $isbn10;
    $isbn10 = $isbn_obj->as_isbn10;
    if ( $isbn10->is_valid() ) {...}
The documentation for Business::ISBN::as_isbn10 says: "Returns a new
ISBN object. If the object is already ISBN-10, this method clones it.
If it is an ISBN-13 with the prefix 978, it returns the ISBN-10
equivalent. For all other cases it returns undef." So for an ISBN that
starts with 979 like mine did, $isbn10 will be undef and we need to do
some extra checking before is_valid().

To test:
- Apply the first two patches on this bug and follow their test plan
- Make sure you have a new record with an ISBN that starts with 979
- Refresh the front page and observe the error
- Apply this patch
- Refresh the front page again and notice the absence of the error

Signed-off-by: Mason James <mtj@kohaaloha.com>
Comment 16 Mason James 2016-05-04 13:43:38 UTC
(In reply to Marcel de Rooy from comment #13)
> Mason:
> Just wondering why you picked ContentFlow?

2 reasons, 
 1/ it's the carousel CALYX selected for production 3 years ago
 2/ it works well in responsive views, (others did not work)

> I once wrote something simple with jquery.jcarousel.min.js and just note
> that this carousel is considerably larger (18K vs 264K?). BTW I am not
> saying that we should use the other one :)
> On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010?
> If there is no further development(?), this might be a risk.

I think it a great idea to offer multiple carousel options, 
but I left this extra functionality until after the patch was accepted

I plan to add other carousels to the feature, should the patch be accepted
Comment 17 Jonathan Druart 2016-05-04 17:13:48 UTC
(In reply to Marcel de Rooy from comment #13)
> On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010?
> If there is no further development(?), this might be a risk.

I can see that as blocker, Mason, would it be easy to update the plugin you used?

(In reply to Frédéric Demians from comment #14)
> I don't see the advantage of this implementation against Bywater plugin. I
> can
> rather see disadvantages, including ContentFlow.js obsolescence (not updated
> since 2010, when jQuery Flipster used by ByWater plugin is actively
> maintained). Reading the code, I don't understand how GetRecentBibs generates
> the list of 'recent' bibs. Why a new table (carousel)? Is it necessary to
> read/re-read this table each time the OPAC main page is loaded?

Same for me, it's not conceivable to call this subroutine for each get of the opac main page. Could you please detail what is the purpose of this subroutine?
Why do you need a new table, cache of the image url that's it?

Additional comments:
- kohastructure.sql changes are missing
- Amazon lookup should be optional
- We have several subroutines in C4::Koha to deal with ISBNs, I am sure you could reuse
- What are the 150 and 300 hardcoded limits?
- It would be better to use Koha::Object
- It would be great to remove all the debug variables, it will ease the readability
Comment 18 Mason James 2016-05-10 06:20:04 UTC
(In reply to Jonathan Druart from comment #17)
> (In reply to Marcel de Rooy from comment #13)
> > On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010?
> > If there is no further development(?), this might be a risk.
> 
> I can see that as blocker, Mason, would it be easy to update the plugin you
> used?

hi, yes - its very easy to swap the carousel plugin to anything else
i'm happy to change the carousel plugin to whatever people desire


> (In reply to Frédéric Demians from comment #14)
> > I don't see the advantage of this implementation against Bywater plugin.

afaik, the big advantage is that the Bywater plugin can't display an *automated* selection of verified cover-images for recently added items

i think for the Bywater plugin, a manual list (report?) would need to be created daily, then each item manually verified for a matching amazon image?


> > rather see disadvantages, including ContentFlow.js obsolescence (not updated
> > since 2010, when jQuery Flipster used by ByWater plugin is actively
> > maintained). Reading the code, I don't understand how GetRecentBibs generates
> > the list of 'recent' bibs. Why a new table (carousel)? Is it necessary to
> > read/re-read this table each time the OPAC main page is loaded?
> 
> Same for me, it's not conceivable to call this subroutine for each get of
> the opac main page. 

with a warmed cache table, the GetRecentBibs() sub takes around 10ms on my old slow VM.  10ms seems acceptable?

> Could you please detail what is the purpose of this subroutine?

the subroutine returns a list of recently added bibs with verified matching amazon cover images

> Why do you need a new table, cache of the image url that's it?

yes, thats all - a method of caching the urls is needed for the feature to work at an acceptable speed
fyi: i did experiment with memcache - but the speed difference was small/negligible, so i decided upon the convenience of a mysql table instead


> Additional comments:
> - kohastructure.sql changes are missing
thanks, i can do this - no problem

> - Amazon lookup should be optional
amazon lookups effectively cease (ie: become 0) as the cache table becomes populated
so this is probably not needed? (unless i misunderstand your point)

> - We have several subroutines in C4::Koha to deal with ISBNs, I am sure you
> could reuse

thanks for the suggestion, i could use NormalizedISBN() instead

> - What are the 150 and 300 hardcoded limits?

they are limits to reduce the item list, 
the values were chosen to give a happy balance of acceptable performance and a good selection of randomised items

> - It would be better to use Koha::Object

sure, i can do this - no problem

> - It would be great to remove all the debug variables, it will ease the
> readability

i would really prefer to leave the debug/profiling code (should any future problems occur?), 
i'm happy to tidy/improve the readability of the profiling code
Comment 19 Mason James 2016-05-10 06:29:36 UTC
> > Same for me, it's not conceivable to call this subroutine for each get of
> > the opac main page. 
> 
> with a warmed cache table, the GetRecentBibs() sub takes around 10ms on my
> old slow VM.  10ms seems acceptable?

a small missed point.. the GetRecentBibs() sub is only executed if the Caro syspref is manually enabled
Comment 20 Mason James 2016-05-17 04:47:56 UTC
(In reply to Jonathan Druart from comment #17)
> (In reply to Marcel de Rooy from comment #13)
> > On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010?
> > If there is no further development(?), this might be a risk.
> 
> I can see that as blocker, Mason, would it be easy to update the plugin you
> used?

Jonathan, can you please suggest a replacement for ContentFlow, so I may proceed
Comment 21 Jonathan Druart 2016-05-17 13:04:44 UTC
(In reply to Mason James from comment #20)
> (In reply to Jonathan Druart from comment #17)
> > (In reply to Marcel de Rooy from comment #13)
> > > On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010?
> > > If there is no further development(?), this might be a risk.
> > 
> > I can see that as blocker, Mason, would it be easy to update the plugin you
> > used?
> 
> Jonathan, can you please suggest a replacement for ContentFlow, so I may
> proceed

I have no idea, but reading the previous comment it seems that jcarousel or jquery-flipster could be good candidates.
Kyle, any ideas?
Comment 22 Mason James 2016-05-23 04:58:30 UTC
(In reply to Jonathan Druart from comment #21)
> (In reply to Mason James from comment #20)
> > (In reply to Jonathan Druart from comment #17)
> > > (In reply to Marcel de Rooy from comment #13)
> > > > On http://www.jacksasylum.eu/ContentFlow/ I only see changelogs until 2010?
> > > > If there is no further development(?), this might be a risk.
> > > 
> > > I can see that as blocker, Mason, would it be easy to update the plugin you
> > > used?
> > 
> > Jonathan, can you please suggest a replacement for ContentFlow, so I may
> > proceed
> 
> I have no idea, but reading the previous comment it seems that jcarousel or
> jquery-flipster could be good candidates.
> Kyle, any ideas?

my humble opinion is that aesthetically flipster is a better choice for the style of this feature
Comment 23 Nick Clemens 2016-07-07 18:22:45 UTC
The ByWater plugin actually can automatically update the covers used.  It uses a public report, chosen in config, so updates whenever the cache expires. 

I would like to see this option remain as we have many users basing their reports on time or specific item types or collection codes, or pointing the report to a list they can individually and and remove titles from. More flexibility is often better :-)

The coverflow plugin is currently tied to amazon covers and generates the links statically:
<img src="http://images.amazon.com/images/P/[% d.isbn %].01.LZZZZZZZ.jpg" />

I would second the use of Flipster since it has a few different config options available (coverflow, carousel, flat)
Comment 24 Marcel de Rooy 2016-07-13 12:54:43 UTC
(In reply to Nick Clemens from comment #23)
> I would second the use of Flipster since it has a few different config
> options available (coverflow, carousel, flat)

To second here does mean first, not second choice? :)
Comment 25 Nick Clemens 2016-07-13 15:54:03 UTC
(In reply to Marcel de Rooy from comment #24)
> (In reply to Nick Clemens from comment #23)
> > I would second the use of Flipster since it has a few different config
> > options available (coverflow, carousel, flat)
> 
> To second here does mean first, not second choice? :)

Poor choice of English vocabulary in a global community :-)

Yes, I support flipster as first choice
Comment 26 Kyle M Hall 2016-07-14 14:43:13 UTC
I would also recommend using Flipster. It's even touch aware and has multiple layout options.

Honestly, I'd recommend you take a good look at the cover flow plugin ( https://github.com/bywatersolutions/koha-plugin-coverflow ) 
and steal heavily from it ; )

It provides a very efficient and flexible way to define the results you want, and allows for as many coverflows as you'd like. The results are based on reports, which are cached, and the javascript it generates is also cached.

The only thing it's really lacking is a nice graphical editor. Right now all the setting are defined as a piece of hand written JSON.
Comment 27 Mason James 2016-09-28 00:26:52 UTC
(In reply to Nick Clemens from comment #23)
> The ByWater plugin actually can automatically update the covers used.  It
> uses a public report, chosen in config, so updates whenever the cache
> expires. 

hi Barton, that sounds positive. 

can you please provide the SQL for the public report, so i can test this further?
Comment 28 Nick Clemens 2016-09-28 15:01:40 UTC
(In reply to Mason James from comment #27)
> (In reply to Nick Clemens from comment #23)
> > The ByWater plugin actually can automatically update the covers used.  It
> > uses a public report, chosen in config, so updates whenever the cache
> > expires. 
> 
> hi Nick, that sounds positive. 
> 
> can you please provide the SQL for the public report, so i can test this
> further?

Pasting in the default report we use, but the plugin allows for use of any report the user saves in Koha through the reports module 

So we have used it to report froma public list, or only on specific item types, we even have a few libraries that manually restrict the report to biblios in the IN statement.

Standard setup is this:
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 != ''
  HAVING isbn != ""
  ORDER BY rand()
  LIMIT 7