[interchange-cvs] interchange - heins modified 5 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Apr 14 11:13:15 EDT 2005


User:      heins
Date:      2005-04-14 15:13:14 GMT
Modified:  lib/Vend Config.pm Form.pm Util.pm
Modified:  code/Filter alpha.filter
Modified:  code/JavaScriptCheck required.jsc
Log:
* Add Help capability to options generation. Uses Help member in
  CodeDef sections, and is automatically generated by codedef_options.

* For use in widgets without that, you need to generate the options
  as a reference and use that. (I will think about a mechanism
  to allow that in metadata.)

  Illustration with previously generated options:

	   [calc]
		  %opts = (
			['foo', 'Foo', 'This is the Foo selection help'],
			['bar', 'Bar', 'This is the Bar selection help'],
		  );
		  return;
	   [/calc]

		[display
			type=radio
			name=foobar
			options=`\%opts`
		] <br>

   Or inline:

		[display
			type=select
			name=foobar
			options=`[
				['foo', 'Foo', 'This is the other Foo selection help'],
				['bar', 'Bar', 'This is the other Bar selection help'],
			]`
		]

Revision  Changes    Path
2.164     +3 -2      interchange/lib/Vend/Config.pm


rev 2.164, prev_rev 2.163
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.163
retrieving revision 2.164
diff -u -r2.163 -r2.164
--- Config.pm	14 Apr 2005 13:36:08 -0000	2.163
+++ Config.pm	14 Apr 2005 15:13:14 -0000	2.164
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.163 2005/04/14 13:36:08 mheins Exp $
+# $Id: Config.pm,v 2.164 2005/04/14 15:13:14 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.163 $, 10);
+$VERSION = substr(q$Revision: 2.164 $, 10);
 
 my %CDname;
 my %CPname;
@@ -3818,6 +3818,7 @@
 	description  	Description
 	override	  	Override
 	visibility  	Visibility
+	help		  	Help
 	documentation	Documentation
 	extrameta		ExtraMeta
 	gobble			Gobble



2.53      +28 -7     interchange/lib/Vend/Form.pm


rev 2.53, prev_rev 2.52
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.52
retrieving revision 2.53
diff -u -r2.52 -r2.53
--- Form.pm	13 Apr 2005 16:13:27 -0000	2.52
+++ Form.pm	14 Apr 2005 15:13:14 -0000	2.53
@@ -1,6 +1,6 @@
 # Vend::Form - Generate Form widgets
 # 
