Bug 13618: Add html filters to all the variables
[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.tagsdisabled ) %]
58                                         Sorry, tags are not enabled on this system.
59                                     [% ELSIF ( ERROR.badparam ) %]
60                                         ERROR: illegal parameter [% ERROR.badparam | html %]
61                                     [% ELSIF ( ERROR.login ) %]
62                                         ERROR: You must log in to complete that action.
63                                     [% ELSIF ( ERROR.failed_delete ) %]
64                                         ERROR: You cannot delete the tag [% ERROR.failed_delete | html %].
65                                         <br />Note: you can only delete your own tags.
66                                     [% ELSIF ( ERROR.scrubbed ) %]
67                                         Note: your tag contained markup code that was removed.
68                                         <br />The tag was added as &quot;[% ERROR.scrubbed | html %]&quot;.
69                                     [% ELSIF ( ERROR.scrubbed_all_bad ) %]
70                                         Note: your tag was entirely markup code.  It was NOT added.
71                                         <br />Please try again with plain text.
72                                     [% ELSE %]Unrecognized error.
73                                     [% END %]
74                                 </div>
75                             [% END %]
76                         [% END # /IF ERRORS %]
77                         <h1>All Tags</h1>
78
79                         <form method="get" action="opac-tags.pl" class="form-inline">
80                             <fieldset>
81                                 <label>
82                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
83                                         Tags to show from other users
84                                     [% ELSE %]
85                                         Tags to show
86                                     [% END %]:
87                                 </label>
88                                 <div class="input-append">
89                                     <input type="text" name="limit" style="text-align: right;" maxlength="4" size="4" value="[% limit or "100" | html %]" />
90                                     <input type="submit" value="OK" class="btn" />
91                                 </div>
92                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
93                                     [% UNLESS ( loggedinusername ) %]
94                                         <p>
95                                             [% IF Koha.Preference('casAuthentication') %]
96                                                 [%# CAS authentication is too complicated for modal window %]
97                                                 <a href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a>
98                                             [% ELSE %]
99                                                 <a class="loginModal-trigger" href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a>
100                                             [% END %]
101                                         </p>
102                                     [% END %]
103                                 [% END %]
104                             </fieldset>
105                         </form>
106
107                         [% IF ( TAGLOOP ) %]
108                             <div id="tagcloud">
109                                 [% FOREACH TAGLOO IN TAGLOOP %]
110                                     <span class="tag tagweight[% TAGLOO.stratum | html %]" id="tag[% loop.count | html %]" style="display:inline;">
111                                     <a href="/cgi-bin/koha/opac-search.pl?tag=[% TAGLOO.term |url %]&amp;q=[% TAGLOO.term |url %]">[% TAGLOO.term | html %]</a>
112                                     <span class="tagweight">[% TAGLOO.weight_total | html %]</span>
113                                     </span>
114                                 [% END %]
115                             </div>
116                         [% END # / TAGLOOP%]
117                         [% IF ( add_op ) %]
118                             [% IF ( added_count ) %]
119                                 <div class="dialog message">[% added_count | html %] [% IF ( added_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully added.</div>
120                             [% END %]
121                             [% IF ( deleted_count ) %]
122                             <div class="dialog message">[% deleted_count | html %] [% IF ( deleted_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully deleted.</div>
123                             [% END %]
124                         [% END # /add_op %]
125
126                         [% IF ( MY_TAGS ) %]
127                         <form id="deletetags" method="post" action="opac-tags.pl">
128                             <h2>Your tags</h2>
129                             <table id="mytagst" class="table table-bordered table-striped">
130                                 <thead><tr><th>&nbsp;</th><th>Term</th><th>Title</th><th>Date added</th></tr></thead>
131                                 <tbody>
132                                     [% FOREACH MY_TAG IN MY_TAGS %]
133                                         <tr>
134                                             <td>
135                                                 <input type="checkbox" name="del[% MY_TAG.tag_id | html %]" value="del[% MY_TAG.tag_id | html %]">
136                                             </td>
137                                             <td class="tagterm">
138                                                 <span class="tdlabel">Tag:</span>
139                                                 [% IF MY_TAG.approved == 1 %]
140                                                     <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">[% MY_TAG.term | html %]</a>
141                                                 [% ELSE %]
142                                                     [% MY_TAG.term | html %] (not approved)
143                                                 [% END %]
144                                             </td>
145                                             <td>
146                                                 [% IF ( MY_TAG.XSLTBloc ) %]
147                                                     [% MY_TAG.XSLTBloc | $raw %]
148                                                 [% ELSE %]
149                                                     <span class="tdlabel">Title:</span>
150                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber | html %]">
151                                                         [% MY_TAG.title | html %]
152                                                         [% IF ( MY_TAG.subtitle ) %]
153                                                             [% FOREACH subtitle IN MY_TAG.subtitle %]
154                                                                 [% subtitle.subfield | html %]
155                                                             [% END %]
156                                                         [% END %]
157                                                     </a>
158                                                     [% IF ( MY_TAG.author ) %]
159                                                         by [% MY_TAG.author | html %]
160                                                     [% END %]
161                                                 [% END # /IF MY_TAG.XSLTBloc %]
162                                             </td>
163                                             <td>
164                                                 <span title="[% MY_TAG.date_created | html %]">
165                                                     <span class="tdlabel">Date added:</span>
166                                                     [% MY_TAG.date_created | $KohaDates %]
167                                                 </span>
168                                             </td>
169                                         </tr>
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 %]