The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

BingoX::Chromium - Generic BingoX Admin module

SYNOPSIS

use BingoX::Chromium;

  # $BR - Blessed Reference
  # $SV - Scalar Value
  # @AV - Array Value
  # $HR - Hash Ref
  # $AR - Array Ref
  # $SR - Stream Ref

  # $proto - BingoX::Chromium object OR sub-class
  # $object - BingoX::Chromium object

CONSTRUCTORS

  $BR = $proto->new( $r, [ $conf ] );

DISPLAY METHODS

  $SV = $proto->postmodify_handler();
  $SV = $proto->postadd_handler();
  $SV = $object->display_list();
  $SV = $object->display_view();
  $SV = $object->display_modify();
  $SV = $object->display_search();                              - Not Implemented Yet!
  $SV = $object->display_row( $field );
  $SV = $object->display_list_buttons();
  $SV = $object->display_modify_buttons();
  $SV = $object->displat_start_html();
  $SV = $object->hidden_fields();

DATA METHODS

  $SV = $object->save_data();
  $HR = $object->get_data( [ $data, ] [ $fields ] );
  $SV = $object->sanity();
  $BR = $proto->dbh();
  $BR = $object->db_obj();
  $HR = $object->get_list_hash();

CLASS VARIABLE METHODS

  $SV = $proto->data_class();
  $SV = $proto->data_class_name();
  $SV = $proto->adminuri();
  $SV = $proto->classdesc();
  $SV = $proto->qfd();
  $SV = $proto->pkd();  
  $SV = $proto->prefix();  
  $SV = $proto->cpkey_params($pcpkey);
  $AR = $proto->fieldlist();
  $HR = $proto->ui();
  $AR = $proto->parents();  
  $AR = $proto->children();  
  $HR = $proto->fields();
  $SV = $proto->fieldname( $field );
  $SV = $proto->fieldtype( $field );
  $HR = $proto->fieldhtmloptions( $field );
  $SV = $proto->fieldrelclass( $field );
  $SV = $proto->fieldrelclasstype( $field );
  $HR = $proto->fieldoptions( $field );
  $HR = $proto->fieldsanity( $field );

OBJECT METHODS

  $SV = $object->flow();
  $SV = $object->cpkey();
  $SV = $object->pcpkey();
  $SV = $object->parent_class(); 
  $BR = $object->cgi();
  $SV = $object->uri();
  $SV = $object->displaymode();
  $SV = $object->section();
  $BR = $object->conf();
  $BR = $object->r();

HTML DISPLAY METHODS

  $SV = $object->HTML_date( $fieldname );
  $SV = $object->HTML_view( $fieldname );
  $SV = $object->HTML_hidden( $fieldname );
  $SV = $object->HTML_text( $fieldname );
  $SV = $object->HTML_textarea( $fieldname );
  $SV = $object->HTML_popup( $fieldname );              - Not Finished!
  $SV = $object->HTML_scrolling( $fieldname );
  $SV = $object->HTML_checkbox( $fieldname );
  $SV = $object->HTML_file( $fieldname );

REQUIRES

Time::Object, Apache, CGI, Carp

EXPORTS

Nothing

DESCRIPTION

 BingoX::Chromium provides the generic API for BingoX admin classes.
 BingoX::Chromium uses admin objects that wrap Carbon data objects

CLASS VARIABLES

Classes that inherit from BingoX::Chromium should have the following class variables:

  • @fieldlist

    The order in which to display fields (if one so chose to display them ;)

  • %fields

    A hash whose keys are columns (same as in the fieldlist array) and whose values are complex arrays. Each array index is described below.

    [0] Descriptive Title

    A string describing the field

    [1] HTML Entity Type

    A string that contains one of the following HTML etity types:

     view
     text
     textarea
     datetime
     popup
     reference
     FIXME: more!!!
    [2] HTML Options

    A hash reference containing options for creating the HTML form field for this field.

    FIXME: I dunno

    [4] Field Options

    A hash reference containing special options for this field. The options include:

      not_null - this field cannot be NULL
    [5] Sanity Methods

    This is a list reference. Each item in the list is either a string with a sanity method name, or a list ref containing the method name, then any parameters that need to be passed to it. An example:

      [
       'sane_foo',
       ['sane_bar', 'baz'],
      ]

    For more info, see "SANITY METHODS".

  • $adminuri

    An optional class variable, corresponds to the adminuri() method. FIXME: Can someone who knows more about this elaborate?

  • $classdesc

    A simple one- or two-word description of the class being administered.

  • $data_class

    The name of the data class that corresponds to the admin class. If this value is not defined, it will default to the name of the admin class, with the first instance of "::Admin::" changed to "::Data::".

