diff options
author | Yorhel <git@yorhel.nl> | 2011-01-25 16:45:45 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-01-25 17:07:06 +0100 |
commit | e46f634c49aa4e174d6cc351b25a60d33c251b25 (patch) | |
tree | 7bf39676260b9c266c083f63ad2522faf79c4b0f /lib/VNDB/Util | |
parent | e23b49f3bd6fddca80076f1dc19e5f913400ff48 (diff) |
TUWF: Initial convert from YAWF to TUWF
There may still be some bugs present and I've only converted the points
where TUWF is incompatible with YAWF. The new TUWF features are not in
use yet, I'll do that later on.
Note that, in order to run the new code, TUWF must be installed on your
system. The configuration for the TransAdmin plugin has also changed.
Other than that there shouldn't be any issues.
Diffstat (limited to 'lib/VNDB/Util')
-rw-r--r-- | lib/VNDB/Util/Auth.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Util/BrowseHTML.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 17 | ||||
-rw-r--r-- | lib/VNDB/Util/FormHTML.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/Util/LayoutHTML.pm | 7 | ||||
-rw-r--r-- | lib/VNDB/Util/Misc.pm | 2 |
6 files changed, 20 insertions, 16 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm index 9ad76894..864d1c54 100644 --- a/lib/VNDB/Util/Auth.pm +++ b/lib/VNDB/Util/Auth.pm @@ -10,7 +10,7 @@ use Digest::SHA qw|sha1_hex sha256_hex|; use Time::HiRes; use Encode 'encode_utf8'; use POSIX 'strftime'; -use YAWF ':html'; +use TUWF ':html'; use VNDB::Func; diff --git a/lib/VNDB/Util/BrowseHTML.pm b/lib/VNDB/Util/BrowseHTML.pm index 62e01fd1..4cce692c 100644 --- a/lib/VNDB/Util/BrowseHTML.pm +++ b/lib/VNDB/Util/BrowseHTML.pm @@ -3,7 +3,7 @@ package VNDB::Util::BrowseHTML; use strict; use warnings; -use YAWF ':html', 'xml_escape'; +use TUWF ':html', 'xml_escape'; use Exporter 'import'; use VNDB::Func; use POSIX 'ceil'; diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index a412949a..97dc6ca1 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -3,7 +3,7 @@ package VNDB::Util::CommonHTML; use strict; use warnings; -use YAWF ':html', 'xml_escape'; +use TUWF ':html', 'xml_escape', 'html_escape'; use Exporter 'import'; use Algorithm::Diff::Fast 'compact_diff'; use VNDB::Func; @@ -233,8 +233,8 @@ sub revdiff { if($o{diff} && $ser1 && $ser2) { my $sep = ref $o{diff} ? qr/($o{diff})/ : qr//; - my @ser1 = $o{split} ? $o{split}->($ser1) : map xml_escape($_), split $sep, $ser1; - my @ser2 = $o{split} ? $o{split}->($ser2) : map xml_escape($_), split $sep, $ser2; + my @ser1 = $o{split} ? $o{split}->($ser1) : map html_escape($_), split $sep, $ser1; + my @ser2 = $o{split} ? $o{split}->($ser2) : map html_escape($_), split $sep, $ser2; return if $o{split} && $#ser1 == $#ser2 && !grep $ser1[$_] ne $ser2[$_], 0..$#ser1; $ser1 = $ser2 = ''; @@ -247,8 +247,8 @@ sub revdiff { $ser2 .= ($ser2?$o{join}:'').($i % 2 ? qq|<b class="diff_add">$b</b>| : $b) if $b ne ''; } } elsif(!$o{htmlize}) { - $ser1 = xml_escape $ser1; - $ser2 = xml_escape $ser2; + $ser1 = html_escape $ser1; + $ser2 = html_escape $ser2; } $ser1 = mt '_revision_empty' if !$ser1 && $ser1 ne '0'; @@ -432,9 +432,10 @@ sub htmlRGHeader { $self->resHeader('Content-Type' => 'application/xhtml+xml; charset=UTF-8'); # This is a REALLY ugly hack, need find a proper solution in YAWF + # TODO: TUWF has a proper solution for this, convert this to use it no warnings 'redefine'; - my $sub = \&YAWF::XML::html; - *YAWF::XML::html = sub () { + my $sub = \&TUWF::XML::html; + *VNDB::Util::LayoutHTML::html = sub { lit q|<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">|; @@ -444,7 +445,7 @@ sub htmlRGHeader { 'xmlns:xlink' => 'http://www.w3.org/1999/xlink'; }; $self->htmlHeader(title => $title); - *YAWF::XML::html = $sub; + *VNDB::Util::LayoutHTML::html = $sub; $self->htmlMainTabs($type, $obj, 'rg'); return 0; } diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm index 41ee0ccc..57ec5b58 100644 --- a/lib/VNDB/Util/FormHTML.pm +++ b/lib/VNDB/Util/FormHTML.pm @@ -3,7 +3,7 @@ package VNDB::Util::FormHTML; use strict; use warnings; -use YAWF ':html'; +use TUWF ':html'; use Exporter 'import'; use POSIX 'strftime'; use VNDB::Func; @@ -227,7 +227,9 @@ sub htmlForm { input type => 'checkbox', name => 'ilock', id => 'ilock', value => 1, $options->{frm}{ilock} ? (checked => 'checked') : (); label for => 'ilock', mt '_form_ilock'; } - txt "\n".mt('_form_hidlock_note')."\n" if $self->authCan('lock') || $self->authCan('del'); + if($self->authCan('lock') || $self->authCan('del')) { + br; txt mt('_form_hidlock_note'); br; + } # edit summary (my $txt = $options->{frm}{editsum}||'') =~ s/&/&/; diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm index cc34b874..fe5f0679 100644 --- a/lib/VNDB/Util/LayoutHTML.pm +++ b/lib/VNDB/Util/LayoutHTML.pm @@ -3,7 +3,7 @@ package VNDB::Util::LayoutHTML; use strict; use warnings; -use YAWF ':html'; +use TUWF ':html'; use Exporter 'import'; use VNDB::Func; @@ -143,7 +143,8 @@ sub htmlFooter { # %options => { prefs => [pref1,..] } if($q && $q->{vid}) { lit '"'; a href => "/v$q->{vid}", style => 'text-decoration: none', $q->{quote}; - txt qq|"\n|; + txt '"'; + br; } txt "vndb $self->{version} | "; @@ -174,7 +175,7 @@ sub htmlFooter { # %options => { prefs => [pref1,..] } # write the SQL queries as a HTML comment when debugging is enabled if($self->debug) { lit "\n<!--\n SQL Queries:\n"; - for (@{$self->{_YAWF}{DB}{queries}}) { + for (@{$self->{_TUWF}{DB}{queries}}) { my $q = !ref $_->[0] ? $_->[0] : $_->[0][0].(exists $_->[0][1] ? ' | "'.join('", "', map defined()?$_:'NULL', @{$_->[0]}[1..$#{$_->[0]}]).'"' : ''); $q =~ s/^\s//g; diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index c64ffe6f..f4f02b57 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -57,7 +57,7 @@ sub filFetchDB { # throwing 500's even for non-browse pages. We have to do some low-level # PostgreSQL stuff with savepoints to ensure that an error won't affect our # existing transaction. - my $dbh = $self->{_YAWF}{DB}{sql}; + my $dbh = $self->dbh; $dbh->pg_savepoint('filter'); my($r, $np); my $OK = eval { |