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

(-)a/C4/Auth.pm (+4 lines)
Lines 380-385 sub get_template_and_user { Link Here
380
                my $sessionSearch = get_session($sessionID || $in->{'query'}->cookie("CGISESSID"));
380
                my $sessionSearch = get_session($sessionID || $in->{'query'}->cookie("CGISESSID"));
381
                $sessionSearch->clear(["busc"]) if ($sessionSearch->param("busc"));
381
                $sessionSearch->clear(["busc"]) if ($sessionSearch->param("busc"));
382
            }
382
            }
383
            unless ( $pagename =~ /^auth-detail$/ ) {
384
                my $sessionSearch = get_session($sessionID || $in->{'query'}->cookie("CGISESSID"));
385
                $sessionSearch->clear(["busc_auth"]) if ($sessionSearch->param("busc_auth"));
386
            }
383
        }
387
        }
384
        # variables passed from CGI: opac_css_override and opac_search_limits.
388
        # variables passed from CGI: opac_css_override and opac_search_limits.
385
        my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
389
        my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
(-)a/koha-tmpl/opac-tmpl/prog/en/js/commons.js (-4 / +43 lines)
Lines 30-46 function addBibToContext( bibnum ) { Link Here
30
    //var store = sessionStorage.getItem( "bibs_selected" );
30
    //var store = sessionStorage.getItem( "bibs_selected" );
31
}
31
}
32
32
33
function addAuthToContext( authid ) {
34
    var authids = getContextAuthIds();
35
    authids.push( authid );
36
    setContextAuthIds( authids );
37
}
38
33
function delBibToContext( bibnum ) {
39
function delBibToContext( bibnum ) {
34
    var bibnums = getContextBiblioNumbers();
40
    var bibnums = getContextBiblioNumbers();
35
    removeByValue( bibnums, bibnum );
41
    removeByValue( bibnums, bibnum );
36
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
42
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
37
}
43
}
38
44
45
function delAuthToContext( authid ) {
46
    var authids = getContextAuthIds();
47
    removeByValue( authids, authid );
48
    setContextAuthIds( $.uniqueArray( authids ) );
49
}
50
39
function setContextBiblioNumbers( bibnums ) {
51
function setContextBiblioNumbers( bibnums ) {
40
    //sessionStorage.setItem("bibs_selected", JSON.stringify( bibnums ) );
52
    //sessionStorage.setItem("bibs_selected", JSON.stringify( bibnums ) );
41
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
53
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
42
}
54
}
43
55
56
function setContextAuthIds( authids ) {
57
    $.cookie('auths_selected', JSON.stringify( authids ));
58
}
59
44
function getContextBiblioNumbers() {
60
function getContextBiblioNumbers() {
45
    //var r = sessionStorage.getItem("bibs_selected");
61
    //var r = sessionStorage.getItem("bibs_selected");
46
    var r = $.cookie('bibs_selected');
62
    var r = $.cookie('bibs_selected');
Lines 51-72 function getContextBiblioNumbers() { Link Here
51
    return r;
67
    return r;
52
}
68
}
53
69
54
function resetSearchContext() {
70
function getContextAuthIds() {
71
    var r = $.cookie('auths_selected');
72
    if ( r ) {
73
        return JSON.parse(r);
74
    }
75
    r = new Array();
76
    return r;
77
}
78
79
function resetBiblioSearchContext() {
55
    setContextBiblioNumbers( new Array() );
80
    setContextBiblioNumbers( new Array() );
56
}
81
}
57
82
83
function resetAuthSearchContext() {
84
    setContextAuthIds( new Array() );
85
}
86
58
$(document).ready(function(){
87
$(document).ready(function(){
59
    // forms with action leading to search
88
    // forms with action leading to search
60
    $("form[action*='opac-search.pl']").submit(function(){
89
    $("form[action*='opac-search.pl']").submit(function(){
61
        resetSearchContext();
90
        resetBiblioSearchContext();
62
    });
91
    });
63
    // any link to launch a search except navigation links
92
    // any link to launch a search except navigation links
64
    $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
93
    $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
65
        resetSearchContext();
94
        resetBiblioSearchContext();
66
    });
95
    });
67
    // any link to a detail page from the results page.
96
    // any link to a detail page from the results page.
68
    $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){
97
    $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){
69
        resetSearchContext();
98
        resetBiblioSearchContext();
99
    });
