Bug 24223: Convert OpacNav system preference to additional content
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-tags.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE AdditionalContents %]
5 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Tags &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% BLOCK cssinclude %]
10     <style>
11         fieldset { padding : .3em;margin:.3em 0;}
12         #tagcloud    {background-color: #F5F5F5; text-align: justify;padding:7px;}
13         .tag a       {text-decoration: none;}
14         .tag a:hover {text-decoration: underline;}
15         .tag         {display: block; padding-left: 1em;}
16         .tagcount    {display: none;}
17         .cloudweight {display: none;}
18         .tagweight {
19             display: none;
20             position: relative;
21             bottom: 0.4em;
22             color: red;
23             font-size: 12px;
24         }
25     </style>
26 [% END %]
27 </head>
28 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usertags' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-tags' bodyclass='scrollto' %][% END %]
29 [% INCLUDE 'masthead.inc' %]
30
31 <div class="main">
32     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
33         <ol class="breadcrumb">
34             <li class="breadcrumb-item">
35                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
36             </li>
37             [% IF ( loggedinusername ) %]
38                 <li class="breadcrumb-item">
39                     <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
40                 </li>
41             [% END %]
42             <li class="breadcrumb-item active">
43                 <a href="#" aria-current="page">Tags</a>
44             </li>
45         </ol>
46     </nav> <!-- /#breadcrumbs -->
47
48     <div class="container-fluid">
49         <div class="row">
50             [% IF ( OpacNav||loggedinusername ) %]
51                 <div class="col col-lg-2 order-2 order-lg-1">
52                     <div id="navigation">
53                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
54                     </div>
55                 </div>
56                 <div class="col-md-12 col-lg-10 order-1">
57             [% ELSE %]
58                 <div class="col order-first order-md-first order-lg-2">
59             [% END %]
60
61                     <div id="usertags" class="maincontent">
62                         <h1>All tags</h1>
63                         [% IF ( ERRORS ) %]
64                             [% FOREACH ERROR IN ERRORS %]
65                                 <div class="alert alert-warning">
66                                     There was a problem with this operation:
67                                     [% IF ( ERROR.badparam ) %]
68                                         ERROR: illegal parameter [% ERROR.badparam | html %]
69                                     [% ELSIF ( ERROR.login ) %]
70                                         ERROR: You must log in to complete that action.
71                                     [% ELSIF ( ERROR.failed_delete ) %]
72                                         ERROR: You cannot delete the tag [% ERROR.failed_delete | html %].
73                                         <br />Note: you can only delete your own tags.
74                                     [% ELSIF ( ERROR.scrubbed ) %]
75                                         Note: your tag contained markup code that was removed.
76                                         <br />The tag was added as &quot;[% ERROR.scrubbed | html %]&quot;.
77                                     [% ELSIF ( ERROR.scrubbed_all_bad ) %]
78                                         Note: your tag was entirely markup code.  It was NOT added.
79                                         <br />Please try again with plain text.
80                                     [% ELSE %]Unrecognized error.
81                                     [% END %]
82                                 </div>
83                             [% END %]
84                         [% END # /IF ERRORS %]
85
86                         <form method="get" action="opac-tags.pl" class="form-inline">
87                             <fieldset>
88                                 <div class="form-inline">
89                                     <label>
90                                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
91                                             Tags to show from other users:
92                                         [% ELSE %]
93                                             Tags to show:
94                                         [% END %]
95                                     </label>
96                                     <input type="text" name="limit" class="form-control form-control-sm mr-2" maxlength="4" size="4" value="[% limit or "100" | html %]" />
97                                     <input type="submit" value="OK" class="btn btn-sm btn-primary" />
98                                 </div>
99                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
100                                     [% UNLESS ( loggedinusername ) %]
101                                         <p>
102                                             [% IF Koha.Preference('casAuthentication') %]
103                                                 [%# CAS authentication is too complicated for modal window %]
104                                                 <a href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a>
105                                             [% ELSE %]
106                                                 <a class="loginModal-trigger" href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a>
107                                             [% END %]
108                                         </p>
109                                     [% END %]
110                                 [% END %]
111                             </fieldset>
112                         </form>
113
114                         [% IF ( TAGLOOP ) %]
115                             <div id="tagcloud">
116                                 [% FOREACH TAGLOO IN TAGLOOP %]
117                                     <span class="tag tagweight[% TAGLOO.stratum | html %]" id="tag[% loop.count | html %]" style="display:inline;">
118                                     <a href="/cgi-bin/koha/opac-search.pl?tag=[% TAGLOO.term |url %]&amp;q=[% TAGLOO.term |url %]">[% TAGLOO.term | html %]</a>
119                                     <span class="tagweight">[% TAGLOO.weight_total | html %]</span>
120                                     </span>
121                                 [% END %]
122                             </div>
123                         [% END # / TAGLOOP%]
124                         [% IF ( add_op ) %]
125                             [% IF ( added_count ) %]
126                                 <div class="dialog message">[% added_count | html %] [% IF ( added_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully added.</div>
127                             [% END %]
128                             [% IF ( deleted_count ) %]
129                             <div class="dialog message">[% deleted_count | html %] [% IF ( deleted_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully deleted.</div>
130                             [% END %]
131                         [% END # /add_op %]
132
133                         [% IF ( MY_TAGS ) %]
134                         <form id="deletetags" method="post" action="opac-tags.pl">
135                             <table id="mytagst" class="table table-bordered table-striped">
136                             <caption>Your tags</caption>
137                                 <thead>
138                                     <tr>
139                                         <th>&nbsp;</th>
140                                         <th>Term</th>
141                                         <th class="anti-the">Title</th>
142                                         <th>Date added</th>
143                                     </tr>
144                                 </thead>
145                                 <tbody>
146                                     [% FOREACH MY_TAG IN MY_TAGS %]
147                                         [% IF MY_TAG.visible %]
148                                         <tr>
149                                             <td class="selectcol">
150                                                 <input type="checkbox" name="del[% MY_TAG.tag_id | html %]" value="del[% MY_TAG.tag_id | html %]">
151                                             </td>
152                                             <td class="tagterm">
153                                                 <span class="tdlabel">Tag:</span>
154                                                 [% IF MY_TAG.approved == 1 %]
155                                                     <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">[% MY_TAG.term | html %]</a>
156                                                 [% ELSE %]
157                                                     [% MY_TAG.term | html %] (not approved)
158                                                 [% END %]
159                                             </td>
160                                             <td>
161                                                 [% IF ( MY_TAG.XSLTBloc ) %]
162                                                     [% MY_TAG.XSLTBloc | $raw %]
163                                                 [% ELSE %]
164                                                     <span class="tdlabel">Title:</span>
165                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber | html %]">
166                                                         [% INCLUDE 'biblio-title.inc' biblio=MY_TAG %]
167                                                     </a>
168                                                     [% IF ( MY_TAG.author ) %]
169                                                         by [% MY_TAG.author | html %]
170                                                     [% END %]
171                                                 [% END # /IF MY_TAG.XSLTBloc %]
172
173                                                 [% INCLUDE 'title-actions-menu.inc' items=MY_TAG %]
174                                             </td>
175                                             <td data-order="[% MY_TAG.date_created | html %]">
176                                                 <span class="tdlabel">Date added:</span>
177                                                 [% MY_TAG.date_created | $KohaDates %]
178                                             </td>
179                                         </tr>
180                                         [% END %]
181                                     [% END %]
182                                 </tbody>
183                             </table>
184                             <input type="submit" value="Delete selected tags" class="btn btn-danger btn-sm delete">
185                         </form>
186                         [% END # /MY_TAGS %]
187                     </div> <!-- / .usertags -->
188                 </div> <!-- / .span10/12 -->
189             </div> <!-- / .row -->
190         </div> <!-- / .container-fluid -->
191     </div> <!-- / .main -->
192
193 [% INCLUDE 'opac-bottom.inc' %]
194 [% BLOCK jsinclude %]
195 [% INCLUDE 'datatables.inc' %]
196 <script>
197
198     function checkboxesChecked() {
199         if ($("#deletetags input:checkbox:checked").length > 0) {
200             return 1;
201         } else {
202             return 0;
203         }
204     }
205
206     $(document).ready(function(){
207         var MSG_DELETE_TAG = _("Are you sure you want to delete the selected tag(s)?");
208         $(".delete").on("click", function(e){
209             if ( checkboxesChecked() == 1 ) {
210                 return confirmDelete(MSG_DELETE_TAG);
211             } else {
212                 alert(_("Please select a tag to delete."));
213                 e.preventDefault();
214             }
215         });
216
217         $("#mytagst").dataTable($.extend(true, {}, dataTablesDefaults, {
218             "sorting": [[ 2, "asc" ]],
219             "columnDefs": [
220                 { "targets": [ 0 ], "sortable": false, "searchable": false },
221                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
222             ]
223         }));
224     });
225
226 </script>
227 [% END %]