0d90b4932512e6c230ac74643da303d6dcfa0a0f
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / includes / html_helpers.inc
1 [% BLOCK options_for_libraries %]
2     [% FOREACH l IN libraries %]
3         [% IF l.selected %]
4             <option value="[% prefix | html %][% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
5         [% ELSE %]
6             <option value="[% prefix | html %][% l.branchcode | html %]">[% l.branchname | html %]</option>
7         [% END%]
8     [% END %]
9 [% END %]
10
11 [% BLOCK options_for_desks %]
12     <option id="nodesk" value="">---</option>
13     [% FOREACH d IN desks %]
14         [% IF d.branchcode == branch %]
15           [% IF selected == d.desk_id %]
16             <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" selected="selected">[% d.desk_name | html %]</option>
17           [% ELSE %]
18             <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" >[% d.desk_name | html %]</option>
19           [% END %]
20         [% ELSE %]
21             <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled hidden>[% d.desk_name | html %]</option>
22         [% END %]
23     [% END %]
24 [% END %]
25
26 [% BLOCK options_for_registers %]
27     [% FOREACH r IN registers %]
28         [% IF r.branch == Branches.GetLoggedInBranchcode %]
29             [% IF r.selected %]
30                 <option class="[%- r.branch | html -%][%- IF r.branch_default -%] default[%- END -%]" value="[% r.id | html %]" selected="selected">[% r.name | html %]</option>
31             [% ELSE %]
32                 <option class="[%- r.branch | html -%][%- IF r.branch_default -%] default[%- END -%]" value="[% r.id | html %]">[% r.name | html %]</option>
33             [% END%]
34         [% ELSE %]
35             <option class="[%- r.branch | html -%][%- IF r.branch_default -%] default[%- END -%]" value="[% r.id | html %]" disabled style="display: none">[% r.name | html %]</option>
36         [% END %]
37     [% END %]
38 [% END %]
39
40 [% BLOCK options_for_authorised_value_categories %]
41     [% FOREACH avc IN authorised_value_categories %]
42         [% IF avc.selected %]
43             <option value="[% avc.category | html %]" selected="selected">[% avc.category | html %]</option>
44         [% ELSE %]
45             <option value="[% avc.category | html %]">[% avc.category | html %]</option>
46         [% END %]
47     [% END %]
48 [% END %]
49
50 [% BLOCK options_for_item_types %]
51     [% FOREACH itemtype IN itemtypes %]
52         [% IF itemtype.itemtype == selected_itemtype %]
53             <option value="[% itemtype.itemtype | html %]" selected="selected">
54         [% ELSE %]
55             <option value="[% itemtype.itemtype | html %]">
56         [% END %]
57             [% itemtype.translated_description | html %]
58         </option>
59     [% END %]
60 [% END %]
61
62 [% BLOCK subfields_for_item %]
63     <ol>
64         [% FOREACH subfield IN subfields %]
65             [% IF subfield.kohafield == 'items.more_subfields_xml' %]
66                 [% SET kohafield = 'items.more_subfields_xml_' _ subfield.subfield %]
67             [% ELSE %]
68                 [% SET kohafield = subfield.kohafield %]
69             [% END %]
70
71             <li>
72                 <div class="subfield_line" style="[% subfield.visibility | html %]" id="subfield[% subfield.tag | html %][% subfield.subfield | html %][% subfield.random | html %]">
73                     [% IF ( subfield.mandatory ) %]
74                         <label class="required">[% subfield.subfield | html %] - [% subfield.marc_lib | $raw %]</label>
75                     [% ELSE %]
76                        <label>[% subfield.subfield | html %] - [% subfield.marc_lib | $raw %]</label>
77                     [% END %]
78
79                     [% SET mv = subfield.marc_value %]
80                     [% IF ( mv.type == 'hidden' ) %]
81                         <input type="hidden" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]">
82                     [% ELSIF ( mv.type == 'select' ) %]
83                         [% IF ( mv.readonly || subfield.IS_RETURN_CLAIM ) %]
84                             <select name="[% kohafield | html %]" id="[%- mv.id | html -%]" class="input_marceditor" readonly="readonly" disabled="disabled" data-width="50%">
85                         [% ELSE %]
86                             <select name="[% kohafield | html %]" id="[%- mv.id | html -%]" class="input_marceditor select2" data-category="[% mv.category | html %]" data-width="50%">
87                         [% END %]
88
89                         [% FOREACH aval IN mv.values %]
90                             [% IF aval == mv.default %]
91                                 <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
92                             [% ELSE %]
93                                 [% IF subfield.IS_LOST_AV && Koha.Preference("ClaimReturnedLostValue") && aval == Koha.Preference("ClaimReturnedLostValue") %]
94                                     <option disabled="disabled" value="[%- aval | html -%]" title="Return claims must be processed from the patron details page">[%- mv.labels.$aval | html -%]</option>
95                                 [%  ELSE %]
96                                     <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
97                                 [% END %]
98                             [% END %]
99                         [% END %]
100                         </select>
101                     [% ELSIF ( mv.type == 'text_auth' ) %]
102                         [% IF mv.readonly %]
103                             <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" readonly="readonly" />
104                         [% ELSE %]
105                             <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
106                             [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %]
107                             <a href="#" class="buttonDot"  onclick="[%- dopop | html -%]; return false;" title="Tag editor">...</a>
108                         [% END %]
109                     [% ELSIF ( mv.type == 'text_plugin' ) %]
110                         [% IF mv.readonly %]
111                             <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" readonly="readonly" />
112                         [% ELSE %]
113                             <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
114                             [% IF ( mv.nopopup ) %]
115                                 <a href="#" id="buttonDot_[%- mv.id | html -%]" class="[%- mv.class | html -%]" title="No popup">...</a>
116                             [% ELSE  %]
117                                 <a href="#" id="buttonDot_[%- mv.id | html -%]" class="[%- mv.class | html -%]" title="Tag editor">...</a>
118                             [% END %]
119                             [% UNLESS no_plugin %][%# FIXME - from batchMod-edit, jQuery is included at the end of the template and cataloguing plugins are not working in this situation %]
120                                 [%- mv.javascript | $raw -%]
121                             [% END %]
122                         [% END %]
123                     [% ELSIF ( mv.type == 'text' ) %]
124                         [% IF mv.readonly %]
125                             <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" readonly="readonly" />
126                         [% ELSE %]
127                             <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
128                         [% END %]
129                     [% ELSIF ( mv.type == 'textarea' ) %]
130                         [% IF mv.readonly %]
131                             <textarea id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" rows="5" cols="64" readonly="readonly" >[% mv.value | html %]</textarea>
132                         [% ELSE %]
133                             <textarea id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor" rows="5" cols="64" >[% mv.value | html %]</textarea>
134                         [% END %]
135                     [% END %]
136
137                     [% IF subfield.kohafield == 'items.more_subfields_xml' %]
138                         <input type="hidden" name="items.more_subfields_xml" value="[% subfield.subfield | html %]" />
139                     [% END %]
140                     <input type="hidden" name="tag"       value="[% subfield.tag | html %]" />
141                     <input type="hidden" name="subfield"  value="[% subfield.subfield | html %]" />
142                     <input type="hidden" name="mandatory" value="[% subfield.mandatory | html %]" />
143                     <input type="hidden" name="important" value="[% subfield.important | html %]" />
144
145                     [% IF add_regex %]
146                         <span name="regex_fields" style="display: none;">
147                             s/<input type="text" name="[% kohafield | html %]_regex_search" class="regex_search" placeholder="regex pattern" />/
148                             <input type="text" name="[% kohafield | html %]_regex_replace" class="regex_replace" placeholder="regex replacement" />/
149                             <input type="text" name="[% kohafield | html %]_regex_modifiers" class="regex_modifiers" placeholder="ig" size="3" />
150                         </span>
151                     [% END %]
152
153                     [% IF add_delete_checkbox %]
154                         [% UNLESS ( subfield.mandatory ) %]
155                             <input type="checkbox" id="row[% subfield.tag | html %][% subfield.subfield | html %][% subfield.random | html %]" title="Check to delete subfield [% subfield.subfield | html %]" name="disable_input" value="[% subfield.subfield | html %]" />
156                         [% ELSE %]
157                             <span class="required">Required</span>
158                         [% END %]
159                     [% ELSE %]
160                         [% IF ( subfield.mandatory ) %] <span class="required">Required</span>
161                         [% ELSIF ( subfield.important ) %] <span class="important">Important</span>
162                         [% END %]
163                     [% END %]
164
165                     [% IF add_regex %]
166                         [% IF (mv.type == 'text' || mv.type == 'text2' || mv.type == 'textarea' ) %]
167                             <a href="#" name="[% kohafield | html %]_field_regex" class="field_regex" id="[% subfield.id | html %]" >RegEx</a>
168                         [% END %]
169                     [% END %]
170
171                     [% IF ( subfield.repeatable ) %]
172                         <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode.parentNode); return false;">
173                             <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
174                         </a>
175                     [% END %]
176
177                     <span class="hint" id="hint[% subfield.tag | html %][% subfield.subfield | html %][% subfield.random | html %]"></span>
178
179                 </div>
180             </li>
181         [% END %]
182     </ol>
183 [% END %]