[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 803b6ea37dbb377a65a4b129dc2a062061c41467
Stefan Hornburg
racke at rt.icdevgroup.org
Sat May 30 10:49:28 UTC 2009
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange wellwell catalog".
The branch, master has been updated
via 803b6ea37dbb377a65a4b129dc2a062061c41467 (commit)
from d68c878e714b223b226f3ffd6bcf971e661f034c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 803b6ea37dbb377a65a4b129dc2a062061c41467
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Sat May 30 12:48:35 2009 +0200
prevent automatic wrapping of components unless COMPOSE_CONTAINER is set
add documentation about [compose]
-----------------------------------------------------------------------
Summary of changes and diff:
README | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-----
catalog.cfg | 2 +-
code/compose.tag | 52 +++++++++++++++++++++++++++++++++----------------
3 files changed, 87 insertions(+), 24 deletions(-)
diff --git a/README b/README
index b71e3c9..fbe7a8f 100644
--- a/README
+++ b/README
@@ -13,6 +13,7 @@ Flaws in Standard / Interchange
*******************************
* two shopping carts components to maintain
+* components need to specified on every page instead of globally
Goals
*****
@@ -33,6 +34,56 @@ Interchange 5.7.1 and at least:
Dispatch.pm 1.103
Order.pm 2.104
+Composition
+***********
+
+[compose] basically just evaluates the components passed inside the [compose]
+tag and fits them into the containers inside the template.
+
+Templates
+=========
+
+Templates are HTML files with placeholders for the containers.
+The placeholders are uppercase words inside curly braces.
+A very simple template would look like:
+
+<html>
+<head>
+{HTMLHEAD}
+</head>
+<body>
+{BODY}
+</body>
+</html>
+
+Components
+==========
+
+Components are evaluated as ITL and put into the placeholders.
+
+[compose
+ component.body="hello_world"
+]
+
+To automatically create a wrapping div for each component,
+set COMPOSE_CONTAINER to 1.
+
+Automatic components/attributes
+===============================
+
+Usually certain components appear on every page and you don't
+want to specify them inside the [compose] tag.
+
+[compose] examines the following variables which set
+components and attributes globally:
+
+MV_COMPONENT_AUTO
+MV_ATTRIBUTE_AUTO
+
+Example:
+Variable MV_COMPONENT_AUTO htmlhead:htmlhead left:menu,categorynav body:infobox
+Variable MV_ATTRIBUTE_AUTO menu.name=main
+
Users, Roles and Permissions
****************************
@@ -116,12 +167,6 @@ Menus
Only menu entries with sufficient permission will be displayed
(permission field in menus table).
-Automatic components/attributes
-*******************************
-
-MV_COMPONENT_AUTO
-MV_ATTRIBUTE_AUTO
-
Forms
*****
diff --git a/catalog.cfg b/catalog.cfg
index b311a61..a8d734b 100644
--- a/catalog.cfg
+++ b/catalog.cfg
@@ -28,7 +28,7 @@ Autoload init
# Automatic components and attributes
Variable MV_COMPONENT_AUTO htmlhead:htmlhead left:menu,categorynav body:infobox,local_body
-Variable MV_ATTRIBUTE_AUTO htmlhead.container= infobox.skipblank=1 menu.name=main
+Variable MV_ATTRIBUTE_AUTO menu.name=main
Variable TITLE WellWell Shop
diff --git a/code/compose.tag b/code/compose.tag
index 53eae9a..cf57a18 100644
--- a/code/compose.tag
+++ b/code/compose.tag
@@ -16,7 +16,7 @@ sub dots2hash {
sub {
my ($template, $opt, $body) = @_;
- my (%acl, %forms, $template_file);
+ my (%acl, %forms, $template_file, $container);
if ($opt->{acl}) {
# check permissions first
@@ -132,6 +132,9 @@ sub {
}
}
+ # determine whether we wrap a container around components
+ $container = $Variable->{COMPOSE_CONTAINER} || $opt->{container};
+
# process components ([compose components.placeholder='COMP_SPEC'...])
# placeholder => "{NAME}" within template file
# COMP_SPEC => "component1=alias1 c2=a2, c3 c4, c5"
@@ -151,7 +154,7 @@ sub {
}
for my $comp (@components) {
- my (%var);
+ my (%var, $type);
if ($forms{$comp}) {
# use precalculated form
@@ -175,8 +178,10 @@ sub {
$Variable->{uc($attr)} = $component_attributes->{$attr};
}
- # figure out whether to output class= or id=
- my $type = $attributes{$alias||$name}{css_type} || 'class';
+ if ($container) {
+ # figure out whether to output class= or id=
+ $type = $attributes{$alias||$name}{css_type} || 'class';
+ }
# locate component
$components_file = "$Variable->{MV_COMPONENT_DIR}/$name";
@@ -194,20 +199,33 @@ sub {
$Tag->error({name => 'component', set => "Component $name not found."});
}
}
-
- if ($component_content =~ /\S/
- || ! $component_attributes->{skipblank}) {
- if (exists $component_attributes->{container}
- && $component_attributes->{container} eq '') {
- push (@content, $component_content);
- } else {
- push (@content,
- qq{<div $type='$name'>} .
- ( $alias ? qq{<div $type='$alias'>} : '' ) .
- $component_content .
- ( $alias ? qq{</div>} : '' ) .
- q{</div>});
+
+ my $wrap = 0;
+
+ if ($container) {
+ if ($component_content =~ /\S/) {
+ # check whether container is explicitly suppressed
+ unless (exists $component_attributes->{container}
+ && $component_attributes->{container} eq '') {
+ $wrap = 1;
+ }
}
+ elsif (! $component_attributes->{skipblank}) {
+ # even wrap empty components
+ $wrap = 1;
+ }
+ }
+
+ if ($wrap) {
+ push (@content,
+ qq{<div $type='$name'>} .
+ ( $alias ? qq{<div $type='$alias'>} : '' ) .
+ $component_content .
+ ( $alias ? qq{</div>} : '' ) .
+ q{</div>});
+ }
+ else {
+ push (@content, $component_content);
}
# reset variables
hooks/post-receive
--
Interchange wellwell catalog
More information about the wellwell-devel
mailing list