View | Details | Raw Unified | Return to bug 12765
Collapse All | Expand All

(-)a/cataloguing/additem.pl (-61 / +30 lines)
Lines 154-159 sub generate_subfield_form { Link Here
154
	    my $input = new CGI;
154
	    my $input = new CGI;
155
	    $value = $input->param('barcode');
155
	    $value = $input->param('barcode');
156
	}
156
	}
157
        my $attributes_no_value = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" );
158
        my $attributes_no_value_textarea = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" );
159
        my $attributes          = qq($attributes_no_value value="$value" );
157
        
160
        
158
        if ( $subfieldlib->{authorised_value} ) {
161
        if ( $subfieldlib->{authorised_value} ) {
159
            my @authorised_values;
162
            my @authorised_values;
Lines 210-244 sub generate_subfield_form { Link Here
210
            }
213
            }
211
214
212
            if ($subfieldlib->{'hidden'}) {
215
            if ($subfieldlib->{'hidden'}) {
213
                $subfield_data{marc_value} = {
216
                $subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value});
214
                    type      => 'hidden',
215
                    id        => $subfield_data{id},
216
                    maxlength => $subfield_data{max_length},
217
                    value     => $value,
218
                    avalue    => $authorised_lib{$value},
219
                };
220
            }
217
            }
221
            else {
218
            else {
222
                $subfield_data{marc_value} = {
219
                $subfield_data{marc_value} =CGI::scrolling_list(      # FIXME: factor out scrolling_list
223
                    type     => 'select',
220
                    -name     => "field_value",
224
                    id       => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield,
221
                    -values   => \@authorised_values,
225
                    name     => "field_value",
222
                    -default  => $value,
226
                    values   => \@authorised_values,
223
                    -labels   => \%authorised_lib,
227
                    labels   => \%authorised_lib,
224
                    -override => 1,
228
                    default  => $value,
225
                    -size     => 1,
229
                };
226
                    -multiple => 0,
227
                    -id       => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield,
228
                    -class    => "input_marceditor",
229
                );
230
            }
230
            }
231
231
232
        }
232
        }
233
            # it's a thesaurus / authority field
233
            # it's a thesaurus / authority field
234
        elsif ( $subfieldlib->{authtypecode} ) {
234
        elsif ( $subfieldlib->{authtypecode} ) {
235
                $subfield_data{marc_value} = {
235
                $subfield_data{marc_value} = "<input type=\"text\" $attributes />
236
                    type          => 'text1',
236
                    <a href=\"#\" class=\"buttonDot\"
237
                    id            => $subfield_data{id},
237
                        onclick=\"Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=".$subfieldlib->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">...</a>
238
                    maxlength     => $subfield_data{max_length},
238
            ";
239
                    value         => $value,
240
                    authtypecode  => $subfieldlib->{authtypecode},
241
                };
242
        }
239
        }
243
            # it's a plugin field
240
            # it's a plugin field
244
        elsif ( $subfieldlib->{value_builder} ) {
241
        elsif ( $subfieldlib->{value_builder} ) {
Lines 250-290 sub generate_subfield_form { Link Here
250
		    my $change = index($javascript, 'function Change') > -1 ?
247
		    my $change = index($javascript, 'function Change') > -1 ?
251
		        "return Change$function_name($subfield_data{random}, '$subfield_data{id}');" :
248
		        "return Change$function_name($subfield_data{random}, '$subfield_data{id}');" :
252
		        'return 1;';
249
		        'return 1;';
253
                    $subfield_data{marc_value} = {
250
                    $subfield_data{marc_value} = qq[<input type="text" $attributes
254
                        type        => 'text2',
251
                        onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');"
255
                        id          => $subfield_data{id},
252
			onchange=" $change"
256
                        maxlength   => $subfield_data{max_length},
253
                         onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" />
257
                        value       => $value,
254
                        <a href="#" class="buttonDot" onclick="Clic$function_name('$subfield_data{id}'); return false;" title="Tag Editor">...</a>
258
                        function    => $function_name,
255
                        $javascript];
259
                        data_random => $subfield_data{random},
260
                        change      => $change,
261
                        javascript  => $javascript,
262
                    };
263
                } else {
256
                } else {
264
                    warn "Plugin Failed: $plugin";
257
                    warn "Plugin Failed: $plugin";
265
                    $subfield_data{marc_value} = {
258
                    $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form
266
                        type        => 'text',
267
                        id          => $subfield_data{id},
268
                        maxlength   => $subfield_data{max_length},
269
                        value       => $value,
270
                    }; # supply default input form
271
                }
259
                }
272
        }
