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