[interchange-cvs] interchange - heins modified lib/Vend/Table/Editor.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Apr 11 19:32:20 EDT 2005


User:      heins
Date:      2005-04-11 23:32:20 GMT
Modified:  lib/Vend/Table Editor.pm
Log:
* Add new automatic options generator -- CodeDef::(Filter|JavascriptCheck|etc.).

* By placing the string 'codedef:filter' in the options field, you
  can pull out the Description members of any CodeDef region.

* For example, if you wanted to build a generator for OrderCheck strings,
  and had custom OrderCheck members, you just define the Description
  as:

  	CodeDef  foo  OrderCheck  1
  	CodeDef  foo  Description The foo check
  	CodeDef  bar  OrderCheck  1
  	CodeDef  bar  Description The bar check

  When you use [display name=checks type=select options="codedef:OrderCheck"]
  you generate:

  <select name="checks">
  	<option value="foo">The foo check
  	<option value="bar">The bar check
  </select>

* Will work for any CodeDef, including UserTag. Does require a Description
  member, though, which are largely undefined.

Revision  Changes    Path
1.65      +27 -2     interchange/lib/Vend/Table/Editor.pm


rev 1.65, prev_rev 1.64
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- Editor.pm	10 Apr 2005 05:25:14 -0000	1.64
+++ Editor.pm	11 Apr 2005 23:32:20 -0000	1.65
@@ -1,6 +1,6 @@
 # Vend::Table::Editor - Swiss-army-knife table editor for Interchange
 #
-# $Id: Editor.pm,v 1.64 2005/04/10 05:25:14 mheins Exp $
+# $Id: Editor.pm,v 1.65 2005/04/11 23:32:20 mheins Exp $
 #
 # Copyright (C) 2002-2003 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.64 $, 10);
+$VERSION = substr(q$Revision: 1.65 $, 10);
 
 use Vend::Util;
 use Vend::Interpolate;
@@ -600,6 +600,30 @@
 					my @tables = $Tag->list_databases();
 					$record->{passed} = join (',', "=--none--", @tables);
 				}
+				elsif($passed =~ /^\s*codedef:+(\w+)\s*$/) {
+					my $tag = $1;
+
+					my @keys = keys %{$Global::CodeDef};
+
+					for(@keys) {
+						if(lc($tag) eq lc($_)) {
+							$tag = $_;
+						}
+					}
+
+					my $desc = $Global::CodeDef->{$tag};
+					my @out;
+
+					if($desc = $desc->{Description}) {
+						while( my($k, $v) = each %$desc) {
+							push @out, [$k, $v];
+						}
+					}
+					else {
+						push @out, ['', errmsg('--none--') ];
+					}
+					$record->{passed} = \@out;
+				}
 				elsif($passed eq 'filters') {
 					$record->{passed} = filters(1);
 				}
@@ -3618,6 +3642,7 @@
 							help				=> $help->{$c},
 							help_url			=> $help_url->{$c},
 							href				=> $wid_href->{$c},
+							js_check			=> $js_check->{$c},
 							key					=> $key,
 							label				=> $label->{$c},
 							lookup				=> $lookup->{$c},








More information about the interchange-cvs mailing list