METHODS

handler ( $r )

Apache handler gets a new display object object of the class it was called as and calls flow against it.

CONSTRUCTORS

new ( $r [, $conf [, $mode ] ] )

Given an apache request object, returns an Admin object of the class it was called as. It also sets the data_class, data_class_name, cgi, uri, displaymode (from $q), and section (from $q).

FLOW

flow ( )

Decides what display method (or save_data) to call based on the displaymode, and submit_type (found in the query object).

?? Is this the best order to check ??

postmodify_handler ( $method_name, [ $method_name_args ] )

This method decides what happens after you leave the "Modify" screen. It normally works by passing a method that gets called, but it's meant to be overloaded as a hook when flow() finishes saving data (or if you hit Cancel). That way you can save something and go somewhere else besides display_view(). It currently will always call $method against $self, so no static methods, please...

postadd_handler ( $method_name, [ $method_name_args ] )

Behaves exactly like postmodify_handler() (see above), but is called after the user exits the "Add a new <whatever>" screen.

DISPLAY METHODS

display_list ( )

Prints an HTML page meant for listing all objects in class.

display_list_buttons ( )

Displays the buttons for display_list(). Easy to overload if you want more buttons!

display_modify_buttons ( )

Displays the buttons for display_modify(). Easy to overload if you want more buttons! Just like display_list buttons.

display_view ( )

Prints an HTML page meant for viewing an object. Itterates through fieldlist calling display_row for each element.

display_view_buttons ( )

Displays the buttons for display_view(). Easy to overload if you want more buttons! Just like display_list buttons.

display_modify ( )

Prints an HTML page meant for modifying an object. Itterates through fieldlist calling display_row for each element.

display_admin_name ( )

Returns class defined Class description as a string.

hidden_fields ( )

A stub called by display_view() and display_modify() that you can overload in your subclass if you want the view or modify/add screens to have a custom title.

hidden_fields ( \%fields )

A stub called by display_view() and display_modify() that you can overload in your subclass if you want the view or modify/add screens to have extra hidden fields.

Or you can pass it a hash ref of hidden fields, were key = field name and value = field value

display_start_html( \%params )

Accessor method to $self->cgi->start_html(); Put into params exactly what you'd put in CGI::start_html(). Overload this in your admin class if you want to set any special BG,text,link colors, or anything else you want to pass to start_html()

display_search ( )

Prints an HTML page meant for limiting what appears on the display_list page.

Not Implimented Yet.

display_row ( $field )

Takes a column (field) name and prints a 2 columned table row where the left column has the fields descriptive name ($self->fieldname($field)) and the right column has the output of that fields method ($self->$field)

DATA METHODS

save_data ( [ \%data ] )
 Goes through the process of calling sanity, then get_data (to get the data out 
of the query object) and then db_obj->modify.
 Optionally takes data hashref as returned by get_data(), otherwise calls get_data() itself.  (This makes extension of save_data() possible without having to call get_data() twice.)
get_data ( [ $data, ] [ $fields ] )

Takes the fields hash (returned by $self->fields()) and the CGI object and returns a data hashref which can be sent to Carbon's new or modify You can optionaly pass a $data hash and a $fields hash which it will use.

OPTIMIZE

sanity ( )

Populates the _errors data instance in the case that the data does not conform to what is allowed to be entered into the database.

cpkey ( [ $db_obj ] )

Returns a string representing a single composite primary key joined by $self->qfd.

cpkey_params ($cpkey)

Returns a params hash from the cpkey string passed.

pcpkey ( )

Returns a cpkey with a class name + $qfd in front of it.

dbh ( )

Returns the object's database handle.

OPTIMIZE Needs work. Doesn't appear to use Carboniums dbh method thus thus doesn't use cached dbh.

