View | Details | Raw Unified | Return to bug 11311
Collapse All | Expand All

(-)a/C4/Auth.pm (+4 lines)
Lines 447-452 sub get_template_and_user { Link Here
447
                my $sessionSearch = get_session( $sessionID || $in->{'query'}->cookie("CGISESSID") );
447
                my $sessionSearch = get_session( $sessionID || $in->{'query'}->cookie("CGISESSID") );
448
                $sessionSearch->clear( ["busc"] ) if ( $sessionSearch->param("busc") );
448
                $sessionSearch->clear( ["busc"] ) if ( $sessionSearch->param("busc") );
449
            }
449
            }
450
            unless ( $pagename =~ /^auth-detail$/ ) {
451
                my $sessionSearch = get_session($sessionID || $in->{'query'}->cookie("CGISESSID"));
452
                $sessionSearch->clear(["busc_auth"]) if ($sessionSearch->param("busc_auth"));
453
            }
450
        }
454
        }
451
455
452
        # variables passed from CGI: opac_css_override and opac_search_limits.
456
        # variables passed from CGI: opac_css_override and opac_search_limits.
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt (-3 / +35 lines)
Lines 23-32 Link Here
23
                            [% INCLUDE 'navigation.inc' %]
23
                            [% INCLUDE 'navigation.inc' %]
24
                        </div>
24
                        </div>
25
                    </div>
25
                    </div>
26
                    <div class="span10">
27
                [% ELSE %]
28
                    <div class="span12">
29
                [% END %]
26
                [% END %]
27
28
                [% content_width = 12 %]
29
                [% IF (OpacNav || OpacNavBottom) %]
30
                  [% content_width = content_width - 2 %]
31
                [% END %]
32
                [% IF Koha.Preference('OpacBrowseResults') && (previous || next) %]
33
                  [% content_width = content_width - 3 %]
34
                [% END %]
35
36
                <div class="span[% content_width %]">
30
                    <div id="userauthdetails" class="maincontent">
37
                    <div id="userauthdetails" class="maincontent">
31
                        <div id="views">
38
                        <div id="views">
32
                            <span class="view">
39
                            <span class="view">
Lines 121-126 Link Here
121
                        </div>
128
                        </div>
122
                    </div> <!-- / .#userauthdetails -->
129
                    </div> <!-- / .#userauthdetails -->
123
                </div> <!-- / .span10/12 -->
130
                </div> <!-- / .span10/12 -->
131
132
              [% IF Koha.Preference('OpacBrowseResults') && ( previous || next ) %]
133
                <div class="span3">
134
                    <div class="nav_results">
135
                        <ul class="pg_menu clearfix">
136
                            <li class="left_results">
137
                              [% IF previous %]
138
                                <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% previous %]" title="previous authority">&laquo; Previous</a>
139
                              [% ELSE %]
140
                                <span>Previous</span>
141
                              [% END %]
142
                            </li>
143
                            <li class="back_results"><a href="opac-authorities-home.pl?[% busc_auth %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
144
                            <li class="right_results">
145
                              [% IF next %]
146
                                <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% next %]" title="next authority">Next &raquo;</a>
147
                              [% ELSE %]
148
                                <span>Next</span>
149
                              [% END %]
150
                            </li>
151
                        </ul>
152
                    </div>
153
                </div>
154
              [% END %]
155
124
            </div> <!-- / .row-fluid -->
156
            </div> <!-- / .row-fluid -->
125
        </div> <!-- / .container-fluid -->
157
        </div> <!-- / .container-fluid -->
126
    </div> <!-- / .main -->
158
    </div> <!-- / .main -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authoritiessearchresultlist.tt (-5 / +46 lines)
Lines 6-12 Link Here
6
        <ul>
6
        <ul>
7
            [% IF ( displayprev ) %]
7
            [% IF ( displayprev ) %]
8
                <li>
8
                <li>
9
                    <a href="opac-authorities-home.pl?startfrom=[% startfromprev %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage |html %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby|html %]">
9
                    <a href="opac-authorities-home.pl?startfrom=[% startfromprev %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage |html %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby|html %]" class="nav">
10
                        &laquo;
10
                        &laquo;
11
                    </a>
11
                    </a>
