From 2929a99bad579d593ba4e88f2f9eb14ba5e99134 Mon Sep 17 00:00:00 2001 From: Erwin Lansing Date: Sun, 4 Apr 2004 21:11:42 +0000 Subject: Add p5-Class-DBI-AsForm 2.2, produce HTML form elements for database columns. This module helps to generate HTML forms for creating new database rows or editing existing rows. It maps column names in a database table to HTML form elements which fit the schema. Large text fields are turned into textareas, and fields with a has-a relationship to other Class::DBI tables are turned into select drop-downs populated with objects from the joined class. WWW: http://search.cpan.org/dist/Class-DBI-AsForm/ PR: ports/65147 Submitted by: Lars Thegler --- databases/Makefile | 1 + databases/p5-Class-DBI-AsForm/Makefile | 35 ++++++++++++++++ databases/p5-Class-DBI-AsForm/distinfo | 2 + .../p5-Class-DBI-AsForm/files/500503-AsForm.pm | 49 ++++++++++++++++++++++ databases/p5-Class-DBI-AsForm/pkg-descr | 8 ++++ databases/p5-Class-DBI-AsForm/pkg-plist | 7 ++++ 6 files changed, 102 insertions(+) create mode 100644 databases/p5-Class-DBI-AsForm/Makefile create mode 100644 databases/p5-Class-DBI-AsForm/distinfo create mode 100644 databases/p5-Class-DBI-AsForm/files/500503-AsForm.pm create mode 100644 databases/p5-Class-DBI-AsForm/pkg-descr create mode 100644 databases/p5-Class-DBI-AsForm/pkg-plist (limited to 'databases') diff --git a/databases/Makefile b/databases/Makefile index 634e9d2f2096..a9d1a9f75f2a 100644 --- a/databases/Makefile +++ b/databases/Makefile @@ -112,6 +112,7 @@ SUBDIR += p5-CDB_File-Generator SUBDIR += p5-Class-DBI SUBDIR += p5-Class-DBI-AbstractSearch + SUBDIR += p5-Class-DBI-AsForm SUBDIR += p5-Class-DBI-BaseDSN SUBDIR += p5-Class-DBI-FromCGI SUBDIR += p5-Class-DBI-Loader diff --git a/databases/p5-Class-DBI-AsForm/Makefile b/databases/p5-Class-DBI-AsForm/Makefile new file mode 100644 index 000000000000..057ec3428d0f --- /dev/null +++ b/databases/p5-Class-DBI-AsForm/Makefile @@ -0,0 +1,35 @@ +# New ports collection makefile for: p5-Class-DBI-AsForm +# Date created: Apr 3 2004 +# Whom: Lars Thegler +# +# $FreeBSD$ + +PORTNAME= Class-DBI-AsForm +PORTVERSION= 2.2 +CATEGORIES= databases perl5 +MASTER_SITES= ${MASTER_SITE_PERL_CPAN} +MASTER_SITE_SUBDIR= Class +PKGNAMEPREFIX= p5- + +MAINTAINER= lars@thegler.dk +COMMENT= Produce HTML form elements for database columns + +BUILD_DEPENDS= ${SITE_PERL}/Class/DBI.pm:${PORTSDIR}/databases/p5-Class-DBI \ + ${SITE_PERL}/HTML/Element.pm:${PORTSDIR}/www/p5-HTML-Tree \ + ${SITE_PERL}/Class/DBI/Plugin/Type.pm:${PORTSDIR}/databases/p5-Class-DBI-Plugin-Type +RUN_DEPENDS= ${BUILD_DEPENDS} + +PERL_CONFIGURE= yes + +MAN3= Class::DBI::AsForm.3 + +.include + +.if ${PERL_LEVEL} < 500600 +EXTRA_PATCHES= ${PATCHDIR}/500503-AsForm.pm + +post-configure: + ${PERL} -pi -e 's,/usr/local/,\$$(PREFIX)/,g' ${WRKSRC}/Makefile +.endif + +.include diff --git a/databases/p5-Class-DBI-AsForm/distinfo b/databases/p5-Class-DBI-AsForm/distinfo new file mode 100644 index 000000000000..ee83807e5bbe --- /dev/null +++ b/databases/p5-Class-DBI-AsForm/distinfo @@ -0,0 +1,2 @@ +MD5 (Class-DBI-AsForm-2.2.tar.gz) = 09a3824bfbf260f2b12583828dce5068 +SIZE (Class-DBI-AsForm-2.2.tar.gz) = 3558 diff --git a/databases/p5-Class-DBI-AsForm/files/500503-AsForm.pm b/databases/p5-Class-DBI-AsForm/files/500503-AsForm.pm new file mode 100644 index 000000000000..e2841c0a0723 --- /dev/null +++ b/databases/p5-Class-DBI-AsForm/files/500503-AsForm.pm @@ -0,0 +1,49 @@ +--- AsForm.pm.orig Sat Apr 3 22:37:32 2004 ++++ AsForm.pm Sat Apr 3 22:37:38 2004 +@@ -1,16 +1,14 @@ + package Class::DBI::AsForm; +-use 5.006; + use strict; +-use warnings; + use Class::DBI::Plugin::Type (); +-our $OLD_STYLE = 0; ++use vars qw($OLD_STYLE);$OLD_STYLE = 0; + + use HTML::Element; + require Exporter; +-our @ISA = qw(Exporter); +-our @EXPORT = qw( to_cgi to_field _to_textarea _to_textfield _to_select ++use vars qw(@ISA);@ISA = qw(Exporter); ++use vars qw(@EXPORT);@EXPORT = qw( to_cgi to_field _to_textarea _to_textfield _to_select + type_of ); +-our $VERSION = '2.2'; ++use vars qw($VERSION);$VERSION = '2.2'; + + =head1 NAME + +@@ -100,14 +98,14 @@ + sub _to_textarea { + my ($self, $col) = @_; + my $a = HTML::Element->new("textarea", name => $col); +- if (ref $self) { $a->push_content($self->$col) } ++ if (ref $self) { $a->push_content($self->$col()) } + $OLD_STYLE && return $a->as_HTML; + $a; + } + + sub _to_textfield { + my ($self, $col) = @_; +- my $value = ref $self && $self->$col; ++ my $value = ref $self && $self->$col(); + my $a = HTML::Element->new("input", type=> "text", name => $col); + $a->attr("value" => $value) if $value; + $OLD_STYLE && return $a->as_HTML; +@@ -122,7 +120,7 @@ + for (@objs) { + my $sel = HTML::Element->new("option", value => $_->id); + $sel->attr("selected" => "selected") if ref $self +- and eval { $_->id == $self->$col->id }; ++ and eval { $_->id == $self->$col()->id }; + $sel->push_content($_->stringify_self); + $a->push_content($sel); + } diff --git a/databases/p5-Class-DBI-AsForm/pkg-descr b/databases/p5-Class-DBI-AsForm/pkg-descr new file mode 100644 index 000000000000..d3f2b5b03e08 --- /dev/null +++ b/databases/p5-Class-DBI-AsForm/pkg-descr @@ -0,0 +1,8 @@ +This module helps to generate HTML forms for creating new database +rows or editing existing rows. It maps column names in a database +table to HTML form elements which fit the schema. Large text fields +are turned into textareas, and fields with a has-a relationship to +other Class::DBI tables are turned into select drop-downs populated +with objects from the joined class. + +WWW: http://search.cpan.org/dist/Class-DBI-AsForm/ diff --git a/databases/p5-Class-DBI-AsForm/pkg-plist b/databases/p5-Class-DBI-AsForm/pkg-plist new file mode 100644 index 000000000000..72ab20f0dfeb --- /dev/null +++ b/databases/p5-Class-DBI-AsForm/pkg-plist @@ -0,0 +1,7 @@ +%%SITE_PERL%%/Class/DBI/AsForm.pm +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Class/DBI/AsForm/.packlist +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Class/DBI/AsForm +@unexec rmdir %D/%%SITE_PERL%%/%%PERL_ARCH%%/auto/Class/DBI 2>/dev/null || true +@unexec rmdir %D/%%SITE_PERL%%/%%PERL_ARCH%%/auto/Class 2>/dev/null || true +@unexec rmdir %D/%%SITE_PERL%%/Class/DBI 2>/dev/null || true +@unexec rmdir %D/%%SITE_PERL%%/Class 2>/dev/null || true -- cgit v1.2.3