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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc (-84 / +126 lines)
Lines 3-90 Link Here
3
[% USE Languages %]
3
[% USE Languages %]
4
4
5
[% IF ( opacfacets ) %]
5
[% IF ( opacfacets ) %]
6
[% IF ( facets_loop ) %]
6
    [% IF ( facets_loop ) %]
7
<div id="search-facets">
7
        <div id="search-facets">
8
<h4>Refine your search</h4>
8
            <h4>Refine your search</h4>
9
<ul>
9
            <ul>
10
[% IF Koha.Preference("SavedSearchFilters") && search_filters.count > 0 %]
10
                [% IF Koha.Preference("SavedSearchFilters") && search_filters.count > 0 %]
11
<li id="search-filters">
11
                    <li id="search-filters">
12
<span id="filter_facets">Custom search filters</span>
12
                        <span id="filter_facets">Custom search filters</span>
13
<ul>
13
                        <ul>
14
    [% SET base_url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
14
                            [% SET base_url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
15
    [% FOREACH search_filter IN search_filters %]
15
                            [% FOREACH search_filter IN search_filters %]
16
        [% SET search_filter_id = search_filter.id | uri %]
16
                                [% SET search_filter_id = search_filter.id | uri %]
17
    <li>
17
                                <li>
18
        [% IF active_filters.${search_filter.id} %]
18
                                    [% IF active_filters.${search_filter.id} %]
19
            <span class="filter_label">[% search_filter.name | html %]<a href="[% base_url _ '&nolimit=search_filter:' _ search_filter_id | $raw %]">[x]</a></span>
19
                                        <span class="filter_label">[% search_filter.name | html %]<a href="[% base_url _ '&nolimit=search_filter:' _ search_filter_id | $raw %]">[x]</a></span>
20
        [% ELSE %]
20
                                    [% ELSE %]
21
            <span class="filter_label"><a href="[% base_url _ '&limit=search_filter:' _ search_filter_id | $raw %]">[% search_filter.name | html %]</a></span>
21
                                        <span class="filter_label"><a href="[% base_url _ '&limit=search_filter:' _ search_filter_id | $raw %]">[% search_filter.name | html %]</a></span>
22
        [% END %]
22
                                    [% END %]
23
    </li>
23
                                </li>
24
    [% END %]
24
                            [% END %]
25
</ul>
25
                        </ul>
26
</li>
26
                    </li>
27
[% END %]
27
                [% END %]
28
    <li id="availability_facet">Availability<ul><li>[% IF ( available ) %]<strong>Showing only records with available items</strong></li><li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi_not_availablity | $raw %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by | uri %][% END %]">Show all records</a>[% ELSE %]<a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by | uri %][% END %]&amp;limit=available">Limit to records with available items</a>[% END %]</li></ul>
28
                <li id="availability_facet">
29
	[% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search | html %][% END %])</li>[% END %]
29
                    Availability
30
	</li>
30
                    <ul>
31
                        <li>
32
                            [% IF ( available ) %]
33
                                <strong>Showing only records with available items</strong>
34
                                </li>
35
                                <li>
36
                                    <a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi_not_availablity | $raw %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by | uri %][% END %]">Show all records</a>
37
                            [% ELSE %]
38
                                <a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by | uri %][% END %]&amp;limit=available">Limit to records with available items</a>[% END %]
39
                        </li>
40
                    </ul>
41
                    [% IF ( related ) %]
42
                        <li>
43
                            (related searches: [% FOREACH relate IN related %][% relate.related_search | html %][% END %])
44
                        </li>
45
                    [% END %]
46
                </li>
31
47
32
	[% FOREACH facets_loo IN facets_loop %]
48
                [% FOREACH facets_loo IN facets_loop %]
33
[% IF facets_loo.facets.size > 0 %]
49
                    [% IF facets_loo.facets.size > 0 %]
34
	<li id="[% facets_loo.type_id | html %]">
50
                        <li id="[% facets_loo.type_id | html %]">
35
[% facets_loo.type_label | html %]
51
                            [% facets_loo.type_label | html %]
36
[% IF facets_loo.type_label_Authors %]<span id="facet-authors">Authors</span>[% END %]
52
                            [% IF facets_loo.type_label_Authors %]
37
[% IF facets_loo.type_label_Titles %]<span id="facet-titles">Titles</span>[% END %]
53
                                <span id="facet-authors">Authors</span>
38
[% IF facets_loo.type_label_Topics %]<span id="facet-topics">Topics</span>[% END %]
54
                            [% END %]
39
[% IF facets_loo.type_label_Places %]<span id="facet-places">Places</span>[% END %]
55
                            [% IF facets_loo.type_label_Titles %]
40
[% IF facets_loo.type_label_Series %]<span id="facet-series">Series</span>[% END %]
56
                                <span id="facet-titles">Titles</span>
41
[% IF facets_loo.type_label_ItemTypes %]<span id="facet-itemtypes">Item types</span>[% END %]
57
                            [% END %]
42
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
58
                            [% IF facets_loo.type_label_Topics %]
43
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
59
                                <span id="facet-topics">Topics</span>
44
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
60
                            [% END %]
