Bug 12162 - Add class="branchcode" to body tag to make OPAC CSS-styleable per branch
[srvgit] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-shelves.tt
index cfce27b..f39b2c5 100644 (file)
@@ -5,11 +5,11 @@
 [% 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' %]
 [% BLOCK cssinclude %][% END %]
 </head>
-[% IF ( loggedinusername ) %]<body id="opac-userlists" class="scrollto">[% ELSE %]<body id="opac-lists" class="scrollto">[% END %]
+[% 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="permissions">Permissions: </label>
+        <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 %]
         &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">
@@ -49,7 +56,7 @@
                 <li>Your lists</li>
             [% END %]
         [% ELSIF ( category2 ) %]
-            [% IF ( viewshelf ) %]
+            [% IF ( viewshelf || edit ) %]
                 <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
             [% ELSE %]
                 <li>Public lists</li>
@@ -61,7 +68,7 @@
                 <li>Your lists</li>
             [% END %]
         [% ELSIF ( showpublicshelves ) %]
-            [% IF ( viewshelf || edit ) %]
+            [% IF ( viewshelf || edit || shelves ) %]
                 <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
             [% ELSE %]
                 <li>Public lists</li>
                     [% 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 %]
                             <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 %]" class="download" onclick="open(CGIBIN+'opac-downloadshelf.pl?shelfid=[% shelfnumber %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false;">Download list</a>
+                                    <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfid=[% shelfnumber %]&amp;showprivateshelves=[% showprivateshelves %]" 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 %]" class="send" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=[% shelfnumber %]','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=[% shelfnumber %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber %]','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" href="/cgi-bin/koha/opac-shelves.pl" onclick="print(); return false;">Print list</a>
                                             [% END %]
                                             <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 %]" class="">Share list</a>
+                                        [% END %]
+                                    [% ELSIF showprivateshelves # not manageshelf and private means shared %]
+                                        [% INCLUDE remove_share %]
+                                            <input type="hidden" name="REMSHR-[% shelfnumber %]" value="1" />
+                                        </form>
                                     [% END # / IF manageshelf %]
                                 </div>
 
                             [% END %]
 
                         [% 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 ) %]
+                                        <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 %]" />
+                                            <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 %]"/>
+                                            [% IF ( showprivateshelves ) %]
+                                                <input type="hidden" name="display" value="privateshelves"/>
+                                            [% END %]
+                                            <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
+                                        </form>
+                                    [% END # / IF manageshelf %]
+                                </div> <!-- / .list-actions -->
+                            </div> <!-- / #toolbar -->
+
                             <div class="alert alert-info">
                                 This list is empty.
                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                     [% END %]
 
                     [% IF ( edit ) %]
-                        <h3><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> &#8674; <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfnumber %]"><em>[% shelfname |html %]</em></a> &#8674; Editing</h3>
                         <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 %]" />
                             <fieldset class="rows">
+                                <legend>Editing <em>[% shelfname |html %]</em></legend>
                                 <ol>
                                     <li><label for="shelfname">List name: </label><input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelfname |html %]" /></li>
                                     <li>
                                             [% END %]
                                         </select>
                                     </li>
-                                    <li>
-                                        [% IF (OpacAllowPublicListCreation) %]
+                                    [% IF ( OpacAllowPublicListCreation || category2 ) %]
+                                        <li>
                                             <label for="category">Category:</label>
                                             <select name="category" id="category">
                                                 [% IF ( category1 ) %]
                                                     <option value="2">Public</option>
                                                 [% END %]
                                             </select>
-                                        [% END %]
-                                    </li>
-                                    [% INCLUDE list_permissions %]
+                                            [% IF ( category2 && !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" />
+                                [% END %]
                             </fieldset>
 
                             <fieldset class="action">
-                                <input type="submit" value="Save" class="submit" />
+                                <input type="submit" value="Save" class="btn" />
                                 [% IF ( showprivateshelves ) %]
                                     <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber %]&amp;display=privateshelves">Cancel</a>
                                 [% ELSE %]
                                 <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 private 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?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 private 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?display=privateshelves">Your lists</a></li>
                                         [% END %]
                                     [% END %]
                                     [% IF ( showpublicshelves ) %]
                                                                     <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 ) %]Private[% END %]
-                                                                        [% IF ( shelveslooppri.viewcategory2 ) %]Public[% END %]
+                                                                        [% IF ( shelveslooppri.viewcategory1 ) %][% IF !shelveslooppri.shares %]Private[% ELSE %]Shared[% END %][% END %]
                                                                     </td>
                                                                     <td>
                                                                         [% IF ( shelveslooppri.mine ) %]
                                                                                 <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 %]" 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 %]" />
+                                                                            <input type="hidden" name="REMSHR-[% shelveslooppri.shelf %]" value="1" />
+                                                                            </form>
                                                                         [% END %]&nbsp;
                                                                     </td>
                                                                 </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.viewcategory1 ) %]Private[% END %]
                                                             [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
                                                         </td>
                                                         <td>
                                               <option value="itemcallnumber">Call number</option>
                                             </select>
                                         </li>
-                                        <li>
-                                        <label for="category">Category:</label>
-                                            <select name="category" id="category">
-                                                <option value="1">Private</option>
-                                                [% IF (OpacAllowPublicListCreation) %]
+                                        [% IF (OpacAllowPublicListCreation) %]
+                                            <li>
+                                                <label for="category">Category:</label>
+                                                <select name="category" id="category">
+                                                    <option value="1">Private</option>
                                                     <option value="2">Public</option>
-                                                [% END %]
-                                            </select>
-                                        </li>
-                                        [% INCLUDE list_permissions %]
+                                                </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" />
     </div> <!-- / .container-fluid -->
   </div> <!-- / .main -->
 
+<div class="modal hide" id="modalWin" role="dialog" aria-hidden="true" tabindex="-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
+            </div>
+        </div>
+    </div>
+</div>
+
 <!-- DEBUG -->
     <div id="debug"></div>
 <!-- /DEBUG -->
 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?");
 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
+var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
 
 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
     function holdSelections() {
@@ -850,6 +915,11 @@ $(function() {
         });
     [% END %]
 
+    // If JS is enabled add paramter to download link
+    var dialoglink = $(".download").attr("href");
+    dialoglink += "&context=modal";
+    $(".download").attr("href",dialoglink);
+
     $("#CheckAll").click(function(){
         $(".checkboxed").checkCheckboxes();
         enableCheckboxActions();