BingoX

 view release on metacpan or  search on metacpan

lib/BingoX/Chromium.pm  view on Meta::CPAN

  $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 );

=head1 REQUIRES

Time::Object, Apache, CGI, Carp

=head1 EXPORTS

lib/BingoX/Chromium.pm  view on Meta::CPAN

A string describing the field

=item [1] HTML Entity Type

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

 view
 text
 textarea
 datetime
 popup
 reference
 FIXME: more!!!

=item [2] HTML Options

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

=item [3] Related Classes

lib/BingoX/Chromium.pm  view on Meta::CPAN

								-DEFAULT	=> sprintf("%02d", $q->param( $qfieldname.'_hour' )	|| $hour)
							)
			.	' : '
			.	$q->textfield(	-NAME		=> $qfieldname.'_min',
								-SIZE		=> $qoptions->{'-MIN_SIZE'}			|| 2,
								-MAXLENGTH	=> $qoptions->{'-MIN_MAXLENGTH'}	|| 2,
								-OVERRIDE	=> $qoptions->{'-MIN_OVERRIDE'}		|| 1,
								-DEFAULT	=> sprintf("%02d", $q->param( $qfieldname.'_min' )	|| $minute)
							)
			.	($hr24 ? '' :
				' ' . $q->popup_menu(	-NAME		=> $qfieldname.'_ampm',
											-VALUES		=> [ 'AM', 'PM' ],
											-DEFAULT	=> ($q->param( $qfieldname.'_ampm' )	|| $ampm),
											-OVERRIDE	=> $qoptions->{'-AMPM_OVERRIDE'}		|| 1
										));
	} else {
		return $q->popup_menu(	-NAME		=> $qfieldname.'_hour',
								-VALUES		=> ($hr24 ? $date_obj->hours24 : $date_obj->hours),
								-DEFAULT	=> sprintf("%02d", $hour),
								-OVERRIDE	=> $qoptions->{'-HR_OVERRIDE'} || 1
							)
			. ' : '
			. $q->popup_menu(	-NAME		=> $qfieldname.'_min',
								-VALUES		=> $date_obj->minutes,
								-DEFAULT	=> sprintf("%02d", $q->param( $qfieldname.'_min' )	|| $minute),
								-OVERRIDE	=> $qoptions->{'-MIN_OVERRIDE'} || 1
							)
			. ($hr24 ? '' :
				' ' . $q->popup_menu(	-NAME		=> $qfieldname.'_ampm',
											-VALUES		=> [ 'AM', 'PM' ],
											-DEFAULT	=> ($q->param( $qfieldname.'_ampm' )	|| $ampm),
											-OVERRIDE	=> $qoptions->{'-AMPM_OVERRIDE'}		|| 1
										));
	}					
} # END sub HTML_time


=item C<HTML_day> ( $fieldname [, $qoptions ] )

lib/BingoX/Chromium.pm  view on Meta::CPAN

				,$q->hidden(	-NAME	=> $qfieldname.'_day',
								-VALUE	=> $date_obj->mday));
	} elsif ($qoptions->{'-TYPE'} =~/text/io) {
		return $q->textfield(	-NAME		=> $qfieldname.'_day',
								-SIZE		=> $qoptions->{'-DAY_SIZE'}			|| 2,
								-MAXLENGTH	=> $qoptions->{'-DAY_MAXLENGTH'}	|| 2,
								-OVERRIDE	=> $qoptions->{'-DAY_OVERRIDE'}		|| 1,
								-DEFAULT	=> $q->param( $qfieldname.'_day' )	|| $date_obj->mday
							);
	} else {
		return $q->popup_menu(	-NAME		=> $qfieldname.'_day',
								-VALUES		=> [ 1 .. 31 ],
								-OVERRIDE	=> $qoptions->{'-DAY_OVERRIDE'}		|| 1,
								-DEFAULT	=> $q->param( $qfieldname.'_day' )	|| $date_obj->mday
							);
	}
} # END sub HTML_day


=item C<HTML_month> ( $fieldname [, $qoptions ] )

lib/BingoX/Chromium.pm  view on Meta::CPAN

				$q->hidden(	-NAME	=> $qfieldname.'_mon',
							-VALUE	=> $date_obj->mon));
	} elsif ($qoptions->{'-TYPE'} =~/text/io) {
		return $q->textfield(	-NAME		=> $qfieldname.'_mon',
								-SIZE		=> $qoptions->{'-MON_SIZE'}			|| 2,
								-MAXLENGTH	=> $qoptions->{'-MON_MAXLENGTH'}	|| 2,
								-OVERRIDE	=> $qoptions->{'-MON_OVERRIDE'}		|| 1,
								-DEFAULT	=> $q->param( $qfieldname.'_mon' )	|| $date_obj->mon
							);
	} else {
		return $q->popup_menu(	-NAME		=> $qfieldname . '_mon',
								-VALUES		=> [ 1 .. 12 ],
								-LABELS		=> ($format =~ /\%B/o ? $date_obj->months_full : $date_obj->months),
								-OVERRIDE	=> $qoptions->{'-MON_OVERRIDE'}		|| 1,
								-DEFAULT	=> $q->param( $qfieldname.'_mon' )	|| $date_obj->mon
							);
	}
} # END sub HTML_month


