[interchange-cvs] interchange - heins modified code/UI_Tag/flex_select.coretag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Sun Feb 22 15:05:30 EST 2004


User:      heins
Date:      2004-02-22 20:05:29 GMT
Modified:  code/UI_Tag flex_select.coretag
Log:
* Allow filter to be passed as parameter to [flex-select].

    [flex-select
		filter.order_date=convert_date
		table=transactions
		/]

  will put that filter in without having to define the field metadata
  or the mv_data_fields setting.

Revision  Changes    Path
1.6       +26 -4     interchange/code/UI_Tag/flex_select.coretag


rev 1.6, prev_rev 1.5
Index: flex_select.coretag
===================================================================
RCS file: /var/cvs/interchange/code/UI_Tag/flex_select.coretag,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- flex_select.coretag	5 Dec 2003 23:44:33 -0000	1.5
+++ flex_select.coretag	22 Feb 2004 20:05:29 -0000	1.6
@@ -181,6 +181,12 @@
 		return flex_select_init($table, $opt);
 	}
 
+	my $filter;
+	if(ref($opt->{filter}) eq 'HASH') {
+		$filter = $opt->{filter};
+	}
+	$filter ||= {};
+
 	my $spec;
 	my $stmt;
 	my $q;
@@ -705,8 +711,15 @@
 				my $stuff = '';
 				for(qw/ class style align valign /) {
 					my $tag = "header_cell_$_";
-					my $thing = $m->{$tag} || $opt->{$tag}
-						or next;
+					my $thing;
+					if(ref $opt->{$tag}) {
+						$thing = $opt->{$tag}{$col} || $m->{$tag} || $opt->{"all_$tag"}
+							or next;
+					}
+					else {
+						$thing = $m->{$tag} || $opt->{$tag}
+							or next;
+					}
 					encode_entities($thing);
 					$stuff .= qq{ $_="$thing"};
 				}
@@ -719,8 +732,15 @@
 				my $stuff = '';
 				for(qw/ class style align valign /) {
 					my $tag = "data_cell_$_";
-					my $thing = $m->{$tag} || $opt->{$tag}
-						or next;
+					my $thing;
+					if(ref $opt->{$tag}) {
+						$thing = $opt->{$tag}{$col} || $m->{$tag} || $opt->{"all_$tag"}
+							or next;
+					}
+					else {
+						$thing = $m->{$tag} || $opt->{$tag}
+							or next;
+					}
 					encode_entities($thing);
 					$stuff .= qq{ $_="$thing"};
 				}
@@ -836,6 +856,8 @@
 
 		# Set up some stuff for the data cells;
 		$style[$idx] = $data_cell_style->($mcol);
+
+		$filter_show[$idx] = $filter->{$mcol} if $filter->{$mcol};
 		$filter_show[$idx] ||= $m->{fs_display_filter} || 'encode_entities';
 		$filter_show[$idx] .= ' encode_entities'
 			 unless $filter_show[$idx] =~ /\b(?:encode_)?entities\b/;








More information about the interchange-cvs mailing list