Bugzilla – Attachment 27152 Details for
Bug 12091
HTML from auth_subfields_structure.tt doesn't pass firefox's html validator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12091 - Ugly HTML corrects for /cgi-bin/koha/admin/auth_subfields_structure.pl
Bug-12091---Ugly-HTML-corrects-for-cgi-binkohaadmi.patch (text/plain), 18.38 KB, created by
Mark Tompsett
on 2014-04-15 23:47:33 UTC
(
hide
)
Description:
Bug 12091 - Ugly HTML corrects for /cgi-bin/koha/admin/auth_subfields_structure.pl
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-04-15 23:47:33 UTC
Size:
18.38 KB
patch
obsolete
>From c68a25047f843ff413e92256c24c58ca0899f552 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Tue, 15 Apr 2014 19:19:32 -0400 >Subject: [PATCH] Bug 12091 - Ugly HTML corrects for > /cgi-bin/koha/admin/auth_subfields_structure.pl > >Untested. I know it cleans up the HTML, but with the renaming of things and the like, it needs to be thoroughly tested still. >--- > admin/auth_subfields_structure.pl | 136 +++++++------------- > .../en/modules/admin/auth_subfields_structure.tt | 136 ++++++++++++++++++-- > 2 files changed, 173 insertions(+), 99 deletions(-) > >diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl >index fb0e59c..8f661e4 100755 >--- a/admin/auth_subfields_structure.pl >+++ b/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} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />"; >- $row_data{tagsubfieldinput} = >- "<label><input type=\"text\" name=\"tagsubfield\" value=\"" >- . $data->{'tagsubfield'} >- . "\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" /></label>"; > $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); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >index 3d22192..f29caea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >@@ -77,17 +77,88 @@ function displayMoreConstraint(numlayer){ > <div id="sub[% loo.tagsubfield %]field"> > <fieldset class="rows"><ol> > >- [% IF ( loo.new_subfield ) %] >- <li><label for="tagsubfieldinput[% loo.row %]">Subfield code: </label>[% loo.tagsubfieldinput %] </li> >- [% ELSE %] >+ [% IF ( loo.new_subfield ) %] >+ <li><label for="tagsubfield">Subfield code: </label>[% loo.tagsubfieldinput %] </li> >+ <li><label for="repeatable">Repeatable: </label>[% loo.repeatable %] </li> >+ <li><label for="mandatory">Mandatory: </label>[% loo.mandatory %] </li> >+ <li><label for="liblibrarian">Text for librarian: </label><input id="liblibrarian" type="text" name="liblibrarian" value="[% loo.liblibrarian %]" size="40" maxlength="80" /></li> >+ <li><label for="libopac">Text for OPAC: </label><input type="text" id="libopac" name="libopac" value="[% loo.libopac %]" size="40" maxlength="80" /></li> >+ <li><label for="tab">Managed in tab: </label>[% loo.tab %] (ignore means that the subfield does not display in the record editor)</li> >+ <li> >+ <fieldset> >+ <legend>Display</legend> >+ <ol> >+ <li><label for="ohidden">Select to display or not:</label>[% loo.ohidden %] </li> >+ </ol> >+ </fieldset> >+ </li> >+ <li> >+ <fieldset class="rows"> >+ <legend>Advanced constraints:</legend> >+ <ol> >+ <li><label for="isurl">Is a URL:</label>[% loo.isurl %] (if checked, it means that the subfield is a URL and can be clicked)</li> >+ <li> >+ <label for="defaultvalue">Default value:</label> >+ <input type="text" name="defaultvalue" id="defaultvalue" value="[% loo.defaultvalue %]" /> >+ </li> >+ </ol> >+ </fieldset> >+ </li> >+ <li> >+ <fieldset><legend>Help input</legend> >+ <ol> >+ <li> >+<label for="authorised_value">Authorized value:</label> >+<select name="authorised_value" size="1" id="[% loo.authorised_value.id %]"> >+[%- FOREACH t IN loo.authorised_value.codes -%] >+ [%- IF loo.authorised_value.default == t && t == "" %] >+ <!-- this case for a space is necessary to validate HTML nicely. --> >+ <option selected="selected" value="[% t %]"> </option> >+ [%- ELSIF loo.frameworkcode.default == t %] >+ <option selected="selected" value="[% t %]">[% t %]</option> >+ [%- ELSE %] >+ <option value="[% t %]">[% t %]</option> >+ [%- END %] >+[%- END -%] >+</select> >+ </li> >+ <li> >+<label for="frameworkcode">Thesaurus:</label> >+<select name="frameworkcode" size="1" id="[% loo.frameworkcode.id %]"> >+[%- FOREACH t IN loo.frameworkcode.codes -%] >+ [%- IF loo.frameworkcode.default == t.value.authtypecode && t.value.authtypecode == "" %] >+ <!-- this case for a space is necessary to validate HTML nicely. --> >+ <option selected="selected" value="[% t.value.authtypecode %]"> </option> >+ [%- ELSIF loo.frameworkcode.default == t.value.authtypecode %] >+ <option selected="selected" value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option> >+ [%- ELSE %] >+ <option value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option> >+ [%- END %] >+[%- END -%] >+</select> >+ </li> >+ <li> >+<label for="value_builder[% loo.row %]">Plugin:</label> >+<select name="value_builder[% loo.row %]" size="1" id="[% loo.value_builder.id %]"> >+[%- FOREACH t IN loo.value_builder.codes -%] >+ [%- IF loo.value_builder.default == t && t == "" %] >+ <!-- this case for a space is necessary to validate HTML nicely. --> >+ <option selected="selected" value="[% t %]"> </option> >+ [%- ELSIF loo.value_builder.default == t %] >+ <option selected="selected" value="[% t %]">[% t %]</option> >+ [%- ELSE %] >+ <option value="[% t %]">[% t %]</option> >+ [%- END %] >+[%- END -%] >+</select> >+ </li> >+ [% ELSE %] > <li> > <input type="hidden" name="tagsubfield" value="[% loo.tagsubfield %]" /> >- </li> >- [% END %] > <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="liblibrarian[% loo.row %]">Text for librarian: </label><input id="liblibrarian[% loo.row %]" type="text" name="liblibrarian" value="[% loo.liblibrarian %]" size="40" maxlength="80" /></li> >- <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="liblibrarian[% loo.row %]">Text for librarian: </label><input id="liblibrarian[% loo.row %]" type="text" name="liblibrarian[% loo.row %]" value="[% loo.liblibrarian %]" size="40" maxlength="80" /></li> >+ <li><label for="libopac[% loo.row %]">Text for OPAC: </label><input type="text" id="libopac[% loo.row %]" name="libopac[% loo.row %]" value="[% loo.libopac %]" size="40" maxlength="80" /></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> > <fieldset> >@@ -106,7 +177,7 @@ function displayMoreConstraint(numlayer){ > <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="defaultvalue[% loo.row %]">Default value:</label> >- <input type="text" name="defaultvalue" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" /> >+ <input type="text" name="defaultvalue[% loo.row %]" id="defaultvalue[% loo.row %]" value="[% loo.defaultvalue %]" /> > </li> > </ol> > </fieldset> >@@ -114,9 +185,52 @@ function displayMoreConstraint(numlayer){ > <li> > <fieldset><legend>Help input</legend> > <ol> >- <li><label for="authorised_value[% loo.row %]">Authorized value:</label> [% loo.authorised_value %]</li> >- <li><label for="frameworkcode[% loo.row %]">Thesaurus:</label> [% loo.frameworkcode %]</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[% loo.row %]" size="1" id="[% loo.authorised_value.id %]"> >+[%- FOREACH t IN loo.authorised_value.codes -%] >+ [%- IF loo.authorised_value.default == t && t == "" %] >+ <!-- this case for a space is necessary to validate HTML nicely. --> >+ <option selected="selected" value="[% t %]"> </option> >+ [%- ELSIF loo.frameworkcode.default == t %] >+ <option selected="selected" value="[% t %]">[% t %]</option> >+ [%- ELSE %] >+ <option value="[% t %]">[% t %]</option> >+ [%- END %] >+[%- END -%] >+</select> >+ </li> >+ <li> >+<label for="frameworkcode[% loo.row %]">Thesaurus:</label> >+<select name="frameworkcode[% loo.row %]" size="1" id="[% loo.frameworkcode.id %]"> >+[%- FOREACH t IN loo.frameworkcode.codes -%] >+ [%- IF loo.frameworkcode.default == t.value.authtypecode && t.value.authtypecode == "" %] >+ <!-- this case for a space is necessary to validate HTML nicely. --> >+ <option selected="selected" value="[% t.value.authtypecode %]"> </option> >+ [%- ELSIF loo.frameworkcode.default == t.value.authtypecode %] >+ <option selected="selected" value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option> >+ [%- ELSE %] >+ <option value="[% t.value.authtypecode %]">[% t.value.authtypecode %]</option> >+ [%- END %] >+[%- END -%] >+</select> >+ </li> >+ <li> >+<label for="value_builder[% loo.row %]">Plugin:</label> >+<select name="value_builder[% loo.row %]" size="1" id="[% loo.value_builder.id %]"> >+[%- FOREACH t IN loo.value_builder.codes -%] >+ [%- IF loo.value_builder.default == t && t == "" %] >+ <!-- this case for a space is necessary to validate HTML nicely. --> >+ <option selected="selected" value="[% t %]"> </option> >+ [%- ELSIF loo.value_builder.default == t %] >+ <option selected="selected" value="[% t %]">[% t %]</option> >+ [%- ELSE %] >+ <option value="[% t %]">[% t %]</option> >+ [%- END %] >+[%- END -%] >+</select> >+ </li> >+ [% END %] > </ol> > </fieldset> > </li> >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12091
:
27152
|
27674
|
30767
|
30768
|
30773
|
30774
|
30778
|
30779
|
30826