From cfc828d832ecee92478466cd2f4e174c2f4b5c3c Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Mon, 22 Jul 2013 10:14:51 -0400 Subject: [PATCH] OPAC Browse: bugfixes squashed together from LP #1177810 In specific: OPAC Browse: go back from numbered to bulleted results OPAC Browse: Avoid showing tracing if linked authorities have no bibs OPAC Browse: Replace English pager with customizable pager OPAC Browse: Extra small bit of documentation about author headings Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Kathy Lussier Signed-off-by: Jason Stephenson --- .../lib/OpenILS/WWW/EGCatLoader/Browse.pm | 13 +++++++++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 14 ++++++++++ .../upgrade/YYYY.schema.bib-auth-browse.sql | 10 +++++++ Open-ILS/src/templates/opac/browse.tt2 | 11 ++++---- Open-ILS/src/templates/opac/parts/config.tt2 | 8 ------ .../RELEASE_NOTES_NEXT/OPAC/BibAuthBrowse.txt | 27 +++++++++++++------ 6 files changed, 61 insertions(+), 22 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm index 81644e63e3..593eb2b049 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm @@ -338,6 +338,19 @@ sub load_browse { } } + my $pager_shortcuts = $self->ctx->{get_org_setting}->( + $self->ctx->{physical_loc} || $self->ctx->{search_ou} || + $self->ctx->{aou_tree}->id, 'opac.browse.pager_shortcuts' + ); + if ($pager_shortcuts) { + my @pager_shortcuts; + while ($pager_shortcuts =~ s/(\*(.+?)\*)//) { + push @pager_shortcuts, [substr($2, 0, 1), $2]; + } + push @pager_shortcuts, map { [$_, $_] } split //, $pager_shortcuts; + $self->ctx->{pager_shortcuts} = \@pager_shortcuts; + } + if ($self->cgi->param('qtype') and defined $self->cgi->param('bterm')) { $self->leading_article_test( diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 2b6772d064..dad8658234 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -4824,6 +4824,20 @@ INSERT into config.org_unit_setting_type 'description' ), 'string', null) +,( 'opac.browse.pager_shortcuts', 'opac', + oils_i18n_gettext( + 'opac.browse.pager_shortcuts', + 'Paging shortcut links for OPAC Browse', + 'coust', + 'label' + ), + oils_i18n_gettext( + '', + 'The characters in this string, in order, will be used as shortcut links for quick paging in the OPAC browse interface. Any sequence surrounded by asterisks will be taken as a whole label, not split into individual labels at the character level, but only the first character will serve as the basis of the search.', + 'coust', + 'description' + ), + 'string', null) ; diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql index 466053c6ea..358fb49a51 100644 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql @@ -7487,6 +7487,16 @@ UPDATE config.metabib_field browse_xpath IS NULL AND field_class = 'author'; +INSERT INTO config.org_unit_setting_type ( + name, label, grp, description, datatype +) VALUES ( + 'opac.browse.pager_shortcuts', + 'Paging shortcut links for OPAC Browse', + 'opac', + 'The characters in this string, in order, will be used as shortcut links for quick paging in the OPAC browse interface. Any sequence surrounded by asterisks will be taken as a whole label, not split into individual labels at the character level, but only the first character will serve as the basis of the search.', + 'string' +); + COMMIT; \qecho This is a browse-only reingest of your bib records. It may take a while. diff --git a/Open-ILS/src/templates/opac/browse.tt2 b/Open-ILS/src/templates/opac/browse.tt2 index 44062b6ace..8ad04e80f9 100644 --- a/Open-ILS/src/templates/opac/browse.tt2 +++ b/Open-ILS/src/templates/opac/browse.tt2 @@ -50,12 +50,11 @@ [% IF ctx.back_pivot %] ← [%l ('Back') %] [% END %] - [% IF browse.english_pager; # XXX how to apply i18n here? + [% IF ctx.pager_shortcuts; current_qtype = CGI.param('qtype') || 'title' %] - 0-9 - [% FOR letter IN ['A'..'Z'] %] - [% letter %] + [% FOR shortcut IN ctx.pager_shortcuts %] + [% shortcut.1 %] [% END %] [% END %] @@ -92,7 +91,7 @@ [% END %] -
    +
      [% FOR result IN ctx.browse_results %]
    • @@ -129,7 +128,7 @@ # that h.target_count is only # defined when h.target is. - IF h.target %] + IF h.target AND h.target_count %]
    • [% field.name %] [% h.heading | html %] ([% h.target_count %]) diff --git a/Open-ILS/src/templates/opac/parts/config.tt2 b/Open-ILS/src/templates/opac/parts/config.tt2 index a0be85b906..bc046bdbfd 100644 --- a/Open-ILS/src/templates/opac/parts/config.tt2 +++ b/Open-ILS/src/templates/opac/parts/config.tt2 @@ -155,12 +155,4 @@ ctx.google_books_preview = 0; # # ctx.maintenance_message = "The system will not be available February 29, 2104."; -# Browse settings -# Set to 1 or 'true' to enable. This controls whether or not the -# "0-9 A B C D ..." links appear on the browse page. We don't yet have a -# serviceable way to internationalize these links, so sites must choose to -# turn on this feature. - -browse.english_pager = 0; - %] diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/BibAuthBrowse.txt b/docs/RELEASE_NOTES_NEXT/OPAC/BibAuthBrowse.txt index 279bfbd154..1f4bcac116 100644 --- a/docs/RELEASE_NOTES_NEXT/OPAC/BibAuthBrowse.txt +++ b/docs/RELEASE_NOTES_NEXT/OPAC/BibAuthBrowse.txt @@ -26,14 +26,19 @@ Configuration considerations for site administrators There are two off-by-default features that site administrators may wish to enable. - * Quick paging links (English): By changing the - ''browse.english_pager'' setting to 1 in the - ''opac/parts/config.tt2'' file for a site's active OPAC templates, - you can make shortcut browsing links ''0-9 A B C D ...'' appear - between the Back and Forward buttons on the browse page. I haven't - figured out how to make this feature internationalizable, so it's - off by default. You can turn it on if it works for your language, - or have a look at improving it if it doesn't. + * Quick paging links: By adding a value for the org unit setting + ''opac.browse.pager_shortcuts'' , you can make shortcut browsing + links such as ''0-9 A B C D ...'' appear between the Back and Next + buttons on the browse page. The set of shortcuts should be chosen + based on the languages in use at your site, but a reasonable value + for English might be the string "*0-9*ABCDEFGHIJKLMNOPQRSTUVWXYZ", + which will yield a link for 0-9 and one for each letter A-Z. The + use of asterisks in the string group a shortcut whose label is more + than a single letter in length. Such longer shortcuts have the multi- + character string for the shortcut label, and the link just goes to the + first heading matching the first character of the label. The letters + not enclosed in asterisks just lead to individual letter shortcuts. + * There is a global flag by the name ''opac.browse.warnable_regexp_per_class'' to control what leading @@ -43,3 +48,9 @@ to enable. enabled if it suits your catalog, and can even be customized per search class (author, title, series, subject). +Also, by default, authors are indexed for browse in such a way that +relator roles like "creator" are dropped off the end of their headings. +This was an aesthetic choice. If a site wanted to display those kinds +of terms, they would update the 'config.metabib_field' table in +the database, setting 'browse_xpath' to NULL where 'field_class' = +''author'' and 'browse_field' is true. -- 2.43.2