[ic] Passing options to widgets via table-editor
Bill Carr
bill at bottlenose-wine.com
Thu Mar 13 10:50:18 EST 2008
On Mar 13, 2008, at 10:40 AM, Mike Heins wrote:
> User: heins
> Date: 2008-03-13 14:17:28 GMT
> Modified: lib/Vend/Table Editor.pm
> Log:
> * Add ability to set arbitrary options from table editor callouts.
> Sparked by:
>
> http://www.icdevgroup.org/pipermail/interchange-users/2008-March/048740.html
>
> Now allows an option to be set with the opts callout, for example
> the "ampm"
> option for the time widget.
>
> [table-editor
> label.starttime='Start Time'
> filter.starttime=date_change
> widget.starttime=time
> opts.starttime="ampm=1"
> ]
>
> Options are specified in Interchange string option format as
> interpreted
> by get_option_hash() routine.
>
>
> Revision Changes Path
> 1.90 +13 -3 interchange/lib/Vend/Table/Editor.pm
>
>
> rev 1.90, prev_rev 1.89
> Index: Editor.pm
> ===================================================================
> RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
> retrieving revision 1.89
> retrieving revision 1.90
> diff -u -r1.89 -r1.90
> --- Editor.pm 18 Sep 2007 18:51:19 -0000 1.89
> +++ Editor.pm 13 Mar 2008 14:17:28 -0000 1.90
> @@ -1,6 +1,6 @@
> # Vend::Table::Editor - Swiss-army-knife table editor for Interchange
> #
> -# $Id: Editor.pm,v 1.89 2007/09/18 18:51:19 racke Exp $
> +# $Id: Editor.pm,v 1.90 2008/03/13 14:17:28 mheins Exp $
> #
> # Copyright (C) 2002-2007 Interchange Development Group
> # Copyright (C) 2002 Mike Heins <mike at perusion.net>
> @@ -26,7 +26,7 @@
> package Vend::Table::Editor;
>
> use vars qw($VERSION);
> -$VERSION = substr(q$Revision: 1.89 $, 10);
> +$VERSION = substr(q$Revision: 1.90 $, 10);
>
> use Vend::Util;
> use Vend::Interpolate;
> @@ -940,6 +940,14 @@
> $record->{$_} =~ s/_UI_KEY_/$key/g;
> }
>
> + if($opt->{opts}) {
> + my $r = get_option_hash(delete $opt->{opts});
> + for my $k (keys %$r) {
> + $record->{$k} = $r->{$k};
> + }
> + }
> +
> +
> #::logDebug("overriding defaults");
> #::logDebug("passed=$record->{passed}") if $record->{debug};
> my %things = (
> @@ -957,7 +965,7 @@
> $record->{$k} = $v;
> }
>
> -#::logDebug("calling Vend::Form");
> +#::logDebug("calling Vend::Form with record=" . ::uneval($record));
> if($record->{save_defaults}) {
> my $sd = $Vend::Session->{meta_defaults} ||= {};
> $sd = $sd->{"${table}::$column"} ||= {};
> @@ -2336,6 +2344,7 @@
> my $meta = $opt->{meta};
> my $js_check = $opt->{js_check};
> my $maxlength = $opt->{maxlength};
> + my $opts = $opt->{opts};
> my $options = $opt->{options};
> my $outboard = $opt->{outboard};
> my $override = $opt->{override};
> @@ -3966,6 +3975,7 @@
> options => $options->{$c},
> outboard => $outboard->{$c},
> override => $overridden,
> + opts => $opts->{$c},
> passed => $passed->{$c},
> pre_filter => $pre_filter->{$c},
> prepend => $prepend->{$c},
>
>
>
Thanks a lot. I'll try it out.
Bill Carr
bill at bottlenose-wine.com
More information about the interchange-users
mailing list