Bug 26592: Prevent XSS vulnerabilities when circ/ysearch.pl is used
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / course_reserves / add_items-step2.tt
1 [% USE Branches %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Course reserves &rsaquo;[% IF is_edit || course_reserve %] Edit item[% ELSE %] Add items[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 </head>
7
8 <body id="courses_add_items_step2" class="course">
9
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
12
13 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo;[% IF is_edit || course_reserve %] Edit [% ELSE %] Reserve [% END %]<em><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | html %]">[% biblio.title | html %]</a></em> for <em><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | html %]">[% course.course_name | html %]</a></em></div>
14
15 <div class="main container-fluid">
16     <div class="row">
17         <div class="col-md-8 col-md-offset-2">
18
19         [% IF course_reserve && !is_edit%]<div class="dialog message" id="already_on_reserve_this">This course already has this item on reserve.</div>[% END %]
20         [% IF course_item %]<div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.count | html %]</div>[% END %]
21
22         <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
23             <input type="hidden" name="course_id" value="[% course.course_id | html %]" />
24             <input type="hidden" name="return" value="[% return | html %]" />
25             <input type="hidden" name="action" value="add" />
26
27             <fieldset class="rows">
28                 [% IF is_edit || course_reserve %]
29                     <legend>Edit <em>[% biblio.title | html %]</em> in <em>[% course.course_name | html %]</em></legend>
30                 [% ELSE %]
31                     <legend>Add <em>[% biblio.title | html %]</em> to <em>[% course.course_name | html %]</em></legend>
32                 [% END %]
33                 <ol>
34                     <li>
35                         <span class="label">Barcode:</span>
36                         <span id="barcode">[% item.barcode | html %]</span>
37                         <input type="hidden" name="itemnumber" value="[% item.itemnumber | html %]" />
38                     </li>
39
40                     [% IF item_level_itypes %]
41                     <li>
42                         <label class="required" for="itype">Item type:</label>
43
44                         [% IF course_item.itype_enabled %]
45                             <input type="checkbox" class="field-toggle" data-pulldown="itype" value="1" name="itype_enabled" id="itype_enabled" checked="checked" />
46                         [% ELSE %]
47                             <input type="checkbox" class="field-toggle" data-pulldown="itype" value="1" name="itype_enabled" id="itype_enabled" />
48                         [% END %]
49
50                         [% IF course_item.itype_enabled %]
51                             <select id="itype" name="itype">
52                         [% ELSE %]
53                             <select id="itype" name="itype" disabled="disabled">
54                         [% END %]
55
56                             <option value=""></option>
57                             [% FOREACH it IN itypes %]
58                                 [% IF it.itemtype == course_item.itype %]
59                                     <option value="[% it.itemtype | html %]" selected="selected">[% it.description | html %]</option>
60                                 [% ELSE %]
61                                     <option value="[% it.itemtype | html %]">[% it.description | html %]</option>
62                                 [% END %]
63                             [% END %]
64                         </select>
65                     </li>
66                     [% END %]
67
68                     <li>
69                         <label class="required" for="ccode">Collection:</label>
70
71                         [% IF course_item.ccode_enabled %]
72                             <input type="checkbox" class="field-toggle" data-pulldown="ccode" value="1" name="ccode_enabled" id="ccode_enabled" checked="checked" />
73                         [% ELSE %]
74                             <input type="checkbox" class="field-toggle" data-pulldown="ccode" value="1" name="ccode_enabled" id="ccode_enabled" />
75                         [% END %]
76
77                         [% IF course_item.ccode_enabled %]
78                             <select id="ccode" name="ccode">
79                         [% ELSE %]
80                             <select id="ccode" name="ccode" disabled="disabled">
81                         [% END %]
82
83                             <option value=""></option>
84                             [% FOREACH c IN ccodes %]
85                                 [% IF c.authorised_value == course_item.ccode %]
86                                     <option value="[% c.authorised_value | html %]" selected="selected">[% c.lib | html %]</option>
87                                 [% ELSE %]
88                                     <option value="[% c.authorised_value | html %]">[% c.lib | html %]</option>
89                                 [% END %]
90                             [% END %]
91                         </select>
92                     </li>
93
94                     <li>
95                         <label class="required" for="location">Shelving location:</label>
96
97                         [% IF course_item.location_enabled %]
98                             <input type="checkbox" class="field-toggle" data-pulldown="location" value="1" name="location_enabled" id="location_enabled" checked="checked" />
99                         [% ELSE %]
100                             <input type="checkbox" class="field-toggle" data-pulldown="location"  value="1" name="location_enabled" id="location_enabled" />
101                         [% END %]
102
103                         [% IF course_item.location_enabled %]
104                             <select id="location" name="location">
105                         [% ELSE %]
106                             <select id="location" name="location" disabled="disabled">
107                         [% END %]
108
109                             <option value=""></option>
110                             [% FOREACH s IN locations %]
111                                 [% IF s.authorised_value == course_item.location %]
112                                     <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
113                                 [% ELSE %]
114                                     <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
115                                 [% END %]
116                             [% END %]
117                         </select>
118                     </li>
119
120                     <li>
121                         <label class="required" for="homebranch">Home library:</label>
122
123                         [% IF course_item.homebranch_enabled %]
124                             <input type="checkbox" value="1" class="field-toggle" data-pulldown="homebranch" name="homebranch_enabled" id="homebranch_enabled" checked />
125                         [% ELSE %]
126                             <input type="checkbox" value="1" class="field-toggle" data-pulldown="homebranch" name="homebranch_enabled" id="homebranch_enabled" />
127                         [% END %]
128
129                         [% IF course_item.homebranch_enabled %]
130                             <select id="homebranch" name="homebranch">
131                         [% ELSE %]
132                             <select id="homebranch" name="homebranch" disabled="disabled">
133                         [% END %]
134
135                             <option value=""></option>
136                             [% FOREACH b IN Branches.all() %]
137                                 [% IF course_item.homebranch.defined && ( ( course.enabled == 'yes' && b.branchcode == item.homebranch ) || ( course.enabled == 'no' && b.branchcode == course_item.homebranch ) ) %]
138                                     <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
139                                 [% ELSE %]
140                                     <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
141                                 [% END %]
142                             [% END %]
143                         </select>
144                     </li>
145
146                     <li>
147                         <label class="required" for="holdingbranch">Holding library:</label>
148
149                         [% IF course_item.holdingbranch_enabled %]
150                             <input type="checkbox" value="1" class="field-toggle" data-pulldown="holdingbranch" name="holdingbranch_enabled" id="holdingbranch_enabled" checked="checked" />
151                         [% ELSE %]
152                             <input type="checkbox" value="1" class="field-toggle" data-pulldown="holdingbranch" name="holdingbranch_enabled" id="holdingbranch_enabled" />
153                         [% END %]
154
155                         [% IF course_item.holdingbranch_enabled %]
156                             <select id="holdingbranch" name="holdingbranch">
157                         [% ELSE %]
158                             <select id="holdingbranch" name="holdingbranch" disabled="disabled">
159                         [% END %]
160
161                             <option value=""></option>
162                             [% FOREACH b IN Branches.all() %]
163                                 [% IF b.branchcode == course_item.holdingbranch %]
164                                     <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
165                                 [% ELSE %]
166                                     <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
167                                 [% END %]
168                             [% END %]
169                         </select>
170                     </li>
171
172                     <li>
173                         <label for="staff_note">Staff note:</label>
174                         <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note | html %]</textarea>
175                     </li>
176
177                     <li>
178                         <label for="public_note">Public note:</label>
179                         <textarea name="public_note" id="public_note">[% course_reserve.public_note | html %]</textarea>
180                     </li>
181
182                 </ol>
183             </fieldset>
184
185             <fieldset class="action">
186                 <input type="submit" id="submit" value="Save" class="submit focus" />
187
188                 <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | uri %]" class="cancel">Cancel</a>
189             </fieldset>
190         </form>
191     </div>
192 </div>
193
194 [% MACRO jsinclude BLOCK %]
195     <script>
196     //<![CDATA[
197         $(document).ready(function(){
198             $('.field-toggle').change(function() {
199                 if( this.checked ) {
200                     $('#' + $(this).data('pulldown') ).removeAttr('disabled');
201                 } else {
202                     $('#' + $(this).data('pulldown') ).val('');
203                     $('#' + $(this).data('pulldown') ).attr('disabled', 'disabled');
204                 }
205             });
206         });
207     //]]>
208     </script>
209 [% END %]
210
211 [% INCLUDE 'intranet-bottom.inc' %]