From 36687c41d6078579a61ae5b4a116707c9c42e83c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 20 Dec 2013 16:33:48 +0100 Subject: [PATCH] Bug 11430: OPAC changes --- koha-tmpl/opac-tmpl/bootstrap/css/opac.css | 15 +- .../bootstrap/en/modules/opac-search-history.tt | 293 +++++++++++++------- opac/opac-search-history.pl | 32 ++- 3 files changed, 220 insertions(+), 120 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/opac.css b/koha-tmpl/opac-tmpl/bootstrap/css/opac.css index d9a22de..221a724 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/css/opac.css +++ b/koha-tmpl/opac-tmpl/bootstrap/css/opac.css @@ -167,7 +167,8 @@ td { #opacheader { background-color: #DDD; } -#selections { +#selections, +.selections { font-weight: bold; } .actions a { @@ -881,7 +882,8 @@ div.rows ol li li { #basket .toolbar { padding: 7px 5px 9px 9px; } -#selections-toolbar { +#selections-toolbar, +.selections-toolbar { background: -moz-linear-gradient(top, #b2b2b2 0%, #e0e0e0 14%, #e8e8e8 100%); /* FF3.6+ */ @@ -940,7 +942,9 @@ div.rows ol li li { #selections-toolbar input.hold.disabled, #selections-toolbar input.hold.disabled:hover, #selections-toolbar a.disabled, -#selections-toolbar a.disabled:hover { +#selections-toolbar a.disabled:hover, +.selections-toolbar a.disabled, +.selections-toolbar a.disabled:hover { color: #888888; text-decoration: none; padding-left: 23px; @@ -1833,7 +1837,9 @@ a.listmenulink:active { font-style: italic; } #CheckAll, -#CheckNone { +#CheckNone, +.CheckAll, +.CheckNone { font-weight: normal; margin: 0 .5em; text-decoration: underline; @@ -2333,6 +2339,7 @@ td img { .clearall, .highlight_controls, #selections-toolbar, + .selections-toolbar, .selectcol, .list-actions, #remove-selected { diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt index 4e44705..780f84e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt @@ -31,91 +31,116 @@
[% END %]
-

Search history

- - [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] -
- +

Search history

+ [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] +
+ + [% END %] +
+
+ [% IF ( current_biblio_searches ) %] +

Current session

+
+
+ Select all + Clear all + | + + Select searches to: + Delete + +
+ + + + + + + + + + + + [% FOREACH s IN current_biblio_searches %] + + + + + + + [% END %] + +
DateSearchResults
[% s.time |$KohaDates with_hours => 1 %][% s.query_desc |html %][% s.total %]
+
[% END %] -
- [% IF ( current_biblio_searches ) %] -

Current session

-
- - - - -
- - - - - - - - - - [% FOREACH s IN current_biblio_searches %] - - - - - - [% END %] - -
DateSearchResults
[% s.time |$KohaDates with_hours => 1 %][% s.query_desc |html %][% s.total %]
- [% END %] - - [% IF ( previous_biblio_searches ) %] -

Previous sessions

-
- - - - -
- - - - - - - - - - [% FOREACH s IN previous_biblio_searches %] - - - - - - [% END %] - -
DateSearchResults
[% s.time |$KohaDates with_hours => 1 %][% s.query_desc |html %][% s.total %]
- [% END %] +
- [% IF !current_biblio_searches && !previous_biblio_searches %] -

Your catalog search history is empty.

- [% END %] -
+
+ [% IF ( previous_biblio_searches ) %] +

Previous sessions

+
+
+ Select all + Clear all + | + + Select searches to: + Delete + +
+ + + + + + + + + + + + + [% FOREACH s IN previous_biblio_searches %] + + + + + + + [% END %] + +
DateSearchResults
[% s.time |$KohaDates with_hours => 1 %][% s.query_desc |html %][% s.total %]
+
+ [% END %] +
+ [% IF !current_biblio_searches && !previous_biblio_searches %] +

Your catalog search history is empty.

+ [% END %] +
- [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] -
- [% IF ( current_authority_searches ) %] -

Current session

-
- - - - -
- + [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] +
+ [% IF ( current_authority_searches ) %] +

Current session

+
+
+ Select all + Clear all + | + + Select searches to: + Delete + +
+ +
+ @@ -124,6 +149,7 @@ [% FOREACH s IN current_authority_searches %] + @@ -131,19 +157,26 @@ [% END %]
Date Search Results
[% s.time |$KohaDates with_hours => 1 %] [% s.query_desc |html %] [% s.total %]
- [% END %] - - [% IF ( previous_authority_searches ) %] -

Previous sessions

- - - - - - - + + [% END %] + + [% IF ( previous_authority_searches ) %] +

Previous sessions

+ +
+ Select all + Clear all + | + + Select searches to: + Delete + +
+ +
+ @@ -152,6 +185,7 @@ [% FOREACH s IN previous_authority_searches %] + @@ -159,11 +193,12 @@ [% END %]
Date Search Results
[% s.time |$KohaDates with_hours => 1 %] [% s.query_desc |html %] [% s.total %]
- [% END %] + + [% END %] - [% IF !current_authority_searches && !previous_authority_searches %] -

Your authority search history is empty.

- [% END %] + [% IF !current_authority_searches && !previous_authority_searches %] +

Your authority search history is empty.

+ [% END %]
[% END %] @@ -176,23 +211,67 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] [% INCLUDE 'datatables.inc' %] + diff --git a/opac/opac-search-history.pl b/opac/opac-search-history.pl index 8d0ba74..a4e972d 100755 --- a/opac/opac-search-history.pl +++ b/opac/opac-search-history.pl @@ -37,7 +37,7 @@ my $cgi = new CGI; # Getting the template and auth my ($template, $loggedinuser, $cookie) = get_template_and_user( { - template_name => "opac-search-history.tmpl", + template_name => "opac-search-history.tt", query => $cgi, type => "opac", authnotrequired => 1, @@ -56,10 +56,27 @@ unless ( $loggedinuser ) { # Deleting search history if ( $action eq 'delete' ) { # Deleting cookie's content - my $current_searches_cookie = C4::Search::History::get_empty_cookie({ - cgi => $cgi, - name => 'KohaOpacRecentSearches', - }); + + my @id = $cgi->param('id'); + my $all = not scalar( @id ); + my $current_searches_cookie; + if ( $all ) { + $current_searches_cookie = C4::Search::History::get_empty_cookie({ + cgi => $cgi, + name => 'KohaOpacRecentSearches', + }); + } else { + my $new_value = C4::Search::History::delete_from_cookie({ + cookie => $cgi->cookie('KohaOpacRecentSearches'), + id => \@id, + }); + $current_searches_cookie = $cgi->cookie( + -name => 'KohaOpacRecentSearches', + # We uri_escape the whole serialized structure so we're sure we won't have any encoding problems + -value => $new_value, + -expires => '' + ); + } # Redirecting to this same url with the cookie in the headers so it's deleted immediately my $uri = $cgi->url(); @@ -101,10 +118,7 @@ unless ( $loggedinuser ) { : q{}; C4::Search::History::delete( { - userid => $loggedinuser, - sessionid => $sessionid, - type => $type, - previous => $previous + id => [ $cgi->param('id') ], } ); # Redirecting to this same url so the user won't see the search history link in the header -- 1.7.10.4