Bug 21476: Fix HTML5 media from playing in the OPAC - incorrect filters
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-tags.tt
index 8e9a477..5316f57 100644 (file)
@@ -1,10 +1,12 @@
+[% USE raw %]
 [% USE Koha %]
 [% USE KohaDates %]
 
-[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Tags
+[% INCLUDE 'doc-head-open.inc' %]
+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Tags</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% BLOCK cssinclude %]
-    <style type="text/css">
+    <style>
         fieldset { padding : .3em;margin:.3em 0;}
         #tagcloud    {background-color: #F3F3F3; text-align: justify;padding:7px;}
         .tag a       {text-decoration: none;}
@@ -28,6 +30,9 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
+        [% IF ( loggedinusername ) %]
+            <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
+        [% END %]
         <li><a href="#">Tags</a></li>
     </ul>
 
                                     [% IF ( ERROR.tagsdisabled ) %]
                                         Sorry, tags are not enabled on this system.
                                     [% ELSIF ( ERROR.badparam ) %]
-                                        ERROR: illegal parameter [% ERROR.badparam %]
+                                        ERROR: illegal parameter [% ERROR.badparam | html %]
                                     [% ELSIF ( ERROR.login ) %]
                                         ERROR: You must log in to complete that action.
                                     [% ELSIF ( ERROR.failed_delete ) %]
-                                        ERROR: You cannot delete the tag [% ERROR.failed_delete %].
+                                        ERROR: You cannot delete the tag [% ERROR.failed_delete | html %].
                                         <br />Note: you can only delete your own tags.
                                     [% ELSIF ( ERROR.scrubbed ) %]
                                         Note: your tag contained markup code that was removed.
-                                        <br />The tag was added as &quot;[% ERROR.scrubbed %]&quot;.
+                                        <br />The tag was added as &quot;[% ERROR.scrubbed | html %]&quot;.
                                     [% ELSIF ( ERROR.scrubbed_all_bad ) %]
                                         Note: your tag was entirely markup code.  It was NOT added.
                                         <br />Please try again with plain text.
                                     [% END %]:
                                 </label>
                                 <div class="input-append">
-                                    <input type="text" name="limit" style="text-align: right;" maxlength="4" size="4" value="[% limit or "100" %]" />
+                                    <input type="text" name="limit" style="text-align: right;" maxlength="4" size="4" value="[% limit or "100" | html %]" />
                                     <input type="submit" value="OK" class="btn" />
                                 </div>
                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                                     [% UNLESS ( loggedinusername ) %]
