dialog.mc - Dialog contruction module.
This Mason component replaces obsoleted ePortal::HTML::Dialog package.
dialog.mc
is used to draw a dialog like windows. Some methods are used
for easy creation of dialogs to edit ThePersistent
objects.
<&| /dialog.mc, parameters ... &> content of the dialog </&>
img()
global function.
icons => [ { src => '/images/image.gif', href => 'some.where.htm', title => 'alt description for icons' } ]
xxx_icon - URL for the icon
xxx_icon_title - popup title for the icon
where xxx is a name of icon.
This method used to construct ``Edit an object'' dialog with a submit form iside.
WARNING! This method generates
<table cols="2"> Your content here </table>
Parameters:
ThePersistent
object to edit.
xxx_icon => 1
to construct an icons with all needed parameters. Call isButtonPressed('xxx')
to check what button or icon was actually clicked.
Generate HTML form. See field methods for details how to generate HTML fields.
<& /dialog.mc:form, parameters, ... &>
Most of dialog field creation method accepts the following parameters:
$obj
object may contain some
useful attributes: fieldtype
, value
, label
, etc...
label
attribute of the
object.
value
attribute of the object.
canvas
property.
Draw a cell for edit_dialog. That is is <td colspan=``2''>. All -xxx like parameters are passed to CGI::td() function.
Draw a row with two cells: label and value
Display content
inside a canvas
.
<&| /dialog.mc:canvas, label => ..., parameters, ... &> dialog value </&>
<canvas> <% optional label %> <% $m->content %> </canvas>
<canvas> label content </canvas>
Discover field type with a help of fieldtype
attribute of the object and
call appropriate method of dialog.mc. Default field type is textfield
.
This is default method to produce a dialog field. This method created a row of table
<tr> <td>label:</td> <td>field</td> </tr>
/dialog.mc:hidden - generate hidden field
Generates list box aka popup_menu.
($values_array, $labels_hash)
Generates radio button group.
Generate text field.
See DIALOG FORM FIELDS for other parameters.
Generate password input field.
See DIALOG FORM FIELDS for other parameters.
Generate text area field.
See DIALOG FORM FIELDS for other parameters.
Generate ACL property field.
See DIALOG FORM FIELDS for other parameters.
Generate file upload field.
See DIALOG FORM FIELDS for other parameters.
Generates list box or checkbox to input YES or NO.
Generates checkbox tag.
Generates date input field.
Generate text read only field.
See DIALOG FORM FIELDS for other parameters.
Display dialog buttons.
<& /dialog.mc:buttons, parameters, ... &>
Possible button names are: ok, cancel, more, delete, apply.
To diplay a button pass parameter xxx_button => 1
To change predefined label of a button pass parameter xxx_label => ``...''
ok and cancel buttons are displayed by default.
Internal method. Do not use it! Used to produce one row table with three cells. This is the correct way to align a table.
td1 td2 td3
This the engine of dialog. Call it from onStartupRequest
method for
proper redirect handling.
This method does the following:
This method is under construction
Safely get attributes values from request and apply them to the object. This method does not updates the object in database. Do it yourself.
This method does extra processing for special multipart attributes like DateTime, xacl_field, etc...
This method does not updates ID attributes.
Check is a button was pressed on dialog.
Every standard dialog button named as dlgb_NAME
. If no dlgb_NAME
parameter exists in request then isButtonPressed('ok')
returns true on
dialog submit.
icons: q max min edit x buttons: ok cancel copy delete apply more
Calculates URL where to return (redirect) from Dialog when a button will pressed.
Sergey Rusakov, <rusakov_sa@users.sourceforge.net>