interchange - heins modified 2 files

[email protected]
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
User:      heins
Date:      2009-04-05 19:24:36 GMT
Modified:  .        WHATSNEW-5.7
Modified:  lib/Vend Form.pm
Log:
* Shorthand added to allow beginning/ending year with date widget
  name (i.e. yearbegin1934, yearend=0000 where 0000 means current year).

Revision  Changes    Path
2.37                 interchange/WHATSNEW-5.7


rev 2.37, prev_rev 2.36
Index: WHATSNEW-5.7
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.7,v
retrieving revision 2.36
retrieving revision 2.37
diff -u -r2.36 -r2.37
--- WHATSNEW-5.7	22 Mar 2009 19:32:31 -0000	2.36
+++ WHATSNEW-5.7	5 Apr 2009 19:24:36 -0000	2.37
@@ -74,6 +74,9 @@
 * Fix table editor bug found by Jeff Boes <[email protected]> which
   prevented custom widget type from working.
 
+* Shorthand added to allow beginning/ending year with date widget
+  name (i.e. yearbegin1934, yearend=0000 where 0000 means current year).
+
 Payment
 -------
 



2.77                 interchange/lib/Vend/Form.pm


rev 2.77, prev_rev 2.76
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.76
retrieving revision 2.77
diff -u -r2.76 -r2.77
--- Form.pm	10 May 2008 14:39:53 -0000	2.76
+++ Form.pm	5 Apr 2009 19:24:36 -0000	2.77
@@ -1,6 +1,6 @@
 # Vend::Form - Generate Form widgets
 # 
-# $Id: Form.pm,v 2.76 2008-05-10 14:39:53 mheins Exp $
+# $Id: Form.pm,v 2.77 2009-04-05 19:24:36 mheins Exp $
 #
 # Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -39,7 +39,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.76 $, 10);
+$VERSION = substr(q$Revision: 2.77 $, 10);
 
 @EXPORT = qw (
 	display
@@ -497,8 +497,17 @@
 	$out .= qq{</select>};
 	$out .= qq{<input type="hidden" name="$name" value="/">};
 	$out .= qq{<select name="$name"$sel_extra>};
+
+	my $cy = $t[5] + 1900;
+
+	# If year_begin or year_end are /00+/, make current year
+	for(qw/ year_begin year_end /) {
+		if( length($opt->{$_}) > 1 and $opt->{$_} == 0) {
+			$opt->{$_} = $cy;
+		}
+	}
+
 	if(my $by = $opt->{year_begin} || $::Variable->{UI_DATE_BEGIN}) {
-		my $cy = $t[5] + 1900;
 		my $ey = $opt->{year_end}  || $::Variable->{UI_DATE_END} || ($cy + 10);
 		if($by < 100) {
 			$by = $cy - abs($by);
@@ -1416,6 +1425,8 @@
 			$opt->{time} = 1 if $extra =~ /time/i;
 			$opt->{ampm} = 1 if $extra =~ /ampm/i;
 			$opt->{blank} = 1 if $extra =~ /blank/i;
+			$opt->{year_begin} = $1 if $extra =~ s/year_?begin(\d+)//i;
+			$opt->{year_end} = $1 if $extra =~ s/year_?end(\d+)//i;
 			($extra =~ /\(\s*(\s*\d+\s*(,\s*\d+\s*)+)\s*\)/i
 					and $opt->{minutes} = $1)
 			  or
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.