From 9b2f96e6e9c635be0539aab722b832841b4e2afa 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 | 41 ++- 3 files changed, 223 insertions(+), 126 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/opac.css b/koha-tmpl/opac-tmpl/bootstrap/css/opac.css index 99719d5..2cf7063 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; @@ -2374,6 +2380,7 @@ a.reviewlink:visited { .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 55426a2..0f0b859 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, @@ -53,13 +53,21 @@ my $previous = $cgi->param('previous'); # If the user is not logged in, we deal with the session unless ( $loggedinuser ) { # Deleting search history - if ($cgi->param('action') && $cgi->param('action') eq 'delete') { + if ( $action eq 'delete') { # Deleting session's search history + my @id = $cgi->param('id'); + my $all = not scalar( @id ); + my $type = $cgi->param('type'); my @searches = (); - if ( $type ) { + unless ( $all ) { @searches = C4::Search::History::get_from_session({ cgi => $cgi }); - @searches = map { $_->{type} ne $type ? $_ : () } @searches; + if ( $type ) { + @searches = map { $_->{type} ne $type ? $_ : () } @searches; + } + if ( @id ) { + @searches = map { my $search = $_; ( grep {/^$search->{id}$/} @id ) ? () : $_ } @searches; + } } C4::Search::History::set_to_session({ cgi => $cgi, search_history => \@searches }); @@ -92,17 +100,20 @@ unless ( $loggedinuser ) { # Deleting search history if ( $action eq 'delete' ) { - my $sessionid = defined $previous - ? $cgi->cookie("CGISESSID") - : q{}; - C4::Search::History::delete( - { - userid => $loggedinuser, - sessionid => $sessionid, - type => $type, - previous => $previous - } - ); + my @id = $cgi->param('id'); + if ( @id ) { + C4::Search::History::delete( + { + id => [ $cgi->param('id') ], + } + ); + } else { + C4::Search::History::delete( + { + userid => $loggedinuser, + } + ); + } # Redirecting to this same url so the user won't see the search history link in the header my $uri = $cgi->url(); print $cgi->redirect($uri); -- 1.7.10.4