NAME

BingoX::Cobalt - Cobalt display parent class containing generic methods

SYNOPSIS

use BingoX::Cobalt;

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

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

CONSTRUCTORS

$BR = $proto->new( [ $app, $dbh, ] $data_object );
$BR = $proto->get( [ $dbh, ] \%params );

STREAM CONSTRUCTOR METHODS

$SR = $proto->stream_obj( $app [, $dbh, ] @_ );
$SR = $proto->stream_hash( [ $dbh, ] @_ );
$SR = $proto->stream_array( [ $dbh, ] @_ );

LIST CONSTRUCTOR METHODS

$AR = $proto->list_obj( $app [, $dbh, ] @_ );
$AR = $proto->list_hash( [ $dbh, ] @_ );
$AR = $proto->list_array( [ $dbh, ] @_ );

RELATION METHODS

$SR = $object->stream_related( $rel_display_class [, \@fields] [, \@sort] [, $unary_rev_flag ] );
$AR = $object->list_related( $rel_display_class [, \@fields] [, \@sort] [, $unary_rev_flag ] );

OBJECT METHODS

$BR = $object->db_obj(  );
$BR = $object->dbh(  );
$BR = $object->app(  );
$BR = $proto->r(  );
$BR = $proto->cgi(  );
$BR = $proto->conf(  );

PARSER METHODS

$SV = $object->include( @_ );
$SV = $object->xinclude( @_ );

CLASS DATA ACCESSOR METHODS

$SV = $proto->data_class(  );
$HR = $proto->display_fields(  );
$AR = $proto->display_order(  );

REQUIRES

BingoX::Time, CGI, Carp, strict

EXPORTS

Nothing

DESCRIPTION

Cobalt provides the generic API for BingoX display classes. Cobalt uses display objects that wrap Carbon data objects (Cobalt mono Carbide?).

CLASS VARIABLES

Classes that inherit from Cobalt should have the following class variables:

REQUIRED

  • @display_order

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

OPTIONAL

  • $data_class

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

  • %display_fields

    A total mystery. If this variable is not defined, eack key is an field from the @display_order variable, and each value is 1.

METHODS

CONSTRUCTORS

new ( [ $app ] [, $dbh ], $data_obj )

Given a data object, returns a Display object of the class it was called as. This means you could concievably provide a data object of a totally inapproriate type, and this method will not compain about it.

get ( [ $app ] [, $dbh, ] \%params )

Returns a display object.

STREAM METHODS

stream_obj ( $app [, $dbh ], @_ )

Returns an stream (CODE ref) that will return objects (See list_obj) If you don't know how to use streams, use list_obj() instead.

stream_hash ( [ $dbh, ] @_ )

Forwards to $class->data_class->stream_hash

stream_array ( [ $dbh, ] @_ )

Forwards to $class->data_class->stream_array

LIST METHODS

list_obj ( $app [, $dbh, ] @_ )

Returns an array ref of Display objects. Used mainly by Apache::XPP (the BingoX default parser) coders. Everyone else is probably using $self->data_class->list_obj().

list_hash ( [ $dbh, ] @_ )

Forwards to $class->data_class->list_hash

list_array ( [ $dbh, ] @_ )

Forwards to $class->data_class->list_array

show_obj ( $app [, $dbh ] [, \%params ] [, $template ] )

Behaves just like list_obj() or stream_obj() but will xinclude each object in a passed $template. Normally called by AUTOLOAD (via a show_* call), but you can call it explicitly if you like. Pass $app and $dbh if it's called statically.

RELATION METHODS

Returns a stream of related display objects from the $rel_display_class class.

list_related( $rel_display_class [, \@fields] [, \@sort] [, $unary_rev_flag ] )

Returns an array ref of related display objects from the $rel_display_class class.

OBJECT METHODS

db_obj ( )

Returns the Data object for the Display Class that it was called from, with the constraint being: map $q->param( $_ ) @{ $data_class->primary_keys }

hour_menu ( $name [, $default ] [, $24hr ] )

Returns a Popup Menu with Hours.

min_menu ( $name [, $default ] )

Returns a Popup Menu with Minutes.

am_pm_menu ( $name [, $default ] )

Returns a Popup Menu with AM/PM menus.

day_menu ( $name [, $default ] )

Returns a Popup Menu with the Days of the Month.

month_menu ( $name [, $default ] )

Returns a Popup Menu with the Months of the Year.

year_menu ( $name [, $default ] )

Returns a Popup Menu with a list of Years up to 20 years from now.

errors_list ( )

Returns list of errors in list format.

Returns a hyper link with the params passed to it, -HREF, -JAVASCRIPT.

submit ( $name, %params )

Returns a Submit Button with the params passed to it, -NAME, -VALUE, -JAVASCRIPT.

image_button ( $name, %params )

Returns a hyper link with the params passed to it, -HREF, -SRC, -BORDER, -ALT, -JAVASCRIPT.

textfield ( $name, %params )

Returns a Text Field with the params passed to it, -VALUE, -SIZE, -OVERRIDE.

hidden ( $name, %params )

Returns a Hidden Field with the params passed to it, -VALUE.

Returns a Popup Menu with the params passed to it, -VALUES, -LABELS, -OVERRIDE.

checkbox ( $name, %params )

Returns a Checkbox with the params passed to it, -VALUE, -LABEL, -OVERRIDE.

checkbox_group ( $name, %params )

Returns a Checkbox Button Group with the params passed to it, -VALUES, -LABELS, OVERRIDE.

radio_group ( $name, %params )

Returns a Radio Button Group with the params passed to it, -NAME, -VALUES, -LABELS, -DEFAULT, -OVERRIDE.

get_default ( )

Gets the default value for the field name requested.

app ( )

Returns the object's Application Object.

dbh ( )

Returns the object's database handle.

r ( )

Returns Apache Request object.

cgi ( )

Returns the display object's internal CGI object (or makes a new one)

conf ( )

Returns the conf object.

date ( )

Returns the display object's internal date object (or makes a new one)

PARSER METHODS

include ( @_ )

Forwards to $app->include

xinclude ( @_ )

Forwards to $app->xinclude

CLASS VARIABLE METHODS

adminuri ( )

Returns class defined URI as a string.

data_class ( )

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

display_fields ( )

Returns the class variable %{"${class}::display_fields"} as a hash reference.

display_order ( )

Returns the class variable @{"${class}::display_order"} as an array reference.

title_field ( )

Returns the title field for the current display class (from the class variable data_class).

date_fields ( )

Returns the date fields for the current display class (from the class variable data_class).

content_fields ( )

Returns the content fields for the current display class (from the class variable data_class).

relations ( )

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

primary_keys ( )

Returns the primary keys for the current display class (from the class variable data_class).

foreign_keys ( )

Returns the foreign keys for the current display class (from the class variable data_class).

cpkey ( )

Returns the cpkey for the current display class (from the class variable db_obj).

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 801:

=over without closing =back

Around line 989:

'=end private api' is invalid. (Stack: =over; =begin private)