45
[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-collections">Collections</span>[% END %]
61
                            [% IF facets_loo.type_label_Places %]
46
[% IF facets_loo.type_label_Language %]<span id="facet-languages">Languages</span>[% END %]
62
                                <span id="facet-places">Places</span>
47
<ul>
63
                            [% END %]
48
  [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
64
                            [% IF facets_loo.type_label_Series %]
49
  [% IF ( sort_by ) %]
65
                                <span id="facet-series">Series</span>
50
    [% url = BLOCK %][% url | $raw %][% "&sort_by=" _ sort_by | url %][% END %]
66
                            [% END %]
51
  [% END %]
67
                            [% IF facets_loo.type_label_ItemTypes %]
52
  [% IF ( results_per_page ) %]
68
                                <span id="facet-itemtypes">Item types</span>
53
    [% url = BLOCK %][% url | $raw %][% "&count=" _ results_per_page | url %][% END %]
69
                            [% END %]
54
  [% END %]
70
                            [% IF ( facets_loo.type_label_HomeLibrary ) %]
55
  [% FOREACH facet IN facets_loo.facets %]
71
                                <span id="facet-home-libraries">Home libraries</span>
56
  [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => facet.facet_label_value ) || facet.facet_label_value %][% END %]
72
                            [% END %]
57
  [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
73
                            [% IF ( facets_loo.type_label_HoldingLibrary ) %]
58
  [% IF loop.count > 5 && !facet.active %]
74
                                <span id="facet-holding-libraries">Holding libraries</span>
59
    <li class="collapsible-facet" style="display:none">
75
                            [% END %]
60
  [% ELSE %]
76
                            [% IF facets_loo.type_label_Location %]
61
    <li>
77
                                <span id="facet-locations">Locations</span>
62
  [% END %]
78
                            [% END %]
63
      [% IF facet.active %]
79
                            [% IF facets_loo.type_label_CollectionCodes %]
64
        [% local_url = BLOCK %][% url | $raw %][% "&nolimit=" _  facet.type_link_value _ ":" _ facet.facet_link_value | url %][% END %]
80
                                <span id="facet-collections">Collections</span>
65
        <span class="facet-label">[% facet.facet_label_value | html %]</span>
81
                            [% END %]
66
        [<a href="[% local_url | $raw %]" title="Remove facet [% facet.facet_label_value | html %]">x</a>]
82
                            [% IF facets_loo.type_label_Language %]
67
      [% ELSE %]
83
                                <span id="facet-languages">Languages</span>
68
        [% local_url = BLOCK %][% url | $raw %][% "&limit=" _  facet.type_link_value _ ":" _ facet.facet_link_value | url %][% END %]
84
                            [% END %]
69
        <span class="facet-label"><a href="[% local_url | $raw %]" title="[% facet.facet_title_value | html %]">[% facet.facet_label_value | html %]</a></span>
85
                            <ul>
70
        [% IF ( displayFacetCount ) %]
86
                                [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
71
          <span class="facet-count"> ([% facet.facet_count | html %])</span>
87
                                [% IF ( sort_by ) %]
72
        [% END %]
88
                                    [% url = BLOCK %][% url | $raw %][% "&sort_by=" _ sort_by | url %][% END %]
73
      [% END %]
89
                                [% END %]
74
    </li>
90
                                [% IF ( results_per_page ) %]
75
  [% END %]
91
                                    [% url = BLOCK %][% url | $raw %][% "&count=" _ results_per_page | url %][% END %]
76
  [% IF facets_loo.facets.size > 5 %]
92
                                [% END %]
77
      <li class="moretoggle">
93
                                [% FOREACH facet IN facets_loo.facets %]
78
          <a href="#"><strong>Show more</strong></a>
94
                                    [% IF facets_loo.type_label_CollectionCodes %]
79
      </li>
95
                                        [% SET facet.facet_label_value = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => facet.facet_label_value ) || facet.facet_label_value %]
80
      <li class="moretoggle" style="display:none">
96
                                    [% END %]
81
          <a href="#"><strong>Show less</strong></a>
97
                                    [% IF facets_loo.type_label_Language %]
82
      </li>
98
                                        [% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %]
83
  [% END %]
99
                                    [% END %]
84
</ul></li>
100
                                    [% IF loop.count > 5 && !facet.active %]
85
[% END %]
101
                                        <li class="collapsible-facet" style="display:none">
86
[% END %]
102
                                    [% ELSE %]
87
</ul>
103
                                        <li>
88
</div>
104
                                    [% END %]
89
[% END %]
105
                                        [% IF facet.active %]
106
                                            [% local_url = BLOCK %][% url | $raw %][% "&nolimit=" _  facet.type_link_value _ ":" _ facet.facet_link_value | url %][% END %]
107
                                            <span class="facet-label">[% facet.facet_label_value | html %]</span>
108
                                            [<a href="[% local_url | $raw %]" title="Remove facet [% facet.facet_label_value | html %]">x</a>]
109
                                        [% ELSE %]
110
                                            [% local_url = BLOCK %][% url | $raw %][% "&limit=" _  facet.type_link_value _ ":" _ facet.facet_link_value | url %][% END %]
111
                                            <span class="facet-label"><a href="[% local_url | $raw %]" title="[% facet.facet_title_value | html %]">[% facet.facet_label_value | html %]</a></span>
112
                                            [% IF ( displayFacetCount ) %]
113
                                                <span class="facet-count"> ([% facet.facet_count | html %])</span>
114
                                            [% END %]
115
                                        [% END %]
116
                                    </li>
117
                                [% END %]
118
                                [% IF facets_loo.facets.size > 5 %]
119
                                    <li class="moretoggle">
120
                                        <a href="#"><strong>Show more</strong></a>
121
                                    </li>
122
                                    <li class="moretoggle" style="display:none">
123
                                        <a href="#"><strong>Show less</strong></a>
124
                                    </li>
125
                                [% END %]
126
                            </ul>
127
                        </li>
128
                    [% END %]
129
                [% END %]
130
            </ul>
131
        </div>
132
    [% END %]
90
[% END %]
133
[% END %]
91
- 

Return to bug 34422