-                                        <p><a class="loginModal-trigger" href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a></p>
+                                        <p>
+                                            [% IF Koha.Preference('casAuthentication') %]
+                                                [%# CAS authentication is too complicated for modal window %]
+                                                <a href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a>
+                                            [% ELSE %]
+                                                <a class="loginModal-trigger" href="/cgi-bin/koha/opac-user.pl">Log in to see your own saved tags.</a>
+                                            [% END %]
+                                        </p>
                                     [% END %]
                                 [% END %]
                             </fieldset>
                         [% IF ( TAGLOOP ) %]
                             <div id="tagcloud">
                                 [% FOREACH TAGLOO IN TAGLOOP %]
-                                    <span class="tag tagweight[% TAGLOO.stratum %]" id="tag[% loop.count %]" style="display:inline;">
-                                    <a href="/cgi-bin/koha/opac-search.pl?tag=[% TAGLOO.term |url %]&amp;q=[% TAGLOO.term |url %]">[% TAGLOO.term |html %]</a>
-                                    <span class="tagweight">[% TAGLOO.weight_total %]</span>
+                                    <span class="tag tagweight[% TAGLOO.stratum | html %]" id="tag[% loop.count | html %]" style="display:inline;">
+                                    <a href="/cgi-bin/koha/opac-search.pl?tag=[% TAGLOO.term |url %]&amp;q=[% TAGLOO.term |url %]">[% TAGLOO.term | html %]</a>
+                                    <span class="tagweight">[% TAGLOO.weight_total | html %]</span>
                                     </span>
                                 [% END %]
                             </div>
                         [% END # / TAGLOOP%]
                         [% IF ( add_op ) %]
                             [% IF ( added_count ) %]
-                                <div class="dialog message">[% added_count %] [% IF ( added_count ==1 ) %] tag[% ELSE %]tags[% END %] successfully added.</div>
+                                <div class="dialog message">[% added_count | html %] [% IF ( added_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully added.</div>
                             [% END %]
                             [% IF ( deleted_count ) %]
-                            <div class="dialog message">[% deleted_count %][% IF ( deleted_count ==1 ) %] tag[% ELSE %]tags[% END %] successfully deleted.</div>
+                            <div class="dialog message">[% deleted_count | html %] [% IF ( deleted_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully deleted.</div>
                             [% END %]
                         [% END # /add_op %]
 
                         [% IF ( MY_TAGS ) %]
-                        <form method="post" action="opac-tags.pl">
-                            <h2>My Tags</h2>
+                        <form id="deletetags" method="post" action="opac-tags.pl">
+                            <h2>Your tags</h2>
                             <table id="mytagst" class="table table-bordered table-striped">
-                                <thead><tr><th>Term</th><th>Title</th><th>Date added</th><th>Delete</th></tr></thead>
+                                <thead><tr><th>&nbsp;</th><th>Term</th><th>Title</th><th>Date added</th></tr></thead>
                                 <tbody>
                                     [% FOREACH MY_TAG IN MY_TAGS %]
                                         <tr>
+                                            <td>
+                                                <input type="checkbox" name="del[% MY_TAG.tag_id | html %]" value="del[% MY_TAG.tag_id | html %]">
+                                            </td>
                                             <td class="tagterm">
                                                 <span class="tdlabel">Tag:</span>
-                                                <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">
-                                            [% MY_TAG.term |html %]</a></td>
+                                                [% IF MY_TAG.approved == 1 %]
+                                                    <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">[% MY_TAG.term | html %]</a>
+                                                [% ELSE %]
+                                                    [% MY_TAG.term | html %] (not approved)
+                                                [% END %]
+                                            </td>
                                             <td>
-                                                <span class="tdlabel">Title:</span>
-                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber %]">
-                                                [% MY_TAG.bib_summary |html %]</a></td>
+                                                [% IF ( MY_TAG.XSLTBloc ) %]
+                                                    [% MY_TAG.XSLTBloc | $raw %]
+                                                [% ELSE %]
+                                                    <span class="tdlabel">Title:</span>
+                                                    <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber | html %]">
+                                                        [% MY_TAG.title | html %]
+                                                        [% IF ( MY_TAG.subtitle ) %]
+                                                            [% FOREACH subtitle IN MY_TAG.subtitle %]
+                                                                [% subtitle.subfield | html %]
+                                                            [% END %]
+                                                        [% END %]
+                                                    </a>
+                                                    [% IF ( MY_TAG.author ) %]
+                                                        by [% MY_TAG.author | html %]
+                                                    [% END %]
+                                                [% END # /IF MY_TAG.XSLTBloc %]
+                                            </td>
                                             <td>
-                                                <span title="[% MY_TAG.date_created %]">
+                                                <span title="[% MY_TAG.date_created | html %]">
                                                     <span class="tdlabel">Date added:</span>
                                                     [% MY_TAG.date_created | $KohaDates %]
                                                 </span>
                                             </td>
-                                            <td><input type="submit" name="del[% MY_TAG.tag_id %]" value="Delete" class="btn btn-danger btn-mini" /></td>
                                         </tr>
                                     [% END %]
                                 </tbody>
                             </table>
+                            <input type="submit" value="Delete selected tags" class="btn btn-danger btn-sm delete">
                         </form>
                         [% END # /MY_TAGS %]
                     </div> <!-- / .usertags -->
 [% INCLUDE 'opac-bottom.inc' %]
 [% BLOCK jsinclude %]
 [% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
+<script>
 //<![CDATA[
+    function checkboxesChecked() {
+        if ($("#deletetags input:checkbox:checked").length > 0) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+
     $(document).ready(function(){
+        var MSG_DELETE_TAG = _("Are you sure you want to delete the selected tag(s)?");
+        $(".delete").on("click", function(e){
+            if ( checkboxesChecked() == 1 ) {
+                return confirmDelete(MSG_DELETE_TAG);
+            } else {
+                alert(_("Please select a tag to delete."));
+                e.preventDefault();
+            }
+        });
+
         $("#mytagst").dataTable($.extend(true, {}, dataTablesDefaults, {
-            "aaSorting": [[ 2, "asc" ]],
-            "aoColumnDefs": [
-              { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }
+            "sorting": [[ 2, "asc" ]],
+            "columnDefs": [
+              { "targets": [ 0 ], "sortable": false, "searchable": false }
             ],
-            "aoColumns": [
+            "columns": [
                 null,
-                { "sType": "anti-the" },
-                { "sType": "title-string" },
+                { "type": "anti-the" },
+                { "type": "title-string" },
                 null
             ]
         }));