=item C<HTML_year> ( $fieldname [, $qoptions ] )

lib/BingoX/Chromium.pm  view on Meta::CPAN

		return ($year ,$q->hidden(	-NAME	=> $qfieldname.'_year',
									-VALUE	=> $year));
	} elsif ($qoptions->{'-TYPE'} =~/text/io) {
		return $q->textfield(	-NAME		=> $qfieldname.'_year',
								-SIZE		=> $size, 
								-MAXLENGTH	=> $max, 
								-OVERRIDE	=> $qoptions->{'-YEAR_OVERRIDE'}	|| 1,
								-DEFAULT	=> $q->param( $qfieldname.'_year' )	|| $year
							);
	} else {
		return $q->popup_menu(	-NAME		=> $qfieldname.'_year',
								-VALUES		=> $values,
								-OVERRIDE	=> $qoptions->{'-YEAR_OVERRIDE'}	|| 1,
								-DEFAULT	=> $q->param( $qfieldname.'_year' )	|| $year
							);
	}
} # END sub HTML_year


=item C<HTML_date> ( $fieldname [, $qoptions ] )

lib/BingoX/Chromium.pm  view on Meta::CPAN

					-OVERRIDE	=> $qoptions->{'-OVERRIDE'}	|| 1,
					-DEFAULT	=> (defined($q->param( $qfieldname ))
									?	$q->param( $qfieldname )
									:	(($self->displaymode eq 'modify')
										? $self->db_obj->$fieldname()
										: ($qoptions->{'-DEFAULT'} || '')))
				) . "\n";
} # END sub HTML_textarea


=item C<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.

B<OPTIMIZE>

=cut

sub HTML_popup {
	my $self		= shift;
	my $class		= ref($self) || return undef;
	my $fieldname	= shift;
	my $qoptions	= shift || $self->fieldhtmloptions( $fieldname );
	my $foptions	= $self->fieldoptions( $fieldname );
	my $q			= $self->cgi;

	## if modify then grab the actual values of the primary keys of the obect				##
	## and prepend the fieldname with them.  This will allow people to modify multiple		##
	## objects on the same page.   Always put the classname and the fieldname at the end	##

lib/BingoX/Chromium.pm  view on Meta::CPAN

							{
								$relclass->primary_keys->[0] => $self->db_obj->$fieldname()
							}
					) || [ ] }->[0];
		(ref($obj) ? return $obj->$relclass_title_field() : return 'None Selected') . "\n";

	## get all of the objects with get_list_hash. ##
	} else {
		my $hashref	= $relclass->get_list_hash( $self->dbh );

		## Allows null value for popups ##
		if (!$foptions->{'not_null'} && $foptions->{'null_label'}) {
			$hashref->{'NULL'} = $foptions->{'null_label'};
		}

#		## if the displaymode isn't add, then highlite the already related objects. ##
#		my $selected = ($self->displaymode eq 'add')
#					? [ ]
#					: $self->db_obj->list_related( $relclass );
#		warn "Too Many Related" if ($selected->[1] && $debug);

		## default - if there's already data in the query object, highlite those objects,			##
		## otherwise if the displaymode if modify, show the data in the scrolling list where the	##
		## keys are composit primary keys seperated by $self->pkd and the									##
		## values are the title_fields of the objects, else don't highlite anything.				##
		$q->popup_menu(	-NAME		=> $qfieldname,
						-VALUES		=> [ sort { $hashref->{$a} cmp $hashref->{$b} } keys %$hashref ],	# need to fill in info later
						-LABELS		=> $hashref,														# need to fill in info later
						-DEFAULT	=> (defined($q->param( $qfieldname ))
									?	$q->param( $qfieldname )
									:	(($self->displaymode eq 'modify')
										? (defined($self->db_obj->$fieldname())
											? $self->db_obj->$fieldname()
											: ($foptions->{'null_label'}
												? 'NULL'
												: $qoptions->{'-DEFAULT'} || ''))
		## The trinary below is for parent child relationships.  Basically, if	##
		## we're adding a new object and this pop-up represents a list of our	##
		## parent fields, we should default to the parent we came through.		##
										: ((($self->displaymode eq 'add') && ($reladminclass eq $self->parent_class) && ($q->param('parent_pcpkey'))) 
											? (substr($q->param('parent_pcpkey'),rindex($q->param('parent_pcpkey'),$self->qfd)+1))
											: ($qoptions->{'-DEFAULT'} || ''))))
						) . "\n";
	}
} # END sub HTML_popup


=item C<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'.

lib/BingoX/Chromium.pm  view on Meta::CPAN

  - 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

lib/BingoX/Chromium.pm  view on Meta::CPAN

 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

lib/BingoX/Chromium.pm  view on Meta::CPAN

