Bug 21526: Use the 'url' filter when needed
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-shelves.tt
index 4050672..581adfd 100644 (file)
@@ -1,39 +1,36 @@
+[% USE raw %]
+[% USE Asset %]
 [% USE Koha %]
 [% SET PRIVATE = 1 %]
 [% SET PUBLIC = 2 %]
 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsShowOnList') ) %]
 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsInputOnList') ) %]
+[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
+[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
 
 [% INCLUDE 'doc-head-open.inc' %]
-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;   [% IF op == 'view' %]Contents of [% shelf.shelfname |html %][% ELSE %]Your lists[% END %]</title>[% INCLUDE 'doc-head-close.inc' %]
+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;   [% IF op == 'view' %]Contents of [% shelf.shelfname | html %][% ELSE %]Your lists[% END %]</title>[% INCLUDE 'doc-head-close.inc' %]
 [% BLOCK cssinclude %][% END %]
 </head>
 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-userlists' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-lists' bodyclass='scrollto' %][% END %]
 
 [% BLOCK list_permissions %]
     <li>
-        <label for="allow_add">Permissions: </label>
-        <select name="allow_add" id="allow_add">
-            [% IF shelf.allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
-            [% IF shelf.allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
-        </select>
-        &nbsp;<span>anyone else to add entries.</span>
-    </li>
-    <li>
-        <label>&nbsp;</label>
-        <select name="allow_delete_own" id="allow_delete_own">
-            [% IF shelf and not shelf.allow_delete_own %]<option value="0" selected="selected">Do not allow</option>[% ELSE %]<option value="0">Do not allow</option>[% END %]
-            [% IF not shelf or shelf.allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
-        </select>
-        &nbsp;<span>anyone to remove their own contributed entries.</span>
-    </li>
-    <li>
-        <label>&nbsp;</label>
-        <select name="allow_delete_other" id="allow_delete_other">
-            [% IF shelf.allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
-            [% IF shelf.allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
+        <label for="allow_changes_from">Allow changes to contents from: </label>
+        <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
+
+            [% IF shelf.allow_change_from_owner %]<option value="0">Nobody</option>[% ELSE %]<option value="0" selected="selected">Nobody</option>[% END %]
+
+            [% IF shelf.allow_change_from_owner && (( !shelf.is_public && !shelf.is_shared ) || !shelf.allow_change_from_others ) %]
+                <option value="1" selected="selected">Owner only</option>
+            [% ELSE %]
+                <option value="1">Owner only</option>
+            [% END %]
+
+            [% IF shelf.allow_change_from_others %]<option value="2" selected="selected">Anyone seeing this list</option>[% ELSE %]<option value="2">Anyone seeing this list</option>[% END %]
+
         </select>
-        &nbsp;<span>anyone to remove other contributed entries.</span>
+        &emsp; <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
     </li>
 [% END %]
 
@@ -42,7 +39,7 @@
     <ul class="breadcrumb noprint">
         <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">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">&rsaquo;</span></li>
+            <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 %]
 
         [% IF op != 'list' %]
             <li>Lists</li>
         [% END %]
 
-        [% IF shelf and shelf.category == PRIVATE %]
+        [% IF shelf and shelf.is_private %]
             [% IF op == 'view' OR op == 'edit_form' %]
-                <li><span class="divider">&rsaquo;</span> <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]">Your lists</a></li>
+                <li><span class="divider">&rsaquo;</span> <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE | uri %]">Your lists</a></li>
             [% ELSE %]
                 <li><span class="divider">&rsaquo;</span> Your lists</li>
             [% END %]
-        [% ELSIF shelf AND shelf.category == PUBLIC %]
+        [% ELSIF shelf AND shelf.is_public %]
             [% IF op == 'view' %]
-                <li><span class="divider">&rsaquo;</span> <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a></li>
+                <li><span class="divider">&rsaquo;</span> <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC | uri %]">Public lists</a></li>
             [% ELSE %]
                 <li><span class="divider">&rsaquo;</span> Public lists</li>
             [% END %]
                     [% CASE 'no_biblio_removed' %]
                         <span>No record was removed.</span>
                     [% CASE 'Koha::Exceptions::Virtualshelves::DuplicateObject' %]
-                        <span>An error occurred when creating the list. The name [% shelfname %] already exists.</span>
+                        <span>An error occurred when creating the list. The name [% shelfname | html %] already exists.</span>
                     [% CASE 'DBIx::Class::Exception' %]
-                        [% m.msg %]
+                        [% m.msg | html %]
                     [% CASE %]
-                        [% m.code %]
-                        [% m.msg %]
+                        [% m.code | html %]
+                        [% m.msg | html %]
                     [% END %]
                     </div>
                 [% END %]
 
-                    [% IF op == 'view' %]
+                    [% IF shelf AND op == 'view' %]
                         <h3>
-                            [% shelf.shelfname |html %]
-                            <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;op=view&amp;shelfnumber=[% shelf.shelfnumber %]" class="rss-list-link noprint">
-                                <img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this list" title="Subscribe to this list" border="0" class="rsssearchicon"/>
+                            [% shelf.shelfname | html %]
+                            <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="rss-list-link noprint">
+                                <img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this list" title="Subscribe to this list" border="0" class="rsssearchicon"/>
                             </a>
                         </h3>
 
-                        [% IF ( itemsloop ) %]
-                            <div id="toolbar" class="toolbar clearfix">
-                                <div class="list-actions">
+                         [% IF ( itemsloop ) %]
+                             <div id="toolbar" class="toolbar clearfix">
+                                 <div class="list-actions">
                                     <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a> <span class="sep">|</span>
-                                    <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | html %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
+                                    <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | uri %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
 
                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
-                                        <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
+                                        <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | uri %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
                                     [% END %]
 
-                                    <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&sortfield=[% sortfield %]&direction=[% direction |uri %]&print=1">Print list</a>
+                                    <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | html %]&sortfield=[% sortfield | html %]&direction=[% direction |uri %]&print=1">Print list</a>
 
                                     [% IF can_manage_shelf %]
                                         <span class="sep">|</span>
                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
                                             <input type="hidden" name="op" value="edit_form" />
                                             <input type="hidden" name="referer" value="view" />
-                                            <input type='hidden' name='category' value='[% category %]' />
+                                            <input type='hidden' name='category' value='[% category | html %]' />
                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                                             <input type="submit" class="editshelf" value="Edit list" />
                                         </form>
                                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
                                             <input type="hidden" name="op" value="delete" />
                                             <input type="hidden" name="referer" value="list" />
-                                            <input type='hidden' name='category' value='[% category %]' />
+                                            <input type='hidden' name='category' value='[% category | html %]' />
                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                                             <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
                                         </form>
                                         [% IF category == PRIVATE && Koha.Preference('OpacAllowSharingPrivateLists') %]
-                                            <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelf.shelfnumber | html %]" class="">Share list</a>
+                                            <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelf.shelfnumber | uri %]" class="sharelist">Share list</a>
                                         [% END %]
                                     [% ELSIF category == PRIVATE # not manageshelf and private means shared %]
                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="post" class="form-inline">
                                             <input type="hidden" name="op" value="remove_share" />
                                             <input type="hidden" name="referer" value="list" />
-                                            <input type='hidden' name='category' value='[% category %]' />
+                                            <input type='hidden' name='category' value='[% category | html %]' />
                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                                             <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
                                         </form>
                                         [% ELSE %]
                                             <option value="copyrightdate">Copyright date</option>
                                         [% END %]
+
+                                        [% IF sortfield == "dateadded" %]
+                                            <option value="dateadded" selected="selected">Date added</option>
+                                        [% ELSE %]
+                                            <option value="dateadded">Date added</option>
+                                        [% END %]
                                     </select>
 
                                     <select name="direction" class="resort" onchange="$('#sorting-form').submit()">
                                         </span>
                                         <span id="tagsel_form" style="display:none">
                                           <label for="tagsel_new">New tag(s), separated by a comma:</label>
-                                          <input name="tagsel_new" id="tagsel_new" maxlength="100" />
+                                          <input type="text" name="tagsel_new" id="tagsel_new" maxlength="100" />
                                           <input id="tagsel_button" name="tagsel_button" class="tagsel_button btn btn-small" title="tagsel_button" type="submit" value="Add" />
                                           <a href="#" id="tagsel_cancel">Cancel</a>
                                         </span>
                                         <tbody>
                                         [% FOREACH itemsloo IN itemsloop %]
                                             <tr>
-                                                <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber %]" /></td>
+                                                <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" /></td>
                                                 [% UNLESS ( item_level_itypes ) %]
                                                     <td>
                                                         [% UNLESS ( noItemTypeImages ) %]
