Bugzilla – Attachment 23716 Details for
Bug 11430
Search history: Delete selected lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11430: OPAC changes
Bug-11430-OPAC-changes.patch (text/plain), 22.34 KB, created by
Jonathan Druart
on 2013-12-20 15:36:00 UTC
(
hide
)
Description:
Bug 11430: OPAC changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-12-20 15:36:00 UTC
Size:
22.34 KB
patch
obsolete
>From 36687c41d6078579a61ae5b4a116707c9c42e83c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >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 @@ > <div class="span12"> > [% END %] > <div id="searchhistory" class="maincontent"> >- <h1>Search history</h1> >- >- [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] >- <div id="tabs" class="toptabs"> >- <ul> >- <li><a href="#biblio_tab">Catalog</a></li> >- <li><a href="#authority_tab">Authority</a></li> >- </ul> >+ <h1>Search history</h1> >+ [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] >+ <div id="tabs" class="toptabs"> >+ <ul> >+ <li><a href="#biblio_tab">Catalog</a></li> >+ <li><a href="#authority_tab">Authority</a></li> >+ </ul> >+ [% END %] >+ <div id="biblio_tab"> >+ <div id="current_biblio"> >+ [% IF ( current_biblio_searches ) %] >+ <h2>Current session</h2> >+ <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >+ <div class="selections-toolbar toolbar"> >+ <a class="CheckAll" href="#">Select all</a> >+ <a class="CheckNone" href="#">Clear all</a> >+ <span class="sep">|</span> >+ <span class="links"> >+ <span class="selections">Select searches to: </span> >+ <a href="#" class="action_delete disabled">Delete</a> >+ </span> >+ </div> >+ <input type="hidden" name="action" value="delete" /> >+ <table class="historyt table table-bordered table-striped"> >+ <thead> >+ <tr> >+ <th></th> >+ <th>Date</th> >+ <th>Search</th> >+ <th>Results</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH s IN current_biblio_searches %] >+ <tr> >+ <td><input type="checkbox" name="id" value="[% s.id %]" /></td> >+ <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> >+ <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td> >+ <td>[% s.total %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </form> > [% END %] >- <div id="biblio_tab"> >- [% IF ( current_biblio_searches ) %] >- <h2>Current session</h2> >- <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >- <input type="hidden" name="action" value="delete" /> >- <input type="hidden" name="previous" value="0" /> >- <input type="hidden" name="type" value="biblio" /> >- <input type="submit" class="deleteshelf" value="Delete your current catalog history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /> >- </form> >- <table class="historyt table table-bordered table-condensed table-striped"> >- <thead> >- <tr> >- <th>Date</th> >- <th>Search</th> >- <th>Results</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH s IN current_biblio_searches %] >- <tr> >- <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> >- <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td> >- <td>[% s.total %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> >- [% END %] >- >- [% IF ( previous_biblio_searches ) %] >- <h2>Previous sessions</h2> >- <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >- <input type="hidden" name="action" value="delete" /> >- <input type="hidden" name="previous" value="1" /> >- <input type="hidden" name="type" value="biblio" /> >- <input type="submit" class="deleteshelf" value="Delete your previous catalog search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /> >- </form> >- <table class="historyt table table-bordered table-condensed table-striped"> >- <thead> >- <tr> >- <th>Date</th> >- <th>Search</th> >- <th>Results</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH s IN previous_biblio_searches %] >- <tr> >- <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> >- <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td> >- <td>[% s.total %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> >- [% END %] >+ </div> > >- [% IF !current_biblio_searches && !previous_biblio_searches %] >- <p>Your catalog search history is empty.</p> >- [% END %] >- </div> >+ <div id="previous_biblio"> >+ [% IF ( previous_biblio_searches ) %] >+ <h2>Previous sessions</h2> >+ <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >+ <div class="selections-toolbar toolbar"> >+ <a class="CheckAll" href="#">Select all</a> >+ <a class="CheckNone" href="#">Clear all</a> >+ <span class="sep">|</span> >+ <span class="links"> >+ <span class="selections">Select searches to: </span> >+ <a href="#" class="action_delete disabled">Delete</a> >+ </span> >+ </div> >+ >+ <input type="hidden" name="action" value="delete" /> >+ <table class="historyt table table-bordered table-striped"> >+ <thead> >+ <tr> >+ <th></th> >+ <th>Date</th> >+ <th>Search</th> >+ <th>Results</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH s IN previous_biblio_searches %] >+ <tr> >+ <td><input type="checkbox" name="id" value="[% s.id %]" /></td> >+ <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> >+ <td><a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td> >+ <td>[% s.total %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </form> >+ [% END %] >+ </div> > >+ [% IF !current_biblio_searches && !previous_biblio_searches %] >+ <p>Your catalog search history is empty.</p> >+ [% END %] >+ </div> > >- [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] >- <div id="authority_tab"> >- [% IF ( current_authority_searches ) %] >- <h2>Current session</h2> >- <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >- <input type="hidden" name="action" value="delete" /> >- <input type="hidden" name="previous" value="0" /> >- <input type="hidden" name="type" value="authority" /> >- <input type="submit" class="deleteshelf" value="Delete your current authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /> >- </form> >- <table class="historyt table table-bordered table-condensed table-striped"> >+ [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %] >+ <div id="authority_tab"> >+ [% IF ( current_authority_searches ) %] >+ <h2>Current session</h2> >+ <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >+ <div class="selections-toolbar toolbar"> >+ <a class="CheckAll" href="#">Select all</a> >+ <a class="CheckNone" href="#">Clear all</a> >+ <span class="sep">|</span> >+ <span class="links"> >+ <span class="selections">Select searches to: </span> >+ <a href="#" class="action_delete disabled">Delete</a> >+ </span> >+ </div> >+ <input type="hidden" name="action" value="delete" /> >+ <table class="historyt table table-bordered table-striped"> > <thead> > <tr> >+ <th></th> > <th>Date</th> > <th>Search</th> > <th>Results</th> >@@ -124,6 +149,7 @@ > <tbody> > [% FOREACH s IN current_authority_searches %] > <tr> >+ <td><input type="checkbox" name="id" value="[% s.id %]" /></td> > <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> > <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td> > <td>[% s.total %]</td> >@@ -131,19 +157,26 @@ > [% END %] > </tbody> > </table> >- [% END %] >- >- [% IF ( previous_authority_searches ) %] >- <h2>Previous sessions</h2> >- <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >- <input type="hidden" name="action" value="delete" /> >- <input type="hidden" name="previous" value="1" /> >- <input type="hidden" name="type" value="authority" /> >- <input type="submit" class="deleteshelf" value="Delete your previous authority search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /> >- </form> >- <table class="historyt table table-bordered table-condensed table-striped"> >+ </form> >+ [% END %] >+ >+ [% IF ( previous_authority_searches ) %] >+ <h2>Previous sessions</h2> >+ <form action="/cgi-bin/koha/opac-search-history.pl" method="get"> >+ <div class="selections-toolbar toolbar"> >+ <a class="CheckAll" href="#">Select all</a> >+ <a class="CheckNone" href="#">Clear all</a> >+ <span class="sep">|</span> >+ <span class="links"> >+ <span class="selections">Select searches to: </span> >+ <a href="#" class="action_delete disabled">Delete</a> >+ </span> >+ </div> >+ <input type="hidden" name="action" value="delete" /> >+ <table class="historyt table table-bordered table-striped"> > <thead> > <tr> >+ <th></th> > <th>Date</th> > <th>Search</th> > <th>Results</th> >@@ -152,6 +185,7 @@ > <tbody> > [% FOREACH s IN previous_authority_searches %] > <tr> >+ <td><input type="checkbox" name="id" value="[% s.id %]" /></td> > <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td> > <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td> > <td>[% s.total %]</td> >@@ -159,11 +193,12 @@ > [% END %] > </tbody> > </table> >- [% END %] >+ </form> >+ [% END %] > >- [% IF !current_authority_searches && !previous_authority_searches %] >- <p>Your authority search history is empty.</p> >- [% END %] >+ [% IF !current_authority_searches && !previous_authority_searches %] >+ <p>Your authority search history is empty.</p> >+ [% END %] > </div> > </div> > [% END %] >@@ -176,23 +211,67 @@ > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] > [% INCLUDE 'datatables.inc' %] >+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> > <script type="text/javascript"> > //<![CDATA[ >- var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete your search history?"); >- $(document).ready(function() { >- // We show table ordered by descending dates by default >- // (so that the more recent query is shown first) >- $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aaSorting": [[ 0, "desc" ]], >- "aoColumns": [ >- { "sType": "title-string" }, >- null, >- null >- ] >- })); >+ var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history?"); >+ $(document).ready(function() { >+ // We show table ordered by descending dates by default >+ // (so that the more recent query is shown first) >+ $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aaSorting": [[ 1, "desc" ]], >+ "aoColumnDefs": [ >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >+ { "aTargets": [ 1 ], "sType": "title-string" }, >+ ] >+ })); >+ >+ [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %] >+ >+ $(".CheckNone").click(function(e){ >+ e.preventDefault(); >+ var form = $(this).parents("form").get(0); >+ $(form).unCheckCheckboxes(); >+ enableCheckboxActions(form); >+ }); >+ $(".CheckAll").click(function(e){ >+ e.preventDefault(); >+ var form = $(this).parents("form").get(0); >+ $(form).checkCheckboxes(); >+ enableCheckboxActions(form); > }); > >- [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %] >+ $("input:checkbox").click(function(){ >+ var form = $(this).parents("form").get(0); >+ enableCheckboxActions(form); >+ }); >+ >+ $(".action_delete").click(function(e){ >+ e.preventDefault(); >+ var form = $(this).parents("form").get(0); >+ var ids = $(form).find("input:checkbox:checked"); >+ if ( $(ids).length < 1 ) { >+ return false; >+ } >+ if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) { >+ $(form).submit(); >+ } >+ return false; >+ }); >+ }); >+ >+ function enableCheckboxActions(form){ >+ // Enable/disable controls if checkboxes are checked >+ var checkedBoxes = $(form).find("input:checkbox:checked"); >+ if ($(checkedBoxes).size()) { >+ $(form).find(".selections").html(_("With selected searches: ")); >+ $(form).find(".selections-toolbar .links a").removeClass("disabled"); >+ } else { >+ $(form).find(".selections").html(_("Select searches to: ")); >+ $(form).find(".selections-toolbar .links a").addClass("disabled"); >+ } >+ } >+ > //]]> > > </script> >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
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 11430
:
23713
|
23714
|
23715
|
23716
|
23717
|
23718
|
25499
|
25500
|
25501
|
25502
|
25503
|
25504
|
25618
|
28636
|
28637
|
28638
|
28639
|
28640
|
28641
|
28642
|
29042
|
29043
|
29044
|
29045
|
29046
|
29047
|
29048
|
29059
|
29081
|
29082
|
29083
|
29084
|
29085
|
29106
|
29107
|
29108
|
29109
|
29110
|
29592
|
29635
|
29636
|
29637
|
29638
|
29639
|
29640
|
33831
|
33832
|
33833
|
33834
|
33835
|
33836
|
36444
|
36820
|
36821
|
36822