=over 4

=item * HTML_checkbox - needs work

=item * HTML_checkboxes (for multiple checkboxes)

=item * HTML_radio

=item * HTML_file - needs work

=item * HTML_popup - should support getting a hashref or a coderef as the LABELS or VALUES

=item * HTML_date - Only supports PST (hardcoded text)

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

=item * HTML_date - Needs to be able to show hours and minutes in a flexable way.

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

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

lib/BingoX/Chromium.pm  view on Meta::CPAN

=item * Apache error page (nicer then Server Error)

=item * New class variable for adminpath (Where that thing can be administered).

=item * Add seperator method (for drawing HRs) between column edit things.

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

=item * HTML methods should use options hash from fields hash.

=item * 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?)

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

=item * have AUTLOAD create dynamic methods

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

=back

=head1 COPYRIGHT

lib/BingoX/Cobalt.pm  view on Meta::CPAN

		$values 	= $date->hours;
		if ($date->hour > 0 && $date->hour <= 12) {
			$default = $date->hour;
		} elsif ($date->hour == 0) {
			$default = '12';
		} else {
			$default = $date->hour - 12;
		}
	}

	return $self->cgi->popup_menu(	-NAME		=> $name,
									-VALUES		=> $values,
									-DEFAULT	=> sprintf("%02d", $default),
									-OVERRIDE	=> 1);
} # END of sub hour_menu


=item C<min_menu> ( $name [, $default ] )

Returns a Popup Menu with Minutes.

=cut
sub min_menu {
	my $self	= shift;
	my $name	= shift;
	my $default	= shift || undef;
	my $date	= ref($default) ? $default : BingoX::Time->new;

	return $self->cgi->popup_menu(	-NAME		=> $name,
									-VALUES		=> $date->minutes,
									-DEFAULT	=> sprintf("%02d", $date->min),
									-OVERRIDE	=> 1);
} # END of sub min_menu


=item C<am_pm_menu> ( $name [, $default ] )

Returns a Popup Menu with AM/PM menus.

lib/BingoX/Cobalt.pm  view on Meta::CPAN

	my $self	= shift;
	my $name	= shift;
	my $default	= shift || undef;
	my $date	= ref($default) ? $default : BingoX::Time->new;

	if ($date->hour >= 0 && $date->hour < 12) {
		$default = 'AM';
	} else {
		$default = 'PM';
	}
	return $self->cgi->popup_menu(	-NAME 		=> $name,
									-VALUES 	=> [ 'AM', 'PM' ],
									-DEFAULT 	=> $default || '',
									-OVERRIDE 	=> 1);
} # END of sub am_pm_menu


=item C<day_menu> ( $name [, $default ] )

Returns a Popup Menu with the Days of the Month.

=cut
sub day_menu {
	my $self	= shift;
	my $name	= shift;
	my $default	= shift || undef;
	my $date	= ref($default) ? $default : BingoX::Time->new;

	return $self->cgi->popup_menu(	-NAME		=> $name,
									-VALUES		=> [ 1 .. 31 ],
									-DEFAULT	=> $date->mday,
									-OVERRIDE	=> 1);
} # END of sub day_menu


=item C<month_menu> ( $name [, $default ] )

Returns a Popup Menu with the Months of the Year.

=cut
sub month_menu {
	my $self	= shift;
	my $name	= shift;
	my $default	= shift || undef;
	my $date	= ref($default) ? $default : BingoX::Time->new;

	return $self->cgi->popup_menu(	-NAME		=> $name,
									-VALUES		=> [ 1 .. 12 ],
									-LABELS		=> $date->months,
									-DEFAULT	=> $date->mon,
									-OVERRIDE	=> 1);
} # END of sub month_menu


=item C<year_menu> ( $name [, $default ] )

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

=cut
sub year_menu {
	my $self	= shift;
	my $name	= shift;
	my $default	= shift || undef;
	my $date	= ref($default) ? $default : BingoX::Time->new;
	my $start_year = $date->year;

	return $self->cgi->popup_menu(	-NAME 		=> $name,
									-VALUES 	=> [ ($start_year - 20) .. ($start_year + 20) ],
									-DEFAULT 	=> $date->year,
									-OVERRIDE 	=> 1);
} # END of sub year_menu


=item C<errors_list> (  )

Returns list of errors in list format.

lib/BingoX/Cobalt.pm  view on Meta::CPAN

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

=cut
sub hidden {
	my $self = shift;
	my $name = shift;
	return $self->cgi->hidden(-NAME => $name, @_);
} # END of sub hidden


=item C<popup_menu> ( $name, %params )

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

=cut
sub popup_menu {
	my $self = shift;
	my $name = shift;
	return $self->cgi->popup_menu(-NAME => $name, -DEFAULT => ($self->_get_default($name) || ''), @_);
} # END of sub popup_menu


=item C<checkbox> ( $name, %params )

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

=cut
sub checkbox {
	my $self = shift;



( run in 2.700 seconds using v1.01-cache-2.11-cpan-364913b4093 )