package HTML::Prototype;
use strict;
use base qw/Class::Accessor::Fast/;
use vars qw/$VERSION $prototype $controls $dragdrop $effects/;
$VERSION = '1.45';
use HTML::Element;
use HTML::Prototype::Js;
use HTML::Prototype::Controls;
use HTML::Prototype::DragDrop;
use HTML::Prototype::Effects;
use HTML::Prototype::Helper;
$prototype = do { package HTML::Prototype::Js; local $/; };
$controls = do { package HTML::Prototype::Controls; local $/; };
$dragdrop = do { package HTML::Prototype::DragDrop; local $/; };
$effects = do { package HTML::Prototype::Effects; local $/; };
my $callbacks = [qw/uninitialized loading loaded interactive complete/];
my $ajax_options = [qw/url asynchronous method insertion form with/];
=head1 NAME
HTML::Prototype - Generate HTML and Javascript for the Prototype library
=head1 SYNOPSIS
use HTML::Prototype;
my $prototype = HTML::Prototype->new;
print $prototype->auto_complete_field(...);
print $prototype->auto_complete_result(...);
print $prototype->auto_complete_stylesheet(...);
print $prototype->content_tag(...);
print $prototype->define_javascript_functions;
print $prototype->draggable_element(...);
print $prototype->drop_receiving_element(...);
print $prototype->evaluate_remote_response(...);
print $prototype->form_remote_tag(...);
print $prototype->in_place_editor(...);
print $prototype->in_place_editor_field(...);
print $prototype->in_place_editor_stylesheet(...);
print $prototype->javascript_tag(...);
print $prototype->link_to_function(...);
print $prototype->link_to_remote(...);
print $prototype->observe_field(...);
print $prototype->observe_form(...);
print $prototype->periodically_call_remote(...);
print $prototype->sortable_element(...);
print $prototype->submit_to_remote(...);
print $prototype->tag(...);
print $prototype->text_field_with_auto_complete(...);
print $prototype->update_element_function(...);
print $prototype->visual_effect(...);
=head1 DESCRIPTION
The module contains some code generators for Prototype, the famous JavaScript
OO library and the script.aculous extensions.
The Prototype library (http://prototype.conio.net/) is designed to make
AJAX easy. Catalyst::Plugin::Prototype makes it easy to connect to the
Prototype library.
This is mostly a port of the Ruby on Rails helper tags for JavaScript
for use in L.
=head2 METHODS
=over 4
=item $prototype->in_place_editor( $field_id, \%options )
Makes an HTML element specified by the DOM ID C<$field_id> become an in-place
editor of a property.
A form is automatically created and displayed when the user clicks the element,
something like this:
The form is serialized and sent to the server using an Ajax call, the action
on the server should process the value and return the updated value in the
body of the reponse. The element will automatically be updated with the
changed value (as returned from the server).
Required options are:
C: Specifies the url where the updated value should be sent after the
user presses "ok".
Addtional options are:
C: Number of rows (more than 1 will use a TEXTAREA)
C: The number of columns the text area should span (works for both single line or multi line).
C: Synonym for ‘cols’ when using single-line (rows=1) input
C: The text on the cancel link. (default: "cancel")
C: CSS class used for the in place edit form. (default: "inplaceeditor-form")
C: The text on the save link. (default: "ok")
C: CSS class added to the element while displaying "Saving..."
(removed when server responds). (default: "inplaceeditor-saving")
C: Will cause the text to be loaded from the server (useful if
your text is actually textile and formatted on the server)
C: If the C option is specified then this text is
displayed while the text is being loaded from the server. (default: "Loading...")
C: The text on the click-to-edit link. (default: "click to edit")
C: The id of an external control used to enter edit mode.
C: Pass through options to the AJAX call (see prototype's Ajax.Updater)
C: JavaScript snippet that should return what is to be sent in the
Ajax call, C