100
101
    $("form[action*='opac-authorities-home.pl']").submit(function(){
102
        resetAuthSearchContext();
103
    });
104
    $("[href*='opac-authorities-home.pl?']").not(".nav").not('.searchwithcontext').click(function(){
105
        resetBiblioSearchContext();
106
    });
107
    $("#opac-authorities-home.pl a[href*='opac-authorities-home.pl?']").click(function(){
108
        resetAuthSearchContext();
70
    });
109
    });
71
});
110
});
72
111
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt (-1 / +31 lines)
Lines 31-38 $(document).ready(function() { Link Here
31
   <div id="bd">
31
   <div id="bd">
32
[% INCLUDE 'masthead.inc' %]
32
[% INCLUDE 'masthead.inc' %]
33
    <div id="yui-main">
33
    <div id="yui-main">
34
    <div class="yui-b"><div class="yui-g">
34
    <div class="yui-b">
35
    <div id="opac-auth-detail-yui-ge" class="yui-ge">
35
36
37
    <div class="yui-u first">
36
    <div id="views"><span class="view"><span id="Normalview">Normal view</span></span> <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% authid %]&amp;marc=1">MARC view</a></span></div>
38
    <div id="views"><span class="view"><span id="Normalview">Normal view</span></span> <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% authid %]&amp;marc=1">MARC view</a></span></div>
37
39
38
<div id="userauthdetails" class="container">
40
<div id="userauthdetails" class="container">
Lines 105-110 $(document).ready(function() { Link Here
105
</div>
107
</div>
106
</div>
108
</div>
107
109
110
[% IF Koha.Preference('OpacBrowseResults') && ( previous || next ) %]
111
<div class="yui-u">
112
<div id="ulactioncontainer" class="container">
113
    <div class="nav_results">
114
        <ul class="pg_menu clearfix">
115
            <li class="left_results">
116
              [% IF previous %]
117
                <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% previous %]" title="previous authority">&laquo; Previous</a>
118
              [% ELSE %]
119
                <span>Previous</span>
120
              [% END %]
121
            </li>
122
            <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>
123
            <li class="right_results">
124
              [% IF next %]
125
                <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% next %]" title="next authority">Next &raquo;</a>
126
              [% ELSE %]
127
                <span>Next</span>
128
              [% END %]
129
            </li>
130
        </ul>
131
    </div>
