| 1 | $VERSION = "1.01.02"; | ||
| 2 | package DBIx::Frame; | ||
| 3 | our $VERSION = "1.01.02"; | ||
| 4 | |||
| 5 | # -*- Perl -*- Wed May 26 09:08:25 CDT 2004 | ||
| 6 | ############################################################################### | ||
| 7 | # Written by Tim Skirvin <tskirvin@ks.uiuc.edu> | ||
| 8 | # Copyright 2001-2004, Tim Skirvin and UIUC Board of Trustees. | ||
| 9 | # Redistribution terms are below. | ||
| 10 | ############################################################################### | ||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | DBIx::Frame::CGI - tools for web-based use of DBIx::Frame databases | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | use DBIx::Frame::CGI; | ||
| 19 | |||
| 20 | DBIx::Frame->init('server', 'dbtype') || exit(0); | ||
| 21 | my $DB = DBIx::Frame->new('database', 'user', 'pass') | ||
| 22 | or die("Couldn't connect to database: ", DBIx->errstr); | ||
| 23 | my $CGI = new CGI || die "Couldn't open CGI"; | ||
| 24 | |||
| 25 | my $params = {}; | ||
| 26 | foreach ($cgi->param) { $$params{$_} = $cgi->param($_); } | ||
| 27 | my $action = $cgi->param('action') || ""; | ||
| 28 | my $table = $cgi->param('table') || ""; | ||
| 29 | |||
| 30 | print $cgi->header(), $cgi->start_html(-title => "YOUR TITLE"); | ||
| 31 | print $DB->make_html( $action, $table, $params, {} ) | ||
| 32 | or die "Couldn't run script"; | ||
| 33 | print $cgi->end_html(); | ||
| 34 | exit(0); | ||
| 35 | |||
| 36 | More functions, and detailed descriptions, are below. | ||
| 37 | |||
| 38 | =head1 DESCRIPTION | ||
| 39 | |||
| 40 | DBIx::Frame::CGI is an extension of the DBIx::Frame module to allow for web | ||
| 41 | use and administration of DBIx::Frame databases. It provides a common set | ||
| 42 | of HTML functions for creating, modifying, viewing, and deleting entries | ||
| 43 | in the database. These tools allow for simple administration scripts, as | ||
| 44 | well as a decent API for creating more complex user scripts. | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | use strict; | ||
| 49 | use DBIx::Frame; | ||
| 50 | use HTML::FormRemove qw(RemoveFormValues); | ||
| 51 | use Exporter; | ||
| 52 | use CGI; | ||
| 53 | |||
| 54 | use vars qw(@EXPORT @EXPORT_OK @ISA @ACTIONS %ACTION ); | ||
| 55 | @ACTIONS = qw( create list search ); | ||
| 56 | %ACTION = ( 'edit' => \&html_edit, 'view' => \&html_view, | ||
| 57 | 'create' => \&html_create, 'search' => \&html_search, | ||
| 58 | 'update' => \&html_update, 'delete' => \&html_delete, | ||
| 59 | 'insert' => \&html_insert, 'list' => \&html_list_banner, | ||
| 60 | '' => \&html_actions, 'actions' => \&html_actions, | ||
| 61 | ); | ||
| 62 | |||
| 63 | use SelfLoader; | ||
| 64 | SelfLoader->load_stubs(); | ||
| 65 | 1; | ||
| 66 | |||
| 67 | __DATA__ # Comment me out to test the functions without SelfLoader; |