get_list_hash ( [ $selection ] )

*** NEEDS TO BE REMOVED ***

Returns a hash ref of all the objects in the class it was called against. The hash is built from the pcpkey, and the data class' title_field, substr()'d to the data class' title_size or by default 80 chars.

OPTIMIZE

db_obj ( )

Retrieves and caches encapsolated DATA object based on whats in the query obect. Looks for pcpkey query param first and then for each primary key individually.

OPTIMIZE

CLASS VARIABLE METHODS

data_class ( ) =item db_class ( )

Returns the data class for the current display class (from the class variable $data_class).

data_class_name ( ) =item db_class_name ( )

Returns the rightmost part of the db_class name (thats the text right of the ::)

ui ( )

This method is a fallback method for the user interface for BingoX::Chromium. ui() contains the default colors for the forms created by BingoX::Chromium. To create a custom color scheme for a specific class or entire admin area create a ui() method in either the Admin class or the subclass and modify the details to your preference.

children ( )

Returns class defined children as an arrayref.

parents ( )

Returns class defined parents as an arrayref.

parent_class ( )

Returns cached parent class

adminuri ( )

Returns class defined URI as a string.

classdesc ( )

Returns class defined Class description as a string.

adminclass ( )

NEEDS POD

fieldlist ( )

Returns the class defined fieldlist as an arrayref.

fields ( )

Returns class defined fields hashref.

fieldname ( $field )

Takes a column name and returns a string with that field's pretty name as defined in the class defined field hash. This is the [0] element of that keys array value.

fieldtype ( $field )

Takes a column name and returns a string with that field's HTML type as defined in the class defined field hash. This is the [1] element of that keys array value.

fieldhtmloptions ( $field )

Takes a column name and returns a hashref with that field's HTML options as defined in the class defined field hash. This is the [2] element of that keys array value.

fieldrelclass ( $field )

Takes a column name and returns a string with that field's related class (if it exists) as defined in the class defined field hash. This is the [3] element of that keys array value.

fieldrelclasstype ( $field )

Takes a column name and returns a string with that field's related class (if it exists) as defined in the class defined field hash. This is the [3] element of that keys array value.

fieldoptions ( $field )

Takes a column name and returns a hashref with that field's options information as defined in the class defined field hash. This is the [4] element of that keys array value.

fieldsanity ( $field )

Takes a column name and returns a listref with that field's sanity information as defined in the class defined field hash. This is the [5] element of that keys array value.

OBJECT METHODS

uri ( )

Returns the cached uri object.

cgi ( )

Returns the cached cgi object.

conf ( )

Returns the cached conf object (set in new).

section ( )

Returns the cached section (set in new).

displaymode ( )

Returns the cached uri displaymode (set in new).

r ( )

Object Method: Returns Apache Request object.

selection ( [ \%hash ] )

Returns a hash reference containing the parameters that specify the current selection. If a new value is passed, it sets the selection to that value.

HTML DISPLAY METHODS

qfieldname ( $fieldname )

Object Method:

Returns the fieldname to be used in the FORM INPUT NAME field. When overloading Administration field variables, use this to get the INPUT TYPE NAME.

ie. <INPUT TYPE="text" NAME="$self->qfieldname('username')">

main_index ( )

Object Method:

Returns the Main Index Path.

HTML_time ( $fieldname [, $qoptions ] )

Object Method:

Generic Hours Form Tag. Called by AUTOLOAD. Gets the default field params based on the fieldname and returns a set of date form fields or in viewable format if the displaymode is 'view'.

HTML_day ( $fieldname [, $qoptions ] )

Object Method:

Generic Day Form Tag. Called by AUTOLOAD. Gets the default field params based on the fieldname and returns a set of date form fields or in viewable format if the displaymode is 'view'.

HTML_month ( $fieldname [, $qoptions ] )

Object Method:

Generic Month Form Tag. Called by AUTOLOAD. Gets the default field params based on the fieldname and returns a set of date form fields or in viewable format if the displaymode is 'view'.

HTML_year ( $fieldname [, $qoptions ] )

Object Method:

Generic Year Form Tag. Called by AUTOLOAD. Gets the default field params based on the fieldname and returns a set of date form fields or in viewable format if the displaymode is 'view'.