-                                                            <img src="[% itemsloo.imageurl %]" alt="[% itemsloo.description %]" title="[% itemsloo.description %]" />
+                                                            <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
                                                         [% END %]
-                                                        [% itemsloo.description %]
+                                                        [% itemsloo.description | html %]
                                                     </td>
                                                 [% END %]
                                                 <td>
                                                     <div class="coverimages">
-                                                        <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber %]">
+                                                        <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber | html %]">
                                                             [% IF ( OPACLocalCoverImages ) %]
-                                                                <span title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.biblionumber %]" id="local-thumbnail[% loop.count %]"></span>
+                                                                <span title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
+                                                            [% END %]
+                                                            [% IF ( AdlibrisEnabled && itemsloo.normalized_isbn ) %]
+                                                                <img src="[% AdlibrisURL | html %]?isbn=[% itemsloo.normalized_isbn | html %]" class="adlibris-cover" alt="Adlibris cover image" />
                                                             [% END %]
-
                                                             [% IF ( OPACAmazonCoverImages ) %]
                                                                 [% IF ( itemsloo.normalized_isbn ) %]
-                                                                    <span title="[% SEARCH_RESULT.biblionumber %]" id="amazon-thumbnail[% loop.count %]"><img src="https://images-na.ssl-images-amazon.com/images/P/[% itemsloo.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" /></span>
+                                                                    <span title="[% itemsloo.biblionumber | html %]" id="amazon-thumbnail[% loop.count | html %]"><img src="https://images-na.ssl-images-amazon.com/images/P/[% itemsloo.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="" /></span>
                                                                 [% ELSE %]
                                                                     <span class="no-image">No cover image available</span>
                                                                 [% END %]
                                                             [% END %]
 
                                                             [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
-                                                                [% IF ( using_https ) %]
-                                                                    <span title="[% SEARCH_RESULT.biblionumber %]" id="syndetics-thumbnail[% loop.count %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% itemsloo.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% itemsloo.normalized_upc %]&amp;oclc=[% itemsloo.normalized_oclc %]" alt="" /></span>
-                                                                [% ELSE %]
-                                                                    <span title="[% SEARCH_RESULT.biblionumber %]" id="syndetics-thumbnail[% loop.count %]"><img src="http://www.syndetics.com/index.aspx?isbn=[% itemsloo.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% itemsloo.normalized_upc %]&amp;oclc=[% itemsloo.normalized_oclc %]" alt="" /></span>
-                                                                [% END %]
+                                                                <span title="[% itemsloo.biblionumber | html %]" id="syndetics-thumbnail[% loop.count | html %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% itemsloo.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% itemsloo.normalized_upc | html %]&amp;oclc=[% itemsloo.normalized_oclc | html %]" alt="" /></span>
                                                             [% END %]
 
                                                             [% IF ( GoogleJackets ) %]
                                                                 [% IF ( itemsloo.normalized_isbn ) %]
-                                                                    <div title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>
+                                                                    <div title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
                                                                 [% ELSE %]
                                                                     <span class="no-image">No cover image available</span>
                                                                 [% END %]
                                                             [% END %]
 
+                                                            [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+                                                                [% coce_id = itemsloo.normalized_ean || itemsloo.normalized_isbn %]
+                                                                [% IF ( coce_id ) %]
+                                                                    <span title="[% itemsloo.biblionumber |url %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
+                                                                [% ELSE %]
+                                                                    <span class="no-image">No cover image available</span>
+                                                                [% END %]
+                                                            [% END %]
+
+
                                                             [% IF OpenLibraryCovers %]
                                                                 [% IF itemsloo.normalized_isbn %]
-                                                                    <span title="[% itemsloo.biblionumber %]" class="[% itemsloo.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>
+                                                                    <span title="[% itemsloo.biblionumber | html %]" class="[% itemsloo.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span>
                                                                 [% ELSE %]
                                                                     <span class="no-image">No cover image available</span>
                                                                 [% END %]
                                                         [% IF ( BakerTaylorEnabled ) %]
                                                             [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
                                                             [% IF ( bt_id ) %]
-                                                                <a href="https://[% BakerTaylorBookstoreURL |html %][% bt_id %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" /></a>
+                                                                <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
                                                             [% ELSE %]
                                                                 <span class="no-image">No cover image available</span>
                                                             [% END %]
                                                         [% END %]
                                                     </div>
                                                     [% IF ( itemsloo.XSLTBloc ) %]
-                                                        [% itemsloo.XSLTBloc %]
+                                                        [% itemsloo.XSLTBloc | $raw %]
                                                     [% ELSE %]
 
                                                         [% IF ( itemsloo.BiblioDefaultViewmarc ) %]
                                                         [% END %]
 
                                                         [% IF ( itemsloo.title ) %]
-                                                            [% itemsloo.title |html %]
+                                                            [% itemsloo.title | html %]
                                                         [% ELSE %]
                                                             No title
                                                         [% END %]
 
                                                         [% FOREACH subtitl IN itemsloo.subtitle %]
-                                                            [% subtitl.subfield|html %]
+                                                            [% subtitl.subfield | html %]
                                                         [% END %]
                                                         </a>
 
                                                         [% IF ( itemsloo.author ) %]
-                                                            by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% itemsloo.author |url %]" title="Search for works by this author" class="author">[% itemsloo.author %]</a>
+                                                            by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% itemsloo.author |url %]" title="Search for works by this author" class="author">[% itemsloo.author | html %]</a>
                                                         [% ELSE %]
                                                             &nbsp;
                                                         [% END %]
                                                         <span class="results_summary">
                                                             <span class="label">Publication:</span>
                                                             [% IF ( itemsloo.place ) %]
-                                                                [% itemsloo.place %]
+                                                                [% itemsloo.place | html %]
                                                             [% END %]
                                                             [% IF ( itemsloo.publishercode ) %]
-                                                                [% itemsloo.publishercode|html %]
+                                                                [% itemsloo.publishercode | html %]
                                                             [% END %]
                                                             [% IF ( itemsloo.publicationyear ) %]
-                                                                [% itemsloo.publicationyear %]
+                                                                [% itemsloo.publicationyear | html %]
                                                             [% ELSE %]
                                                                 [% IF ( itemsloo.copyrightdate ) %]
-                                                                    [% itemsloo.copyrightdate %]
+                                                                    [% itemsloo.copyrightdate | html %]
                                                                 [% END %]
                                                             [% END %]
-                                                            [% IF ( itemsloo.pages ) %]. [% itemsloo.pages %][% END %]
-                                                            [% IF ( itemsloo.notes ) %], [% itemsloo.notes|html %][% END %]
-                                                            [% IF ( itemsloo.item('size') ) %] [% itemsloo.item('size') %][% END %]
+                                                            [% IF ( itemsloo.pages ) %]. [% itemsloo.pages | html %][% END %]
+                                                            [% IF ( itemsloo.notes ) %], [% itemsloo.notes | html %][% END %]
+                                                            [% IF ( itemsloo.item('size') ) %] [% itemsloo.item('size') | html %][% END %]
                                                         </span>
                                                         <span class="results_summary">
                                                             <span class="label">Holdings:</span>
                                                             [% IF ( itemsloo.ITEM_RESULTS ) %]
                                                                 [% FOREACH ITEM_RESULT IN itemsloo.ITEM_RESULTS %]
-                                                                    [% ITEM_RESULT.homebranch %]
+                                                                    [% ITEM_RESULT.homebranch | html %]
                                                                     [% IF ( ITEM_RESULT.location_opac ) %]
-                                                                        , [% ITEM_RESULT.location_opac %]
+                                                                        , [% ITEM_RESULT.location_opac | html %]
                                                                     [% END %]
                                                                     [% IF ( ITEM_RESULT.itemcallnumber ) %]
-                                                                        ([% ITEM_RESULT.itemcallnumber %])
+                                                                        ([% ITEM_RESULT.itemcallnumber | html %])
                                                                             [% IF ( loop.last ) %].[% ELSE %],[% END %]
                                                                     [% END %]
                                                                 [% END %]
                                                             <span class="label">Tags:</span>
                                                             <ul>
                                                                 [% FOREACH TagLoo IN itemsloo.TagLoop %]
-                                                                    <li><a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term |url %]&amp;q=[% TagLoo.term |url %]">[% TagLoo.term %]</a> <span class="weight">([% TagLoo.weight_total %])</span></li>
+                                                                    <li><a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term |url %]&amp;q=[% TagLoo.term |url %]">[% TagLoo.term | html %]</a> <span class="weight">([% TagLoo.weight_total | html %])</span></li>
                                                                 [% END %]
                                                             </ul>
                                                         </div>
                                                             [% UNLESS ( itemsloo.norequests ) %]
                                                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                                                                     [% IF ( itemsloo.allow_onshelf_holds ) %]
