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

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

Return to bug 12176