From f866ef090fa39ab5b1e5f3a29a78dd284399a59c Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 15 Mar 2011 13:47:10 -0400 Subject: [PATCH] Improve search term propagation from page to page Also, for things like the author link on the record detail page, build a link with 'qtype=author&query=JK Rowling' instead of 'query=au:JK Rowling' The latter works, but causes the search form to look stupid. Query type dropdown will be set to keyword by default, and the term will be "au:JK Rowling", which will be a head scratcher for 99% of real users. --- .../web/templates/default/opac/myopac/circs.tt2 | 2 +- .../web/templates/default/opac/myopac/holds.tt2 | 2 +- .../web/templates/default/opac/myopac/main.tt2 | 2 +- .../web/templates/default/opac/parts/header.tt2 | 11 +++++++++++ .../default/opac/parts/record/summary.tt2 | 6 +++--- .../templates/default/opac/parts/result/table.tt2 | 14 ++++++-------- .../web/templates/default/opac/parts/searchbar.tt2 | 2 +- Open-ILS/web/templates/default/opac/results.tt2 | 4 ---- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Open-ILS/web/templates/default/opac/myopac/circs.tt2 b/Open-ILS/web/templates/default/opac/myopac/circs.tt2 index d5602be..8846bdf 100644 --- a/Open-ILS/web/templates/default/opac/myopac/circs.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/circs.tt2 @@ -116,7 +116,7 @@ name="author"> [% attrs.title %] [% IF attrs.author %] / - [% attrs.author %] + [% attrs.author %] [% END %] diff --git a/Open-ILS/web/templates/default/opac/myopac/holds.tt2 b/Open-ILS/web/templates/default/opac/myopac/holds.tt2 index 79e3044..d0dd325 100644 --- a/Open-ILS/web/templates/default/opac/myopac/holds.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/holds.tt2 @@ -146,7 +146,7 @@
- [% attrs.author | html %] + [% attrs.author | html %]
diff --git a/Open-ILS/web/templates/default/opac/myopac/main.tt2 b/Open-ILS/web/templates/default/opac/myopac/main.tt2 index 0c307f0..b2e4a2f 100644 --- a/Open-ILS/web/templates/default/opac/myopac/main.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/main.tt2 @@ -170,7 +170,7 @@ [% attrs.author %] + href="[% ctx.opac_root %]/results?qtype=author&query=[% attrs.author | replace('[,\.:;]', '') | url %]">[% attrs.author %] [% date.format( diff --git a/Open-ILS/web/templates/default/opac/parts/header.tt2 b/Open-ILS/web/templates/default/opac/parts/header.tt2 index 03dbcf1..fa775b2 100644 --- a/Open-ILS/web/templates/default/opac/parts/header.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/header.tt2 @@ -8,6 +8,17 @@ # Don't wrap in l() here; do that where this format string is actually used. SET HUMAN_NAME_FORMAT = '[_1] [_2] [_3] [_4] [_5]'; + # x and y are artifacts of using tags instead of + # true submit buttons, and their values are never used. page is used, but + # currently none of the use cases for rendering the query_string back + # into page output call for propagating the value of the page variable. + + query_string = CGI.query_string | + replace(';x=\d+','') | replace(';y=\d+','') | replace(';page=\d*', '') | + replace(';', '&'); + + propagator = '?' _ query_string; + formats = [ # XXX KCLS-specific {'code' => 'a', 'name' => 'Book', 'image' => 'media_book.jpg'}, {'code' => 'i', 'name' => 'Book on cassette', 'image' => 'media_bookoncasset.jpg'}, diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index 63c1daf..9a6ed0b 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -30,7 +30,7 @@ [% l("Author") %]: [% attrs.author %] + href="[% ctx.opac_root %]/results?qtype=author&query=[% attrs.author | replace('[,\.:;]', '') | uri %]&loc=[% CGI.param('loc') | uri %]">[% attrs.author %] [% END %] @@ -38,7 +38,7 @@
@@ -248,7 +248,7 @@
- [% l('Place Hold') %][% l('Place Hold') %] [% l('Reviews and More') %] diff --git a/Open-ILS/web/templates/default/opac/parts/result/table.tt2 b/Open-ILS/web/templates/default/opac/parts/result/table.tt2 index 1358ecb..b4ef916 100644 --- a/Open-ILS/web/templates/default/opac/parts/result/table.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/result/table.tt2 @@ -1,7 +1,5 @@ [% PROCESS "default/opac/parts/marc_misc.tt2"; - np_link = '?' _ query_string; - ctx.result_start = 1 + ctx.page_size * page; ctx.result_stop = 1 + ctx.page_size * (page + 1); IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END; @@ -26,7 +24,7 @@ [% IF page > 0 %] Previous @@ -37,7 +35,7 @@ [% IF (page + 1) < page_count %] Next @@ -78,7 +76,7 @@ [% ident = attrs.isbn_clean || attrs.upc; IF ident; %] - Image of itemImage of item
[% END %] @@ -88,7 +86,7 @@ valign="top"> @@ -96,7 +94,7 @@ [% attrs.author %]    [% attrs.pubdate %] @@ -181,7 +179,7 @@
place holdPlace Hold diff --git a/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 b/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 index 8e9d787..84ab264 100644 --- a/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/searchbar.tt2 @@ -48,7 +48,7 @@ - [% PROCESS build_org_selector name='loc' value=loc %] + [% PROCESS build_org_selector name='loc' value=CGI.param('loc') %] -- 1.7.2.5