From: Brian O'Connor Date: Fri, 16 Apr 2004 09:46:51 +0000 (+0000) Subject: Updates to the Turnkey templates for atoms, tt2 templates, and xml X-Git-Tag: v0.06~82 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82cedef0e6878ce7be2d2515eb042e5deeb1b226;p=dbsrgits%2FSQL-Translator.git Updates to the Turnkey templates for atoms, tt2 templates, and xml --- diff --git a/lib/SQL/Translator/Producer/Turnkey.pm b/lib/SQL/Translator/Producer/Turnkey.pm index 83ec2ca..2bcf783 100644 --- a/lib/SQL/Translator/Producer/Turnkey.pm +++ b/lib/SQL/Translator/Producer/Turnkey.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Turnkey; # ------------------------------------------------------------------- -# $Id: Turnkey.pm,v 1.41 2004-04-16 09:08:44 boconnor Exp $ +# $Id: Turnkey.pm,v 1.42 2004-04-16 09:46:51 boconnor Exp $ # ------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -22,7 +22,7 @@ package SQL::Translator::Producer::Turnkey; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.41 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.42 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -203,7 +203,7 @@ L. =head1 AUTHORS Allen Day Eallenday@ucla.eduE -Brian O\'Connor Ebrian.oconnor@excite.comE. +Brian O\'Connor Eboconnor@ucla.comE. =cut @@ -549,33 +549,34 @@ EOF } elsif($type eq 'template'){ return <<'EOF'; [% TAGS [- -] %] -[% MACRO renderpanel(panel,dbobject) BLOCK %] +[% MACRO renderpanel(panel,name,dbobject) BLOCK %] [% FOREACH p = panel.containers %] [% IF p.can_render(panel) %] [% IF p.type == 'Container' %] - [% renderpanel(p,dbobject) %] + [% renderpanel(p,name,dbobject) %] [% ELSE %] - [% IF panel.label == 'MainContainer' %] + [% IF p.type == 'major' %]
- [% IF p.name %] -
[% p.name %][% IF panel.type == 'major' %]: [% dbobject.name %][% END %]
+ [% IF name %] +
[% name %]
[% END %] - [% renderatom(p,dbobject) %] + [% renderatom(name,dbobject,p.containers[0]) %]
- [% ELSE %] + [% ELSIF p.type == 'minor' %]
- [% IF p.name %] -
[% p.name %][% IF panel.type == 'major' %]: [% dbobject.name %][% END %]
+ [% IF name %] + [% linkname = ref(p.containers[0]) %] +
[% linkname | replace('Turnkey::Atom::', '') %]
[% END %] - [% renderatom(p,dbobject) %] + [% renderatom(name,dbobject,p.containers[0]) %]
[% END %] @@ -617,7 +618,7 @@ EOF [% obj %] [% END %] [% END %] -[% MACRO renderatom(atom, dbobject) SWITCH atom.name %] +[% MACRO renderatom(name, dbobject, atom) SWITCH name %] [- FOREACH node = nodes -] [- IF !node.value.is_trivial_link -] [% CASE '[- format_table(node.key) -]' %] @@ -643,12 +644,15 @@ EOF return <<'EOF'; [%- TAGS [- -] -%] [-- IF !node.is_trivial_link --] +[% records = atom.render(dbobject) %] [% rowcount = 0 %] [% IF atom.focus == "yes" %] +[% FOREACH record = records %] +[% fields = record.data %] [- FOREACH field = node.data_fields -] [- IF field != "1" -] - + [- END -] [- END -] [- FOREACH field = node.edges -] @@ -658,6 +662,7 @@ EOF [% IF (rowcount > 1) %] [% END %] [% rowcount = rowcount + 1 %]
[- field -][% obj2link(dbobject.[- field -]) %]
[- field -][% obj2link(fields.[- field -]) %]

+[% END %] [% ELSE %]
    [% FOREACH record = atom.render(dbobject) %]