12
                </li>
12
                </li>
Lines 15-26 Link Here
15
                [% IF ( number.highlight ) %]
15
                [% IF ( number.highlight ) %]
16
                    <li class="active"><a href="#">[% number.number %]</a></li>
16
                    <li class="active"><a href="#">[% number.number %]</a></li>
17
                [% ELSE %]
17
                [% ELSE %]
18
                    <li><a href="opac-authorities-home.pl?startfrom=[% number.startfrom %]&amp;[% FOREACH searchdat IN number.searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage |html %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby|html %]">[% number.number %]</a></li>
18
                    <li><a href="opac-authorities-home.pl?startfrom=[% number.startfrom %]&amp;[% FOREACH searchdat IN number.searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage |html %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby|html %]" class="nav">[% number.number %]</a></li>
19
                [% END %]
19
                [% END %]
20
            [% END %]
20
            [% END %]
21
            [% IF ( displaynext ) %]
21
            [% IF ( displaynext ) %]
22
                <li>
22
                <li>
23
                    <a href="opac-authorities-home.pl?startfrom=[% startfromnext %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]&amp;resultsperpage=[% resultsperpage |html %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby|html %]">&raquo;</a>
23
                    <a href="opac-authorities-home.pl?startfrom=[% startfromnext %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]&amp;resultsperpage=[% resultsperpage |html %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby|html %]" class="nav">&raquo;</a>
24
                </li>
24
                </li>
25
            [% END %]
25
            [% END %]
26
        </ul>
26
        </ul>
Lines 55-60 Link Here
55
                [% END %]
55
                [% END %]
56
                    <div id="userauthsearchresults" class="maincontent">
56
                    <div id="userauthsearchresults" class="maincontent">
57
                        <h1>Authority search results</h1>
57
                        <h1>Authority search results</h1>
58
                        <span class="details_link"><a href="#">Browse selected records</a></span>
58
59
59
                        [% pagination %]
60
                        [% pagination %]
60
61
Lines 75-80 Link Here
75
                                <table class="table table-bordered table-striped">
76
                                <table class="table table-bordered table-striped">
76
                                    <thead>
77
                                    <thead>
77
                                        <tr>
78
                                        <tr>
79
                                            <th></th>
78
                                            <th>Authorized headings</th>
80
                                            <th>Authorized headings</th>
79
                                            <th>Type of heading</th>
81
                                            <th>Type of heading</th>
80
                                            [% UNLESS ( isEDITORS ) %]
82
                                            [% UNLESS ( isEDITORS ) %]
Lines 86-92 Link Here
86
                                    <tbody>
88
                                    <tbody>
87
                                        [% FOREACH resul IN result %]
89
                                        [% FOREACH resul IN result %]
88
                                            <tr>
90
                                            <tr>
89
                                                <td>[% PROCESS authresult summary=resul.summary %]</td>
91
                                                  <td><input type="checkbox" id="auth[% resul.authid %]" name="authid" value="[% resul.authid %]" /></td>
92
                                                  <td>[% PROCESS authresult summary=resul.summary %]</td>
90
                                                <td>[% resul.authtype %]</td>
93
                                                <td>[% resul.authtype %]</td>
91
                                                [% UNLESS ( resul.isEDITORS ) %]
94
                                                [% UNLESS ( resul.isEDITORS ) %]
92
                                                    <td>
95
                                                    <td>
Lines 112-115 Link Here
112
    </div> <!-- / .main -->
115
    </div> <!-- / .main -->
113
116
114
[% INCLUDE 'opac-bottom.inc' %]
117
[% INCLUDE 'opac-bottom.inc' %]
115
[% BLOCK jsinclude %][% END %]
118
[% BLOCK jsinclude %]
119
  <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
120
  <script type="text/javascript">
121
  //<![CDATA[
122
    function updateDetailsLink() {
123
      var authids = getContextAuthIds();
124
      if ( authids.length > 0 ) {
125
        $(".details_link a").attr("href", "/cgi-bin/koha/opac-authoritiesdetail.pl?authid=" + authids[0]);
126
        $(".details_link").show();
127
      } else {
128
        $(".details_link").hide();
129
      }
130
    }
