[Koha-patches] [PATCH] Finishing off StripWhiteSpace tool, you can now switch this on (off by default) to remove whitespace from the outputted html
Chris Cormack
chris at bigballofwax.co.nz
Tue Mar 31 04:29:03 CEST 2009
---
C4/Output.pm | 7 ++++---
installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
installer/data/mysql/updatedatabase.pl | 7 +++++++
kohaversion.pl | 2 +-
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/C4/Output.pm b/C4/Output.pm
index 443383c..f800ef4 100644
--- a/C4/Output.pm
+++ b/C4/Output.pm
@@ -366,10 +366,10 @@ sub output_html_with_http_headers ($$$;$) {
my $html = shift;
# strip new lines or whitespace
- if (C4::Context->preference('FilterWhiteSpace') eq 'stripwhitespace'){
+ if (C4::Context->preference('StripWhiteSpace') eq 'stripwhitespace'){
$html = remove_white_space($html);
}
- elsif (C4::Context->preference('FilterWhiteSpace') eq 'stripnewlines'){
+ elsif (C4::Context->preference('StripWhiteSpace') eq 'stripnewlines'){
$html = remove_newline($html);
}
@@ -401,7 +401,8 @@ sub is_ajax () {
}
sub remove_white_space {
- $_[0] =~ s/^\s+$//mgo;
+ $_[0] =~ s/^\s*$//mgo;
+ $_[0] =~ s/^\n//mg;
return $_[0];
}
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index ef70ba6..8ef5f09 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -229,3 +229,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImageSize', 'MC', 'Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','MC|LC','Choice');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('StripWhiteSpace', 'off', 'Choose what filterin you want for html output stripnewlines removes all newlines, stripwhitespace whitespace and blank lines, and off does nothing', 'off|stripnewlines|stripwhitespace','Choice');
\ No newline at end of file
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 7e161b5..c4243d5 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2272,6 +2272,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = '3.01.00.016';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('StripWhiteSpace', 'off', 'Choose what filtering you want for html output stripnewlines removes all newlines, stripwhitespace whitespace and blank lines, and off does nothing','off|stripnewlines|stripwhitespace','Choice')");
+ print "Upgrade to $DBversion done (added Strip White space filters)\n";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index a0c6437..fc73c47 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = '3.01.00.015';
+ our $VERSION = '3.01.00.016';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
--
1.5.6.3
More information about the Koha-patches
mailing list