Bug 12615: Remove CGI::scrolling_list from marc_subfields_structure.pl
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Sun, 20 Jul 2014 21:59:59 +0000 (18:59 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 30 Jul 2014 13:45:46 +0000 (10:45 -0300)
This patch removes all instances on this file.

Also re-enable editor feature to show/change kohafield value, can't find when or why it was removed.
Up to QA or RM for consideration, simply to remove.
But is strange to have a non editable field on auth frameworks.

To test:
1. Apply the patch
2. Go to Administration > MARC frameworks
3. Clic MARC structure of any auth fw
4. Clic subfield on any tag, e.g. 020
5. Clic 'Edit subfields' button

Now the tests proper

6. On any subfield, check pulldown
'Managed in tab', was replaced, so test
if it works and search for regressions
Change, save, load, change again

7. Clic on 'Advanced constraints'
(2) scrolling list removed
At the bottom, check 'Koha link', was changed
Check assign/remove/save/load values, search for regressions

8. Clic on 'Other options' box
Eight(6) scrolling_list removed, they use to
feed three pulldowns, so check each one

'Authorised value',
'Thesaurus'
'Plugin'
Check assign/remove/save/load values, search for regressions
Check adding a new subfield

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, no regressions found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
admin/marc_subfields_structure.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt

index 552bb89..475555e 100755 (executable)
@@ -179,29 +179,11 @@ if ( $op eq 'add_form' ) {
         my %row_data;    # get a fresh hash for the row data
         $row_data{defaultvalue} = $data->{defaultvalue};
         $row_data{maxlength} = $data->{maxlength};
-        $row_data{tab} = CGI::scrolling_list(
-            -name   => 'tab',
-            -id     => "tab$i",
-            -values =>
-              [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ],
-            -labels => {
-                '-1' => 'ignore',
-                '0'  => '0',
-                '1'  => '1',
-                '2'  => '2',
-                '3'  => '3',
-                '4'  => '4',
-                '5'  => '5',
-                '6'  => '6',
-                '7'  => '7',
-                '8'  => '8',
-                '9'  => '9',
-                '10' => 'items (10)',
-            },
-            -default  => $data->{'tab'},
-            -size     => 1,
-            -multiple => 0,
-        );
+        $row_data{tab} = {
+                    id      => "tab$i",
+                    default => $data->{'tab'},
+                    };
+
         $row_data{tagsubfield} =
             $data->{'tagsubfield'}
           . "<input type=\"hidden\" name=\"tagsubfield\" value=\""
@@ -212,38 +194,26 @@ if ( $op eq 'add_form' ) {
         $row_data{liblibrarian} = CGI::escapeHTML( $data->{'liblibrarian'} );
         $row_data{libopac}      = CGI::escapeHTML( $data->{'libopac'} );
         $row_data{seealso}      = CGI::escapeHTML( $data->{'seealso'} );
-        $row_data{kohafield}    = CGI::scrolling_list(
-            -name     => "kohafield",
-            -id       => "kohafield$i",
-            -values   => \@kohafields,
-            -default  => "$data->{'kohafield'}",
-            -size     => 1,
-            -multiple => 0,
-        );
-        $row_data{authorised_value} = CGI::scrolling_list(
-            -name     => "authorised_value",
-            -id       => "authorised_value$i",
-            -values   => \@authorised_values,
-            -default  => $data->{'authorised_value'},
-            -size     => 1,
-            -multiple => 0,
-        );
-        $row_data{value_builder} = CGI::scrolling_list(
-            -name     => "value_builder",
-            -id       => "value_builder$i",
-            -values   => \@value_builder,
-            -default  => $data->{'value_builder'},
-            -size     => 1,
-            -multiple => 0,
-        );
-        $row_data{authtypes} = CGI::scrolling_list(
-            -name     => "authtypecode",
-            -id       => "authtypecode$i",
-            -values   => \@authtypes,
-            -default  => $data->{'authtypecode'},
-            -size     => 1,
-            -multiple => 0,
-        );
+        $row_data{kohafield} = {
+                    id      => "kohafield$i",
+                    values  => \@kohafields,
+                    default => "$data->{'kohafield'}",
+                    };
+        $row_data{authorised_value} = {
+                    id      => "authorised_value$i",
+                    values  => \@authorised_values,
+                    default => $data->{'authorised_value'},
+        };
+        $row_data{value_builder} = {
+                    id      => "value_builder$i",
+                    values  => \@value_builder,
+                    default => $data->{'value_builder'},
+        };
+        $row_data{authtypes} = {
+                    id      => "authtypecode$i",
+                    values  => \@authtypes,
+                    default => $data->{'authtypecode'},
+        };
         $row_data{repeatable} = CGI::checkbox(
             -name     => "repeatable$i",
             -checked  => $data->{'repeatable'} ? 'checked' : '',
@@ -278,29 +248,10 @@ if ( $op eq 'add_form' ) {
         $row_data{'subfieldcode'} = '';
         $row_data{'maxlength'} = 9999;
 
-        $row_data{tab} = CGI::scrolling_list(
-            -name   => 'tab',
-            -id     => "tab$i",
-            -values =>
-              [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ],
-            -labels => {
-                '-1' => 'ignore',
-                '0'  => '0',
-                '1'  => '1',
-                '2'  => '2',
-                '3'  => '3',
-                '4'  => '4',
-                '5'  => '5',
-                '6'  => '6',
-                '7'  => '7',
-                '8'  => '8',
-                '9'  => '9',
-                '10' => 'items (10)',
-            },
-            -default  => "",
-            -size     => 1,
-            -multiple => 0,
-        );
+        $row_data{tab} = {
+                    id      => "tab$i",
+                    default => $data->{'tab'},
+                    };
         $row_data{tagsubfield} =
             "<input type=\"text\" name=\"tagsubfield\" value=\""
           . $data->{'tagsubfield'}
@@ -308,14 +259,11 @@ if ( $op eq 'add_form' ) {
         $row_data{liblibrarian} = "";
         $row_data{libopac}      = "";
         $row_data{seealso}      = "";
-        $row_data{kohafield}    = CGI::scrolling_list(
-            -name     => 'kohafield',
-            -id       => "kohafield$i",
-            -values   => \@kohafields,
-            -default  => "",
-            -size     => 1,
-            -multiple => 0,
-        );
+        $row_data{kohafield} = {
+                    id      => "kohafield$i",
+                    values  => \@kohafields,
+                    default => "$data->{'kohafield'}",
+                    };
         $row_data{hidden}     = "";
         $row_data{repeatable} = CGI::checkbox(
             -name     => "repeatable$i",
@@ -338,28 +286,21 @@ if ( $op eq 'add_form' ) {
             -value    => 1,
             -label    => ''
         );
-        $row_data{value_builder} = CGI::scrolling_list(
-            -name     => "value_builder",
-            -id       => "value_builder$i",
-            -values   => \@value_builder,
-            -default  => $data->{'value_builder'},
-            -size     => 1,
-            -multiple => 0,
-        );
-        $row_data{authorised_value} = CGI::scrolling_list(
-            -name     => "authorised_value",
-            -id       => "authorised_value$i",
-            -values   => \@authorised_values,
-            -size     => 1,
-            -multiple => 0,
-        );
-        $row_data{authtypes} = CGI::scrolling_list(
-            -name     => "authtypecode",
-            -id       => "authtypecode$i",
-            -values   => \@authtypes,
-            -size     => 1,
-            -multiple => 0,
-        );
+        $row_data{value_builder} = {
+                    id      => "value_builder$i",
+                    values  => \@value_builder,
+                    default => $data->{'value_builder'},
+        };
+        $row_data{authorised_value} = {
+                    id      => "authorised_value$i",
+                    values  => \@authorised_values,
+                    default => $data->{'authorised_value'},
+        };
+        $row_data{authtypes} = {
+                    id      => "authtypecode$i",
+                    values  => \@authtypes,
+                    default => $data->{'authtypecode'},
+        };
         $row_data{link}   = CGI::escapeHTML( $data->{'link'} );
         $row_data{row}    = $i;
         push( @loop_data, \%row_data );
index 4936041..1568393 100644 (file)
@@ -229,7 +229,28 @@ function populateHiddenCheckboxes(tab) {
                                <li><label for="libopac[% loo.row %]">Text for OPAC: </label><input type="text" id="libopac[% loo.row %]" name="libopac" value="[% loo.libopac %]" size="40" maxlength="80" /></li>
                                <li><label for="repeatable[% loo.row %]">Repeatable: </label>[% loo.repeatable %]</li>
                                <li><label for="mandatory[% loo.row %]">Mandatory: </label>[% loo.mandatory %]</li>
-                               <li><label for="tab[% loo.row %]">Managed in tab: </label>[% loo.tab %] (ignore means that the subfield does not display in the record editor)</li>
+                        <li><label for="tab[% loo.row %]">Managed in tab: </label>
+                            <select name="tab" tabindex="" size="1" id="[% loo.tab.id %]">
+                            [%- IF ( loo.tab.default ==  -1 ) -%]
+                                <option value="-1" selected="selected">ignore</option>
+                            [%- ELSE -%]
+                                <option value="-1">ignore</option>
+                            [%- END -%]
+                            [%- FOREACH t IN [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] -%]
+                                [%- IF ( loo.tab.default ==  t ) -%]
+                                <option value="[%- t -%]" selected="selected">[%- t -%]</option>
+                                [%- ELSE -%]
+                                <option value="[%- t -%]">[%- t -%]</option>
+                                [%- END -%]
+                            [%- END -%]
+                            [%- IF ( loo.tab.default ==  10 ) -%]
+                                <option value="10" selected="selected">items (10)</option>
+                            [%- ELSE -%]
+                                <option value="10">items (10)</option>
+                            [%- END -%]
+                            </select>
+                            (ignore means that the subfield does not display in the record editor)
+                        </li>
                        </ol>
                     </fieldset>
                     </div>
@@ -256,7 +277,18 @@ function populateHiddenCheckboxes(tab) {
                 </li>
                 <li><label for="isurl[% loo.row %]">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li>
                 <li><label for="link[% loo.row %]">Link:</label><input type="text" id="link[% loo.row %]" name="link" value="[% loo.link %]" size="10" maxlength="80" /> (e.g., Title or Local-Number) <span class="error"><em>NOTE: If you change this value you must ask your administrator to run misc/batchRebuildBiblioTables.pl.</em></span></li>
-                <li><label for="kohafield[% loo.row %]">Koha link:</label>[% loo.kohafield %]</li>
+                <li>
+                    <label for="kohafield[% loo.row %]">Koha link:</label>
+                    <select name="kohafield" id="[% loo.kohafield.id %]" size="1">
+                    [% FOREACH value IN loo.kohafield.values %]
+                      [% IF ( value == loo.kohafield.default ) %]
+                        <option value="[% value %]" selected>[% value %]</option>
+                      [% ELSE %]
+                        <option value="[% value %]">[% value %]</option>
+                      [% END %]
+                    [% END %]
+                    </select>
+                </li>
                        </ol>
             </fieldset>
             </div>
@@ -264,9 +296,42 @@ function populateHiddenCheckboxes(tab) {
             <div id="oth[% loo.urisubfieldcode %]">
             <fieldset class="rows">
                        <ol>
-                               <li><label for="authorised_value[% loo.row %]">Authorized value:</label>[% loo.authorised_value %]</li>
-                               <li><label for="authtypecode[% loo.row %]">Thesaurus:</label>[% loo.authtypes %]</li>
-                               <li><label for="value_builder[% loo.row %]">Plugin:</label>[% loo.value_builder %]</li>
+                            <li>
+                                <label for="authorised_value[% loo.row %]">Authorized value:</label>
+                                <select name="authorised_value" id="[% loo.authorised_value.id %]" size="1">
+                                [% FOREACH value IN loo.authorised_value.values %]
+                                    [% IF ( value == loo.authorised_value.default ) %]
+                                    <option value="[% value %]" selected>[% value %]</option>
+                                    [% ELSE %]
+                                    <option value="[% value %]">[% value %]</option>
+                                    [% END %]
+                                [% END %]
+                                </select>
+                            </li>
+                            <li>
+                                <label for="authtypecode[% loo.row %]">Thesaurus:</label>
+                                <select name="authtypecode" id="[% loo.authtypes.id %]" size="1">
+                                [% FOREACH value IN loo.authtypes.values %]
+                                    [% IF ( value == loo.authtypes.default ) %]
+                                    <option value="[% value %]" selected>[% value %]</option>
+                                    [% ELSE %]
+                                    <option value="[% value %]">[% value %]</option>
+                                    [% END %]
+                                [% END %]
+                                </select>
+                            </li>
+                            <li>
+                                <label for="value_builder[% loo.row %]">Plugin:</label>
+                                <select name="value_builder" id="[% loo.value_builder.id %]" size="1">
+                                [% FOREACH value IN loo.value_builder.values %]
+                                    [% IF ( value == loo.value_builder.default ) %]
+                                    <option value="[% value %]" selected>[% value %]</option>
+                                    [% ELSE %]
+                                    <option value="[% value %]">[% value %]</option>
+                                    [% END %]
+                                [% END %]
+                                </select>
+                            </li>
                        </ol>
             </fieldset>
             </div>