-                                                                        <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue--></span>
+                                                                        <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber | html %]">Place hold</a><!-- add back when available 0 holds in queue--></span>
                                                                     [% ELSE %]
                                                                         [% IF ( itemsloo.itemsissued ) %]
-                                                                            <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue--></span>
+                                                                            <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber | html %]">Place hold</a><!-- add back when available 0 holds in queue--></span>
                                                                         [% END %]
                                                                     [% END %]
                                                                 [% END # / IF opacuserlogin %]
 
                                                         [% IF ( TagsInputEnabled ) %]
                                                             [% IF ( loggedinusername ) %]
-                                                                <span class="actions"><a class="tag_add hidden" id="tag_add[% itemsloo.biblionumber %]" href="#">Add tag</a></span>
-                                                                <div id="tagform[% itemsloo.biblionumber %]" class="tag_results_input" style="display:none;">
-                                                                    <label for="newtag[% itemsloo.biblionumber %]">New tag(s), separated by a comma:</label>
-                                                                    <input name="newtag[% itemsloo.biblionumber %]" id="newtag[% itemsloo.biblionumber %]" maxlength="100" />
-                                                                    <input name="tagbutton" class="tagbutton btn btn-small" title="[% itemsloo.biblionumber %]" type="submit" value="Add" />
-                                                                    <a class="cancel_tag_add" id="cancel[% itemsloo.biblionumber %]" href="#">(done)</a>
+                                                                <span class="actions"><a class="tag_add hidden" id="tag_add[% itemsloo.biblionumber | html %]" href="#">Add tag</a></span>
+                                                                <div id="tagform[% itemsloo.biblionumber | html %]" class="tag_results_input" style="display:none;">
+                                                                    <label for="newtag[% itemsloo.biblionumber | html %]">New tag(s), separated by a comma:</label>
+                                                                    <input type="text" name="newtag[% itemsloo.biblionumber | html %]" id="newtag[% itemsloo.biblionumber | html %]" maxlength="100" />
+                                                                    <input name="tagbutton" class="tagbutton btn btn-small" title="[% itemsloo.biblionumber | html %]" type="submit" value="Add" />
+                                                                    <a class="cancel_tag_add" id="cancel[% itemsloo.biblionumber | html %]" href="#">(done)</a>
                                                                 </div>
-                                                                <div id="newtag[% itemsloo.biblionumber %]_status" class="tagstatus" style="display:none;">
+                                                                <div id="newtag[% itemsloo.biblionumber | html %]_status" class="tagstatus" style="display:none;">
                                                                 Tag status here.
                                                                 </div>
                                                             [% ELSIF ( loop.first ) %]
                                                         [% END # / IF TagsInputEnabled %]
 
                                                         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername && ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
-                                                            <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]'); return false;">Save to another list</a></span>
+                                                            <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber | html %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber | html %]'); return false;">Save to another list</a></span>
                                                         [% END %]
 
                                                         [% IF can_remove_biblios %]