131
132
    $(document).ready(function(){
133
      $("div.searchresults").unCheckCheckboxes();
134
      var authids = getContextAuthIds();
135
      if ( authids ) {
136
        for (var i = 0 ; i < authids.length ; i++ ) {
137
          var id = ('#auth' + authids[i]);
138
          if ( $(id) ) {
139
            $(id).attr('checked', true);
140
          }
141
        }
142
        updateDetailsLink();
143
      }
144
      $("input[name='authid']").change(function(){
145
        if ( $(this).is(':checked') == true ) {
146
          addAuthToContext( $(this).val() );
147
        } else {
148
          delAuthToContext( $(this).val() );
149
        }
150
        updateDetailsLink();
151
      });
152
    });
153
154
  //]]>
155
  </script>
156
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js (-4 / +43 lines)
Lines 33-48 function addBibToContext( bibnum ) { Link Here
33
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
33
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
34
}
34
}
35
35
36
function addAuthToContext( authid ) {
37
    var authids = getContextAuthIds();
38
    authids.push( authid );
39
    setContextAuthIds( authids );
40
}
41
36
function delBibToContext( bibnum ) {
42
function delBibToContext( bibnum ) {
37
    var bibnums = getContextBiblioNumbers();
43
    var bibnums = getContextBiblioNumbers();
38
    removeByValue( bibnums, bibnum );
44
    removeByValue( bibnums, bibnum );
39
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
45
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
40
}
46
}
41
47
48
function delAuthToContext( authid ) {
49
    var authids = getContextAuthIds();
50
    removeByValue( authids, authid );
51
    setContextAuthIds( $.uniqueArray( authids ) );
52
}
53
42
function setContextBiblioNumbers( bibnums ) {
54
function setContextBiblioNumbers( bibnums ) {
43
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
55
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
44
}
56
}
45
57
58
function setContextAuthIds( authids ) {
59
    $.cookie('auths_selected', JSON.stringify( authids ));
60
}
61
46
function getContextBiblioNumbers() {
62
function getContextBiblioNumbers() {
47
    var r = $.cookie('bibs_selected');
63
    var r = $.cookie('bibs_selected');
48
    if ( r ) {
64
    if ( r ) {
Lines 52-72 function getContextBiblioNumbers() { Link Here
52
    return r;
68
    return r;
53
}
69
}
54
70
55
function resetSearchContext() {
71
function getContextAuthIds() {
72
    var r = $.cookie('auths_selected');
73
    if ( r ) {
74
        return JSON.parse(r);
75
    }
76
    r = new Array();
77
    return r;
78
}
79
80
function resetBiblioSearchContext() {
56
    setContextBiblioNumbers( new Array() );
81
    setContextBiblioNumbers( new Array() );
57
}
82
}
58
83
84
function resetAuthSearchContext() {
85
    setContextAuthIds( new Array() );
86
}
87
59
$(document).ready(function(){
88
$(document).ready(function(){
60
    // forms with action leading to search
89
    // forms with action leading to search
61
    $("form[action*='opac-search.pl']").submit(function(){
90
    $("form[action*='opac-search.pl']").submit(function(){
62
        resetSearchContext();
91
        resetBiblioSearchContext();
63
    });
92
    });
64
    // any link to launch a search except navigation links
93
    // any link to launch a search except navigation links
65
    $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
94
    $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
66
        resetSearchContext();
95
        resetBiblioSearchContext();
67
    });
96
    });
68
    // any link to a detail page from the results page.
97
    // any link to a detail page from the results page.
69
    $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){
98
    $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){
70
        resetSearchContext();
99
        resetBiblioSearchContext();
100
    });
101
102
    $("form[action*='opac-authorities-home.pl']").submit(function(){
103
        resetAuthSearchContext();
104
    });
105
    $("[href*='opac-authorities-home.pl?']").not(".nav").not('.searchwithcontext').click(function(){
106
        resetBiblioSearchContext();
107
    });
108
    $("#opac-authorities-home.pl a[href*='opac-authorities-home.pl?']").click(function(){
109
        resetAuthSearchContext();
71
    });
110
    });