132
</div>
133
</div>
134
[% END %]
135
136
</div>
137
</div>
108
</div>
138
</div>
109
</div>
139
</div>
110
</div>
140
</div>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt (-6 / +46 lines)
Lines 3-8 Link Here
3
[% PROCESS 'authorities-search-results.inc' %]
3
[% PROCESS 'authorities-search-results.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF ( total ) %]Authority search result[% ELSE %]No results found[% END %]
4
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF ( total ) %]Authority search result[% ELSE %]No results found[% END %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
7
<script type="text/javascript">
8
//<![CDATA[
9
  function updateDetailsLink() {
10
    var authids = getContextAuthIds();
11
    if ( authids.length > 0 ) {
12
      $(".details_link a").attr("href", "/cgi-bin/koha/opac-authoritiesdetail.pl?authid=" + authids[0]);
13
      $(".details_link").show();
14
    } else {
15
      $(".details_link").hide();
16
    }
17
  }
18
19
  $(document).ready(function(){
20
    $("div.searchresults").unCheckCheckboxes();
21
    var authids = getContextAuthIds();
22
    if ( authids ) {
23
      for (var i = 0 ; i < authids.length ; i++ ) {
24
        var id = ('#auth' + authids[i]);
25
        if ( $(id) ) {
26
          $(id).attr('checked', true);
27
        }
28
      }
29
      updateDetailsLink();
30
    }
31
    $("input[name='authid']").change(function(){
32
      if ( $(this).is(':checked') == true ) {
33
        addAuthToContext( $(this).val() );
34
      } else {
35
        delAuthToContext( $(this).val() );
36
      }
37
      updateDetailsLink();
38
    });
39
  });
40
41
//]]>
42
</script>
6
</head>
43
</head>
7
<body id="opac-authoritiesresultlist">
44
<body id="opac-authoritiesresultlist">
8
[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %]
45
[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %]
Lines 13-21 Link Here
13
	<div class="yui-b"><div class="yui-g">
50
	<div class="yui-b"><div class="yui-g">
14
<div id="userauthsearchresults" class="container">
51
<div id="userauthsearchresults" class="container">
15
	<h1>Authority search results</h1>
52
	<h1>Authority search results</h1>
53
    <span class="details_link"><a href="#">Browse selected records</a></span>
16
	<div id="pages">
54
	<div id="pages">
17
			[% IF ( displayprev ) %]
55
			[% IF ( displayprev ) %]
18
				<a href="opac-authorities-home.pl?startfrom=[% startfromprev %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]">
56
                <a href="opac-authorities-home.pl?startfrom=[% startfromprev %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]" class="nav">
19
					&lt;&lt;
57
					&lt;&lt;
20
				</a>
58
				</a>
21
			[% END %]
59
			[% END %]
Lines 23-33 Link Here
23
				[% IF ( number.highlight ) %]
61
				[% IF ( number.highlight ) %]
24
					<span class="current">[% number.number %]</span>
62
					<span class="current">[% number.number %]</span>
25
				[% ELSE %]
63
				[% ELSE %]
26
					<a href="opac-authorities-home.pl?startfrom=[% number.startfrom %]&amp;[% FOREACH searchdat IN number.searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]">[% number.number %]</a>
64
                    <a href="opac-authorities-home.pl?startfrom=[% number.startfrom %]&amp;[% FOREACH searchdat IN number.searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]" class="nav">[% number.number %]</a>
27
				[% END %]
65
				[% END %]
28
			[% END %]
66
			[% END %]
29
			[% IF ( displaynext ) %]
67
			[% IF ( displaynext ) %]
30
				<a href="opac-authorities-home.pl?startfrom=[% startfromnext %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]&amp;resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]">&gt;&gt;</a>
68
                <a href="opac-authorities-home.pl?startfrom=[% startfromnext %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]&amp;resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]" class="nav">&gt;&gt;</a>
31
				[% END %]
69
				[% END %]
32
		</div>
70
		</div>
33
		<div id="results">
71
		<div id="results">
Lines 46-51 Link Here
46
<div class="searchresults">
84
<div class="searchresults">
47
		<table>
85
		<table>
48
			<tr>
86
			<tr>
87
                <th></th>
49
                <th>Authorized headings</th>
88
                <th>Authorized headings</th>
50
                <th>Type of heading</th>
89
                <th>Type of heading</th>
51
				[% UNLESS ( isEDITORS ) %]
90
				[% UNLESS ( isEDITORS ) %]
Lines 59-64 Link Here
59
            [% ELSE %]
98
            [% ELSE %]
60
                <tr>
99
                <tr>
61
            [% END %]
100
            [% END %]
101
                    <td><input type="checkbox" id="auth[% resul.authid %]" name="authid" value="[% resul.authid %]" /></td>
62
                    <td>[% PROCESS authresult summary=resul.summary link="/cgi-bin/koha/opac-authorities-home.pl?op=do_search&type=opac&operatorc=contains&marclistc=mainentry&and_orc=and&orderby=HeadingAsc&valuec=" %]</td>
102
                    <td>[% PROCESS authresult summary=resul.summary link="/cgi-bin/koha/opac-authorities-home.pl?op=do_search&type=opac&operatorc=contains&marclistc=mainentry&and_orc=and&orderby=HeadingAsc&valuec=" %]</td>
63
                    <td>[% resul.authtype %]</td>
103
                    <td>[% resul.authtype %]</td>
64
					[% UNLESS ( resul.isEDITORS ) %]
104
					[% UNLESS ( resul.isEDITORS ) %]
Lines 75-89 Link Here
75
	</div>
115
	</div>
76
	<div id="resultnumber">
116
	<div id="resultnumber">
77
			[% IF ( displayprev ) %]
117
			[% IF ( displayprev ) %]
78
				<a href="opac-authorities-home.pl?startfrom=[% startfromprev %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]">&lt;&lt;</a>
118
                <a href="opac-authorities-home.pl?startfrom=[% startfromprev %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]" class="nav">&lt;&lt;</a>
79
			[% END %]
119
			[% END %]
80
			[% FOREACH number IN numbers %]
120
			[% FOREACH number IN numbers %]
81
				[% IF ( number.highlight ) %]<span class="current">[% number.number %]</span>[% ELSE %]
121
				[% IF ( number.highlight ) %]<span class="current">[% number.number %]</span>[% ELSE %]
82
					<a href="opac-authorities-home.pl?startfrom=[% number.startfrom %]&amp;[% FOREACH searchdat IN number.searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]">[% number.number %]</a>
122
                    <a href="opac-authorities-home.pl?startfrom=[% number.startfrom %]&amp;[% FOREACH searchdat IN number.searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]" class="nav">[% number.number %]</a>
83
				[% END %]
123
				[% END %]
84
			[% END %]
124
			[% END %]
85
			[% IF ( displaynext ) %]
125
			[% IF ( displaynext ) %]
86
				<a href="opac-authorities-home.pl?startfrom=[% startfromnext %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]&amp;resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]">&gt;&gt;</a>
126
                <a href="opac-authorities-home.pl?startfrom=[% startfromnext %]&amp;[% FOREACH searchdat IN searchdata %][% searchdat.term %]=[% searchdat.val |url %]&amp;[% END %]&amp;resultsperpage=[% resultsperpage %]&amp;type=opac&amp;op=do_search&amp;authtypecode=[% authtypecode %]&amp;orderby=[% orderby %]" class="nav">&gt;&gt;</a>
87
				[% END %]
127
				[% END %]
88
	</div>	
128
	</div>	
89
			[% END %]
129
			[% END %]
(-)a/opac/opac-authorities-home.pl (-3 / +19 lines)
Lines 22-28 use strict; Link Here
22
use warnings;
22
use warnings;
23
23
24
use CGI;
24
use CGI;
25
use C4::Auth;
25
use C4::Auth qw( get_session );
26
26
27
27
use C4::Context;
28
use C4::Context;
28
use C4::Auth;
29
use C4::Auth;
Lines 65-72 if ( $op eq "do_search" ) { Link Here
65
    my $orderby = $query->param('orderby');
66
    my $orderby = $query->param('orderby');
66
    my @value = ($query->param('value') || "",);
67
    my @value = ($query->param('value') || "",);
67
68
68
    $resultsperpage = $query->param('resultsperpage');
69
    $resultsperpage = $query->param('resultsperpage') // 20;
69
    $resultsperpage = 20 if ( !defined $resultsperpage );
70
70
    my @tags;
71
    my @tags;
71
    my ( $results, $total, @fields ) =
72
    my ( $results, $total, @fields ) =
72
      SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator,
73
      SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator,
Lines 129-134 if ( $op eq "do_search" ) { Link Here
129
        my @usedauths = grep { $_->{used} > 0 } @$results;
130
        my @usedauths = grep { $_->{used} > 0 } @$results;
130
        $results = \@usedauths;
131
        $results = \@usedauths;
131
    }
132
    }
133
134
    if ( C4::Context->preference("OpacBrowseResults") ) {
135
        my $busc_params;
136
        $busc_params .= 'op=do_search&amp;authtypecode='.$authtypecode;
137
        $busc_params .= '&amp;marclist=' . $_ for @marclist;
138
        $busc_params .= '&amp;and_or=' . $_ for @and_or;
139
        $busc_params .= '&amp;excluding=' . $_ for @excluding;
140
        $busc_params .= '&amp;operator=' . $_ for @operator;
141
        $busc_params .= '&amp;orderby=' . $orderby;
142
        $busc_params .= '&amp;value=' . $_ for @value;
143
        $busc_params .= '&amp;resultsperpage=' . $resultsperpage;
144
        my $session = get_session( $query->cookie("CGISESSID") );
145
        $session->param( busc_auth => $busc_params );
146
    }
147
132
    $template->param( result => $results ) if $results;
148
    $template->param( result => $results ) if $results;
133
    $template->param( FIELDS => \@fields );
149
    $template->param( FIELDS => \@fields );
134
    $template->param( orderby => $orderby );
150
    $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;
46
use CGI;
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