HTML_date ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns a set of date form fields or in viewable format if the displaymode is 'view'.

Needs to be less Sybase Dependant and handle Time

HTML_view ( $fieldname )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in viewable format.

HTML_hidden ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value as a hidden input field.

HTML_text ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a text input field or in viewable format if the displaymode is 'view'.

HTML_password ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a password input field with a corresponding or in an obscured format if the displaymode is 'view'.

HTML_textarea ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a text input field or in viewable format if the displaymode is 'view'.

HTML_popup ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a popup field or in viewable format if the displaymode is 'view'.

Note: Not used yet because its not easy to populate the vaules & labels fields. USually always overloaded in the subclasses.

OPTIMIZE

HTML_radio ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a group of radio buttons or in viewable format if the displaymode is 'view'.

HTML_scrolling ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a scrolling list field or in viewable format if the displaymode is 'view'.

Note: Not used yet because its not easy to populate the vaules & labels fields. USually always overloaded in the subclasses.

OPTIMIZE

HTML_checkbox ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a checkbox field or in viewable format if the displaymode is 'view'.

Note: Not used yet because its not easy to populate the vaules & labels fields. USually always overloaded in the subclasses.

HTML_file ( $fieldname [, $qoptions ] )

Object Method:

Generic form field method called by AUTOLOAD. Gets the default field params based on the fieldname and returns the value in a form file upload field or in viewable format if the displaymode is 'view'.

SANITY METHODS

These methods can be overridden at any level to provide customized sanity checking. These methods always return an error message on failure, and an empty string on success.

sane_regex ( $data, $regex [, $error ] )

If $data matches the regular expression in $regex, returns an empty string. Otherwise, returns $error or a default error message.

sane_maxlength ( $data, $length )

Makes sure that $data is no more than $length characters long. Returns an error message on failure, an empty string on success.

sane_minlength ( $data, $length )

Makes sure that $data is at least $length characters long. Returns an error message on failure, an empty string on success.

AUTOLOAD (?????)

AUTOLOAD method - Figures out what method was being called by stripping the fully qualified portion of $AUTOLOAD out as $name. This method is expected to be a column name (an element of fieldlist). It then figures out what that columns fieldtype is from fieldtype($name). It then calls that type of HTML display method and passed $name to it.

