[interchange-cvs] interchange - heins modified 18 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Apr 13 12:13:29 EDT 2005


User:      heins
Date:      2005-04-13 16:13:28 GMT
Modified:  dist/lib/UI/pages/admin meta_editor.html
Modified:  code/Filter convert_date.filter filter_select.filter
Modified:           italics.filter large.filter linkdecode.filter
Modified:           next_sequential.filter pgbool.filter pgbooln.filter
Modified:           qb_safe.filter restrict_html.filter
Modified:           show_null.filter value.filter
Modified:           vars_and_comments.filter
Modified:  lib/Vend Config.pm Form.pm Util.pm
Modified:  lib/Vend/Table Editor.pm
Log:
* Add Stefan's suggested Visibility modification for CodeDef options.
  By default the visibility is public.

  It wants something like:

  		codedef:JavaScriptCheck

  Will return all public Descriptions.

  		codedef:JavaScriptCheck:private         -- return public and private.
  		codedef:JavaScriptCheck:private,admin   -- return public,private,admin

  If Visibility is "with Foo::Bar", it checks to see if $Foo::Bar::VERSION
  is true and returns the option if it is.

* Create routine to automatically select Routine for certain type of
  CodeDef. Currently there are many separate methods of doing that.
  This one prefers local over global, and is called with:

  	   codedef_routine($type, $name);

  For instance, codedef_routine('OrderCheck', 'multistate') will
  return $Vend::Cfg->{CodeDef}{OrderCheck}{multistate} if it exists,
  otherwise returns $Global::CodeDef->{OrderCheck}{multistate}.

* Modify Form.pm to use this for JavaScriptCheck. More will be
  added.

* Modify filters to add private Visibility for non-mainstream filters.

* Modify meta editor to use this.

Revision  Changes    Path
2.16      +1 -0      interchange/dist/lib/UI/pages/admin/meta_editor.html


rev 2.16, prev_rev 2.15
Index: meta_editor.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/meta_editor.html,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -r2.15 -r2.16
--- meta_editor.html	11 Apr 2005 23:36:50 -0000	2.15
+++ meta_editor.html	13 Apr 2005 16:13:27 -0000	2.16
@@ -141,6 +141,7 @@
 		'extended.ui_sort_option' => qq{=--default--,f=Case insensitive, fr=Case insensitive/Reverse, n=Numeric, nr=Reverse Numeric},
 		'field' => qq{columns::$m_table},
 		'extended.js_check' => qq{codedef::JavascriptCheck},
+		'filter' => 'codedef:filter:empty',
 	},
 
 	filter => {
@@ -276,4 +277,4 @@
 	][/table-editor]
 
 @_UI_STD_FOOTER_@
-<!-- page: @@MV_PAGE@@ version: $Revision: 2.15 $ -->
+<!-- page: @@MV_PAGE@@ version: $Revision: 2.16 $ -->



1.5       +3 -2      interchange/code/Filter/convert_date.filter


