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

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

Return to bug 34422