-                                                            <span class="actions"><a class="removefromlist" href="/cgi-bin/koha/opac-shelves.pl?op=remove_biblios&amp;shelfnumber=[% shelf.shelfnumber %]&amp;biblionumber=[% itemsloo.biblionumber %]">Remove from this list</a></span>
+                                                            <span class="actions"><a class="removefromlist" href="/cgi-bin/koha/opac-shelves.pl?op=remove_biblios&amp;shelfnumber=[% shelf.shelfnumber | html %]&amp;biblionumber=[% itemsloo.biblionumber | html %]">Remove from this list</a></span>
                                                         [% END %]
 
                                                         [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
                                                             [% IF ( itemsloo.incart ) %]
-                                                                <span class="actions"><a class="addtocart cart[% itemsloo.biblionumber %] hidden" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">In your cart</a> <a class="cartRemove cartR[% itemsloo.biblionumber %] hidden" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber %]'); return false;">(remove)</a></span>
+                                                                <span class="actions"><a class="addtocart cart[% itemsloo.biblionumber | html %] hidden" href="#" onclick="addRecord('[% itemsloo.biblionumber | html %]'); return false;">In your cart</a> <a class="cartRemove cartR[% itemsloo.biblionumber | html %] hidden" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber | html %]'); return false;">(remove)</a></span>
                                                             [% ELSE %]
