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