rev 1.5, prev_rev 1.4
Index: convert_date.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/convert_date.filter,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- convert_date.filter	12 Apr 2005 03:23:18 -0000	1.4
+++ convert_date.filter	13 Apr 2005 16:13:27 -0000	1.5
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: convert_date.filter,v 1.4 2005/04/12 03:23:18 mheins Exp $
+# $Id: convert_date.filter,v 1.5 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef convert_date Filter
-#CodeDef convert_date Description Convert date
+CodeDef convert_date Description Convert date
+CodeDef convert_date Visibility  private
 CodeDef convert_date Routine <<EOR
 sub {
 	my $time = shift(@_);



1.2       +4 -3      interchange/code/Filter/filter_select.filter


rev 1.2, prev_rev 1.1
Index: filter_select.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/filter_select.filter,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- filter_select.filter	12 Apr 2005 20:09:01 -0000	1.1
+++ filter_select.filter	13 Apr 2005 16:13:27 -0000	1.2
@@ -1,12 +1,13 @@
 # Copyright 2005 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: filter_select.filter,v 1.1 2005/04/12 20:09:01 mheins Exp $
+# $Id: filter_select.filter,v 1.2 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef calculated Filter
 CodeDef calculated Alias filter_select
 CodeDef filter_select Filter
-CodeDef filter_select Description Date widget
-CodeDef filter_select Version $Revision: 1.1 $
+CodeDef filter_select Description Auto-select filter
+CodeDef filter_select Visibility private
+CodeDef filter_select Version $Revision: 1.2 $
 CodeDef filter_select Routine <<EOR
 sub {
 	## This replaces the calculated filter for the survey



1.3       +3 -2      interchange/code/Filter/italics.filter


rev 1.3, prev_rev 1.2
Index: italics.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/italics.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- italics.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ italics.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: italics.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: italics.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef italics Filter
-#CodeDef italics Description HTML Italics
+CodeDef italics Description HTML Italics
+CodeDef italics Visibility  private
 CodeDef italics Routine <<EOR
 sub {
 	return '<i>' . shift(@_) . '</i>';



1.3       +3 -2      interchange/code/Filter/large.filter


rev 1.3, prev_rev 1.2
Index: large.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/large.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- large.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ large.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: large.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: large.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef large Filter
-#CodeDef large Description HTML large
+CodeDef large Description HTML large
+CodeDef large Visibility  private
 CodeDef large Routine <<EOR
 sub {
 	return '<large>' . shift(@_) . '</large>';



1.4       +3 -2      interchange/code/Filter/linkdecode.filter


rev 1.4, prev_rev 1.3
Index: linkdecode.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/linkdecode.filter,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linkdecode.filter	12 Apr 2005 03:23:18 -0000	1.3
+++ linkdecode.filter	13 Apr 2005 16:13:27 -0000	1.4
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: linkdecode.filter,v 1.3 2005/04/12 03:23:18 mheins Exp $
+# $Id: linkdecode.filter,v 1.4 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef linkdecode Filter
-#CodeDef linkdecode Description URLdecode link text
+CodeDef linkdecode Description URLdecode link text
+CodeDef linkdecode Visibility  private
 CodeDef linkdecode Routine <<EOR
 sub {
 	my $body = shift;



1.4       +3 -2      interchange/code/Filter/next_sequential.filter


rev 1.4, prev_rev 1.3
Index: next_sequential.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/next_sequential.filter,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- next_sequential.filter	12 Apr 2005 03:23:18 -0000	1.3
+++ next_sequential.filter	13 Apr 2005 16:13:27 -0000	1.4
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: next_sequential.filter,v 1.3 2005/04/12 03:23:18 mheins Exp $
+# $Id: next_sequential.filter,v 1.4 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef next_sequential Filter
-#CodeDef next_sequential Description Next sequential
+CodeDef next_sequential Description Next sequential
+CodeDef next_sequential Visibility  private
 CodeDef next_sequential Routine <<EOR
 sub {
 	my ($value, $field, $table, $col, $qualifier) = @_;



1.3       +3 -2      interchange/code/Filter/pgbool.filter


rev 1.3, prev_rev 1.2
Index: pgbool.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/pgbool.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pgbool.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ pgbool.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: pgbool.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: pgbool.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef pgbool Filter
-#CodeDef pgbool Description Postgres Boolean
+CodeDef pgbool Description Postgres Boolean
+CodeDef pgbool Visibility  private
 CodeDef pgbool Routine <<EOR
 sub {
 	my $val = shift;



1.3       +3 -2      interchange/code/Filter/pgbooln.filter


rev 1.3, prev_rev 1.2
Index: pgbooln.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/pgbooln.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pgbooln.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ pgbooln.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: pgbooln.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: pgbooln.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef pgbooln Filter
-#CodeDef pgbool Description Postgres Boolean NOT
+CodeDef pgbooln Description Postgres Boolean NOT
+CodeDef pgbooln Visibility  private
 CodeDef pgbooln Routine <<EOR
 sub {
 	my $val = shift;



1.5       +3 -2      interchange/code/Filter/qb_safe.filter


rev 1.5, prev_rev 1.4
Index: qb_safe.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/qb_safe.filter,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- qb_safe.filter	12 Apr 2005 03:23:18 -0000	1.4
+++ qb_safe.filter	13 Apr 2005 16:13:27 -0000	1.5
@@ -1,14 +1,15 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: qb_safe.filter,v 1.4 2005/04/12 03:23:18 mheins Exp $
+# $Id: qb_safe.filter,v 1.5 2005/04/13 16:13:27 mheins Exp $
 
 # QuickBooks Safe: make data safe for quickbooks
 # QB will crash at the drop of a hat, so don't forget to remove 
 # any unfriendly characters.
 
 CodeDef qb_safe Filter
-#CodeDef qb_safe Description Safe for Quickbooks
+CodeDef qb_safe Description Safe for Quickbooks
+CodeDef qb_safe Visibility  private
 CodeDef qb_safe Routine <<EOR
 sub {
 	my $val = shift;



1.3       +3 -2      interchange/code/Filter/restrict_html.filter


rev 1.3, prev_rev 1.2
Index: restrict_html.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/restrict_html.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- restrict_html.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ restrict_html.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: restrict_html.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: restrict_html.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef restrict_html Filter
-#CodeDef restrict_html Description Restrict HTML
+CodeDef restrict_html Description Restrict HTML
+CodeDef restrict_html Visibility  private
 CodeDef restrict_html Routine <<EOR
 sub {
 	my $val = shift;



1.3       +3 -2      interchange/code/Filter/show_null.filter


rev 1.3, prev_rev 1.2
Index: show_null.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/show_null.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- show_null.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ show_null.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: show_null.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: show_null.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef show_null Filter
-#CodeDef show_null Description Show NULL
+CodeDef show_null Description Show NULL
+CodeDef show_null Visibility  private
 CodeDef show_null Routine <<EOR
 sub {
 	my $val = shift;



1.3       +3 -2      interchange/code/Filter/value.filter


rev 1.3, prev_rev 1.2
Index: value.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/value.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- value.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ value.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,10 +1,11 @@
 # Copyright 2002-2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Copyright 1996-2002 Red Hat, Inc.
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: value.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: value.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef value Filter
-#CodeDef value Description Return $Values->{VALUE}
+CodeDef value Description Return $Values->{VALUE}
+CodeDef value Visibility  private
 CodeDef value Routine <<EOR
 sub {
 	return $::Values->{$_[0]};



1.3       +3 -2      interchange/code/Filter/vars_and_comments.filter


rev 1.3, prev_rev 1.2
Index: vars_and_comments.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/vars_and_comments.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vars_and_comments.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ vars_and_comments.filter	13 Apr 2005 16:13:27 -0000	1.3
@@ -1,9 +1,10 @@
 # Copyright 2004 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: vars_and_comments.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: vars_and_comments.filter,v 1.3 2005/04/13 16:13:27 mheins Exp $
 
 CodeDef vars_and_comments Filter
-#CodeDef vars_and_comments Description Vars/comments
+CodeDef vars_and_comments Description Vars/comments
+CodeDef vars_and_comments Visibility  private
 CodeDef vars_and_comments Routine <<EOR
 sub {
 	my $body = shift;



2.162     +3 -2      interchange/lib/Vend/Config.pm


rev 2.162, prev_rev 2.161
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.161
retrieving revision 2.162
diff -u -r2.161 -r2.162
--- Config.pm	12 Apr 2005 15:14:39 -0000	2.161
+++ Config.pm	13 Apr 2005 16:13:27 -0000	2.162
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.161 2005/04/12 15:14:39 mheins Exp $
+# $Id: Config.pm,v 2.162 2005/04/13 16:13:27 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -49,7 +49,7 @@
 use Vend::File;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.161 $, 10);
+$VERSION = substr(q$Revision: 2.162 $, 10);
 
 my %CDname;
 my %CPname;
@@ -3816,6 +3816,7 @@
 	attrdefault		attrDefault
 	cannest			canNest
 	description  	Description
+	visibility  	Visibility
 	documentation	Documentation
 	extrameta		ExtraMeta
 	gobble			Gobble



2.52      +9 -9      interchange/lib/Vend/Form.pm


rev 2.52, prev_rev 2.51
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.51
retrieving revision 2.52
diff -u -r2.51 -r2.52
--- Form.pm	12 Apr 2005 15:14:39 -0000	2.51
+++ Form.pm	13 Apr 2005 16:13:27 -0000	2.52
@@ -1,6 +1,6 @@
 # Vend::Form - Generate Form widgets
 # 
-# $Id: Form.pm,v 2.51 2005/04/12 15:14:39 mheins Exp $
+# $Id: Form.pm,v 2.52 2005/04/13 16:13:27 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -38,7 +38,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.51 $, 10);
+$VERSION = substr(q$Revision: 2.52 $, 10);
 
 @EXPORT = qw (
 	display
@@ -1102,14 +1102,14 @@
 	$opt->{rows}      ||= $opt->{height};
 
 	if($opt->{js_check}) {
-		my @checks = split /[\s,\0]+/, $opt->{js_check};
-		my $js = $Global::CodeDef->{JavaScriptCheck} || {};
-		my $jsl = $Vend::Cfg->{CodeDef}{JavaScriptCheck} || {};
-		$js = $js->{Routine} || {};
-		$jsl = $jsl->{Routine} || {};
+		my @checks = grep /\w/, split /[\s,\0]+/, $opt->{js_check};
 		for(@checks) {
-			my $sub = $jsl->{$_} || $js->{$_} or next;
-			$sub->($opt);
+			if(my $sub = Vend::Util::codedef_routine('JavaScriptCheck', $_)) {
+				$sub->($opt);
+			}
+			else {
+				::logError('Unknown %s: %s', 'JavaScriptCheck', $_);
+			}
 		}
 	}
 



2.80      +98 -2     interchange/lib/Vend/Util.pm


rev 2.80, prev_rev 2.79
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.79
retrieving revision 2.80
diff -u -r2.79 -r2.80
--- Util.pm	31 Jan 2005 21:40:35 -0000	2.79
+++ Util.pm	13 Apr 2005 16:13:27 -0000	2.80
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.79 2005/01/31 21:40:35 jonc Exp $
+# $Id: Util.pm,v 2.80 2005/04/13 16:13:27 mheins Exp $
 # 
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -87,7 +87,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.79 $, 10);
+$VERSION = substr(q$Revision: 2.80 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -1965,6 +1965,102 @@
 	}
 
 	$ok;
+}
+
+sub codedef_routine {
+	my ($tag, $routine, $modifier) = @_;
+
+	my @tries;
+	my $tried;
+
+	RESOLVEDEF: {
+		if($Vend::Cfg->{CodeDef}{$tag}) {
+			push @tries, $Vend::Cfg->{CodeDef}{$tag}{Routine} || {};
+		}
+		if($Global::CodeDef->{$tag}) {
+			push @tries, $Global::CodeDef->{$tag}{Routine} || {};
+		}
+		if(! @tries and ! $tried++) {
+			my @keys = keys %{$Vend::Cfg->{CodeDef}};
+			push @keys, keys %{$Global::CodeDef};
+			for(@keys) {
+				if(lc($tag) eq lc($_)) {
+					$tag = $_;
+					redo RESOLVEDEF;
+				}
+			}
+		}
+	}
+
+	for(@tries) {
+		return $_->{$routine} if $_->{$routine};
+	}
+	return undef;
+}
+
+sub codedef_options {
+	my ($tag, $modifier) = @_;
+
+	my @out;
+	my $empty;
+
+	my @keys = keys %{$Vend::Cfg->{CodeDef}};
+	push @keys, keys %{$Global::CodeDef};
+
+	my %gate = ( public => 1 );
+
+	my @mod = grep /\w/, split /[\s\0,]+/, $modifier;
+	for(@mod) {
+		if($_ eq 'all') {
+			$gate{private} = 1;
+		}
+
+		if($_ eq 'empty') {
+			$empty = ['', errmsg('--select--')];
+		}
+
+		if($_ eq 'admin') {
+			$gate{admin} = 1;
+		}
+	}
+
+	for(@keys) {
+		if(lc($tag) eq lc($_)) {
+			$tag = $_;
+			last;
+		}
+	}
+
+	my %seen;
+
+	for my $repos ( $Vend::Cfg->{CodeDef}{$tag}, $Global::CodeDef->{$tag} ) {
+		if(my $desc = $repos->{Description}) {
+			my $vis = $repos->{Visibility} || {};
+			while( my($k, $v) = each %$desc) {
+				next if $seen{$k}++;
+				if(my $perm = $vis->{$k}) {
+					if($perm =~ /^with\s+([\w:]+)/) {
+						my $mod = $1;
+						no strict 'refs';
+						next unless ${$mod . "::VERSION"};
+					}
+					else {
+						next unless $gate{$perm};
+					}
+				}
+				push @out, [$k, $v];
+			}
+		}
+	}
+
+	if(@out) {
+		@out = sort { $a->[1] cmp $b->[1] } @out;
+		unshift @out, $empty if $empty;
+	}
+	else {
+		push @out, ['', errmsg('--none--') ];
+	}
+	return \@out;
 }
 
 ### Provide stubs for former Vend::Util functions relocated to Vend::File



1.69      +6 -26     interchange/lib/Vend/Table/Editor.pm


rev 1.69, prev_rev 1.68
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- Editor.pm	13 Apr 2005 03:14:47 -0000	1.68
+++ Editor.pm	13 Apr 2005 16:13:28 -0000	1.69
@@ -1,6 +1,6 @@
 # Vend::Table::Editor - Swiss-army-knife table editor for Interchange
 #
-# $Id: Editor.pm,v 1.68 2005/04/13 03:14:47 mheins Exp $
+# $Id: Editor.pm,v 1.69 2005/04/13 16:13:28 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.68 $, 10);
+$VERSION = substr(q$Revision: 1.69 $, 10);
 
 use Vend::Util;
 use Vend::Interpolate;
@@ -593,7 +593,7 @@
 		$record->{name} ||= $column;
 #::logDebug("record now=" . ::uneval($record));
 
-		if($record->{options} and $record->{options} =~ /^[\w:]+$/) {
+		if($record->{options} and $record->{options} =~ /^[\w:,]+$/) {
 #::logDebug("checking options");
 			PASS: {
 				my $passed = $record->{options};
@@ -602,30 +602,10 @@
 					my @tables = $Tag->list_databases();
 					$record->{passed} = join (',', "=--none--", @tables);
 				}
-				elsif($passed =~ /^\s*codedef:+(\w+)\s*$/i) {
+				elsif($passed =~ /^\s*codedef:+(\w+)(:+(\w+))?\s*$/i) {
 					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];
-						}
-						@out = sort { $a->[1] cmp $b->[1] } @out;
-					}
-					else {
-						push @out, ['', errmsg('--none--') ];
-					}
-					$record->{passed} = \@out;
+					my $mod = $3;
+					$record->{passed} = Vend::Util::codedef_options($tag, $mod);
 				}
 				elsif($passed eq 'filters') {
 					$record->{passed} = filters(1);








More information about the interchange-cvs mailing list