Bugzilla – Attachment 39459 Details for
Bug 13948
Add ability to dump template toolkit variables to html comment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13948: Add ability to dump template toolkit variables to html comment
Bug-13948-Add-ability-to-dump-template-toolkit-var.patch (text/plain), 10.83 KB, created by
Jonathan Druart
on 2015-05-24 12:56:47 UTC
(
hide
)
Description:
Bug 13948: Add ability to dump template toolkit variables to html comment
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-05-24 12:56:47 UTC
Size:
10.83 KB
patch
obsolete
>From 8dccd04da84d8ea67c1ec58e8df0a9524cc7690d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 2 Apr 2015 11:14:45 -0400 >Subject: [PATCH] Bug 13948: Add ability to dump template toolkit variables to > html comment > >It would be incredibly helpful if we could easily enable Koha to dump >all Template Toolkit variables to a comment for debugging purposes. > >Test Plan: >1) Apply this patch >2) Run updatedatabase >3) Enable the new system preferences DumpTemplateVarsIntranet and > DumpTemplateVarsOpac >4) Load a page in the staff intranet, view the html source >5) Note the template toolkit variables are embedded in an html comment >6) Load a page in the opac, view the html source >7) Note the template toolkit variable are embedded in an html comment > >NOTE: I had to cpan2deb Template::Plugin::Stash to test. > This is not optimal. Additionally: > http://www.template-toolkit.org/docs/modules/Template/Plugin/index.html > does not contain Stash. I suspect this was how it was > introduced initially by TT. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> >--- > C4/Installer/PerlDependencies.pm | 13 ++- > installer/data/mysql/sysprefs.sql | 2 + > installer/data/mysql/updatedatabase.pl | 24 +++- > .../prog/en/includes/doc-head-open.inc | 14 +++ > .../prog/en/modules/admin/preferences/logs.pref | 122 ++++++++++++--------- > .../bootstrap/en/includes/doc-head-open.inc | 14 +++ > 6 files changed, 130 insertions(+), 59 deletions(-) > >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index 4b2067e..21b46b2 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -518,10 +518,15 @@ our $PERL_DEPS = { > 'min_ver' => '2.05', > }, > 'Template' => { >- 'usage' => 'Core', >- 'required' => '1', >- 'min_ver' => '2.22', >- }, >+ 'usage' => 'Core', >+ 'required' => '1', >+ 'min_ver' => '2.22', >+ }, >+ 'Template::Plugin::Stash' => { >+ 'usage' => 'Debugging', >+ 'required' => '1', >+ 'min_ver' => '1.006', >+ }, > 'Gravatar::URL' => { > 'usage' => 'Photos in OPAC reviews', > 'required' => '0', >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index f371193..06a7d7c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -115,6 +115,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('DisplayMultiPlaceHold','1','','Display the ability to place multiple holds or not','YesNo'), > ('DisplayOPACiconsXSLT','1','','If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC.','YesNo'), > ('dontmerge','1',NULL,'If ON, modifying an authority record will not update all associated bibliographic records immediately, ask your system administrator to enable the merge_authorities.pl cron job','YesNo'), >+('DumpTemplateVarsIntranet', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the staff intranet.', 'YesNo'), >+('DumpTemplateVarsOpac', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the opac.', 'YesNo'), > ('EasyAnalyticalRecords','0','','If on, display in the catalogue screens tools to easily setup analytical record relationships','YesNo'), > ('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'), > ('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 1dd8c0b..1059c5a 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -38,7 +38,6 @@ use C4::Context; > use C4::Installer; > use C4::Dates; > use Koha::Database; >- > use Koha; > > use MARC::Record; >@@ -10462,6 +10461,29 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "XXX"; >+if ( CheckVersion($DBversion) ) { >+ my $rs = Koha::Database->new()->schema()->resultset('Systempreference'); >+ $rs->find_or_create( >+ { >+ variable => 'DumpTemplateVarsIntranet', >+ value => 0, >+ explanation => 'If enabled, dump all Template Toolkit variable to a comment in the html source for the staff intranet.', >+ type => 'YesNo', >+ } >+ ); >+ $rs->find_or_create( >+ { >+ variable => 'DumpTemplateVarsOpac', >+ value => 0, >+ explanation => 'If enabled, dump all Template Toolkit variable to a comment in the html source for the opac.', >+ type => 'YesNo', >+ } >+ ); >+ print "Upgrade to $DBversion done (Bug 13948 - Add ability to dump template toolkit variables to html comment)\n"; >+ SetVersion($DBversion); >+} >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc >index 23449a5..0cafa59 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc >@@ -1,4 +1,18 @@ > <!DOCTYPE html> > <!-- TEMPLATE FILE: [% template.name.split('/').last %] --> >+ >+[% USE Koha %] >+[% IF Koha.Preference('DumpTemplateVarsIntranet') %] >+ [% USE Stash %] >+ [% USE Dumper %] >+ <!-- >+ [% FILTER replace('<!--', '<!- -') %] >+ [% FILTER replace('-->', '- ->') %] >+ [% Dumper.dump( Stash.stash() ) %] >+ [% END %] >+ [% END %] >+ --> >+[% END %] >+ > [% IF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]">[% ELSE %]<html lang="[% lang %]">[% END %] > <head> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >index 73f76c2..7227c8c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >@@ -1,55 +1,69 @@ > Logging: >- - >- - pref: LetterLog >- choices: >- on: Log >- off: "Don't log" >- - when an automatic claim notice is sent. >- - >- - pref: BorrowersLog >- choices: >- on: Log >- off: "Don't log" >- - changes to patron records. >- - >- - pref: CataloguingLog >- choices: >- on: Log >- off: "Don't log" >- - any changes to bibliographic or item records. Since this occurs whenever a book is checked in or out as well, it is not advisable to turn this on. >- - >- - pref: AuthoritiesLog >- choices: >- on: Log >- off: "Don't log" >- - changes to authority records. >- - >- - pref: FinesLog >- choices: >- on: Log >- off: "Don't log" >- - when fines are charged, paid, or forgiven. >- - >- - pref: IssueLog >- choices: >- on: Log >- off: "Don't log" >- - when items are checked out. >- - >- - pref: ReturnLog >- choices: >- on: Log >- off: "Don't log" >- - when items are returned. >- - >- - pref: SubscriptionLog >- choices: >- on: Log >- off: "Don't log" >- - when serials are added, deleted or changed. >- - >- - pref: CronjobLog >- choices: >- on: Log >- off: "Don't log" >- - information from cron jobs. >+ Logging: >+ - >+ - pref: LetterLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - when an automatic claim notice is sent. >+ - >+ - pref: BorrowersLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - changes to patron records. >+ - >+ - pref: CataloguingLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - any changes to bibliographic or item records. Since this occurs whenever a book is checked in or out as well, it is not advisable to turn this on. >+ - >+ - pref: AuthoritiesLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - changes to authority records. >+ - >+ - pref: FinesLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - when fines are charged, paid, or forgiven. >+ - >+ - pref: IssueLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - when items are checked out. >+ - >+ - pref: ReturnLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - when items are returned. >+ - >+ - pref: SubscriptionLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - when serials are added, deleted or changed. >+ - >+ - pref: CronjobLog >+ choices: >+ on: Log >+ off: "Don't log" >+ - information from cron jobs. >+ Debugging: >+ - >+ - pref: DumpTemplateVarsIntranet >+ choices: >+ on: Do >+ off: "Don't" >+ - dump all Template Toolkit variable to a comment in the html source for the staff intranet. >+ - >+ - pref: DumpTemplateVarsOpac >+ choices: >+ on: Do >+ off: "Don't" >+ - dump all Template Toolkit variable to a comment in the html source for the OPAC. >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc >index b288c18..4dc6cd5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc >@@ -1,5 +1,19 @@ > <!DOCTYPE html> > <!-- TEMPLATE FILE: [% template.name.split('/').last %] --> >+ >+[% USE Koha %] >+[% IF Koha.Preference('DumpTemplateVarsOpac') %] >+ [% USE Stash %] >+ [% USE Dumper %] >+ <!-- >+ [% FILTER replace('<!--', '<!- -') %] >+ [% FILTER replace('-->', '- ->') %] >+ [% Dumper.dump( Stash.stash() ) %] >+ [% END %] >+ [% END %] >+ --> >+[% END %] >+ > [% IF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]" class="no-js">[% ELSE %]<html lang="[% lang %]" class="no-js">[% END %] > <head> > <title> >-- >2.1.0
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 13948
:
37444
|
37445
|
37981
|
39096
|
39097
|
39205
|
39245
|
39246
|
39247
|
39459
|
39460
|
39461
|
39994
|
39995
|
39996
|
39997