-                                                                <span class="actions"><a class="addtocart cart[% itemsloo.biblionumber %] hidden" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">Add to cart</a> <a style="display:none;" class="cartRemove cartR[% itemsloo.biblionumber %] hidden" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber %]'); return false;">(remove)</a></span>
+                                                                <span class="actions"><a class="addtocart cart[% itemsloo.biblionumber | html %] hidden" href="#" onclick="addRecord('[% itemsloo.biblionumber | html %]'); return false;">Add to cart</a> <a style="display:none;" class="cartRemove cartR[% itemsloo.biblionumber | html %] hidden" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber | html %]'); return false;">(remove)</a></span>
                                                             [% END %]
                                                         [% END # / IF opacbookbag %]
                                                     </span> <!-- / .results_summary .actions -->
 
                                                     <!-- COinS / Openurl -->
-                                                    <span class="Z3988" title="[% itemsloo.coins %]"></span>
+                                                    <span class="Z3988" title="[% itemsloo.coins | html %]"></span>
                                                 </td>
                                             </tr>
                                         [% END # / FOREACH itemsloop %]
                                 </div><!-- / .searchresults -->
 
                             [% IF ( pagination_bar ) %]
-                                <div class="pages">[% pagination_bar %]</div>
+                                <div class="pages">[% pagination_bar | $raw %]</div>
                             [% END %]
 
                         [% ELSE %]
 
                                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
                                             <input type="hidden" name="op" value="delete" />
-                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html  %]"/>
+                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]"/>
                                             <input type="hidden" name="category" value="category" />
                                             <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
                                         </form>
                                 [% END %]
                             </div>
                         [% END # / IF itemsloop %]
-                    [% END %]
-
+                      [% END %]
                     [% IF itemsloop && can_remove_biblios %]
                         <input type="hidden" name="op" value="remove_biblios" />
                         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                         <form method="post" action="opac-shelves.pl">
                         <input type="hidden" name="op" value="delete" />
                         <input type="hidden" name="referer" value="list" />
-                        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html  %]"/>
+                        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
                         <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
                         </form>
                     [% END %]
                                     <legend>Create a new list</legend>
                                     <input type="hidden" name="op" value="add" />
                                 [% ELSE %]
