@@ -, +, @@ /cgi-bin/koha/admin/auth_subfields_structure.pl --- admin/auth_subfields_structure.pl | 136 +++++++------------- .../en/modules/admin/auth_subfields_structure.tt | 136 ++++++++++++++++++-- 2 files changed, 173 insertions(+), 99 deletions(-) --- a/admin/auth_subfields_structure.pl +++ a/admin/auth_subfields_structure.pl @@ -23,6 +23,7 @@ use C4::Output; use C4::Auth; use CGI; use C4::Context; +use C4::Koha; sub string_search { @@ -92,24 +93,13 @@ if ($op eq 'add_form') { } # build authorised value list - $sth2 = $dbh->prepare("select distinct category from authorised_values"); - $sth2->execute; - my @authorised_values; - push @authorised_values,""; - while ((my $category) = $sth2->fetchrow_array) { - push @authorised_values, $category; - } - push (@authorised_values,"branches"); - push (@authorised_values,"itemtypes"); + my $authorised_values = C4::Koha::GetAuthorisedValueCategories; + unshift @$authorised_values,""; + push (@$authorised_values,"branches"); + push (@$authorised_values,"itemtypes"); # build thesaurus categories list - $sth2 = $dbh->prepare("select authtypecode from auth_types"); - $sth2->execute; - my @authtypes; - push @authtypes, ""; - while ( ( my $authtypecode ) = $sth2->fetchrow_array ) { - push @authtypes, $authtypecode; - } + my $authtypes = getauthtypes; # build value_builder list my @value_builder=(''); @@ -159,7 +149,6 @@ if ($op eq 'add_form') { }, -default=>$data->{'tab'}, -size=>1, - -tabindex=>'', -multiple=>0, ); $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden', @@ -207,47 +196,34 @@ if ($op eq 'add_form') { -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, - -tabindex=>'', - -multiple=>0, - ); - $row_data{frameworkcode} = CGI::scrolling_list(-name=>'frameworkcode', - -id=>"frameworkcode$i", - -values=> \@authtypes, - -default=>$data->{'frameworkcode'}, - -size=>1, - -tabindex=>'', - -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, - -tabindex=>'', - -multiple=>0, - ); - + $row_data{authorised_value} = { + id => "authorised_value$i", + codes => $authorised_values, + default => $data->{'authorised_value'}, + }; + $row_data{frameworkcode} = { + id => "frameworkcode$i", + codes => $authtypes, + default => $data->{'frameworkcode'}, + }; + $row_data{value_builder} = { + id => "value_builder$i", + codes => \@value_builder, + default =>$data->{'value_builder'}, + }; $row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i", -checked => $data->{'repeatable'}?'checked':'', -value => 1, - -label => '', -id => "repeatable$i"); $row_data{mandatory} = CGI::checkbox(-name => "mandatory$i", -checked => $data->{'mandatory'}?'checked':'', -value => 1, - -label => '', -id => "mandatory$i"); $row_data{hidden} = CGI::escapeHTML($data->{hidden}) ; $row_data{isurl} = CGI::checkbox( -name => "isurl$i", -id => "isurl$i", -checked => $data->{'isurl'}?'checked':'', - -value => 1, - -label => ''); + -value => 1); $row_data{row} = $i; push(@loop_data, \%row_data); $i++; @@ -257,7 +233,7 @@ if ($op eq 'add_form') { my %row_data; # get a fresh hash for the row data $row_data{'new_subfield'} = 1; $row_data{tab} = CGI::scrolling_list(-name=>'tab', - -id => "tab$i", + -id => "tab", -values => [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ], -labels => { @@ -275,11 +251,10 @@ if ($op eq 'add_form') { }, -default=>"", -size=>1, - -tabindex=>'', -multiple=>0, ); $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden', - -id=>"ohidden$i", + -id=>"ohidden", #-values=>['0','1','2'], #-labels => {'0'=>'Show','1'=>'Show Collapsed', # '2' =>'Hide', @@ -294,7 +269,7 @@ if ($op eq 'add_form') { ); #$row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden', - # -id=>"ihidden$i", + # -id=>"ihidden", # -values=>['0','1','2'], # -labels => {'0'=>'Show','1'=>'Show Collapsed', # '2' =>'Hide', @@ -304,7 +279,7 @@ if ($op eq 'add_form') { # -multiple=>0, # ); #$row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden', - # -id=>"ehidden$i", + # -id=>"ehidden", # -values=>['0','1','2'], # -labels => {'0'=>'Show','1'=>'Show Collapsed', # '2' =>'Hide', @@ -314,60 +289,45 @@ if ($op eq 'add_form') { # -multiple=>0, # ); $row_data{tagsubfieldinput} = "{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />"; - $row_data{tagsubfieldinput} = - ""; $row_data{tagsubfield} = $data->{'tagsubfield'}; $row_data{liblibrarian} = ""; $row_data{libopac} = ""; $row_data{seealso} = ""; $row_data{hidden} = "000"; $row_data{repeatable} = CGI::checkbox( -name=> 'repeatable', - -id => "repeatable$i", + -id => "repeatable", -checked => '', - -value => 1, - -label => ''); + -value => 1); $row_data{mandatory} = CGI::checkbox( -name=> 'mandatory', - -id => "mandatory$i", + -id => "mandatory", -checked => '', - -value => 1, - -label => ''); + -value => 1); $row_data{isurl} = CGI::checkbox(-name => 'isurl', - -id => "isurl$i", + -id => "isurl", -checked => '', - -value => 1, - -label => ''); + -value => 1); $row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield', - -id => "kohafield$i", + -id => "kohafield", -values=> \@kohafields, -default=> "", -size=>1, -multiple=>0, ); - $row_data{frameworkcode} = CGI::scrolling_list(-name=>'frameworkcode', - -id=>'frameworkcode', - -values=> \@authtypes, - -default=>$data->{'frameworkcode'}, - -size=>1, - -tabindex=>'', - -multiple=>0, - ); - $row_data{authorised_value} = CGI::scrolling_list(-name=>'authorised_value', - -id => 'authorised_value', - -values=> \@authorised_values, - -size=>1, - -tabindex=>'', - -multiple=>0, - ); - $row_data{value_builder} = CGI::scrolling_list(-name=>'value_builder', - -id=>'value_builder', - -values=> \@value_builder, - -default=>$data->{'value_builder'}, - -size=>1, - -tabindex=>'', - -multiple=>0, - ); + $row_data{frameworkcode} = { + id => "frameworkcode", + codes => $authtypes, + default => $data->{'frameworkcode'}, + }; + $row_data{authorised_value} = { + id => 'authorised_value', + codes => @$authorised_values, + default => $data->{'authorised_value'}, + }; + $row_data{value_builder} = { + id => "value_builder", + codes => \@value_builder, + default =>$data->{'value_builder'}, + }; $row_data{row} = $i; push(@loop_data, \%row_data); } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt @@ -77,17 +77,88 @@ function displayMoreConstraint(numlayer){
    - [% IF ( loo.new_subfield ) %] -
  1. [% loo.tagsubfieldinput %] 
  2. - [% ELSE %] + [% IF ( loo.new_subfield ) %] +
  3. [% loo.tagsubfieldinput %] 
  4. +
  5. [% loo.repeatable %] 
  6. +
  7. [% loo.mandatory %] 
  8. +
  9. +
  10. +
  11. [% loo.tab %] (ignore means that the subfield does not display in the record editor)
  12. +
  13. +
    + Display +
      +
    1. [% loo.ohidden %]
    2. +
    +
    +
  14. +
  15. +
    + Advanced constraints: +
      +
    1. [% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)
    2. +
    3. + + +
    4. +
    +
    +
  16. +
  17. +
    Help input +
      +
    1. + + +
    2. +
    3. + + +
    4. +
    5. + + +
    6. + [% ELSE %]
    7. -
    8. - [% END %]
    9. [% loo.repeatable %] 
    10. [% loo.mandatory %] 
    11. -
    12. -
    13. +
    14. +
    15. [% loo.tab %] (ignore means that the subfield does not display in the record editor)
    16. @@ -106,7 +177,7 @@ function displayMoreConstraint(numlayer){
    17. [% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)
    18. - +
    @@ -114,9 +185,52 @@ function displayMoreConstraint(numlayer){
  18. Help input
      -
    1. [% loo.authorised_value %]
    2. -
    3. [% loo.frameworkcode %]
    4. -
    5. [% loo.value_builder %]
    6. +
    7. + + +
    8. +
    9. + + +
    10. +
    11. + + +
    12. + [% END %]
  19. --