[wellwell-devel] [wellwell/zoom] Template::Zoom has been uploaded to CPAN as Template::Flute.
Stefan Hornburg
wellwell-devel at rt.icdevgroup.org
Sun Mar 13 19:35:51 UTC 2011
commit 3fea6d7c925b411d30b0392bd0eb80b3692ba262
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Sun Mar 13 20:32:19 2011 +0100
Template::Zoom has been uploaded to CPAN as Template::Flute.
lib/Vend/PDF.pm | 40 +++++++-------
lib/WellWell/Compose.pm | 2 +-
lib/WellWell/Compose/Component/Zoom.pm | 82 -----------------------------
lib/WellWell/Compose/Engine/Zoom.pm | 62 ----------------------
lib/WellWell/Engine.pm | 2 +-
lib/WellWell/{Zoom.pm => Flute.pm} | 52 +++++++++---------
lib/WellWell/{Zoom => Flute}/Increment.pm | 4 +-
lib/WellWell/Iterate.pm | 18 +++---
plugins/wishlists/code/wishlist.tag | 4 +-
9 files changed, 61 insertions(+), 205 deletions(-)
---
diff --git a/lib/Vend/PDF.pm b/lib/Vend/PDF.pm
index ab77616..cf51e9f 100644
--- a/lib/Vend/PDF.pm
+++ b/lib/Vend/PDF.pm
@@ -19,13 +19,13 @@
package Vend::PDF;
-use Template::Zoom::Specification::XML;
-use Template::Zoom::HTML;
-use Template::Zoom::Database::Rose;
-use Template::Zoom::Style::CSS;
-use Template::Zoom;
-use Template::Zoom::I18N;
-use Template::Zoom::PDF;
+use Template::Flute::Specification::XML;
+use Template::Flute::HTML;
+use Template::Flute::Database::Rose;
+use Template::Flute::Style::CSS;
+use Template::Flute;
+use Template::Flute::I18N;
+use Template::Flute::PDF;
use Vend::Config;
use Vend::Data;
@@ -46,7 +46,7 @@ sub pdf {
return;
}
- # input for Zoom template
+ # input for Flute template
if (exists $opt->{input}) {
%input = %{$opt->{input}};
}
@@ -54,7 +54,7 @@ sub pdf {
# parse specification file
my ($xml_spec, $spec);
- $xml_spec = new Template::Zoom::Specification::XML;
+ $xml_spec = new Template::Flute::Specification::XML;
unless ($spec = $xml_spec->parse_file($specification)) {
die "$0: error parsing $xml_file: " . $xml_spec->error() . "\n";
@@ -78,14 +78,14 @@ sub pdf {
};
- $i18n = new Template::Zoom::I18N ($sub);
+ $i18n = new Template::Flute::I18N ($sub);
}
# parse template
my ($html_object);
- $html_object = new Template::Zoom::HTML;
+ $html_object = new Template::Flute::HTML;
$html_object->parse_file($template, $spec);
@@ -102,29 +102,29 @@ sub pdf {
# create database object
my ($rose);
- $rose = new Template::Zoom::Database::Rose(dbh => database_exists_ref('products')->dbh());
+ $rose = new Template::Flute::Database::Rose(dbh => database_exists_ref('products')->dbh());
# create CSS object
my ($css);
- $css = new Template::Zoom::Style::CSS (template => $html_object);
+ $css = new Template::Flute::Style::CSS (template => $html_object);
- # create Template::Zoom object and process template
- my ($zoom);
+ # create Template::Flute object and process template
+ my ($flute);
- $zoom = new Template::Zoom (template => $html_object,
+ $flute = new Template::Flute (template => $html_object,
i18n => $i18n,
database => $rose,
filters => $opt->{filters},
values => $opt->{values},
);
- $zoom->process();
+ $flute->process();
# finally generate PDF
my ($pdf);
- $pdf = new Template::Zoom::PDF (template => $html_object,
+ $pdf = new Template::Flute::PDF (template => $html_object,
import => $opt->{import},
page_size => $opt->{page_size});
@@ -141,9 +141,9 @@ sub combine {
my ($output, $files, $opt) = @_;
my ($pdf, $import);
- $pdf = new Template::Zoom::PDF (file => $output, page_size => $opt->{page_size});
+ $pdf = new Template::Flute::PDF (file => $output, page_size => $opt->{page_size});
- $import = new Template::Zoom::PDF::Import;
+ $import = new Template::Flute::PDF::Import;
for my $pdf_file (@$files) {
$import->import(pdf => $pdf->{pdf}, file => $pdf_file);
diff --git a/lib/WellWell/Compose.pm b/lib/WellWell/Compose.pm
index 973871d..1bf18f1 100644
--- a/lib/WellWell/Compose.pm
+++ b/lib/WellWell/Compose.pm
@@ -28,7 +28,7 @@ use Vend::Tags;
use WellWell::Engine qw/load_engine/;
use WellWell::Compose::Engine::ITL;
-use WellWell::Compose::Engine::Zoom;
+use WellWell::Compose::Engine::Flute;
Vend::Config::parse_tag('UserTag', 'compose Order template');
Vend::Config::parse_tag('UserTag', 'compose HasEndTag');
diff --git a/lib/WellWell/Engine.pm b/lib/WellWell/Engine.pm
index 4567a73..9cd6aaf 100644
--- a/lib/WellWell/Engine.pm
+++ b/lib/WellWell/Engine.pm
@@ -27,7 +27,7 @@ our @ISA = qw(Exporter);
our @EXPORT_OK = qw/load_engine/;
our %engines = ('itl' => 'WellWell::Compose::Engine::ITL',
- 'zoom' => 'WellWell::Compose::Engine::Zoom');
+ 'flute' => 'WellWell::Compose::Engine::Flute');
use Vend::Config;
diff --git a/lib/WellWell/Zoom.pm b/lib/WellWell/Flute.pm
similarity index 86%
rename from lib/WellWell/Zoom.pm
rename to lib/WellWell/Flute.pm
index cd0af0b..fcdd61f 100644
--- a/lib/WellWell/Zoom.pm
+++ b/lib/WellWell/Flute.pm
@@ -1,4 +1,4 @@
-# WellWell::Zoom - WellWell template parsing routines
+# WellWell::Flute - WellWell template parsing routines
#
# Copyright (C) 2010 Stefan Hornburg (Racke) <racke at linuxia.de>.
#
@@ -17,7 +17,7 @@
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
-package WellWell::Zoom;
+package WellWell::Flute;
use strict;
use warnings;
@@ -25,29 +25,29 @@ use warnings;
use XML::Twig;
use Rose::DB::Object::QueryBuilder qw(build_select);
-use WellWell::Zoom::Increment;
+use WellWell::Flute::Increment;
use Vend::Config;
use Vend::Data;
use Vend::Tags;
-Vend::Config::parse_tag('UserTag', 'zoom MapRoutine WellWell::Zoom::zoom');
-Vend::Config::parse_tag('UserTag', 'zoom Order function name');
-Vend::Config::parse_tag('UserTag', 'zoom AddAttr');
-Vend::Config::parse_tag('UserTag', 'zoom HasEndTag');
+Vend::Config::parse_tag('UserTag', 'flute MapRoutine WellWell::Flute::flute');
+Vend::Config::parse_tag('UserTag', 'flute Order function name');
+Vend::Config::parse_tag('UserTag', 'flute AddAttr');
+Vend::Config::parse_tag('UserTag', 'flute HasEndTag');
-# zoom - [zoom] tag
+# flute - [flute] tag
-sub zoom {
+sub flute {
my ($function, $name, $opt, $body) = @_;
if ($function eq 'init') {
- unless (exists $::Scratch->{zoom}) {
- Vend::Tags->tmp('zoom', {});
+ unless (exists $::Scratch->{flute}) {
+ Vend::Tags->tmp('flute', {});
}
- $::Scratch->{zoom}->{$name}->{html} = $body;
- $::Scratch->{zoom}->{$name}->{object} = parse_template($body, $opt->{specs});
+ $::Scratch->{flute}->{$name}->{html} = $body;
+ $::Scratch->{flute}->{$name}->{object} = parse_template($body, $opt->{specs});
}
if ($function eq 'display') {
@@ -55,7 +55,7 @@ sub zoom {
$att_name, $att_spec, $att_tag_name, $att_tag_spec, %att_tags, $att_val,
$lel, %paste_pos, $rep_str);
- unless ($sref = $::Scratch->{zoom}->{$name}->{object}) {
+ unless ($sref = $::Scratch->{flute}->{$name}->{object}) {
die "Missing template $name\n";
}
@@ -74,7 +74,7 @@ sub zoom {
}
unless (keys %tables) {
- Vend::Tags->error({name => 'zoom', set => 'Missing tables in specification.'});
+ Vend::Tags->error({name => 'flute', set => 'Missing tables in specification.'});
return;
}
@@ -114,17 +114,17 @@ sub zoom {
}
for my $elt (@{$value->{elts}}) {
- if ($elt->{zoom_rep_sub}) {
+ if ($elt->{flute_rep_sub}) {
# call subroutine to handle this element
- $elt->{zoom_rep_sub}->($elt, $rep_str, $row);
+ $elt->{flute_rep_sub}->($elt, $rep_str, $row);
}
- elsif ($elt->{zoom_rep_att}) {
+ elsif ($elt->{flute_rep_att}) {
# replace attribute instead of embedded text (e.g. for <input>)
- $elt->set_att($elt->{zoom_rep_att}, $rep_str);
+ $elt->set_att($elt->{flute_rep_att}, $rep_str);
}
- elsif ($elt->{zoom_rep_elt}) {
+ elsif ($elt->{flute_rep_elt}) {
# use provided text element for replacement
- $elt->{zoom_rep_elt}->set_text($rep_str);
+ $elt->{flute_rep_elt}->set_text($rep_str);
}
else {
$elt->set_text($rep_str);
@@ -277,14 +277,14 @@ sub parse_handler {
if ($gi eq 'input') {
# replace value attribute instead of text
- $elt->{zoom_rep_att} = 'value';
+ $elt->{flute_rep_att} = 'value';
} elsif ($gi eq 'select') {
- $elt->{zoom_rep_sub} = \&set_selected;
+ $elt->{flute_rep_sub} = \&set_selected;
} elsif (! $elt->contains_only_text()) {
# contains real elements, so we have to be careful with
# set text and apply it only to the first PCDATA element
if ($elt_text = $elt->first_child('#PCDATA')) {
- $elt->{zoom_rep_elt} = $elt_text;
+ $elt->{flute_rep_elt} = $elt_text;
}
}
@@ -293,7 +293,7 @@ sub parse_handler {
my $subref = $Vend::Cfg->{Sub}{$sob->{sub}} || $Global::GlobalSub->{$sob->{sub}};
if (exists $sob->{scope} && $sob->{scope} eq 'element') {
- $elt->{zoom_rep_sub} = $subref;
+ $elt->{flute_rep_sub} = $subref;
} else {
$sob->{subref} = $subref;
}
@@ -306,7 +306,7 @@ sub parse_handler {
push (@{$sob->{elts}}, $elt);
# create increment object and record it for increment updates
- $sob->{increment} = new WellWell::Zoom::Increment;
+ $sob->{increment} = new WellWell::Flute::Increment;
push(@{$sref->{increments}->{$sob->{list}}->{array}}, $sob);
# record it for increment values
diff --git a/lib/WellWell/Zoom/Increment.pm b/lib/WellWell/Flute/Increment.pm
similarity index 93%
rename from lib/WellWell/Zoom/Increment.pm
rename to lib/WellWell/Flute/Increment.pm
index 7fe7749..684b9a3 100644
--- a/lib/WellWell/Zoom/Increment.pm
+++ b/lib/WellWell/Flute/Increment.pm
@@ -1,4 +1,4 @@
-# WellWell::Zoom::Increment - WellWell increment objects
+# WellWell::Flute::Increment - WellWell increment objects
#
# Copyright (C) 2010 Stefan Hornburg (Racke) <racke at linuxia.de>.
#
@@ -17,7 +17,7 @@
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
-package WellWell::Zoom::Increment;
+package WellWell::Flute::Increment;
use strict;
use warnings;
diff --git a/lib/WellWell/Iterate.pm b/lib/WellWell/Iterate.pm
index 0d04e3a..2099bb8 100644
--- a/lib/WellWell/Iterate.pm
+++ b/lib/WellWell/Iterate.pm
@@ -24,7 +24,7 @@ use warnings;
require Exporter;
our @ISA = qw(Exporter);
-our @EXPORT_OK = qw/load_zoom/;
+our @EXPORT_OK = qw/load_flute/;
use Vend::Config;
use Vend::Data;
@@ -50,7 +50,7 @@ sub iterate {
if (exists $opt->{query}) {
if (ref($opt->{query}) eq 'HASH') {
# use query builder
- $engine = load_zoom();
+ $engine = load_flute();
$iter = $engine->{database}->build($opt->{query});
}
}
@@ -97,17 +97,17 @@ sub iterate {
return join('', @out);
}
-sub load_zoom {
+sub load_flute {
my ($engine);
- if ($Vend::Session->{engine}->{zoomx}) {
- # reuse existing zoom engine
- $engine = $Vend::Session->{engine}->{zoom};
+ if ($Vend::Session->{engine}->{flutex}) {
+ # reuse existing flute engine
+ $engine = $Vend::Session->{engine}->{flute};
}
else {
- # load zoom engine
- $engine = load_engine('zoom', database_exists_ref('products')->dbh());
- $Vend::Session->{engine}->{zoom} = $engine;
+ # load flute engine
+ $engine = load_engine('flute', database_exists_ref('products')->dbh());
+ $Vend::Session->{engine}->{flute} = $engine;
}
return $engine;
diff --git a/plugins/wishlists/code/wishlist.tag b/plugins/wishlists/code/wishlist.tag
index d660c62..5caeca9 100644
--- a/plugins/wishlists/code/wishlist.tag
+++ b/plugins/wishlists/code/wishlist.tag
@@ -233,7 +233,7 @@ sub {
my $sql = qq{select sku$fields from cart_products where cart = $wishlist_code order by position};
- if ($opt->{zoom}) {
+ if ($opt->{flute}) {
my %build;
%build = (tables => ['cart_products', 'products'],
@@ -241,7 +241,7 @@ sub {
clauses => ['T1.sku = T2.sku'],
query => [cart => $wishlist_code]);
- return $Tag->zoom({function => 'display', name => 'wishlist', build => \%build});
+ return $Tag->flute({function => 'display', name => 'wishlist', build => \%build});
}
return $Tag->query ({sql => $sql, list => 1, prefix => 'item',
More information about the wellwell-devel
mailing list