REVISION HISTORY

 $Log: Chromium.pm,v $
 Revision 2.36  2001/11/14 23:12:26  gefilte
 save_data() - now optionally takes \%data, the result of get_data().

 RATIONALE :
        Consider a case when you want to override save_data() in a method which
 calls SUPER::save_data() (arguably a very useful feature.)  Now suppose that
 your save_data() method needs to see the result of get_data(), or possibly even
 manipulate those results (although that should be accomplished by overriding
 get_data()), before calling SUPER::save_data(). Before this change, the
 (arguably expensive) call to get_data() would need to be repeated.  With this
 change, passing a \%data to save_data() will circumvent the need for the
 second call.
        I considered using instance data to cache the results of get_data(), but
 since get_data() can be optionally called with a preset \%data hash this
 feature, while solving the efficiency problem, would open the door to more bugs.

        "Did you make sure the NO_BUGS flag is on?  Well that's your problem!"
                - Colin Bielen (paraphrase)

 Revision 2.35  2001/11/14 22:53:49  gefilte
 Fixed some POD

 Revision 2.34  2001/10/19 22:23:54  gefilte
 HTML_scrolling() - now sets -DEFAULT properly to what is in the database
        (don't know if this ever worked right, but it didn't when I tried it. check out the tiny diff :-)

 Revision 2.33  2001/10/12 00:50:34  gefilte
 display_modify() - fixed output of 'li' tags (cosmetic)

 Added support for fields of type 'password' :
        - added method HTML_password()
        - added special case to display_row() which displays the password field twice (for verification purposes) unless displaymode is 'view'
        - get_data() verifies that the two fields are alike, otherwise it sets and _error and blanks the field out (so it doesn't persist)
        - sanity() doesn't set the 'required' error if an error is already set

 N.B. - get_data() is setting an error state, normally only done by sanity(). This may not be the right approach, but I couldn't think of a more efficient one than this, since the field being verified (essentially the second password field) will not be examined by sanity().

 Revision 2.32  2001/10/05 01:31:31  gefilte
 HTML_checkbox() - made slightly MORE useful than the last revision!

 Revision 2.31  2001/10/04 23:28:00  gefilte
 get_data()
        - fixed procedures for parsing dates and checkboxes so that they
          do NOT add to the %$data hashref unless the data has in fact changed
          from what is in the $db_obj.

 HTML_checkbox() - made more usable :-)

        "If only there were evil people somewhere insidiously committing evil deeds and it were necessary only to separate them from the rest of us and destroy them.  But the line dividing good and evil cuts through the heart of every human being.  And who is willing to destroy a piece of his own heart?"
                - Aleksandr Isaevich Solzhenitsyn, novelist, Nobel laureate (1918-)

 Revision 2.30  2001/09/29 00:29:22  gefilte
 db_class(), db_class_name() - renamed to data_class(), data_class_name()
        - this is consistent with Cobalt's naming scheme
        - left symbolrefs to old names for backward compatibility
        - changed ALL calls and documentary references to these methods to new names
        - changed procedure to ascertain data_class to FIRST look at new class data member (below), then try using the standard BingoX class naming scheme

 added class data $data_class so that you can set an arbitrary class as your Carbon-based data class

 new() - uses data_class() methods to populate class data instead of figuring it out on its own

 fieldname(), fieldtype(), fieldhtmloptions(), fieldsrelclass(), rieldrelclasstype(), fieldoptions(), fieldsanity()
        - now verify the existence of array elements before attempting to read them (who thought you could get away with not doing this????)

 HTML_time(), HTML_day(), HTML_month(), HTML_year(), HTML_date()
        - now return undef if displaymode() is 'view' and referenced datetime field is empty

 fixed some documentation typos

 Revision 2.29  2001/09/27 18:10:22  gefilte
 save_data() - cleaned up $data prep
        ($data was verified twice! sanity() was being called twice! INSANITY!)

 Revision 2.28  2000/12/12 18:51:57  useevil
  - updated version for new release:  1.92

 Revision 2.27  2000/10/20 00:24:15  zhobson
 Minor changes to synopsis of new() in the docs

 Revision 2.26  2000/10/17 00:57:47  dweimer
 - corrected POD for main_index()
 - changed main_index()

 Revision 2.25  2000/09/20 21:03:27  dweimer
 Merged one last portion from the old tree.

 Revision 2.24  2000/09/20 21:00:22  dweimer
 Merged David's changes.
 His comment:
 handler() method now sets up Apache response settings instead of display_*() methods.

 Revision 2.23  2000/09/20 00:31:59  zhobson
 Fixed a scope warning in flow() (used "my $other_class" twice in the same scope)

 Revision 2.22  2000/09/19 23:40:59  dweimer
 Version update 1.91

 Revision 2.21  2000/09/13 20:58:27  adam
  - in get_data, changed how dates are handled if SHOW_24HOURS is off

 Revision 2.20  2000/09/12 16:03:35  david
 Made Data::Dumper optional -- only called when $debug is activated.  Changed all of its calls to Data::Dumper::Dumper().
 Caused handler to return result of flow(), flow ends up returning results of display_*(), display_*() methods now return Apache response constants.

 Revision 2.19  2000/09/08 22:06:24  colin
  - get_data - if the field is a date it makes sure there is at least
    the year in the query object.  Before it would break if you had a year
    in your %fields hash, but were not submitting that datefield in your
    add or modify form.  get_data would blindly try and build a date.

 Revision 2.18  2000/09/08 21:31:23  thai
  - cleaned up the code

 Revision 2.17  2000/09/08 05:19:38  thai
  - turned off debug

 Revision 2.16  2000/09/08 03:19:09  adam
  GENERAL
    Added parent/child relationship functionality, where each class can
    specify parent and child classes.  These are used to display buttons
    at the bottom of the display list screens to access your parents or
    children based on the selected item in the list.

  - updated POD
  - new
      - now accepts a CGI as an optional 4th param.
      - sets the selection from the $q->param('parent_pcpkey');
      - sets the parent_class object var from the $q->param('parent_pcpkey')
  - flow
      - checks to see if you are entering from a parent or child and sets
        $q->param('parent_pcpkey') with whats passed.
      - Gets the desired child or parent admin object and calls flow against it.
      - added debugging
  - changed all occurances of $q->startform to try and print $self->adminuri
    as the ACTION.  If there is no adminuri it uses uri as before.
  - display_list
      - displays information at the top of the page about what parent you
        came from (if there is a parent)
  - all forms now include hidden for parent_pcpkey
  - display_list_buttoms
  - displays buttons to view the display list page of any child or
           parent classes you might have.
  - pcpkey
    - renamed qkey to pcpkey
    - changed all occurances of qkey to pcpkey
  - cpkey
    - cpkey now just calls cpkey against the db_obj
  - cpkey_params
    - calls cpkey_params against your data_class
  - added children and parents class var accessor methods
  - HTML_popup
    - if your displaymode is add and you have a parent_pcpkey it attempts to
      select the parent in the pop-up menu.

 Revision 2.15  2000/09/07 22:49:03  thai
  - changed line 1200 to use BingoX::Time

 Revision 2.14  2000/09/07 20:00:02  thai
  - changed all occurances of DateTime::Date to BingoX::Time

 Revision 2.13  2000/08/31 21:54:18  greg
 Added COPYRIGHT information.
 Added file COPYING (LGPL).
 Cleaned up POD.
 Moved into BingoX namespace.
 References to Bingo::XPP now point to Apache::XPP.

 "To the first approximation, syntactic sugar is trivial to implement.
  To the second approximation, the first approximation is totally bogus."
        -Larry Wall

 Revision 2.12  2000/08/10 21:10:55  thai
  - added qkey() to get the prefix and the cpkey
  - changed occurrances where primary keys were being iterated to use
    cpkey()
  - added prefix() method to return the correct prefix combination

 Revision 2.11  2000/08/09 21:25:03  thai
  - changed get_list_hash() to be more Carbon friendly

 Revision 2.10  2000/08/07 23:10:25  thai
  - added main_index() method to return the main index url
  - changed regex pattern for HTML_textarea()

 Revision 2.9  2000/08/07 17:59:32  thai
  - added remove and modify to the display_list_buttons() method
    and to flow

 Revision 2.8  2000/08/03 20:48:09  thai
  - addd qfd() method to handle qfds
  - fixed bug in HTML_date() that would create a new date object when
    displaymode was 'view'
  - the sub pkd() now calls data_class->pkd()

 Revision 2.7  2000/08/01 00:43:51  thai
  - changed db_obj->errstr to dbh->errstr on line 305
  - moved all the $qfieldname stuff to the qfieldname() method
  - removed the fieldtype eq 'custom' from line 1174 in get_data()

 Revision 2.6  2000/07/14 19:27:05  dougw
 save_data returns undef if it can't ref get_data's return value, should be a hashref.
 Small typo fix, hidden_fields returns a string as it should.

 Revision 2.5  2000/07/12 19:30:17  thai
  - fixed POD, cleaned up code

 Revision 2.4  2000/07/07 01:20:43  dougw
  - Added 1 instead of Turned On for the check box value. Who ever thought 
    of that?  Changed the comparisons for hashrefs. Beware !%$hashref is 
    different than ref $hashref ne 'HASH'

 Revision 2.3  2000/05/31 02:39:20  greg
 changed use of s/.*:// to substr(...) in AUTOLOAD for efficiency.

 Revision 2.2  2000/05/24 20:47:25  thai
  - added more sanity when dereferencing, @{ $code->() || [ ] }
  - added warning when creating new date objects fail

 Revision 2.1  2000/05/19 01:25:11  thai
  - cleaned up code
  - is now part of the Bingo user space

 Revision 2.0  2000/05/02 00:54:33  thai
  - committed as 2.0

 Revision 1.38  2000/03/21 02:00:23  dougw
 Fixed a bug introduced recently that broke adding new object when
 the identity key was in the fields list. This is so wierd. (zack)

 Revision 1.37  2000/03/17 21:09:00  dougw
 Allowed hidden values to be used in HTML_date for -TYPE=>'view'
 Fixed checkbox undef error

 Revision 1.36  2000/03/15 22:26:17  zack
 Added HTML_radio() and modified new() to allow passing a display mode.

 Revision 1.35  2000/03/15 19:25:43  colin
 -HTML_popup now sorts options alphabetically

 Revision 1.34  2000/03/14 21:45:08  dougw
 Fixed get_data->save_data problems (thanks dave).
 Removed spurious comments.

 Revision 1.33  2000/03/14 20:58:10  dougw
 Modified HTML_popup to allow a NULL selection. Use the fieldoption -null_label
 to specify what you want the option to be named. The option must not have the
 -not_null option set for obvious reasons.

 Revision 1.32  2000/03/10 01:57:54  colin
 made display_list()'s hash sorter even cooler (thanks doug)

 Revision 1.31  2000/03/10 01:18:02  colin
 -display_list() now sorts its entries alphabetically.

 Revision 1.30  2000/03/09 18:58:23  colin
 -fixed a bug in HTML_date() where $qfieldname was being used as a global.
 -fixed similar bugs in HTML_day(),HTML_month(),and HTML_year()
 -one can now pass a hashref to hidden_fields(). If one wanted to.

 Revision 1.29  2000/03/09 00:45:32  colin
 -(thai) fixed a bug in HTML_date() where it wasn't passing fieldnames to its helper methods.
 -HTML_date() now checks the -TYPE it's passed in fieldoptions

 Revision 1.28  2000/03/08 03:09:32  thai
  - parsed out HTML_date() to HTML_day(), HTML_month(), HTML_year(),
    and HTML_time()

 Revision 1.27  2000/02/25 20:24:17  colin
 corrected some minor ui bugs in display_list() and display_modify()

 Revision 1.26  2000/02/18 23:38:56  colin
 - altered sanity() so that it now accepts a passed \%data hashref instead
   of looking for things in the query object. this way the data is already
   formatted and we don't have to format data again (especially useful because
   we don't have to re-sort all the date fields, etc)

 Revision 1.25  2000/02/17 23:37:43  colin
 -get_data() now gives meaningful error messages when users enter invalid info in date fields

 Revision 1.24  2000/02/17 03:46:27  dougw
 Small modifications to take advantage of DateTime changes.
 Using $obj instead of $obj->time_local;

 Revision 1.23  2000/02/11 18:52:00  colin
 - (doug) HTML_* methods now use DateTime to manage date info.
 - (colin) Changed ui() so that a) it caches the hasref if called as an object method and b)
   allows you to override default settings (and add others) when calling the method, as
   opposed to calling SUPER::ui() and then re-setting the resulting hashref.

 Revision 1.22  2000/02/08 03:34:31  zack
 - documented the %fields class variable
 - added not_null to field options (index [4])
 - implemented flexible sanity checking
   - added sane_regex()
   - added sane_minlength() and sane_maxlength()
 - updated docs for fieldoptions() and fieldsanity()
 - HTML_textarea(): 'WRAP' defaults to 'VIRTUAL'

 Revision 1.21  2000/02/04 19:48:28  derek
  - Fixed two instances where $ui wasn't being accessed to include font tags

 Revision 1.20  2000/02/04 19:28:45  derek
  - Changed Cancel button on View page to Return to List and modified flow
    to reflect the change
  - Added tons of CGI HTML code to make the Chromium interface look better
  - Added ui method that has defaults for colors and fonts that are used
    in the newly designed skin-like interfaces
  - Added Greg's adminclass method to return the project specific admin
    super class
  - Fixed display bug in HTML_textarea where content fields weren't being
    broken up into paragraphs in View mode
  - Added flow to display_row method to check for content fields and break
    them into two rows for the key/value pair

 Revision 1.19  2000/02/03 03:42:35  zack
 Documentation fixes and updates

 Revision 1.18  2000/01/31 02:00:19  adam
  - dbh was using a GLOBAL flag to see if had already set the
   $r->register_cleanup.  That was bad since the global was living beyond
   each hit.  In the end, the DBH wasn't being cleared after every hit.
   So now it uses the Apache notes to store the flag.
 - display_row() - oops...  thats not the variable name!

 "The best laid plans..."

 Revision 1.17  2000/01/30 04:30:46  adam
  - using an HTMl fieldtype of 'row' makes display_row() not print table
   tags, it just prints the results of the method $_().

 Revision 1.16  2000/01/27 22:12:17  colin
 Added cgi() and marked CGI_obj() as deprecated (evil music here).
 Added some \%qoptions to HTML_file

 Revision 1.15  2000/01/27 01:17:14  colin
 - finished HTML_file(). Also, due to popular request, display_modify() now uses
   $q->start_multipart_form() instead of $q->startform().
 - Well, it actually wasn't a *popular* request, but when the email went out asking
   if anyone had problems with it there was no response. 
 Ever. And that's good enough for me!

 Revision 1.14  2000/01/25 20:55:48  colin
 added:
 postmodify_handler()
 postadd_handler()
 hidden_fields()
 display_list_buttons()
 display_modify_buttons()

 HooHah!

 Revision 1.13  2000/01/24 22:19:39  dougw
 Adam added adminuri

 Revision 1.12  2000/01/24 22:11:03  colin
 added some Center tags.

 Revision 1.11  2000/01/21 22:08:24  colin
 added display_start_html().

 Revision 1.9  2000/01/21 21:35:26  colin
 took out an extra warn(). my bad.

 Revision 1.6  2000/01/12 22:43:35  adam
  - removed Carbon::debug

 Revision 1.5  2000/01/11 02:30:19  zack
 HTML_textarea() now accepts a -WRAP option (default 'NONE')
 HTML_checkbox() works with "add" functionality

 Revision 1.4  1999/12/21 00:51:57  zack
 implemented selections. added selection()

 Revision 1.3  1999/12/05 04:05:38  greg
 new - fixed _db_class to be generic instead of hard coded to 'Mogwai'
 dbh - now handles the cleanup of cached dbh instead of Data

 Revision 1.2  1999/12/04 23:48:08  greg
 fixed POD errors

 Revision 1.1.1.1  1999/12/03 20:10:40  adam
 START

