Sergey Rusakov > ePortal-4.5 > ePortal::HTML::Dialog

Download:
ePortal-4.5.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 4.5   Source  

NAME ^

ePortal::HTML::Dialog - A widget for generating HTML code for Dialogs.

SYNOPSIS ^

This module is used to make a dialog windows. All drawing methods returns the HTML in scalar or array context or output it with $m->print in void context.

    # Typical example:
     
    <% $dlg->dialog_start( title => 'Dialog's title', width => 400) %>
    <% $dlg->field( "field1", RO => 1) %>
    <% $dlg->field( "hidden_field", hidden=>1)  %>
    <% $dlg->field( "field")  %>
    <% $dlg->row('&nbsp;') %>
    <% $dlg->buttons(delete_button => 1) %>
    <% $dlg->dialog_end %>
    <p>

    <%method onStartRequest><%perl>
        $obj = new ePortal::ThePersistent::SupportObject;
        $dlg = new ePortal::HTML::Dialog( obj => $obj);

        my $location = try {
          $dlg->handle_request( );
        } catch ePortal::Exception::DataNotValid with {
          my $E = shift;
          $session{ErrorMessage} = $E->text;
          '';
        };

        if ($dlg->isButtonPressed('ok') { ... }
        return $location if $location;
    </%perl></%method>

    %#=== @metags once =========================================================
    <%once>
    my ($dlg, $obj);
    </%once>

    %#=== @metags cleanup =========================================================
    <%cleanup>
    ($dlg, $obj) = ();
    </%cleanup>

METHODS ^

new()

Object contructor. Maintain the same parameters as initialize(). Initializes all internal attributes to their default values.

 my $d = new ePortal::HTML::Dialog( obj => $object );
 my $location = $d->handle_reqest();
 ...

initialize()

Accept many parameters to configure visual representation of dialog and its internal logic.

See "Dialog attributes" for details.

handle_request(%hash)

Responsible for handling request from dialog events. This function processes button presses, does object preservation, deletion, copying, etc.

As result it returns an URL for external redirect. It does not do redirect itself.

isButtonPressed($button_name)

Checks is a button was pressed. Use this function only after call to handle_request().

button_name is one of: qw/q max min edit delete copy x ok cancel more/

dialog_start()

Start a dialog. Output its caption and start <FORM> tag.

dialog_end()

Output closing tags for <TABLE> and <FORM>, focus the cursor

row()

Generates a row for dialog's table. Parameters are passed in two modes:

 row(text, -colspan=>2, -align=>"center", option => xxx)
 row(label, value, option => xxx)

text is shown in 2 cells colspan. label,value is shown in 2 cells. Options are passed directly to CGI module.

field($field_name,%parameters)

Display an input field for an attribute of the object. Field label and it's dialog control is determined via htmlLabel() and htmlField().

Parameters are:

buttons()

Draw a row with a buttons. By default only 2 buttons are shown: ok_button and cancel_button. See initialize() for details.

DIALOG ATTRIBUTES ^

This attributes may be used in ant call to handle_request, initialize, or any call to dialog.mc method.

AUTHOR ^

Sergey Rusakov, <rusakov_sa@users.sourceforge.net>

syntax highlighting: