Bug 23852: Merge biblio-title.inc and biblio-default-view.inc
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / addbooks.tt
blobcf82814234552a736f8cc302ea6228cc2f579dee
1 [% USE raw %]
2 [% USE Koha %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Cataloging</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
9 <body id="cat_addbooks" class="cat">
10     [% INCLUDE 'header.inc' %]
11     [% INCLUDE 'cataloging-search.inc' %]
13     <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Cataloging</div>
15     <div class="main container-fluid">
16         <div class="row">
17             <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
19                 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
20                     <div id="toolbar" class="btn-toolbar">
21                         [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %]
22                             <a id="useadvanced" href="/cgi-bin/koha/cataloguing/editor.pl" class="btn btn-default"><i class="fa fa-pencil"></i> Advanced editor</a>
23                         [% END %]
24                         <div class="btn-group">
25                             <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New record <span class="caret"></span></button>
26                             <ul class="dropdown-menu">
27                                 <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=">Default framework</a></li>
28                                 [% FOREACH framework IN frameworks %]
29                                     <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% framework.frameworktext | html %]</a></li>
30                                 [% END %]
31                             </ul>
32                         </div>
33                         [% IF servers.count > 0 %]
34                             <div class="btn-group">
35                                 <button class="btn btn-default" id="z3950search"><i class="fa fa-search"></i> New from Z39.50/SRU</button>
36                                 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
37                                     <span class="caret"></span>
38                                 </button>
39                                 <ul class="dropdown-menu">
40                                     <li id="Default" class="z3950searchFw"><a href="#">Default framework</a></li>
41                                     [% FOREACH framework IN frameworks %]
42                                         <li id="[% framework.frameworkcode | html %]" class="z3950searchFw"><a href="#">[% framework.frameworktext | html %]</a></li>
43                                     [% END %]
44                                 </ul>
45                             </div>
46                         [% END # /IF servers.count %]
47                         [% IF ( total ) %]
48                             <div class="btn-group"><button type="submit" class="btn btn-default merge-items"><i class="fa fa-compress"></i> Merge selected</button></div>
49                         [% END %]
50                     </div> <!-- /#toolbar -->
51                 [% END # /IF CAN_user_editcatalogue_edit_catalogue %]
53                 [% IF ( noitemsfound ) %]
54                     No results found
55                 [% END %]
57                 [%# display the search results %]
59                 [% IF ( total ) %]
60                     <div>
61                         [% total | html %] result(s) found in catalog,
62                         <a href="#searchresult-breeding">[% breeding_count | html %] result(s) found in reservoir</a>
63                     </div>
64                     <div class="pages">[% pagination_bar | $raw %]</div>
65                     <div class="searchresults">
66                         <table>
67                             <tr>
68                                 <th>&nbsp;</th>
69                                 <th>Title</th>
70                                 <th>Location</th>
71                                 <th>&nbsp;</th>
72                             </tr>
73                             [% FOREACH resultsloo IN resultsloop %]
74                                 <tr>
75                                     <td><input type="checkbox" class="selection" id="bib[% resultsloo.biblionumber | html %]" name="biblionumber" value="[% resultsloo.biblionumber | html %]" /></td>
76                                     <td>
77                                         <p>
78                                             [% INCLUDE 'biblio-title.inc' biblio=resultsloo link = 1 %]
79                                         </p>
80                                         [% IF ( resultsloo.summary ) %]
81                                             <p>[% resultsloo.summary | html %]</p>
82                                         [% ELSE %]
83                                             <p>
84                                                 [% IF ( resultsloo.author ) %]
85                                                     [% resultsloo.author | html %]
86                                                 [% ELSE %]
87                                                     &nbsp;
88                                                 [% END %]
89                                                 [% IF ( resultsloo.isbn ) %] - [% resultsloo.isbn | html %] [% END %]
90                                                 [% IF ( resultsloo.publicationyear ) %] - [% resultsloo.publicationyear | html %][% END %]
91                                                 [% IF ( resultsloo.publishercode ) %]- [% resultsloo.publishercode | html %][% END %]
92                                                 [% IF ( resultsloo.copyrightdate ) %] - [% resultsloo.copyrightdate | html %][% END %]
93                                                 [% IF ( resultsloo.edition ) %]Edition: [% resultsloo.edition | html %][% END %]
94                                                 [% IF ( resultsloo.place ) %] ; [% resultsloo.place | html %][% END %]
95                                                 [% IF ( resultsloo.pages ) %] - [% resultsloo.pages | html %][% END %]
96                                                 [% IF ( resultsloo.item('size') ) %] ; [% resultsloo.item('size') | html %][% END %]
97                                                 [% IF ( resultsloo.timestamp ) %] <em>(modified on [% resultsloo.timestamp | html %])</em>[% END %]
98                                             </p>
99                                         [% END %]
100                                     </td>
101                                     <td>
102                                         [% IF ( resultsloo.available_items_loop ) %]
103                                             <span class="available">
104                                                 [% FOREACH items_loo IN resultsloo.available_items_loop %]
105                                                     [% items_loo.count | html %] [% items_loo.branchname | html %]
106                                                     [% IF ( items_loo.location ) %]<span class="shelvingloc">[% items_loo.location | html %]</span>[% END %]
107                                                     [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
108                                                     [% IF ( items_loo.classification ) %]
109                                                         <a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:[% items_loo.classification |url %]">
110                                                             [% items_loo.classification | html %]
111                                                         </a>
112                                                     [% END %]
113                                                     <br />
114                                                 [% END %]
115                                             </span>
116                                         [% END %]
117                                         <span class="unavailable">
118                                             [% IF ( resultsloo.onloancount ) %] Checked out ([% resultsloo.onloancount | html %]),<br /> [% END %]
119                                             [% IF ( resultsloo.withdrawncount ) %] Withdrawn ([% resultsloo.withdrawncount | html %]),<br /> [% END %]
120                                             [% IF ( resultsloo.itemlostcount ) %] Lost ([% resultsloo.itemlostcount | html %])<br />[% END %]
121                                             [% IF ( resultsloo.orderedcount ) %] On order ([% resultsloo.orderedcount | html %])<br/>[% END %]
122                                             [% IF ( resultsloo.notforloancount ) %] Not for loan ([% resultsloo.notforloancount | html %])[% END %]
123                                             [% IF ( resultsloo.onholdcount ) %] Waiting on hold ([% resultsloo.onholdcount | html %])[% END %]
124                                         </span>
125                                     </td>
126                                     <td>
127                                         <div class="dropup">
128                                             <a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% resultsloo.biblionumber | html %]" role="button" data-toggle="dropdown" href="#">
129                                                 Actions <b class="caret"></b>
130                                             </a>
131                                             <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% resultsloo.biblionumber | html %]">
132                                                 <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% resultsloo.biblionumber | uri %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
133                                                 <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% resultsloo.biblionumber | uri %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
134                                                 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
135                                                     <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% resultsloo.biblionumber | uri %]"><i class="fa fa-pencil"></i> Edit record</a></li>
136                                                 [% END %]
137                                                 [% IF ( CAN_user_editcatalogue_edit_items ) %]
138                                                     <li><a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% resultsloo.biblionumber | uri %]"><i class="fa fa-plus"></i> Add/Edit items</a></li>
139                                                 [% END %]
140                                             </ul>
141                                         </div> <!-- /.dropup -->
142                                     </td>
143                                 </tr>
144                             [% END # /FOREACH resultsloo %]
145                         </table>
146                         <div class="pages">[% pagination_bar | $raw %]</div>
147                         <hr />
148                     </div> <!-- /.searchresults -->
149                 [% ELSE # IF total %]
150                     [% IF ( query ) %]
151                         [% IF ( error ) %]<div class="dialog alert">[% END %]<strong>No results found</strong>
152                         [% IF ( error ) %]
153                             Error: <span class="error">[% error | html %]</span></div>
154                         [% END %]
155                     [% END %]
156                 [% END # /IF total %]
158                 [% IF ( query ) %]
159                     <div id="searchresult-breeding">
160                         <h3>Biblios in reservoir</h3>
161                         [% IF ( breeding_loop ) %]
162                             <table>
163                                 <tr>
164                                     <th>Title</th>
165                                     <th>ISBN</th>
166                                     <th>Date</th>
167                                     <th>Edition</th>
168                                     <th>Coming from</th>
169                                     <th>&nbsp;</th>
170                                 </tr>
171                                 [% FOREACH breeding_loo IN breeding_loop %]
172                                     <tr>
173                                         <td>
174                                             [% breeding_loo.title | html %]
175                                             [% breeding_loo.author | html %]
176                                         </td>
177                                         <td>[% breeding_loo.isbn | html %]</td>
178                                         <td>[% breeding_loo.copyrightdate | html %]</td>
179                                         <td>[% breeding_loo.edition | html %]</td>
180                                         <td>[% breeding_loo.file | html %]</td>
181                                         <td>
182                                             <div class="dropup">
183                                                 <a class="btn btn-default btn-xs dropdown-toggle" id="reservoirsearchactions[% breeding_loo.id | html %]" role="button" data-toggle="dropdown" href="#">
184                                                     Actions <b class="caret"></b>
185                                                 </a>
186                                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reservoirsearchactions[% breeding_loo.id | html %]">
187                                                     <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
188                                                     <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
189                                                     [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
190                                                         <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id | uri %]"><i class="fa fa-plus"></i> Add biblio</a></li>
191                                                     [% END %]
192                                                 </ul>
193                                             </div>
194                                         </td>
195                                     </tr>
196                                 [% END # /IF breeding_loo %]
197                             </table>
198                         [% ELSE %]
199                             <p>None</p>
200                         [% END # /IF breeding_loop %]
201                     </div>
202                 [% END # /IF query %]
204                 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
205                     <div class="modal-dialog">
206                         <div class="modal-content">
207                             <div class="modal-header">
208                                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
209                                 <h3 id="dataPreviewLabel">Preview</h3>
210                             </div>
211                             <div class="modal-body">
212                                 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
213                             </div>
214                             <div class="modal-footer">
215                                 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
216                             </div>
217                         </div> <!-- /.modal-content -->
218                     </div> <!-- /.modal-dialog -->
219                 </div> <!-- /#dataPreview -->
220             </div> <!-- /.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 -->
221         </div> <!-- /.row -->
223 [% MACRO jsinclude BLOCK %]
224     <script>
226          $(document).ready(function() {
227             //Set focus to cataloging search
228             $("input[name=q]:eq(0)").focus();
230             $("#z3950search").click(function(){
231                 PopupZ3950("Default");
232                 return false;
233             });
235             $(".z3950searchFw").click(function(){
236                 PopupZ3950($(this).prop('id'));
237                 return false;
238             });
239             $(".merge-items").on("click",function(e){
240                 e.preventDefault();
241                 MergeItems();
242             });
244             $("#useadvanced").click(function(){
245                 $.cookie( 'catalogue_editor_[% logged_in_user.borrowernumber | html %]', 'advanced', { expires: 365, path: '/' } );
246                 return true;
247             });
249             $(".previewData").on("click", function(e){
250                 e.preventDefault();
251                 var ltitle = $(this).text();
252                 var page = $(this).attr("href");
253                 $("#dataPreviewLabel").text(ltitle);
254                 $("#dataPreview .modal-body").load(page + " div");
255                 $('#dataPreview').modal({show:true});
256             });
257             $("#dataPreview").on("hidden.bs.modal", function(){
258                 $("#dataPreviewLabel").html("");
259                 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
260             });
262         });
264         /* this function open a popup to search on z3950 server.  */
265         function PopupZ3950(fw) {
266             var strQuery = GetZ3950Terms(fw);
267             if(strQuery){
268                 window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes');
269             }
270         }
271         /* provide Z3950 search points */
272         function GetZ3950Terms(fw){
273             var strQuery="&frameworkcode=" + fw;
274             [% FOREACH z3950_search_param IN z3950_search_params %]
275                 strQuery += "&" + "[% z3950_search_param.name | uri %]" + "=" + "[% z3950_search_param.value | uri %]";
276             [% END %]
277             return strQuery;
278         }
280         /**
281          * This function checks if the adequate number of records are checked for merging
282          */
283         function MergeItems() {
284             var checkboxes = $("input:checkbox:checked");
285             if (checkboxes.length < 2) {
286                 alert(_("At least two records must be selected for merging."));
287             } else {
288                 var params = [];
289                 $(checkboxes).each(function() {
290                     params.push('biblionumber=' + $(this).val());
291                 });
292                 var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
293                 location.href = url;
294             }
295             return false;
296         }
298     </script>
299 [% END %]
301 [% INCLUDE 'intranet-bottom.inc' %]