72
});
111
});
(-)a/opac/opac-authorities-home.pl (-3 / +17 lines)
Lines 22-28 use strict; Link Here
22
use warnings;
22
use warnings;
23
23
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use C4::Auth;
25
use C4::Auth qw( get_session );
26
26
27
use C4::Context;
27
use C4::Context;
28
use C4::Auth;
28
use C4::Auth;
Lines 66-73 if ( $op eq "do_search" ) { Link Here
66
    my $orderby = $query->param('orderby');
66
    my $orderby = $query->param('orderby');
67
    my @value = ($query->param('value') || "",);
67
    my @value = ($query->param('value') || "",);
68
68
69
    $resultsperpage = $query->param('resultsperpage');
69
    $resultsperpage = $query->param('resultsperpage') // 20;
70
    $resultsperpage = 20 if ( !defined $resultsperpage );
70
71
    my @tags;
71
    my @tags;
72
    my ( $results, $total, @fields ) =
72
    my ( $results, $total, @fields ) =
73
      SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator,
73
      SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator,
Lines 161-166 if ( $op eq "do_search" ) { Link Here
161
        }
161
        }
162
    }
162
    }
163
163
164
    if ( C4::Context->preference("OpacBrowseResults") ) {
165
        my $busc_params;
166
        $busc_params .= 'op=do_search&amp;authtypecode='.$authtypecode;
167
        $busc_params .= '&amp;marclist=' . $_ for @marclist;
168
        $busc_params .= '&amp;and_or=' . $_ for @and_or;
169
        $busc_params .= '&amp;excluding=' . $_ for @excluding;
170
        $busc_params .= '&amp;operator=' . $_ for @operator;
171
        $busc_params .= '&amp;orderby=' . $orderby;
172
        $busc_params .= '&amp;value=' . $_ for @value;
173
        $busc_params .= '&amp;resultsperpage=' . $resultsperpage;
174
        my $session = get_session( $query->cookie("CGISESSID") );
175
        $session->param( busc_auth => $busc_params );
176
    }
177
164
    $template->param( result => $results ) if $results;
178
    $template->param( result => $results ) if $results;
165
    $template->param( FIELDS => \@fields );
179
    $template->param( FIELDS => \@fields );
166
    $template->param( orderby => $orderby );
180
    $template->param( orderby => $orderby );
(-)a/opac/opac-authoritiesdetail.pl (-2 / +18 lines)
Lines 40-52 use strict; Link Here
40
use warnings;
40
use warnings;
41
41
42
use C4::AuthoritiesMarc;
42
use C4::AuthoritiesMarc;
43
use C4::Auth;
43
use C4::Auth qw( :DEFAULT get_session );
44
use C4::Context;
44
use C4::Context;
45
use C4::Output;
45
use C4::Output;
46
use CGI qw ( -utf8 );
46
use CGI qw ( -utf8 );
47
use MARC::Record;
47
use MARC::Record;
48
use C4::Koha;
48
use C4::Koha;
49
49
50
use JSON;
51
use List::MoreUtils qw( first_index );
52
50
53
51
my $query = new CGI;
54
my $query = new CGI;
52
55
Lines 169-174 if ($show_marc) { Link Here
169
    }
172
    }
170
    $template->param( "Tab0XX" => \@loop_data );
173
    $template->param( "Tab0XX" => \@loop_data );
171
} else {
174
} else {
175
    my $authids = $query->cookie('auths_selected');
176
    $authids = $authids ? JSON::from_json($authids) : [];
177
    if ( scalar( @$authids ) ) {
178
        my $idx = first_index { $_ == $authid } @$authids;
179
        my $previous = $idx ? $authids->[$idx - 1] : undef;
180
        my $next = ( $idx + 1 < @$authids ) ? $authids->[$idx + 1] : undef;
181
        my $session = get_session($query->cookie("CGISESSID"));
182
183
        $template->param(
184
            previous => $previous,
185
            next => $next,
186
            busc_auth => $session->param("busc_auth"),
187
        );
188
    }
172
    my $summary = BuildSummary($record, $authid, $authtypecode);
189
    my $summary = BuildSummary($record, $authid, $authtypecode);
173
    $template->{VARS}->{'summary'} = $summary;
190
    $template->{VARS}->{'summary'} = $summary;
174
}
191
}
175
- 

Return to bug 11311