-# $Id: Form.pm,v 2.52 2005/04/13 16:13:27 mheins Exp $
+# $Id: Form.pm,v 2.53 2005/04/14 15:13:14 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.52 $, 10);
+$VERSION = substr(q$Revision: 2.53 $, 10);
 
 @EXPORT = qw (
 	display
@@ -98,6 +98,8 @@
 		.
 		qq({MAXLENGTH?} maxlength="{MAXLENGTH}"{/MAXLENGTH?})
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({WRAP?} wrap="{WRAP}"{/WRAP?})
 		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
@@ -120,6 +122,8 @@
 	file =>
 		qq({PREPEND}<input type="file" name="{NAME}" value="{ENCODED}")
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({COLS?} size="{COLS}"{/COLS?})
 		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
@@ -129,6 +133,8 @@
 	filetext =>
 		qq({PREPEND}<input type="file" name="{NAME}" value="{ENCODED}")
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({COLS?} size="{COLS}"{/COLS?})
 		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
@@ -140,10 +146,14 @@
 		.
 		qq({COLS?} size="{COLS}"{/COLS?})
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({DISABLED?} DISABLED{/DISABLED?})
 		.
 		qq({MAXLENGTH?} maxlength="{MAXLENGTH}"{/MAXLENGTH?})
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
 		.
 		qq(>{APPEND})
@@ -167,25 +177,29 @@
 		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({DISABLED?} DISABLED{/DISABLED?})
 		.
 		qq({SELECTED?} CHECKED{/SELECTED?})
 		.
-		qq(>&nbsp;{TLABEL})
+		qq(>&nbsp;{TTITLE?}<span title="{TTITLE}">{/TTITLE?}{TLABEL}{TTITLE?}</span>{/TTITLE?})
 		,
 	boxnbsp =>
 		qq(<input type="{VARIANT}" name="{NAME}" value="{TVALUE}")
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
 		.
 		qq({DISABLED?} DISABLED{/DISABLED?})
 		.
 		qq({SELECTED?} CHECKED{/SELECTED?})
 		.
-		qq(>&nbsp;{TLABEL}&nbsp;&nbsp;)
+		qq(>&nbsp;{TTITLE?}<span title="{TTITLE}">{/TTITLE?}{TLABEL}{TTITLE?}</span>{/TTITLE?}&nbsp;&nbsp;)
 		,
 	boxlabel =>
-		qq(<td{TD_LABEL?} {TD_LABEL}{/TD_LABEL?}>)
+		qq(<td{TD_LABEL?} {TD_LABEL}{/TD_LABEL?}{TTITLE?} title="{TTITLE}"{/TTITLE?}>)
 		.
 		qq({FONT?}<font size="{FONT}">{/FONT?})
 		.
@@ -198,6 +212,8 @@
 		.
 		qq(<input type="{VARIANT}" name="{NAME}" value="{TVALUE}")
 		.
+		qq({TTITLE?} title="{TTITLE}"{/TTITLE?})
+		.
 		qq({DISABLED?} DISABLED{/DISABLED?})
 		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
@@ -745,8 +761,9 @@
 	my $no_encode = $opt->{pre_filter} eq 'decode_entities' ? 1 : 0;
 	
 	for(@$opts) {
-		my ($value, $label) = @$_;
+		my ($value, $label, $help) = @$_;
 		encode($label, $ESCAPE_CHARS::std) unless $no_encode;
+		encode($help, $ESCAPE_CHARS::std) if $help;
 		if($value =~ /^\s*\~\~(.*)\~\~\s*$/) {
 			my $label = $1;
 			if($optgroup_one++) {
@@ -782,6 +799,7 @@
 		my $vvalue = $value;
 		encode($vvalue, $ESCAPE_CHARS::std);
 		$run .= qq| value="$vvalue"|;
+		$run .= qq| title="$help"| if $help;
 		if (length($default)) {
 			$regex	= qr/$re_b\Q$value\E$re_e/;
 			$default =~ $regex and $select = 1;
@@ -914,8 +932,9 @@
 	my $no_encode = $opt->{pre_filter} eq 'decode_entities' ? 1 : 0;
 
 	for(@$opts) {
-		my($value,$label) = @$_;
+		my($value,$label,$help) = @$_;
 		encode($label, $ESCAPE_CHARS::std) unless $no_encode;
+		encode($help, $ESCAPE_CHARS::std) if $help;
 		if($value =~ /^\s*\~\~(.*)\~\~\s*$/) {
 			my $lab = $1;
 			$lab =~ s/"/&quot;/g;
@@ -968,6 +987,8 @@
 			$label =~ s/ /&nbsp;/g if $xlt;
 			$opt->{tlabel} = $label;
 		}
+
+		$opt->{ttitle} = $help;
 
 		$run .= attr_list($template, $opt);
 		$run .= '</tr>' if $inc && ! ($i % $inc);



2.81      +4 -3      interchange/lib/Vend/Util.pm


rev 2.81, prev_rev 2.80
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.80
retrieving revision 2.81
diff -u -r2.80 -r2.81
--- Util.pm	13 Apr 2005 16:13:27 -0000	2.80
+++ Util.pm	14 Apr 2005 15:13:14 -0000	2.81
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.80 2005/04/13 16:13:27 mheins Exp $
+# $Id: Util.pm,v 2.81 2005/04/14 15:13:14 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.80 $, 10);
+$VERSION = substr(q$Revision: 2.81 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -2036,6 +2036,7 @@
 	for my $repos ( $Vend::Cfg->{CodeDef}{$tag}, $Global::CodeDef->{$tag} ) {
 		if(my $desc = $repos->{Description}) {
 			my $vis = $repos->{Visibility} || {};
+			my $help = $repos->{Help} || {};
 			while( my($k, $v) = each %$desc) {
 				next if $seen{$k}++;
 				if(my $perm = $vis->{$k}) {
@@ -2048,7 +2049,7 @@
 						next unless $gate{$perm};
 					}
 				}
-				push @out, [$k, $v];
+				push @out, [$k, $v, $help->{$k}];
 			}
 		}
 	}



1.3       +2 -1      interchange/code/Filter/alpha.filter


rev 1.3, prev_rev 1.2
Index: alpha.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/alpha.filter,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- alpha.filter	12 Apr 2005 03:23:18 -0000	1.2
+++ alpha.filter	14 Apr 2005 15:13:14 -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: alpha.filter,v 1.2 2005/04/12 03:23:18 mheins Exp $
+# $Id: alpha.filter,v 1.3 2005/04/14 15:13:14 mheins Exp $
 
 CodeDef alpha Filter
 CodeDef alpha Description A-Za-z only
+CodeDef alpha Help  Returns only alpha charactors (i.e. ISO 8859-1)
 CodeDef alpha Routine <<EOR
 sub {
 	my $val = shift;



1.2       +2 -1      interchange/code/JavaScriptCheck/required.jsc


rev 1.2, prev_rev 1.1
Index: required.jsc
===================================================================
RCS file: /var/cvs/interchange/code/JavaScriptCheck/required.jsc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- required.jsc	11 Apr 2005 23:36:50 -0000	1.1
+++ required.jsc	14 Apr 2005 15:13:14 -0000	1.2
@@ -1,5 +1,6 @@
 CodeDef required  JavaScriptCheck  1
-CodeDef required  Description Javascript check for non-blank
+CodeDef required  Description Javascript non-blank check
+CodeDef required  Help Also checks for only whitespace
 CodeDef required  Routine <<EOR
 sub {
 	my $opt = shift;








More information about the interchange-cvs mailing list