From srdjan at catalyst.net.nz Tue Dec 29 07:58:58 2015 From: srdjan at catalyst.net.nz (Srdjan) Date: Tue, 29 Dec 2015 19:58:58 +1300 Subject: [Koha-patches] [PATCH] Bug 15434: search-xlate.inc - search criteria definition table Message-ID: <1451372338-15855-1-git-send-email-srdjan@catalyst.net.nz> Collected search criteria and limit labels in search-xlate.inc, so it can be used gor both making search criteria selects and displaying back selections on the result screen. --- .../opac-tmpl/bootstrap/en/includes/masthead.inc | 29 ++++++----- .../bootstrap/en/includes/search-xlate.inc | 43 ++++++++++++++++ .../bootstrap/en/modules/opac-advsearch.tt | 59 +++++++++++----------- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 48 ++++++++++++++---- 4 files changed, 125 insertions(+), 54 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/search-xlate.inc diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 20ff3f8..3e7017e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -1,4 +1,5 @@ [% USE Koha %] +[% PROCESS 'search-xlate.inc' %] [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
@@ -168,41 +169,41 @@ [% END # /ms_kw %] [% IF ( ms_ti ) %] - + [% ELSE %] - + [% END # /ms_ti %] [% IF ( ms_au ) %] - + [% ELSE %] - + [% END # /ms_au%] [% IF ( ms_su ) %] - + [% ELSE %] - + [% END # /ms_su %] [% IF ( ms_nb ) %] - + [% ELSE %] - + [% END # /ms_nb%] [% IF ( ms_se ) %] - + [% ELSE %] - + [% END # /ms_se %] [% IF ( numbersphr ) %] [% IF ( ms_callnum ) %] - + [% ELSE %] - + [% END #/ms_callnum %] [% ELSE %] [% IF ( ms_callnum ) %] - + [% ELSE %] - + [% END # /ms_callnum %] [% END # /numbersphr %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/search-xlate.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/search-xlate.inc new file mode 100644 index 0000000..db0b941 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/search-xlate.inc @@ -0,0 +1,43 @@ +[% + search_xlate = { + "kw" => "Keyword" + "su" => "Subject" + "su-br" => "Subject and broader terms" + "su-na" => "Subject and narrower terms" + "su-rl" => "Subject and related terms" + "ti" => "Title" + "se" => "Series" + "se,wrdl" => "Series title" + "callnum" => "Call Number" + "location" => "Shelving Location" + "au" => "Author" + "cpn" => "Corporate name" + "cfn" => "Conference name" + "pn" => "Personal name" + "nt" => "Notes/Comments" + "curriculum" => "Curriculum" + "pb" => "Publisher" + "pl" => "Publisher Location" + "sn" => "Standard Number" + "nb" => "ISBN" + "ns" => "ISSN" + "bc" => "Barcode" + } + limit_xlate = { + "mc-itype" => "Type" + "ln" => "Language" + "branch" => "Branch" + "aud" => "Audience" + "l-format" => "Format" + "ctype" => "Content Type" + "yr" => "Year" + } + qualifier_xlate = { + "wrdl" => "" + "phr" => "phrase" + "st-numeric" => "" + "ge=" => ">=" + "le=" => "<=" + "rtrn" => "" + } +%] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index d1ce16a..2c35c3a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% PROCESS 'search-xlate.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Advanced search [% INCLUDE 'doc-head-close.inc' %] @@ -41,54 +42,54 @@ [% END %] [% IF ( expanded_options ) %][% left_content %][% END %] [% IF ( expanded_options ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 8a0ec89..4ee19ca 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -1,14 +1,44 @@ [% USE Koha %] +[% PROCESS 'search-xlate.inc' %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %] +[% +IF searchdesc; + search_result_str = "Results of search"; + IF query_desc; + search_result_str = search_result_str _ " for '"; + query_desc_xlate = query_desc; + FOREACH pair IN search_xlate.pairs; + query_desc_xlate = query_desc_xlate.replace(pair.key _ ':', pair.value _ ':'); + query_desc_xlate = query_desc_xlate.replace(pair.key _ ',wrdl:', pair.value _ ':'); + query_desc_xlate = query_desc_xlate.replace(pair.key _ ',phr:', pair.value _ ' ' _ qualifier_xlate.phr _ ':'); + END; + search_result_str = search_result_str _ query_desc_xlate _ "'"; + END; + IF limit_desc; + search_result_str = search_result_str _ " with limit(s): '"; + limit_desc_xlate = limit_desc; + FOREACH pair IN limit_xlate.pairs; + limit_desc_xlate = limit_desc_xlate.replace(pair.key _ ':', pair.value _ ':'); + limit_desc_xlate = limit_desc_xlate.replace(pair.key _ ',', pair.value _ ','); + END; + FOREACH pair IN qualifier_xlate.pairs; + IF pair.value; + replacement_str = ' ' _ pair.value; + ELSE; + replacement_str = ''; + END; + limit_desc_xlate = limit_desc_xlate.replace(',' _ pair.key, replacement_str); + END; + search_result_str = search_result_str _ limit_desc_xlate _ "'"; + END; +ELSE; + search_result_str = "You did not specify any search criteria."; +END; +%] [% INCLUDE 'doc-head-open.inc' %] -[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › -[% IF ( searchdesc ) %] - Results of search [% IF ( query_desc ) %]for '[% query_desc | html%]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %] -[% ELSE %] - You did not specify any search criteria. -[% END %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › [% search_result_str | html %] [% INCLUDE 'doc-head-close.inc' %] [% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %] [% BLOCK cssinclude %] @@ -26,11 +56,7 @@ -- 1.9.1 From srdjan at catalyst.net.nz Thu Dec 31 03:20:52 2015 From: srdjan at catalyst.net.nz (Srdjan) Date: Thu, 31 Dec 2015 15:20:52 +1300 Subject: [Koha-patches] [PATCH] Bug 15434: Search criteria definition table Message-ID: <1451528452-2933-1-git-send-email-srdjan@catalyst.net.nz> Collected search criteria and limit labels in opac-bottom.inc, so it can be used for both making search criteria selects and displaying back selections on the result screen. *-opac-bootstrap.po translation files need to be changed: * references to opac-advanced-search.tt need to be updated to opac-bottom.inc * messages and translations need  -s removed --- .../bootstrap/en/includes/opac-bottom.inc | 52 ++++++++++++++++++++ .../bootstrap/en/modules/opac-results-grouped.tt | 12 ++++- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 14 +++++- koha-tmpl/opac-tmpl/bootstrap/js/search.js | 57 ++++++++++++++++++++++ 4 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/search.js 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 1d350ea..7a77ece 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -85,6 +85,7 @@ $.widget.bridge('uitooltip', $.ui.tooltip); + [% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]