-                                    <legend>Editing <em>[% shelf.shelfname |html %]</em></legend>
+                                    <legend>Editing <em>[% shelf.shelfname | html %]</em></legend>
                                     <input type="hidden" name="op" value="edit" />
                                     <input type="hidden" name="referer" value="[% referer | html %]" />
                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                                 [% END %]
-                                <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber %]" />
+                                <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />
                                 <ol>
                                     <li>
                                         <label class="required" for="shelfname">List name: </label>
-                                        <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname |html %]" /></li>
+                                        <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname | html %]" required="required" class="required"/> <span class="required">Required</span></li>
                                     <li>
                                         <label for="sortfield" >Sort this list by: </label>
                                         <select name="sortfield" id="sortfield">
                                             [% ELSE %]
                                                 <option value="itemcallnumber">Call number</option>
                                             [% END %]
+                                            [% IF shelf.sortfield == "dateadded" %]
+                                                <option value="dateadded" selected="selected">Date added</option>
+                                            [% ELSE %]
+                                                <option value="dateadded">Date added</option>
+                                            [% END %]
                                         </select>
                                     </li>
                                     [% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
                                         <li>
                                             <label for="category">Category:</label>
-                                            <select name="category" id="category">
-                                                [% IF shelf.category == PRIVATE %]
+                                            <select name="category" id="category" onchange="AdjustRemark()">
+                                                [% IF shelf.is_private %]
                                                         <option value="1" selected="selected">Private</option>
                                                     [% ELSE %]
                                                         <option value="1">Private</option>
                                                     [% END %]
-                                                [% IF shelf.category == PUBLIC %]
+                                                [% IF shelf.is_public %]
                                                     <option value="2" selected="selected">Public</option>
                                                 [% ELSE %]
                                                     <option value="2">Public</option>
                                                 [% END %]
                                             </select>
-                                            [% IF shelf.category == PUBLIC AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
+                                            [% IF shelf.is_public AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
                                                 <span class="hint alert alert-info">The library has disabled the ability for patrons to create new public lists.  If you make your list private, you will not be able to make it public again.</span>
                                             [% END %]
                                         </li>
-                                        [% INCLUDE list_permissions %]
                                     [% END %]
+                                    [% INCLUDE list_permissions %]
                                 </ol>
                                 [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
-                                    <input type="hidden" name="category" value="[% PRIVATE %]" />
+                                    <input type="hidden" name="category" value="[% PRIVATE | html %]" />
                                 [% END %]
                             </fieldset>
 
                             <fieldset class="action">
-                                <input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" />
+                                <input type="submit" value="Save" class="btn" />
                                 [% IF referer == 'view' %]
-                                    <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]" class="cancel">Cancel</a>
+                                    <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
                                 [% ELSE %]
-                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]" class="cancel">Cancel</a>
+                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE | uri %]" class="cancel">Cancel</a>
                                  [% END %]
 
                             </fieldset>
                         <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                                 [% IF category == PRIVATE %]
-                                    <li id="privateshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=listamp;category=[% PRIVATE %]">Your lists</a></li>
+                                    <li id="privateshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=listamp;category=[% PRIVATE | html %]">Your lists</a></li>
                                 [% ELSE %]
-                                    <li id="privateshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]">Your lists</a></li>
+                                    <li id="privateshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE | html %]">Your lists</a></li>
                                 [% END %]
                             [% END %]
                             [% IF category == PUBLIC %]
-                                <li id="publicshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a></li>
+                                <li id="publicshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC | html %]">Public lists</a></li>
                             [% ELSE %]
-                                <li id="publicshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a></li>
+                                <li id="publicshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC | html %]">Public lists</a></li>
                             [% END %]
                         </ul>
 
                                         [% FOREACH s IN shelves %]
                                             [% SET contents = s.get_contents %]
                                             <tr>
-                                                <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]">[% s.shelfname |html %]</a></td>
-                                                <td>[% IF contents.count %][% contents.count %] [% IF contents.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
+                                                <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a></td>
+                                                <td>[% IF contents.count %][% contents.count | html %] [% IF contents.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
                                                 <td>
-                                                    [% IF s.category == PRIVATE %]
+                                                    [% IF s.is_private %]
                                                         [% IF s.is_shared %]Shared[% ELSE %]Private[% END %]
                                                     [% ELSE %]
                                                         Public
                                                 <td>
                                                     [% IF s.can_be_managed( loggedinusernumber ) %]
                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
-                                                            <input type="hidden" name="shelfnumber" value="[% s.shelfnumber |html %]" />
-                                                            <input type="hidden" name="category" value="[% s.category %]" />
+                                                            <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
+                                                            <input type="hidden" name="category" value="[% s.category | html %]" />
                                                             <input type="hidden" name="op" value="edit_form" />
                                                             <input type="hidden" name="referer" value="list" />
                                                             <input type="submit" class="editshelf" value="Edit" />
                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="post" class="form-inline">
                                                             <input type="hidden" name="op" value="delete" />
                                                             <input type="hidden" name="referer" value="list" />
-                                                            <input type='hidden' name='category' value='[% category %]' />
+                                                            <input type='hidden' name='category' value='[% category | html %]' />
                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
                                                             <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
                                                         </form>
                                                     [% END %]
-                                                    [% IF s.category == PRIVATE AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
-                                                        <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber |html %]" class="">Share</a>
+                                                    [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
+                                                        <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber | uri %]" class="sharelist">Share</a>
                                                     [% END %]
                                                     [% IF s.is_shared_with( loggedinusernumber ) %]
                                                         <form action="opac-shelves.pl" method="post" class="form-inline">
                                                             <input type="hidden" name="op" value="remove_share" />
                                                             <input type="hidden" name="referer" value="list" />
-                                                            <input type='hidden' name='category' value='[% category %]' />
+                                                            <input type='hidden' name='category' value='[% category | html %]' />
                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
                                                             <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
                                                         </form>
                                         [% END %]
                                     </tbody>
                                 </table>
-                                <div class="pages">[% pagination_bar %]</div>
+                                <div class="pages">[% pagination_bar | $raw %]</div>
                             [% ELSE %]
                                 [% IF category == PUBLIC %]
                                     <p>No public lists.</p>
                                     <p>No private lists.</p>
                                 [% END %]
                             [% END %]
-                            <div> [%# privateshelves or publicshelves %]
+                            </div> [%# privateshelves or publicshelves %]
                             </div> [%# <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all"> %]
                         [% ELSIF NOT loggedinusernumber %]
                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
     <div class="modal-content">
         <div class="modal-body">
             <div style="margin:1em;padding:1em;font-size:150%;">
-                <img src="[% interface %]/[% theme %]/images/loading.gif" /> Loading
+                <img src="[% interface | html %]/[% theme | html %]/images/loading.gif" /> Loading
             </div>
         </div>
     </div>
 
 [% INCLUDE 'opac-bottom.inc' %]
 [% BLOCK jsinclude %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-<script type="text/javascript">
+[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
+<script>
 //<![CDATA[
 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
@@ -935,29 +950,41 @@ $(function() {
     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
+    [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+        KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
+    [% END %]
+
     $('#sort-submit').hide();
 
     [% IF print %]
         window.print();
         setTimeout('window.close()', 1);
     [% END %]
-}); // document.ready
-
-function Check(f) {
-    var _alertString="";
-    var alertString2;
 
-    if(f.addshelf.value.length ==0){
-        _alertString += _("- You must enter a list name") + "\n";
-    }
+    AdjustRemark();
+}); // document.ready
 
-    if (_alertString.length==0) {
-        f.submit();
+function AdjustRemark() {
+    var category;
+    if( $("#category").length > 0 ) {
+        category = $("#category").val();
     } else {
-        alertString2 = _("Form not submitted because of the following problem(s)");
-        alertString2 += "\n------------------------------------------------------------------------------------\n\n";
-        alertString2 += _alertString;
-        alert(alertString2);
+        category = [% category | html %];
+    }
+    var perms = $("#allow_changes_from").val();
+
+    if( perms < 2 ) {
+        $("#anyone_remark").hide();
+    } else if( category==1 ) {
+        // If we move to Private (without shares), show Anyone remark
+        // Note: the number of shares is not tested real-time
+        [% IF !shelf.is_shared %]
+            $("#anyone_remark").show();
+        [% ELSE %]
+            $("#anyone_remark").hide();
+        [% END %]
+    } else { // category==2
+        $("#anyone_remark").hide();
     }
 }
 //]]>