]> git.koha-community.org Git - koha.git/blob - koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
Bug 34478: Add missing CSRF token to POST forms
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-illrequests.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE AuthorisedValues %]
5 [% USE Branches %]
6 [% USE AdditionalContents %]
7 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
8 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Your interlibrary loan requests &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %][% END %]
13 </head>
14 [% INCLUDE 'bodytag.inc' bodyid='opac-illrequests' bodyclass='scrollto' %]
15 [% BLOCK messages %]
16     [% IF message == "1" %]
17         <div class="alert alert-success" role="alert">Request updated</div>
18     [% ELSIF message == "2" %]
19         <div class="alert alert-success" role="alert">Request placed</div>
20     [% END %]
21 [% END %]
22 [% INCLUDE 'masthead.inc' %]
23 <div class="main">
24     [% WRAPPER breadcrumbs %]
25         [% IF ( logged_in_user ) %]
26             [% WRAPPER breadcrumb_item %]
27                 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
28             [% END %]
29         [% END %]
30
31         [% IF method != 'list' %]
32             [% WRAPPER breadcrumb_item %]
33                 <a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a>
34             [% END %]
35             [% IF method == 'create' %]
36                 [% WRAPPER breadcrumb_item bc_active= 1 %]
37                     <span>New interlibrary loan request</span>
38                 [% END %]
39             [% ELSIF method == 'view' %]
40                 [% WRAPPER breadcrumb_item bc_active= 1 %]
41                     <span>View interlibrary loan request</span>
42                 [% END %]
43             [% ELSIF method == 'typedisclaimer' %]
44                 [% WRAPPER breadcrumb_item bc_active= 1 %]
45                     <span>Ill request disclaimer</span>
46                 [% END %]
47             [% END %]
48         [% ELSE %]
49             [% WRAPPER breadcrumb_item bc_active= 1 %]
50                 <a href="#" aria-current="page">Interlibrary loan requests</a>
51             [% END %]
52         [% END %]
53     [% END #/ WRAPPER breadcrumbs %]
54
55     <div class="container-fluid">
56         <div class="row">
57             [% IF ( OpacNav||loggedinusername ) && !print %]
58                 <div class="col-lg-2">
59                     <div id="navigation">
60                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
61                     </div>
62                 </div>
63             [% END %]
64
65             [% IF ( OpacNav||loggedinusername ) %]
66                 <div class="col-lg-10 order-first order-md-first order-lg-2">
67             [% ELSE %]
68                 <div class="col order-first order-md-first order-lg-2">
69             [% END %]
70
71                 [% IF !backends_available %]
72                     <div class="alert alert-warning">ILL module configuration problem. Contact your administrator.</div>
73                 [% ELSE %]
74                     <div id="illrequests" class="maincontent">
75                         [% IF method == 'create' %]
76                             <h1>New interlibrary loan request</h1>
77                             [% IF stage == 'copyrightclearance' %]
78                                 [% INCLUDE messages %]
79                                 <div>
80                                     <p>
81                                         [% Koha.Preference('ILLModuleCopyrightClearance') | $raw %]
82                                     </p>
83                                     [% USE link_url = url('/cgi-bin/koha/opac-illrequests.pl', whole.value.other) %]
84                                     <a href="[% link_url _ '&amp;stage=copyrightclearance' | $raw %]"
85                                     class="btn btn-sm btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Yes</a>
86                                     <a href="/cgi-bin/koha/opac-illrequests.pl"
87                                     class="btn btn-sm btn-danger"><i class="fa fa-times" aria-hidden="true"></i> No</a>
88                                 </div>
89                             [% ELSE %]
90                                 [% INCLUDE messages %]
91                                 [% IF backends %]
92                                     <form method="post" id="illrequestcreate-form" novalidate="novalidate">
93                                         [% INCLUDE 'csrf-token.inc' %]
94                                         <legend class="sr-only">Backends</legend>
95                                         <fieldset class="rows">
96                                             <label for="backend">Provider:</label>
97                                             <select name="backend">
98                                                 [% FOREACH backend IN backends %]
99                                                     <option value="[% backend | html %]">[% backend | html %]</option>
100                                                 [% END %]
101                                             </select>
102                                         </fieldset>
103                                         <fieldset class="action">
104                                             <input type="hidden" name="method" value="create" />
105                                             <input type="submit" name="create_select_backend" value="Next" />
106                                         </fieldset>
107                                     </form>
108                                 [% ELSE %]
109                                     [% PROCESS $whole.opac_template %]
110                                 [% END %]
111                             [% END # /IF stage == 'copyrightclearance' %]
112                         [% ELSIF method == 'list' %]
113                             <h1>Interlibrary loan requests</h1>
114                             [% INCLUDE messages %]
115
116                             [% IF can_place_ill_in_opac %]
117                                 <div id="illrequests-create-button" class="dropdown btn-group">
118                                     [% IF backends.size > 1 %]
119                                         <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
120                                             <i class="fa fa-plus" aria-hidden="true"></i> Create a new request <span class="caret"></span>
121                                         </button>
122                                         <div id="backend-dropdown-options" class="dropdown-menu nojs" aria-labelledby="ill-backend-dropdown">
123                                             [% FOREACH backend IN backends %]
124                                                 <a class="dropdown-item" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend | uri %]">[% backend | html %]</a>
125                                             [% END %]
126                                         </div>
127                                     [% ELSE %]
128                                         <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 | html %]">
129                                             <i class="fa fa-plus" aria-hidden="true"></i> Create a new request
130                                         </a>
131                                     [% END %]
132                                 </div>
133                             [% END %]
134
135                             <table id="illrequestlist" class="table table-bordered table-striped">
136                                 <caption class="sr-only">Requests</caption>
137                                 <thead>
138                                     <tr>
139                                         <th>Request ID</th>
140                                         <th>Author</th>
141                                         <th>Title</th>
142                                         <th>Requested from</th>
143                                         <th>Request type</th>
144                                         <th>Status</th>
145                                         <th>Request placed</th>
146                                         <th>Last updated</th>
147                                         <th></th>
148                                     </tr>
149                                 </thead>
150                                 <tbody>
151                                     [% FOREACH request IN requests %]
152                                         [% status = request.status | html %]
153                                         [% type = request.get_type %]
154                                         <tr>
155                                             <td>[% request.id | html %]</td>
156                                             <td>
157                                                 [% IF request.metadata.Author %][% request.metadata.Author | html %][% ELSE %]<span>N/A</span>[% END %]
158                                             </td>
159                                             <td>
160                                                 [% IF request.metadata.Title %][% request.metadata.Title | html %][% ELSE %]<span>N/A</span>[% END %]
161                                             </td>
162                                             <td>[% request.backend | html %]</td>
163                                             <td>
164                                                 [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
165                                             </td>
166                                             <td>[% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]</td>
167                                             <td data-order="[% request.placed | html %]">[% request.placed | $KohaDates %]</td>
168                                             <td data-order="[% request.updated | html %]">[% request.updated | $KohaDates %]</td>
169                                             <td>
170                                                 <a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id | uri %]" class="btn btn-primary btn-sm pull-right">View</a>
171                                             </td>
172                                         </tr>
173                                     [% END %]
174                                 </tbody>
175                             </table>
176                         [% ELSIF method == 'view' %]
177                             <h1>View interlibrary loan request</h1>
178                             [% INCLUDE messages %]
179                             [% status = request.status %]
180                             <form method="post" action="?method=update" id="illrequestupdate-form" novalidate="novalidate">
181                                 [% INCLUDE 'csrf-token.inc' %]
182                                 <fieldset class="rows">
183                                     <legend id="library_legend">Details from library</legend>
184                                     <ol>
185                                         [% type = request.get_type %]
186                                         <li>
187                                             <label for="request_id">Request ID:</label>
188                                             [% request.id | html %]
189                                         </li>
190                                         <li>
191                                             <label for="backend">Requested from:</label>
192                                             [% request.backend | html %]
193                                         </li>
194                                         [% IF request.biblio_id %]
195                                             <li>
196                                                 <label for="biblio">Requested item:</label>
197                                                 <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% request.biblio_id | uri %]">View the requested item</a>
198                                             </li>
199                                         [% END %]
200                                         <li>
201                                             <label for="branchcode">Collection library:</label>
202                                             [% Branches.GetName(request.branchcode) | html %]
203                                         </li>
204                                         <li>
205                                             <label for="status">Status:</label>
206                                             [% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]
207                                         </li>
208                                         <li>
209                                             <label for="medium">Request type:</label>
210                                             [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
211                                         </li>
212                                         <li>
213                                             <label for="placed">Request placed:</label>
214                                             [% request.placed | $KohaDates %]
215                                         </li>
216                                         <li>
217                                             <label for="updated">Last updated:</label>
218                                             [% request.updated | $KohaDates %]
219                                         </li>
220                                         <li>
221                                             <label for="notesopac">Notes:</label>
222                                             [% IF !request.completed %]
223                                                 <textarea name="notesopac" rows="5" cols="50">[% request.notesopac | html %]</textarea>
224                                             [% ELSE %]
225                                                 [% request.notesopac | html %]
226                                             [% END %]
227                                         </li>
228                                     </ol>
229                                 </fieldset>
230                                 <div id="ill-supplier-metadata" class="rows">
231                                     <legend id="backend_legend">Details from [% request.backend | html %]</legend>
232                                     [% FOREACH meta IN request.metadata %]
233                                         <div class="requestattr-[% meta.key | replace(' ', '_') | html %]">
234                                             <span class="label">[% meta.key | html %]:</span>
235                                             <span class="value">[% IF meta.value %][% meta.value | html %][% ELSE %]N/A[% END %]</span>
236                                         </div>
237                                     [% END %]
238                                 </div>
239                             [% IF can_place_ill_in_opac %]
240                                 <fieldset class="action illrequest-actions">
241                                     <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
242                                     <input type="hidden" name="method" value="update" />
243                                     [% IF !request.completed %]
244                                         [% IF request.status == "NEW" %]
245                                             <a class="cancel-illrequest btn btn-danger" href="/cgi-bin/koha/opac-illrequests.pl?method=cancreq&amp;illrequest_id=[% request.illrequest_id | html %]">Request cancellation</a>
246                                         [% END %]
247                                         <input type="submit" class="update-illrequest btn btn-primary" value="Submit modifications" />
248                                     [% END %]
249                                     <span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
250                                 </fieldset>
251                             [% END %]
252                             </form>
253                         [% ELSIF method == 'availability' %]
254                             <h1>Interlibrary loan item availability</h1>
255                             <div id="results">
256                                 <form method="POST" action="/cgi-bin/koha/opac-illrequests.pl">
257                                     [% INCLUDE 'csrf-token.inc' %]
258                                     <legend><h2>Displaying availability results</h2></legend>
259                                     [% FOREACH key IN whole.keys %]
260                                         [% value = whole.$key %]
261                                         [% IF key != 'custom_key' && key != 'custom_value' %]
262                                         <input type="hidden" name="[% key | html %]" value="[% value | html %]">
263                                         [% END %]
264                                     [% END %]
265                                     [% custom_keys = whole.custom_key.split('\0') %]
266                                     [% custom_values = whole.custom_value.split('\0') %]
267                                     [% i = 0 %]
268                                     [% FOREACH custom_key IN custom_keys %]
269                                         <input type="hidden" name="custom_key" value="[% custom_key | html %]">
270                                         <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
271                                     [% i = i + 1 %]
272                                     [% END %]
273                                     <input type="hidden" name="checked_availability" value="1">
274                                     <div id="continue-request-row" class="alert">
275                                         If you can't find what you are looking for, you can
276                                         <button class="button" class="btn btn-primary" type="submit">continue creating your request</button> or
277                                         <a href="/cgi-bin/koha/opac-illrequests.pl">cancel your request</a>
278                                     </div>
279                                 </form>
280                                 [% FOR service IN services %]
281                                     <h3 class="ill_availability_sourcename">[% service.name | html %]</h3>
282                                     [% INCLUDE 'ill-availability-table.inc' service=service %]
283                                 [% END %]
284                             </div> <!-- /#illrequestupdate-form -->
285                         [% ELSIF method == 'typedisclaimer' %]
286                             <h1>ILL request disclaimer</h1>
287                             <div id="results" class="page-section">
288                                 [% INCLUDE messages %]
289                                 <form method="post" id="typedisclaimer-form">
290                                     [% INCLUDE 'csrf-token.inc' %]
291                                     <fieldset class="rows">
292                                         [% disclaimer.text | $raw %]
293                                         [% SET disc_av_category_code = AuthorisedValues.GetAuthValueDropbox(disclaimer.av_cat) %]
294                                         [% IF disc_av_category_code.count %]
295                                         <br>
296                                             <select name="type_disclaimer_value">
297                                                 [% FOR av_option IN disc_av_category_code %]
298                                                     <option value="[% av_option.lib_opac | html %]">[% av_option.lib_opac | html %]</option>
299                                                 [% END %]
300                                             </select>
301                                         [% END %]
302                                     </fieldset>
303                                     <fieldset class="action">
304                                         [% FOREACH key IN whole.keys %]
305                                             [% value = whole.$key %]
306                                             [% IF key != 'custom_key' && key != 'custom_value' %]
307                                             <input type="hidden" name="[% key | html %]" value="[% value | html %]">
308                                             [% END %]
309                                         [% END %]
310                                         [% custom_keys = whole.custom_key.split('\0') %]
311                                         [% custom_values = whole.custom_value.split('\0') %]
312                                         [% i = 0 %]
313                                         [% FOREACH custom_key IN custom_keys %]
314                                             <input type="hidden" name="custom_key" value="[% custom_key | html %]">
315                                             <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
316                                         [% i = i + 1 %]
317                                         [% END %]
318                                         <input type="hidden" name="type_disclaimer_submitted" value="1">
319                                         <input type="submit" class="btn btn-primary" value="Submit" />
320                                         <a class="action" href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a>
321                                     </fieldset>
322                                 </form>
323                             </div>
324                         [% END # / IF method == 'create' %]
325                     </div> <!-- / #illrequests -->
326                 [% END # /IF !backends_available %]
327             </div> <!-- / .col-lg-10/12 -->
328         </div> <!-- / .row -->
329     </div> <!-- / .container-fluid -->
330 </div> <!-- / .main -->
331
332 [% INCLUDE 'opac-bottom.inc' %]
333
334 [% BLOCK jsinclude %]
335     [% INCLUDE 'datatables.inc' %]
336     <script>
337         $("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
338             "columnDefs": [
339                 { "targets": [ -1 ], "sortable": false, "searchable": false }
340             ],
341             "order": [[ 3, "desc" ]],
342             "deferRender": true
343         }));
344         $("#backend-dropdown-options").removeClass("nojs");
345         [% IF services_json.length > 0 %]
346             var services = [% services_json | $raw %];
347         [% ELSE %]
348             var services = [];
349         [% END %]
350         [% IF metadata.length > 0 %]
351             var metadata = "[% metadata | $raw %]";
352         [% END %]
353     </script>
354     [% IF method == 'availability' %]
355         [% Asset.js("js/ill-availability.js") | $raw %]
356         <script>
357             $(document).ready(function() {
358                 window.doSearch();
359             });
360         </script>
361     [% END %]
362     [% TRY %]
363         [% PROCESS backend_jsinclude %]
364     [% CATCH %]
365     [% END %]
366 [% END %]