Bugzilla – Attachment 20946 Details for
Bug 10857
Add facets cancellation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10857: Add facets cancellation
Bug-10857-Add-facets-cancellation.patch (text/plain), 8.15 KB, created by
Jonathan Druart
on 2013-09-10 12:25:55 UTC
(
hide
)
Description:
Bug 10857: Add facets cancellation
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-09-10 12:25:55 UTC
Size:
8.15 KB
patch
obsolete
>From 502ff365c460ea7b2df0c2952079725aa4f19aa9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 11 Jun 2013 11:31:49 +0200 >Subject: [PATCH] Bug 10857: Add facets cancellation > >When searching (at the OPAC or pro), facets can be enabled but never >disabled. So a user is obliged to relaunch the search. > >This patch adds a new link "[x]" at the right of each selected facet. >This link relaunch the search without this facet. > >Test plan: >- Launch a search (OPAC and pro) >- Enable some facets >- Disable some facets >--- > catalogue/search.pl | 12 ++++++++ > .../intranet-tmpl/prog/en/includes/facets.inc | 27 +++++++++++++++-- > .../opac-tmpl/prog/en/includes/opac-facets.inc | 31 +++++++++++++++++--- > opac/opac-search.pl | 13 ++++++++ > 4 files changed, 76 insertions(+), 7 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 9e81a81..829768b 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -411,6 +411,9 @@ my @operands = map uri_unescape($_), $cgi->param('q'); > > # limits are use to limit to results to a pre-defined category such as branch or language > my @limits = map uri_unescape($_), $cgi->param('limit'); >+my @nolimits = map uri_unescape($_), $cgi->param('nolimit'); >+my %is_nolimit = map { $_ => 1 } @nolimits; >+@limits = grep { not $is_nolimit{$_} } @limits; > > if($params->{'multibranchlimit'}) { > my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')'; >@@ -685,6 +688,15 @@ my $gotopage = $cgi->param('gotoPage'); > $template->{'VARS'}->{'gotoPage'} = $gotopage > if $gotopage =~ m/^(ISBD|labeledMARC|MARC|more)?detail.pl$/; > >+my @input_values = map { $_->{input_value} } @limit_inputs; >+for my $facet ( @$facets ) { >+ for my $entry ( @{ $facet->{facets} } ) { >+ my $index = $entry->{type_link_value}; >+ my $value = $entry->{facet_link_value}; >+ $entry->{active} = grep { $_ eq qq{$index:$value} } @input_values; >+ } >+} >+ > $template->param( > #classlist => $classlist, > total => $total, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >index 8853ec7..c67433d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >@@ -20,9 +20,30 @@ > [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %] > [% IF ( facets_loo.type_label_Location ) %]Locations[% END %] > <ul> >- [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by %][% END %]&limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">[% facet.facet_label_value %]</a> [% IF ( displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %] >- <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by %][% END %][% IF ( offset ) %]&offset=[% offset %][% END %]&expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show more</a></li> >-[% END %] >+ [% FOREACH facet IN facets_loo.facets %] >+ <li> >+ [% SET query_cgi_f = query_cgi | html %] >+ [% SET limit_cgi_f = limit_cgi | html %] >+ [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi_f _ limit_cgi_f %] >+ [% IF ( sort_by ) %] >+ [% SET url = url _ "&sort_by=" _ sort_by %] >+ [% END %] >+ [% IF facet.active %] >+ [% SET url = url _ "&nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] >+ [% facet.facet_label_value %] >+ [<a href="[% url |url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>] >+ [% ELSE %] >+ [% SET url = url _ "&limit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] >+ <a href="[% url | url %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a> >+ [% IF ( displayFacetCount ) %] >+ ([% facet.facet_count %]) >+ [% END %] >+ [% END %] >+ </li> >+ [% END %] >+ [% IF ( facets_loo.expandable ) %] >+ <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by %][% END %][% IF ( offset ) %]&offset=[% offset %][% END %]&expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show more</a></li> >+ [% END %] > </ul></li> > [% END %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >index 48d39d3..b598248 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >@@ -21,10 +21,33 @@ > [% END %] > [% IF ( facets_loo.type_label_Location ) %]Locations[% END %] > <ul> >- [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]&limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a> [% IF ( displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %] >- <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %][% IF ( offset ) %]&offset=[% offset %][% END %]&expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show more</a></li> >-[% END %] >-</ul></li> >+ [% FOREACH facet IN facets_loo.facets %] >+ <li> >+ [% SET query_cgi_f = query_cgi | html %] >+ [% SET limit_cgi_f = limit_cgi | html %] >+ [% SET url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi_f _ limit_cgi_f %] >+ [% IF ( sort_by ) %] >+ [% SET url = url _ "&sort_by=" _ sort_by |html %] >+ [% END %] >+ [% IF facet.active %] >+ [% SET url = url _ "&nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] >+ [% facet.facet_label_value %] >+ [<a href="[% url |url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>] >+ [% ELSE %] >+ [% SET url = url _ "&limit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] >+ <a href="[% url | url %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a> >+ [% IF ( displayFacetCount ) %] >+ ([% facet.facet_count %]) >+ [% END %] >+ [% END %] >+ </li> >+ [% END %] >+ [% IF ( facets_loo.expandable ) %] >+ <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %][% IF ( offset ) %]&offset=[% offset %][% END %]&expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show more</a> >+ </li> >+ [% END %] >+</ul> >+</li> > [% END %] > [% END %] > </ul> >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 2854da6..19618d4 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -400,6 +400,9 @@ if ($operands[0] && !$operands[1]) { > > # limits are use to limit to results to a pre-defined category such as branch or language > my @limits = $cgi->param('limit'); >+my @nolimits = $cgi->param('nolimit'); >+my %is_nolimit = map { $_ => 1 } @nolimits; >+@limits = grep { not $is_nolimit{$_} } @limits; > @limits = map { uri_unescape($_) } @limits; > > if($params->{'multibranchlimit'}) { >@@ -848,6 +851,16 @@ for (my $i=0;$i<@servers;$i++) { > } #/end of the for loop > #$template->param(FEDERATED_RESULTS => \@results_array); > >+my @input_values = map { $_->{input_value} } @limit_inputs; >+for my $facet ( @$facets ) { >+ for my $entry ( @{ $facet->{facets} } ) { >+ my $index = $entry->{type_link_value}; >+ my $value = $entry->{facet_link_value}; >+ $entry->{active} = grep { $_ eq qq{$index:$value} } @input_values; >+ } >+} >+ >+ > $template->param( > #classlist => $classlist, > total => $total, >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10857
:
20946
|
22746
|
24081
|
24082
|
24125
|
24126
|
24162
|
24163
|
24201
|
24202
|
24203