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