SEE ALSO

perl(1).

KNOWN BUGS

None

TODO

  • HTML_checkbox - needs work

  • HTML_checkboxes (for multiple checkboxes)

  • HTML_radio

  • HTML_file - needs work

  • HTML_popup - should support getting a hashref or a coderef as the LABELS or VALUES

  • HTML_date - Only supports PST (hardcoded text)

  • HTML_date - should it be some DateTime dependant? Is there a way to make it more universal?

  • HTML_date - Needs to be able to show hours and minutes in a flexable way.

  • HTML_date - Needs ability to display time in 24 hour time. (Fix in get_data as well).

  • display_modify, view, list - need class data to control HTML options like title, table sizes etc...

  • get_data - needs to be able to get times as well as dates in 24hr and 12hr formats.

  • %fields - figure out how fields hash would pass other options to HTML methods

  • %fields - figure out how to structure relationship info (many2many vs. many2one)

  • %fields - figure out how to structure sanity information in hash

  • Should flow be broken up into different methods based on displaymode.

  • Flow should be controllable with class data. ie. to View before Modify. Search before List.

  • display_search() - needs to be added.

  • Apache error page (nicer then Server Error)

  • New class variable for adminpath (Where that thing can be administered).

  • Add seperator method (for drawing HRs) between column edit things.

  • HTML_scrolling (or any method that relates) - Can link to that methods view page for that object.

  • HTML methods should use options hash from fields hash.

  • HTML_popup - doesn't totally work because I don't know how one 2 many carbon relationships work. I am also not sure if I want to structure the class data the way I did. It also doesn't support composite primary keys (how would it?)

  • need HTML_popupwindow method which lets users select related items from a js pop-up window. (See Derek's Code or CyberStore Code)

  • have AUTLOAD create dynamic methods

  • dbh() - doesn't use Carboniums dbh. Doesn't cache dbh object. Should just call Carboniums dbh. (or uses object's dbh.)

COPYRIGHT

    Copyright (c) 2000, Cnation Inc. All Rights Reserved. This module is free
    software. It may be used, redistributed and/or modified under the terms
    of the GNU Lesser General Public License as published by the Free Software
    Foundation.

    You should have received a copy of the GNU Lesser General Public License
    along with this library; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

AUTHORS

 Adam Pisoni <adam@cnation.com>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 188:

'=item' outside of any '=over'