Bug 14257: Follow-up - Add documentation, fix typo, fix test
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-shelves.tt
index b586ac1..ab704ab 100644 (file)
@@ -1,8 +1,11 @@
 [% USE Koha %]
-[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
-[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
+[% 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') ) %]
 
-[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog ›   [% IF ( viewshelf ) %]Contents of [% shelfname |html %][% ELSE %]Your lists[% END %][% INCLUDE 'doc-head-close.inc' %]
+[% 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' %]
 [% BLOCK cssinclude %][% END %]
 </head>
 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-userlists' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-lists' bodyclass='scrollto' %][% END %]
     <li>
         <label for="allow_add">Permissions: </label>
         <select name="allow_add" id="allow_add">
-            [% IF allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
-            [% IF allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
+            [% 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. (The owner of a list is always allowed to add entries, but needs permission to remove.)</span>
+        &nbsp;<span>anyone else to add entries.</span>
     </li>
     <li>
         <label>&nbsp;</label>
         <select name="allow_delete_own" id="allow_delete_own">
-            [% IF allow_delete_own %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
-            [% IF allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
+            [% 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 his own contributed entries.</span>
+        &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 allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
-            [% IF allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
+            [% 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 %]
         </select>
         &nbsp;<span>anyone to remove other contributed entries.</span>
     </li>
 [% END %]
-[% BLOCK remove_share %]
-    [%# Use: add parameter shelfnumber and add end form tag %]
-    <form action="opac-shelves.pl" method="post" class="form-inline">
-        <input type="hidden" name="shelves" value="1" />
-        <input type="hidden" name="display" value="privateshelves" />
-        <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
-[% END %]
 
 [% INCLUDE 'masthead.inc' %]
 <div class="main">
     <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">[% FOREACH USER_INF IN USER_INFO %][% USER_INF.title %] [% USER_INF.firstname %] [% USER_INF.surname %][% END %]</a> <span class="divider">&rsaquo;</span></li>
+            <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>
         [% END %]
 
-        [% IF ( category1 ) %]
-            [% IF ( viewshelf || edit ) %]
-                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
-            [% ELSE %]
-                <li>Your lists</li>
-            [% END %]
-        [% ELSIF ( category2 ) %]
-            [% IF ( viewshelf || edit ) %]
-                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
-            [% ELSE %]
-                <li>Public lists</li>
-            [% END %]
-        [% ELSIF ( showprivateshelves ) %]
-            [% IF ( viewshelf || edit ) %]
-                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
+        [% IF op != 'list' %]
+            <li><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a></li>
+        [% ELSE %]
+            <li>Lists</li>
+        [% END %]
+
+        [% IF shelf and shelf.category == 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>
             [% ELSE %]
-                <li>Your lists</li>
+                <li><span class="divider">&rsaquo;</span> Your lists</li>
             [% END %]
-        [% ELSIF ( showpublicshelves ) %]
-            [% IF ( viewshelf || edit || shelves ) %]
-                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
+        [% ELSIF shelf AND shelf.category == 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>
             [% ELSE %]
-                <li>Public lists</li>
+                <li><span class="divider">&rsaquo;</span> Public lists</li>
             [% END %]
         [% END %]
 
-        [% IF ( viewshelf ) %]
-            <li><span class="divider">&rsaquo;</span> Contents of <i>[% shelfname | html %]</i></li>
+        [% IF op == 'view' %]
+            <li><span class="divider">&rsaquo;</span> Contents of <i>[% shelf.shelfname | html %]</i></li>
         [% END %]
 
-        [% IF ( shelves ) %]
+        [% IF op == 'add_form' %]
             <li><span class="divider">&rsaquo;</span> Create new list</li>
         [% END %]
 
-        [% IF ( edit ) %]
-            <li><span class="divider">&rsaquo;</span> Edit list <i>[% shelfname | html %]</i></li>
+        [% IF op == 'edit_form' %]
+            <li><span class="divider">&rsaquo;</span> Edit list <i>[% shelf.shelfname | html %]</i></li>
         [% END %]
 
     </ul> <!-- / .breadcrumb -->
             [% END %]
                 <div id="usershelves" class="maincontent">
 
-                    [% IF ( paramsloop ) %]
-                        [% FOREACH paramsloo IN paramsloop %]
-                            [% IF ( paramsloo.already ) %]<div class="alert">A list named <b>[% paramsloo.already %]</b> already exists!</div>[% END %]
-                            [% IF ( paramsloo.addshelf_failed ) %]<div class="dialog alert">List could not be created. [% IF loggedinuser==0 %](Do not use the database administrator account.)[% END %]</div>[% END %]
-                            [% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %]
-                            [% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %]
-                            [% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %]
-                            [% IF ( paramsloo.need_confirm ) %]
-                              <div class="alert">
-                                The list <i>[% paramsloo.need_confirm %]</i> is not empty.
-                                <br />It has <b>[% paramsloo.count %]</b> [% IF ( paramsloo.single ) %]entry[% ELSE %]entries[% END %].
-                                <br />Use the "Confirm" button below to confirm deletion.
-                             </div>
-                            [% END %]
-                            [% IF ( paramsloo.nopermission ) %]
-                              <div class="alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission |html%].</div>
-                            [% END %]
-                            [% IF ( paramsloo.failgetitem ) %]
-                              <div class="alert">ERROR: No item found with barcode [% paramsloo.failgetitem %].</div>
-                            [% END %]
-                            [% IF ( paramsloo.duplicatebiblio ) %]
-                              <div class="alert">A record matching barcode <b>[% paramsloo.duplicatebiblio %]</b> has already been added.</div>
-                            [% END %]
-                            [% IF ( paramsloo.delete_ok ) %]
-                              <div class="alert alert-info">List [% paramsloo.delete_ok |html %] Deleted.</div>
-                            [% END %]
-                            [% IF ( paramsloo.delete_fail ) %]
-                              <div class="alert alert-info">ERROR: Database error. Delete (list number [% paramsloo.delete_fail |html %]) failed.</div>
-                            [% END %]
-                            [% IF ( paramsloo.unrecognized ) %]
-                              <div class="alert alert-info">ERROR: List number [% paramsloo.unrecognized %] unrecognized.</div>
-                            [% END %]
-                            [% IF ( paramsloo.modifyfailure) %]
-                              <div class="alert alert-info">ERROR: Shelf could not be renamed to [% paramsloo.modifyfailure %]. This name may not be unique for this type of list. Please check.</div>
-                            [% END %]
-                            [% IF ( paramsloo.nothingdeleted) %]
-                              <div class="alert alert-info">Warning: You could not delete any selected items from this shelf.</div>
-                            [% END %]
-                            [% IF ( paramsloo.somedeleted) %]
-                              <div class="alert alert-info">Warning: You could not delete all selected items from this shelf.</div>
-                            [% END %]
-                        [% END # / FOREACH paramsloop %]
-                    [% END # / IF paramsloop %]
+                [% FOR m IN messages %]
+                    [% SWITCH m.type %]
+                        [% CASE 'message' %]
+                            <div class="alert alert-success" role="alert">
+                        [% CASE 'error' %]
+                            <div class="alert alert-danger" role="alert">
+                    [% END %]
+                    [% SWITCH m.code %]
+                    [% CASE 'error_on_update' %]
+                        <span>An error occurred when updating this list.</span>
+                    [% CASE 'error_on_insert' %]
+                        <span>An error occurred when creating this list.</span>
+                    [% CASE 'error_on_delete' %]
+                        <span>An error occurred when deleting this list.</span>
+                    [% CASE 'error_on_add_biblio' %]
+                        <span>The item has not been added to the list. Please check it's not already in the list.</span>
+                    [% CASE 'error_on_remove_share' %]
+                        <span>The share has not been removed.</span>
+                    [% CASE 'success_on_update' %]
+                        <span>List updated.</span>
+                    [% CASE 'success_on_insert' %]
+                        <span>List created.</span>
+                    [% CASE 'success_on_delete' %]
+                        <span>List deleted.</span>
+                    [% CASE 'success_on_add_biblio' %]
+                        <span>The item has been added to the list.</span>
+                    [% CASE 'success_on_remove_biblios' %]
+                        <span>The item has been removed from the list.</span>
+                    [% CASE 'success_on_remove_share' %]
+                        <span>The share has been removed.</span>
+                    [% CASE 'does_not_exist' %]
+                        <span>This list does not exist.</span>
+                    [% CASE 'item_does_not_exist' %]
+                        <span>This item does not exist.</span>
+                    [% CASE 'unauthorized_on_view' %]
+                        <span>You do not have permission to view this list.</span>
+                    [% CASE 'unauthorized_on_insert' %]
+                        <span>You do not have permission to create a new list.</span>
+                    [% CASE 'unauthorized_on_update' %]
+                        <span>You do not have permission to update this list.</span>
+                    [% CASE 'unauthorized_on_delete' %]
+                        <span>You do not have permission to delete this list.</span>
+                    [% CASE 'unauthorized_on_add_biblio' %]
+                        <span>You do not have permission to add a record to this list.</span>
+                    [% 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>
+                    [% CASE 'DBIx::Class::Exception' %]
+                        [% m.msg %]
+                    [% CASE %]
+                        [% m.code %]
+                        [% m.msg %]
+                    [% END %]
+                    </div>
+                [% END %]
 
-                    [% IF ( viewshelf ) %]<!--  Viewing a particular shelf -->
+                    [% IF op == 'view' %]
                         <h3>
-                            [% shelfname |html %]
-                            <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;viewshelf=[% shelfnumber %]" class="rss-list-link noprint">
+                            [% 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"/>
                             </a>
                         </h3>
                         [% IF ( itemsloop ) %]
                             <div id="toolbar" class="toolbar clearfix">
                                 <div class="list-actions">
-                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a> <span class="sep">|</span>
-                                    <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfid=[% shelfnumber | html %]&amp;showprivateshelves=[% showprivateshelves | html %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
+                                    <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>
 
                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
-                                        <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% 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 | 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>
                                     [% END %]
 
-                                    <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfnumber %]&sort=[% sort %]&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 %]&sortfield=[% sortfield %]&direction=[% direction |uri %]&print=1">Print list</a>
 
-                                    [% IF ( manageshelf ) %]
+                                    [% 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="modif" />
-                                            <input type="hidden" name="display" value="viewshelf" />
-                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
+                                            <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="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" value="1" name="shelves"/>
-                                            <input type="hidden" value="1" name="DEL-[% shelfnumber | html %]"/>
-                                            [% IF ( showprivateshelves ) %]
-                                                <input type="hidden" name="display" value="privateshelves"/>
-                                            [% END %]
+                                            <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="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                                             <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
                                         </form>
-                                        [% IF showprivateshelves && Koha.Preference('OpacAllowSharingPrivateLists') %]
-                                            <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelfnumber | html %]" class="">Share list</a>
+                                        [% IF category == PRIVATE && Koha.Preference('OpacAllowSharingPrivateLists') %]
+                                            <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelf.shelfnumber | html %]" class="">Share list</a>
                                         [% END %]
-                                    [% ELSIF showprivateshelves # not manageshelf and private means shared %]
-                                        [% INCLUDE remove_share %]
-                                            <input type="hidden" name="REMSHR-[% shelfnumber | html %]" value="1" />
+                                    [% 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="shelfnumber" value="[% shelf.shelfnumber | html %]" />
+                                            <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
                                         </form>
-                                    [% END # / IF manageshelf %]
+                                    [% END %]
                                 </div>
 
                                 <form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form" class="form-inline sort_by pull-right">
-                                    <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" />
+                                    <input type="hidden" name="op" value="view" />
+                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
 
-                                    <label for="sort">Sort by: </label>
-                                    <select name="sort" id="sort" class="resort" onchange="$('#sorting-form').submit()">
+                                    <label for="sortfield">Sort by: </label>
+                                    <select name="sortfield" id="sortfield" class="resort" onchange="$('#sorting-form').submit()">
                                         <option value="">Default sorting</option>
 
-                                        [% IF sort == 'author' %]
+                                        [% IF sortfield == 'author' %]
                                             <option value="author" selected="selected">Author</option>
                                         [% ELSE %]
                                             <option value="author">Author</option>
                                         [% END %]
 
-                                        [% IF sort == 'title' %]
+                                        [% IF sortfield == 'title' %]
                                             <option value="title" selected="selected">Title</option>
                                         [% ELSE %]
                                             <option value="title">Title</option>
                                         [% END %]
 
-                                        [% IF sort == 'itemcallnumber' %]
+                                        [% IF sortfield == 'itemcallnumber' %]
                                             <option value="itemcallnumber" selected="selected">Call number</option>
                                         [% ELSE %]
                                             <option value="itemcallnumber">Call number</option>
                                         [% END %]
 
-                                        [% IF sort == 'copyrightdate' %]
+                                        [% IF sortfield == 'copyrightdate' %]
                                             <option value="copyrightdate" selected="selected">Copyright date</option>
                                         [% ELSE %]
                                             <option value="copyrightdate">Copyright date</option>
                                           <a href="#" id="tagsel_cancel">Cancel</a>
                                         </span>
                                     [% END %]
-                                    [% IF ( loggedinusername && allowremovingitems ) %]
+                                    [% IF loggedinusername && can_remove_biblios %]
                                         <span id="removeitems"></span>
                                     [% END %]
                                 </span> <!-- / .links -->
                             </div> <!-- / #selections-toolbar -->
 
                             <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform" class="checkboxed">
-                                [% IF ( manageshelf ) %]
-                                    <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" />
-                                    <input type="hidden" name="modifyshelfcontents" value="1" />
+                                [% IF can_manage_shelf %]
+                                    <input type="hidden" name="op" value="remove_biblios" />
+                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                                 [% END %]
                                 <div class="searchresults">
                                     <table id="listcontents" class="table">
                                         <tbody>
                                         [% FOREACH itemsloo IN itemsloop %]
                                             <tr>
-                                                <td class="select selectcol"><input type="checkbox" class="cb" name="REM-[% itemsloo.biblionumber %]" value="[% itemsloo.biblionumber %]" /></td>
+                                                <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber %]" /></td>
                                                 [% UNLESS ( item_level_itypes ) %]
                                                     <td>
                                                         [% UNLESS ( noItemTypeImages ) %]
 
                                                             [% IF ( OPACAmazonCoverImages ) %]
                                                                 [% IF ( itemsloo.normalized_isbn ) %]
-                                                                    <span title="[% SEARCH_RESULT.biblionumber %]" id="amazon-thumbnail[% loop.count %]"><img src="http://images.amazon.com/images/P/[% itemsloo.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" /></span>
+                                                                    <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>
                                                                 [% ELSE %]
                                                                     <span class="no-image">No cover image available</span>
                                                                 [% END %]
 
                                                         </a> <!-- / .p1 -->
                                                         [% IF ( BakerTaylorEnabled ) %]
-                                                            [% IF ( itemsloo.normalized_isbn ) %]
-                                                                <a href="https://[% BakerTaylorBookstoreURL |html %][% itemsloo.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% itemsloo.normalized_isbn %]" /></a>
+                                                            [% 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>
                                                             [% ELSE %]
                                                                 <span class="no-image">No cover image available</span>
                                                             [% END %]
                                                             <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>
                                                         [% END %]
 
-                                                        [% IF ( allowremovingitems ) %]
-                                                            <span class="actions"><a class="removefromlist hidden" id="REM-[% itemsloo.biblionumber %]" href="#">Remove from this list</a></span>
+                                                        [% 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>
                                                         [% END %]
 
                                                         [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
                         [% ELSE %]
                             <div id="toolbar" class="toolbar clearfix">
                                 <div class="list-actions">
-                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a> <span class="sep"></span>
-                                    [% IF ( manageshelf ) %]
+                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a> <span class="sep"></span>
+                                    [% 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="modif" />
-                                            <input type="hidden" name="display" value="viewshelf" />
-                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
+                                            <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="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" value="1" name="shelves"/>
-                                            <input type="hidden" value="1" name="DEL-[% shelfnumber | html  %]"/>
-                                            [% IF ( showprivateshelves ) %]
-                                                <input type="hidden" name="display" value="privateshelves"/>
-                                            [% END %]
+                                            <input type="hidden" name="op" value="delete" />
+                                            <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 # / IF manageshelf %]
+                                    [% END %]
                                 </div> <!-- / .list-actions -->
                             </div> <!-- / #toolbar -->
 
                                 [% END %]
                             </div>
                         [% END # / IF itemsloop %]
-                    [% END # / IF viewshelf %]
+                    [% END %]
 
-                    [% IF ( itemsloop && allowremovingitems ) %]
-                        <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
+                    [% IF itemsloop && can_remove_biblios %]
+                        <input type="hidden" name="op" value="remove_biblios" />
+                        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
                         <input type="hidden" name="modifyshelfcontents" value="1" />
-                        <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" /><input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
+                        <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
                         </form>
-                    [% ELSIF ( !itemsloop && manageshelf ) %]
+                    [% ELSIF !itemsloop && can_manage_shelf %]
                         <form method="post" action="opac-shelves.pl">
-                        <input type="hidden" name="DEL-[% shelfnumber | html %]" value="1" />
-                        <input type="hidden" name="shelves" value="1" />
-                        <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
+                        <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="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
                         </form>
                     [% END %]
 
-                    [% IF ( edit ) %]
+                    [% IF op == 'add_form' OR op == 'edit_form' %]
                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
-                            <input type="hidden" name="op" value="modifsave" />
-                            <input type="hidden" name="display" value="[% display %]" />
-                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
                             <fieldset class="rows">
-                                <legend>Editing <em>[% shelfname |html %]</em></legend>
+                                [% IF op == 'add_form' %]
+                                    <div id="addshelf">
+                                    <legend>Create a new list</legend>
+                                    <input type="hidden" name="op" value="add" />
+                                [% ELSE %]
+                                    <legend>Editing <em>[% shelf.shelfname |html %]</em></legend>
+                                    <input type="hidden" name="op" value="edit" />
+                                    <input type="hidden" name="referer" value="[% referer %]" />
+                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
+                                [% END %]
+                                <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber %]" />
                                 <ol>
-                                    <li><label for="shelfname">List name: </label><input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelfname |html %]" /></li>
+                                    <li>
+                                        <label class="required" for="shelfname">List name: </label>
+                                        <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname |html %]" /></li>
                                     <li>
                                         <label for="sortfield" >Sort this list by: </label>
                                         <select name="sortfield" id="sortfield">
-                                            [% IF ( sortfield == "title" ) %]
+                                            [% IF shelf.sortfield == "title" %]
                                                 <option value="title" selected="selected">Title</option>
                                             [% ELSE %]
                                                 <option value="title">Title</option>
                                             [% END %]
-                                            [% IF ( sortfield == "author" ) %]
+                                            [% IF shelf.sortfield == "author" %]
                                                 <option value="author" selected="selected">Author</option>
                                             [% ELSE %]
                                                 <option value="author">Author</option>
                                             [% END %]
-                                            [% IF ( sortfield == "copyrightdate" ) %]
+                                            [% IF shelf.sortfield == "copyrightdate" %]
                                                 <option value="copyrightdate" selected="selected">Year</option>
                                             [% ELSE %]
                                                 <option value="copyrightdate">Year</option>
                                             [% END %]
-                                            [% IF ( sortfield == "itemcallnumber" ) %]
+                                            [% IF shelf.sortfield == "itemcallnumber" %]
                                                 <option value="itemcallnumber" selected="selected">Call number</option>
                                             [% ELSE %]
                                                 <option value="itemcallnumber">Call number</option>
                                             [% END %]
                                         </select>
                                     </li>
-                                    [% IF ( OpacAllowPublicListCreation || category2 ) %]
+                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
                                         <li>
                                             <label for="category">Category:</label>
                                             <select name="category" id="category">
-                                                [% IF ( category1 ) %]
+                                                [% IF shelf.category == PRIVATE %]
                                                         <option value="1" selected="selected">Private</option>
                                                     [% ELSE %]
                                                         <option value="1">Private</option>
                                                     [% END %]
-                                                [% IF ( category2 ) %]
+                                                [% IF shelf.category == PUBLIC %]
                                                     <option value="2" selected="selected">Public</option>
                                                 [% ELSE %]
                                                     <option value="2">Public</option>
                                                 [% END %]
                                             </select>
-                                            [% IF ( category2 && !OpacAllowPublicListCreation ) %]
+                                            [% IF shelf.category == 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 %]
                                 </ol>
-                                [% UNLESS ( OpacAllowPublicListCreation || category2 ) %]
-                                    <input type="hidden" name="category" value="1" />
+                                [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
+                                    <input type="hidden" name="category" value="[% PRIVATE %]" />
                                 [% END %]
                             </fieldset>
 
                             <fieldset class="action">
-                                <input type="submit" value="Save" class="btn" />
-                                [% IF ( showprivateshelves ) %]
-                                    <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber | html %]&amp;display=privateshelves">Cancel</a>
+                                <input type="submit" onclick="Check(this.form); return false;" 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>
                                 [% ELSE %]
-                                    <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber | html %]">Cancel</a>
-                                [% END %]
+                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]" class="cancel">Cancel</a>
+                                 [% END %]
+
                             </fieldset>
                         </form>
-                    [% END # / IF edit %]
 
+                    [% ELSIF op == 'list' %]
+                        <h2>Lists</h2>
+                        <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
+                        <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>
+                                [% 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>
+                                [% 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>
+                            [% 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>
+                            [% END %]
+                        </ul>
 
-                    [% UNLESS ( edit ) %]
-                        [% UNLESS ( viewshelf ) %]
-                            [% UNLESS ( shelves ) %]
-                                <h2>Lists</h2>
-                                <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
-                                <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
-                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
-                                        [% IF ( showprivateshelves ) %]
-                                            <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?display=privateshelves">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?display=privateshelves">Your lists</a></li>
-                                        [% END %]
-                                    [% END %]
-                                    [% IF ( showpublicshelves ) %]
-                                        <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?display=publicshelves">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?display=publicshelves">Public lists</a></li>
-                                    [% END %]
-                                </ul>
-
-                                [% IF ( showprivateshelves ) %]
-                                        <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
-
-                                        [% IF ( loggedinusername ) %]
-                                            <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a></div>
-                                            [% IF ( showprivateshelves ) %]
-                                                [% IF ( shelveslooppriv ) %]
-                                                    <table class="table">
-                                                        <thead>
-                                                            <tr>
-                                                                <th>List name</th>
-                                                                <th>Contents</th>
-                                                                <th>Type</th>
-                                                                <th>&nbsp;</th>
-                                                            </tr>
-                                                        </thead>
-                                                        <tbody>
-                                                            [% FOREACH shelveslooppri IN shelveslooppriv %]
-                                                                <tr>
-                                                                    <td><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves&amp;viewshelf=[% shelveslooppri.shelf %]&amp;sortfield=[% shelveslooppri.sortfield %]">[% shelveslooppri.shelfname |html %]</a></td>
-                                                                    <td>[% IF ( shelveslooppri.count ) %][% shelveslooppri.count %] [% IF ( shelveslooppri.single ) %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
-                                                                    <td>
-                                                                        [% IF ( shelveslooppri.viewcategory1 ) %][% IF !shelveslooppri.shares %]Private[% ELSE %]Shared[% END %][% END %]
-                                                                    </td>
-                                                                    <td>
-                                                                        [% IF ( shelveslooppri.mine ) %]
-                                                                        <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
-                                                                            <input type="hidden" name="shelfnumber" value="[% shelveslooppri.shelf |html %]" />
-                                                                            <input type="hidden" name="display" value="privateshelves" />
-                                                                            <input type="hidden" name="op" value="modif" />
-                                                                            <input type="submit" class="editshelf" value="Edit" />
-                                                                        </form>
-                                                                        <form action="opac-shelves.pl" method="post" class="form-inline">
-                                                                            <input type="hidden" name="shelves" value="1" />
-                                                                            <input type="hidden" name="display" value="privateshelves" />
-                                                                            <input type="hidden" name="DEL-[% shelveslooppri.shelf |html %]" value="1" />
-                                                                            <input type="hidden" name="shelfoff" value="[% shelfoff |html %]" />
-                                                                            [% IF ( shelveslooppri.confirm ) %]
-                                                                                <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm |html %]" value="1" />
-                                                                                <input type="submit" class="btn btn-danger confirm" value="Confirm" />
-                                                                            [% ELSE %]
-                                                                                <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
-                                                                            [% END %]
-                                                                        </form>
-                                                                            [% IF Koha.Preference('OpacAllowSharingPrivateLists') %]
-                                                                                <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelveslooppri.shelf |html %]" class="">Share</a>
-                                                                            [% END %]
-                                                                        [% ELSE # not shelveslooppri.mine, so shared %]
-                                                                            [% INCLUDE remove_share  # if pref is off, you should still be able to remove shares %]
-                                                                            <input type="hidden" name="shelfoff" value="[% shelfoff |html %]" />
-                                                                            <input type="hidden" name="REMSHR-[% shelveslooppri.shelf |html %]" value="1" />
-                                                                            </form>
-                                                                        [% END %]&nbsp;
-                                                                    </td>
-                                                                </tr>
-                                                            [% END # / FOREACH shelveslooppri %]
-                                                        </tbody>
-                                                    </table>
-                                                    <div class="pages">[% pagination_bar %]</div>
-                                                [% ELSE %]
-                                                    <p>No private lists.</p>
-                                                [% END # / IF shelveslooppriv %]
-                                            [% END # / IF showprivateshelves %]
-                                        [% ELSE %]
-                                            [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
-                                                <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
-                                            [% END %]
-                                        [% END  # IF loggedinusername %]
-                                    </div><!-- / #privateshelves -->
-                                [% END # / IF showprivateshelves %]
-                                [% IF ( showpublicshelves ) %]
-                                    <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
-
-                                    [% IF ( loggedinusername ) %]
-                                        <div id="toolbar" class="toolbar"> <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a></div>
-                                    [% ELSE %]
-                                        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
-                                            <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
-                                        [% END %]
-                                    [% END # / IF loggedinusername %]
-
-                                    [% IF ( shelvesloop ) %]
-                                        <table class="table">
-                                            <thead>
-                                                <tr>
-                                                    <th>List name</th>
-                                                    <th>Contents</th>
-                                                    <th>Type</th><th>&nbsp;</th>
-                                                </tr>
-                                            </thead>
-                                            <tbody>
-                                                [% FOREACH shelvesloo IN shelvesloop %]
-                                                    <tr>
-                                                        <td><a class="title" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelvesloo.shelf %]&amp;sortfield=[% shelvesloo.sortfield %]">[% shelvesloo.shelfname |html %]</a></td>
-                                                        <td>[% shelvesloo.count %] [% IF ( shelvesloo.single ) %]item[% ELSE %]item(s)[% END %]</td>
-                                                        <td>
-                                                            [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
-                                                        </td>
-                                                        <td>
-                                                            [% IF ( shelvesloo.mine ) %]
-                                                                <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
-                                                                    <input type="hidden" name="shelfnumber" value="[% shelvesloo.shelf %]" />
-                                                                    <input type="hidden" name="op" value="modif" />
-                                                                    <input type="hidden" name="display" value="publicshelves" />
-                                                                    <input type="submit" class="editshelf" value="Edit" />
-                                                                </form>
-                                                                <form action="opac-shelves.pl" method="post" class="form-inline">
-                                                                    <input type="hidden" name="shelves" value="1" />
-                                                                    <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
-                                                                    [% IF ( shelvesloo.confirm ) %]
-                                                                        <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
-                                                                        <input type="submit" class="btn btn-danger confirm" value="Confirm" />
-                                                                    [% ELSE %]
-                                                                        <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
-                                                                    [% END %]
-                                                                </form>
-                                                            [% END %]&nbsp;
-                                                        </td>
-                                                    </tr>
-                                                [% END # / FOREACH shelvesloop %]
-                                            </tbody>
-                                        </table>
-                                        [% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
-                                    [% ELSE %]
-                                        [% IF ( showpublicshelves ) %]<p>No public lists.</p>[% END %]
-                                    [% END # / IF shelvesloop %]
-
-                                    </div><!-- / # publicshelves -->
-                                [% END # / IF showprivateshelves %]
-                                </div> <!-- / .ui-tabs-panel -->
-                            [% END # / UNLESS shelves %]
-                        [% END # / UNLESS viewshelf %]
-                    [% END # / UNLESS edit %]
-
-                    [% IF ( shelves ) %]
-                        <div id="addshelf">
-                            <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
-                                <fieldset class="rows">
-                                    <legend>Create a new list</legend>
-                                    <input type="hidden" name="shelves" value="1" />
-                                    <ol>
-                                        <li>
-                                            <label class="required" for="addshelf">List name:</label>
-                                            [% IF ( already ) %]
-                                              <input id="addshelf" type="text" name="addshelf" value="[% already %]" maxlength="255" class="input-fluid" />
-                                            [% ELSE %]
-                                              <input id="addshelf" type="text" name="addshelf" maxlength="255" class="input-fluid" />
-                                            [% END %]
-                                            <input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />
-                                        </li>
-                                        <li>
-                                            <label for="sortfield" >Sort this list by: </label>
-                                            <select name="sortfield" id="sortfield">
-                                              <option value="title">Title</option>
-                                              <option value="author">Author</option>
-                                              <option value="copyrightdate">Year</option>
-                                              <option value="itemcallnumber">Call number</option>
-                                            </select>
-                                        </li>
-                                        [% IF (OpacAllowPublicListCreation) %]
-                                            <li>
-                                                <label for="category">Category:</label>
-                                                <select name="category" id="category">
-                                                    <option value="1">Private</option>
-                                                    <option value="2">Public</option>
-                                                </select>
-                                            </li>
-                                            [% INCLUDE list_permissions %]
-                                        [% END %]
-                                    </ol>
-                                    [% UNLESS (OpacAllowPublicListCreation) %]
-                                        <input type="hidden" name="category" value="1" />
-                                    [% END %]
-                                </fieldset>
-                                <fieldset class="action">
-                                    <input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" />
-                                    <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl">Cancel</a>
-                                </fieldset>
-                            </form>
-                        </div> <!-- / #addshelf -->
-                    [% END # / IF shelves %]
+                        [% IF category == PRIVATE %]
+                            <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
+                        [% ELSE %]
+                            <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
+                        [% END %]
 
+                            [% IF loggedinusername %]
+                                <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a></div>
+                            [% ELSE %]
+                                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
+                                    <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
+                                [% END %]
+                            [% END %]
+
+                            [% IF shelves.count %]
+                                <table class="table">
+                                    <thead>
+                                        <tr>
+                                            <th>List name</th>
+                                            <th>Contents</th>
+                                            <th>Type</th>
+                                            <th>&nbsp;</th>
+                                        </tr>
+                                    </thead>
+                                    <tbody>
+                                        [% 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>
+                                                    [% IF s.category == PRIVATE %]
+                                                        [% IF s.is_shared %]Shared[% ELSE %]Private[% END %]
+                                                    [% ELSE %]
+                                                        Public
+                                                    [% END %]
+                                                </td>
+                                                <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="op" value="edit_form" />
+                                                            <input type="hidden" name="referer" value="list" />
+                                                            <input type="submit" class="editshelf" value="Edit" />
+                                                        </form>
+                                                    [% END %]
+                                                    [% IF s.can_be_deleted( loggedinusernumber ) %]
+                                                        <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="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>
+                                                    [% 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="shelfnumber" value="[% s.shelfnumber | html %]" />
+                                                            <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
+                                                        </form>
+                                                    [% END %]&nbsp;
+                                                </td>
+                                            </tr>
+                                        [% END %]
+                                    </tbody>
+                                </table>
+                                <div class="pages">[% pagination_bar %]</div>
+                            [% ELSE %]
+                                [% IF category == PUBLIC %]
+                                    <p>No public lists.</p>
+                                [% ELSIF loggedinusernumber %]
+                                    <p>No private lists.</p>
+                                [% END %]
+                            [% END %]
+                            <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="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
+                            [% END %]
+                        [% END  # IF loggedinusername %]
                 </div> <!-- / #usershelves -->
                 </div> <!-- / .span10/12 -->
       </div> <!-- / .row-fluid -->
@@ -843,9 +764,7 @@ var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
         } else {
             var bibs = "";
             $(checkedBoxes).each(function(){
-                var name = $(this).attr("name");
-                bib = name.substr(4);
-                bibs += bib + "/";
+                bibs += $(this).val() + "/";
             });
             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
         }
@@ -921,7 +840,7 @@ $(function() {
         });
     [% END %]
 
-    // If JS is enabled add paramter to download link
+    // If JS is enabled add parameter to download link
     var dialoglink = $(".download").attr("href");
     dialoglink += "&context=modal";
     $(".download").attr("href",dialoglink);
@@ -988,15 +907,9 @@ $(function() {
         });
     [% END %]
 
-    [% IF ( loggedinusername && allowremovingitems ) %]
-        var removeFromListLinks = $(".removefromlist");
-        removeFromListLinks.removeClass("hidden");
-        // "remove from list" appearing on each line of the list output
-        removeFromListLinks.on("click",function(){
-            $(".checkboxed").unCheckCheckboxes();
-            var listitem = $("input[name="+this.id+"]");
-            listitem.prop("checked",true);
-            $("#myform").submit();
+    [% IF loggedinusername && can_remove_biblios %]
+        $(".removefromlist").on("click", function(e){
+            return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
         });
 
         $("#myform").submit(function(){