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


BingoX documentation  | view source Contained in the BingoX distribution.

Index


NAME

Top

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

SYNOPSIS

Top

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

Top

BingoX::Time, CGI, Carp, strict

EXPORTS

Top

Nothing

DESCRIPTION

Top

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

CLASS VARIABLES

Top

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

Top

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.

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.

popup_menu ( $name, %params )

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).

REVISION HISTORY

Top

 $Log: Cobalt.pm,v $
 Revision 2.15  2000/12/12 18:53:36  useevil
  - updated version for new release:  1.92

 Revision 2.14  2000/10/20 00:26:40  zhobson
 stream_* now returns blessed streams a la Carbon

 Revision 2.13  2000/10/17 00:49:55  dweimer
 - added adminuri()

 Revision 2.12  2000/09/19 23:41:46  dweimer
 Version update 1.91

 Revision 2.11  2000/09/12 00:49:17  david
 Fixed several accessor methods to be pure object methods.

 Revision 2.10  2000/09/07 20:00:34  thai
  - changed all occurrances of DateTime::Date to BingoX::Time

 Revision 2.9  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.8  2000/08/08 22:19:51  thai
  - there were two foreign_keys() when one should be relations()

 Revision 2.7  2000/08/03 20:49:13  thai
  - added methods:
  	title_field()
 	date_fields()
 	primary_keys()
 	foreign_keys()
 	cpkey()
 	relations()
 	content_fields()

 Revision 2.6  2000/08/01 00:44:43  thai
  - changed $debug to undef

 Revision 2.5  2000/07/13 22:20:04  thai
  - added new methods:
 		date/time menus
 		HTML form methods
 		get_default()
 		_get_default()
 		date()
  - changed methods:
 		db_obj() will now iterate through primary keys
 		cgi() will try to get the cgi object from the app()
 		r() will try to get r from the app()
 		conf() will try to get conf from the app()
 		dbh() will try to get dbh from the app()

 Revision 2.4  2000/07/12 19:29:39  thai
  - fixed POD, cleaned up code

 Revision 2.3  2000/06/24 03:16:37  dougw
 Added return undef to stream_related

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

 Revision 2.1  2000/05/19 01:25:25  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.9  2000/04/26 23:46:19  dougw
 AUTOLOAD now checks for $self::data_class before using $self->data_class
 this fixes a problem caused when a Display class that doesn't have a
 corresponding data_class calls use on a data class.

 Revision 1.8  2000/03/27 22:12:11  zack
 display_order() and display_fields() were using the data class
 instead of the display class, so they were always returning
 emtpy lists. Wow.

 Revision 1.7  2000/03/20 22:22:02  colin
 added show_obj()

 Revision 1.6  2000/03/15 20:14:15  zack
 Allow passing of cache/sort arrayrefs (a la stream_*) to get()

 Revision 1.5  2000/03/14 21:05:36  thai
  - returns undef if data_class->list_obj() returns undef

 Revision 1.4  2000/03/14 01:40:54  thai
  - fixed list_obj() to deref whats returned from data_class->list_obj()
    or [ ], it would fail miserably if not

 Revision 1.3  2000/03/07 23:43:13  zack
 Modified data_Class() so the class field is no longer required.
 Updated documentation

 Revision 1.2  2000/02/03 03:08:23  zack
 Fixed some documentation errors and inaccuracies, documented $data_class

 Revision 1.1  1999/11/04 20:51:15  greg
 First commit of generic Display class for the bingo model.




REVISION HISTORY (Xwing: Display.pm)

Top

 Revision 1.4  1999/10/28 21:58:35  thai
  - added more methods to handle many FORM elements
  - image_button methods added for process, destroy,
    recalculate, and so on...

 Revision 1.3  1999/10/28 00:32:12  greg
 Combined with a more complete Display class (from Gonzo). This should be moved
 into the bingo project, and kept as one distinct thing...

 Revision 1.2  1999/10/20 23:41:53  greg
 Added method r to return the Apache request object.

 Revision 1.1  1999/10/12 00:02:07  thai
  - initial commit
  - partially functional, just does nothing

    I guess you could say its a "GNDN"




SEE ALSO

Top

perl(1).

KNOWN BUGS

Top

None

TODO

Top

Nothing yet... anybody have suggestions?

COPYRIGHT

Top

AUTHORS

Top

 Colin Bielen <colin@cnation.com>
 Greg Williams <greg@cnation.com>


BingoX documentation  | view source Contained in the BingoX distribution.