260
        }
273
        elsif ( $tag eq '' ) {       # it's an hidden field
261
        elsif ( $tag eq '' ) {       # it's an hidden field
274
            $subfield_data{marc_value} = {
262
            $subfield_data{marc_value} = qq(<input type="hidden" $attributes />);
275
                type        => 'hidden',
276
                id          => $subfield_data{id},
277
                maxlength   => $subfield_data{max_length},
278
                value       => $value,
279
            };
280
        }
263
        }
281
        elsif ( $subfieldlib->{'hidden'} ) {   # FIXME: shouldn't input type be "hidden" ?
264
        elsif ( $subfieldlib->{'hidden'} ) {   # FIXME: shouldn't input type be "hidden" ?
282
            $subfield_data{marc_value} = {
265
            $subfield_data{marc_value} = qq(<input type="text" $attributes />);
283
                type        => 'text',
284
                id          => $subfield_data{id},
285
                maxlength   => $subfield_data{max_length},
286
                value       => $value,
287
            };
288
        }
266
        }
289
        elsif ( length($value) > 100
267
        elsif ( length($value) > 100
290
                    or (C4::Context->preference("marcflavour") eq "UNIMARC" and
268
                    or (C4::Context->preference("marcflavour") eq "UNIMARC" and
Lines 293-311 sub generate_subfield_form { Link Here
293
                          500 <= $tag && $tag < 600                     )
271
                          500 <= $tag && $tag < 600                     )
294
                  ) {
272
                  ) {
295
            # oversize field (textarea)
273
            # oversize field (textarea)
296
            $subfield_data{marc_value} = {
274
            $subfield_data{marc_value} = "<textarea $attributes_no_value_textarea>$value</textarea>\n";
297
                type        => 'textarea',
298
                id          => $subfield_data{id},
299
                value       => $value,
300
            };
301
        } else {
275
        } else {
302
           # it's a standard field
276
           # it's a standard field
303
            $subfield_data{marc_value} = {
277
           $subfield_data{marc_value} = "<input type=\"text\" $attributes />";
304
                type        => 'text',
305
                id          => $subfield_data{id},
306
                maxlength   => $subfield_data{max_length},
307
                value       => $value,
308
            };
309
        }
278
        }
310
        
279
        
311
        return \%subfield_data;
280
        return \%subfield_data;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-27 / +1 lines)
Lines 212-243 $(document).ready(function() { Link Here
212
               [% ELSE %]
212
               [% ELSE %]
213
               <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
213
               <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
214
               [% END %]
214
               [% END %]
215
215
                [% ite.marc_value %]
216
                [% SET mv = ite.marc_value %]
217
                [% IF ( mv.type == 'hidden' ) %]
218
                    <input type="hidden" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />[% mv.avalue %]
219
                [% ELSIF ( mv.type == 'select' ) %]
220
                    <select name="[%- mv.name -%]" id="[%- mv.id -%]" size="1" class="input_marceditor">
221
                    [% FOREACH aval IN mv.values %]
222
                        [% IF aval == mv.default %]
223
                            <option value="[%- aval -%]" selected="selected">[%- mv.labels.$aval -%]</option>
224
                        [% ELSE %]
225
                            <option value="[%- aval -%]">[%- mv.labels.$aval -%]</option>
226
                        [% END %]
227
                    [% END %]
228
                    </select>
229
                [% ELSIF ( mv.type == 'text1' ) %]
230
                    <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
231
                    <a href="#" class="buttonDot" onclick="Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=&quot;[%- mv.authtypecode -%]&quot;&index=[%- mv.id -%]','[%- mv.id -%]'); return false;" title="Tag editor">...</a>
232
                [% ELSIF ( mv.type == 'text2' ) %]
233
                    <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" onfocus="Focus[%- mv.function -%]([%- mv.data_random -%], '[%- mv.id -%]');" onchange="[%- mv.change -%]" onblur="Blur[%- mv.function -%]([%- mv.data_random -%], '[%- mv.id -%]');" />
234
                    <a href="#" class="buttonDot" onclick="Clic[%- mv.function -%]('[%- mv.id -%]'); return false;" title="Tag editor">...</a>[% mv.javascript %]
235
                [% ELSIF ( mv.type == 'text' ) %]
236
                    <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
237
                [% ELSIF ( mv.type == 'textarea' ) %]
238
                    <textarea id="[%- mv.id -%]" name="field_value" class="input_marceditor" rows="5" cols="64" >[% mv.value %]</textarea>
239
                [% END %]
240
241
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
216
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
242
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
217
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
243
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
218
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
244
- 

Return to bug 12765