[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 57cc1163cadc37f8bb8fa565f7a53608d70e3444

Stefan Hornburg racke at rt.icdevgroup.org
Tue Apr 7 12:44:12 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  57cc1163cadc37f8bb8fa565f7a53608d70e3444 (commit)
      from  ec313b5be3a0d100dab51a7e7886b38145f1ac5c (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 57cc1163cadc37f8bb8fa565f7a53608d70e3444
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Tue Apr 7 14:43:41 2009 +0200

    allow load hook to provide defaults for form attributeallow load hook to provide defaults for form attributes

-----------------------------------------------------------------------

Summary of changes and diff:
 README        |    6 ++++--
 code/form.tag |   23 +++++++++++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 5369433..b50710b 100755
--- a/README
+++ b/README
@@ -190,8 +190,10 @@ called if the profile check for the form part has been failed.
 The return value of the load hook is either a false value or
 a hash reference which can contain the following members:
 
-page	triggers a bounce to that page instead of displaying
-        the form
+page       triggers a bounce to that page instead of displaying
+           the form
+
+attributes hash reference providing defaults for form attributes
 
 Save
 ....
diff --git a/code/form.tag b/code/form.tag
index 3e987d9..0e36934 100644
--- a/code/form.tag
+++ b/code/form.tag
@@ -108,6 +108,9 @@ sub {
 				}
 			} 
 			elsif ($_->{position} == $pos) {
+				# clear form attributes
+				delete $Scratch->{form_attributes}->{$opt->{series}};
+
 				# check for appropriate hook for loading
 				my ($hook, $hooksub, $hookret);
 
@@ -117,9 +120,14 @@ sub {
 				if ($hooksub) {
 					$hookret = $hooksub->($_->{part});
 
-					if ($hookret && $hookret->{page}) {
-						$Tag->tmp('form_series_bounce', $hookret->{page});
-						return;
+					if ($hookret) {
+						if ($hookret->{page}) {
+							$Tag->tmp('form_series_bounce', $hookret->{page});
+							return;
+						}
+						if ($hookret->{attributes}) {
+							$Scratch->{form_attributes}->{$opt->{series}} = $hookret->{attributes};
+						}
 					}
 				}
 				else {
@@ -144,16 +152,23 @@ sub {
 		}
 	
 		# form elements
-		my ($elset, $attrset, $qcomp);
+		my ($elset, $attrref, $attrset, $qcomp);
 
 		$qcomp = $Db{form_elements}->quote($opt->{part});
 
 		$elset = $Db{form_elements}->query({sql => qq{select name,label,widget from form_elements where component = $qcomp order by priority desc, code asc}, hashref => 1});
 
+		# form attributes from load hook
+		$attrref = $Scratch->{form_attributes}->{$opt->{series}} || {};
+
 		for my $elref (@$elset) {
 			# fetch attributes for form element
 			my (%attributes, $required);
 		
+			if (exists $attrref->{$elref->{name}}) {
+				%attributes = %{$attrref->{$elref->{name}}};
+			}
+
 			$attrset = $Db{form_attributes}->query(q{select attribute,value from form_attributes where name = '%s' and (component = '' or component = '%s') order by component asc}, $elref->{name}, $opt->{part});
 			for (@$attrset) {
 				$attributes{$_->[0]} = $_->[1];


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list