[interchange-cvs] interchange - heins modified 2 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon Apr 11 19:35:27 EDT 2005
User: heins
Date: 2005-04-11 23:35:27 GMT
Modified: lib/Vend Config.pm Form.pm
Log:
* Add JavaScriptCheck member of CodeDef family. Used to generate
automatic Javascript-based field checks for [table-editor].
* Requires using the {prepend} member, so will not work with
[display] unless you use a template.
Revision Changes Path
2.160 +3 -2 interchange/lib/Vend/Config.pm
rev 2.160, prev_rev 2.159
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.159
retrieving revision 2.160
diff -u -r2.159 -r2.160
--- Config.pm 8 Apr 2005 01:42:52 -0000 2.159
+++ Config.pm 11 Apr 2005 23:35:26 -0000 2.160
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.159 2005/04/08 01:42:52 jon Exp $
+# $Id: Config.pm,v 2.160 2005/04/11 23:35:26 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.159 $, 10);
+$VERSION = substr(q$Revision: 2.160 $, 10);
my %CDname;
my %CPname;
@@ -1211,6 +1211,7 @@
lc LocaleChange
tag UserTag
ct CoreTag
+ jsc JavaScriptCheck
/;
for( values %extmap ) {
2.50 +28 -8 interchange/lib/Vend/Form.pm
rev 2.50, prev_rev 2.49
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.49
retrieving revision 2.50
diff -u -r2.49 -r2.50
--- Form.pm 14 Feb 2005 06:37:10 -0000 2.49
+++ Form.pm 11 Apr 2005 23:35:27 -0000 2.50
@@ -1,6 +1,6 @@
# Vend::Form - Generate Form widgets
#
-# $Id: Form.pm,v 2.49 2005/02/14 06:37:10 mheins Exp $
+# $Id: Form.pm,v 2.50 2005/04/11 23:35: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.49 $, 10);
+$VERSION = substr(q$Revision: 2.50 $, 10);
@EXPORT = qw (
display
@@ -80,8 +80,6 @@
.
qq({EXTRA?} {EXTRA}{/EXTRA?})
.
- qq({JS?} {JS}{/JS?})
- .
qq(>)
,
selecttail =>
@@ -1097,6 +1095,18 @@
$opt->{cols} ||= $opt->{width} || $opt->{size};
$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} || {};
+ for(@checks) {
+ my $sub = $jsl->{$_} || $js->{$_} or next;
+ $sub->($opt);
+ }
+ }
+
# This handles the embedded attribute information in certain types,
# for example:
#
@@ -1274,10 +1284,14 @@
$opt->{value} =~ s/[/\[/g if $opt->{enable_itl};
if($opt->{class}) {
- $opt->{extra} = $opt->{extra}
- ? qq{$opt->{extra} class="$opt->{class}"}
- : qq{class="$opt->{class}"}
- ;
+ if($opt->{extra}) {
+ $opt->{extra} =~ s{(^|\s+)class=(["'])?[^\s'"]+\2}{$1};
+ $opt->{extra} =~ s/\s+$//;
+ $opt->{extra} .= qq{class="$opt->{class}"} ;
+ }
+ else {
+ $opt->{extra} = qq{class="$opt->{class}"} ;
+ }
}
# Action taken for various types
@@ -1333,6 +1347,12 @@
HTML::Entities::encode($c);
no warnings;
$opt->{append} .= qq{<input type=hidden name="mv_individual_profile" value="$c">};
+ }
+
+ if($opt->{js}) {
+ $opt->{extra} ||= '';
+ $opt->{extra} .= " $opt->{js}";
+ $opt->{extra} =~ s/^\s+//;
}
return $sub->($opt, $data);
}
More information about the interchange-cvs
mailing list