Bug 28101: Update breadcrumb markup in the OPAC for consistency and accessibility
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-request-article.tt
1 [% USE Koha %]
2 [% USE Branches %]
3 [% USE ItemTypes %]
4 [% USE AdditionalContents %]
5 [% USE raw %]
6 [% INCLUDE 'doc-head-open.inc' %]
7
8 <title>Request article &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% BLOCK cssinclude %][% END %]
11 </head>
12
13 [% INCLUDE 'bodytag.inc' bodyid='opac-request-article' %]
14 [% INCLUDE 'masthead.inc' %]
15
16 [% SET disclaimer = AdditionalContents.get( location => "ArticleRequestsDisclaimerText", lang => lang, library => Branches.GetLoggedInBranchcode ) %]
17
18 <div class="main">
19     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
20         <ol class="breadcrumb">
21             <li class="breadcrumb-item">
22                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
23             </li>
24             <li class="breadcrumb-item">
25                 <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Details for: [% biblio.title | html %]</a>
26             </li>
27             <li class="breadcrumb-item active">
28                 <a href="#" aria-current="page">Request article</a>
29             </li>
30         </ol>
31     </nav> <!-- /#breadcrumbs -->
32
33     <div class="container-fluid maincontent">
34         <div class="row">
35             <div class="col">
36                 [% IF error_message %]
37                     <h1 class="title">[% biblio.title | html %]</h1>
38                     <div class="alert alert-info">
39                         [% SWITCH error_message %]
40                             [% CASE 'article_request_limit_reached'       %]You reached your open article requests limit.
41                             [% CASE 'article_request_unhandled_exception' %]An error has occurred.
42                         [% END %]
43                     </div>
44                 [% ELSIF biblio.can_article_request( patron ) %]
45                     <h1>Place article request for [% biblio.title | html %]</h1>
46                     [% IF ( disclaimer && !action) %]
47                         <div class="alert alert-warning">
48                             [% PROCESS koha_news_block news => disclaimer %]
49                             <a href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;action=accept"
50                             class="btn btn-sm btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Accept</a>
51                         </div>
52                     [% ELSE %]
53                         [% SET article_request_type = biblio.article_request_type( patron ) %]
54
55                         [% IF article_request_type == 'yes' %]       [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFields') %]           [% END %]
56                         [% IF article_request_type == 'bib_only' %]  [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsRecordOnly') %] [% END %]
57                         [% IF article_request_type == 'item_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsItemOnly') %]   [% END %]
58
59
60                         <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
61                             <legend class="sr-only">Place article request</legend>
62                             <input type="hidden" name="action" value="create" />
63                             <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
64
65                             <fieldset class="rows">
66                                 <ul>
67                                     <li>
68                                         [% IF mandatory_fields.search('title') %]
69                                             <label for="title" class="required">Title:</label>
70                                             <input type="text" required="required" name="title" id="title" size="50" value="[% title | html %]"/>
71                                         [% ELSE %]
72                                             <label for="title">Title:</label>
73                                             <input type="text" name="title" id="title" size="50" value="[% title | html %]"/>
74                                         [% END %]
75                                     </li>
76
77                                     <li>
78                                         [% IF mandatory_fields.search('author') %]
79                                             <label for="author" class="required">Author:</label>
80                                             <input type="text" required="required" name="author" id="author" size="50" value="[% author | html %]"/>
81                                         [% ELSE %]
82                                             <label for="author">Author:</label>
83                                             <input type="text" name="author" id="author" size="50" value="[% author | html %]"/>
84                                         [% END %]
85                                     </li>
86
87                                     <li>
88                                         [% IF mandatory_fields.search('volume') %]
89                                             <label for="volume" class="required">Volume:</label>
90                                             <input type="text" required="required" name="volume" id="volume" size="50"/>
91                                         [% ELSE %]
92                                             <label for="volume">Volume:</label>
93                                             <input type="text" name="volume" id="volume" size="50"/>
94                                         [% END %]
95                                     </li>
96
97                                     <li>
98                                         [% IF mandatory_fields.search('issue') %]
99                                             <label for="issue" class="required">Issue:</label>
100                                             <input type="text" required="required" name="issue" id="issue" size="50"/>
101                                         [% ELSE %]
102                                             <label for="issue">Issue:</label>
103                                             <input type="text" name="issue" id="issue" size="50"/>
104                                         [% END %]
105                                     </li>
106
107                                     <li>
108                                         [% IF mandatory_fields.search('date') %]
109                                             <label for="date" class="required">Date:</label>
110                                             <input type="text" required="required" name="date" id="date" size="50"/>
111                                         [% ELSE %]
112                                             <label for="date">Date:</label>
113                                             <input type="text" name="date" id="date" size="50"/>
114                                         [% END %]
115                                     </li>
116
117                                     <li>
118                                         <label for="toc_request">Table of contents:</label>
119                                         <input type="checkbox" name="toc_request" value="1"/>
120                                     </li>
121
122                                     <li>
123                                         [% IF mandatory_fields.search('pages') %]
124                                             <label for="pages" class="required">Pages:</label>
125                                             <input type="text" required="required" name="pages" id="pages" size="50" value="[% pageinfo | html %]"/>
126                                         [% ELSE %]
127                                             <label for="pages">Pages:</label>
128                                             <input type="text" name="pages" id="pages" size="50" value="[% pageinfo | html %]"/>
129                                         [% END %]
130                                     </li>
131
132                                     <li>
133                                         [% IF mandatory_fields.search('chapters') %]
134                                             <label for="chapters" class="required">Chapters:</label>
135                                             <input type="text" required="required" name="chapters" id="chapters" size="50"/>
136                                         [% ELSE %]
137                                             <label for="chapters">Chapters:</label>
138                                             <input type="text" name="chapters" id="chapters" size="50"/>
139                                         [% END %]
140                                     </li>
141
142                                     <li>
143                                         <label for="patron_notes">Notes:</label>
144                                         <input type="text" name="patron_notes" id="patron_notes" size="50"/>
145                                     </li>
146
147                                     <li>
148                                         <label for="format">Format:</label>
149                                         <select name="format" id="format">
150                                             <option value="PHOTOCOPY">Photocopy</option>
151                                             <option value="SCAN">Digital scan</option>
152                                         </select>
153                                     </li>
154
155                                     <li>
156                                         <label for="branchcode">Pickup library:</label>
157                                         <select name="branchcode" id="branchcode" required="required">
158                                             [% FOREACH b IN Branches.all %]
159                                                 [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
160                                                     <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
161                                                 [% ELSE %]
162                                                     <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
163                                                 [% END %]
164                                             [% END %]
165                                         </select>
166                                     </li>
167                                 </ul>
168                             </fieldset>
169
170                             [% IF article_request_type != 'bib_only' %]
171                                 <table class="copiesrow table table-bordered table-striped">
172                                     <caption>Select a specific item:</caption>
173                                     <thead>
174                                         <tr>
175                                             <th>&nbsp;</th>
176                                             <th>Item type</th>
177                                             <th>Barcode</th>
178                                             <th>Home library</th>
179                                             <th>Call number</th>
180                                             <th>Enumeration</th>
181                                         </tr>
182                                     </thead>
183
184                                     <tbody>
185                                         [% FOREACH item IN biblio.items %]
186                                             [% IF item.can_article_request( patron ) %]
187                                                 <tr>
188                                                     <td>
189                                                         [% IF article_request_type == 'item_only' && !checked %]
190                                                             [% SET checked = 1 %]
191                                                             <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
192                                                         [% ELSE %]
193                                                             <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
194                                                         [% END %]
195                                                     </td>
196                                                     <td>
197                                                         [% ItemTypes.GetDescription( item.itype ) | html %]
198                                                     </td>
199                                                     <td>
200                                                         [% item.barcode | html %]
201                                                     </td>
202                                                     <td>
203                                                         [% Branches.GetName( item.homebranch ) | html %]
204                                                     </td>
205                                                     <td>
206                                                         [% item.itemcallnumber | html %]
207                                                     </td>
208                                                     <td>
209                                                         [% item.enumchron | html %]
210                                                     </td>
211                                                 </tr>
212                                             [% END %]
213                                         [% END %]
214
215                                         [% IF article_request_type != 'item_only' %]
216                                             <tr>
217                                                 <td>
218                                                     <input type="radio" name="itemnumber" value="" checked="checked"/>
219                                                 </td>
220                                                 <td colspan="6">
221                                                     Any item
222                                                 </td>
223                                             </tr>
224                                         [% END %]
225                                     </tbody>
226                                 </table>
227                             [% END %]
228
229                             <input type="submit" class="btn btn-primary" value="Place request" />
230                         </form>
231                     [% END %]
232                 [% ELSE %]
233                     <h1 class="title">[% biblio.title | html %]</h1>
234                     <div class="alert alert-info">
235                         No article requests can be made for this record.
236                     </div>
237                 [% END %]
238             </div> <!-- /.col -->
239         </div> <!-- /.row -->
240     </div> <!-- / .container-fluid -->
241 </div> <!-- / .main -->
242
243 [% INCLUDE 'opac-bottom.inc' %]
244
245 [% BLOCK jsinclude %]
246 <script>
247 $(document).ready( function() {
248     allow_submit = false;
249     $('#place-article-request').on('submit', function( event ){
250         if ( ! allow_submit ) {
251             event.preventDefault();
252
253             [% IF article_request_type == 'item_only' %]
254                 if ( ! $("input:radio[name='itemnumber']").is(":checked") ) {
255                     alert( _("Please select a specific item for this article request.") );
256                     return 0;
257                 }
258             [% END %]
259
260             var mandatory_fields = "[% mandatory_fields | html %]";
261             var m = new Array();
262             if ( mandatory_fields ) m = mandatory_fields.split(",");
263             var f = new Array();
264
265             for (i = 0; i < m.length; i++) {
266                 if ( ! $("#" + m[i]).val() ) {
267                     f.push( m[i] );
268                 }
269             }
270
271             if ( f.length ) {
272                 alert( _("The following fields are required and not filled in: ") + f.join(", ") );
273                 return 0;
274             }
275
276             // Check if all fields are blank
277             if( m.length == 0 && $('#title').val()=='' && $('#author').val()=='' && $('#volume').val()=='' && $('#issue').val()=='' && $('#date').val()=='' && $('#pages').val()=='' && $('#chapters').val()=='' && $('#patron_notes').val()=='' && !$('input[name="toc_request"]').prop('checked') ) {
278                 alert( _("Please fill in at least one field.") );
279                 return 0;
280             }
281
282             allow_submit = true;
283             $('#place-article-request').submit();
284         }
285     });
286
287     // Initialize format(s)
288     var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
289     if( !supported_formats.match(/PHOTOCOPY/) )
290         $('#format option[value="PHOTOCOPY"]').remove();
291     if( !supported_formats.match(/SCAN/) )
292         $('#format option[value="SCAN"]').remove();
293
294     if( $('#format option').length > 1 ) {
295         // Select first listed format
296         var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
297         $('#format option[value="'+first_format+'"]').attr('selected', true);
298     }
299 });
300 </script>
301 [% END %]