CGI-Browse
view release on metacpan or search on metacpan
lib/CGI/Browse.pm view on Meta::CPAN
=head3 URLS AND LINK-OUTS
Two keys should always be defined: "root" and "browse".
If all of your scripts/controllers use a common domain or directory, use the root key to set it. If they are on different pathways or domains, set the root key to an empty string.
Additional URLs may be defined. The keys should match the "link" key values from the fields list-of-hashes. In the included example, the "State" column has a link-out named "link1", so the "urls" parameter includes a URL key for link1, which points t...
=head2 OPTIONAL PARAMETERS
=head3 CLASSES
This list of CSS classes enables you to create alternating style patterns on your data rows for visibility. Note that the default classes are ["rowA", "rowB"], which alternates every other row. The included example uses a larger pattern ["rowA", "row...
=head3 DEFAULT HTML FEATURE
The module can return the default layout by using the "default_html" key in the "features" parameter hashref. If you do not use this setting, then the module will return a hashref of individual blocks for each data and label feature. This hashref is ...
=head3 DELETE FEATURE
There are two different delete methods available in addition to disabling the delete feature.
You can enable a delete per row:
features => { default_html => 1, delete => 'each' }
You can enable delete checkboxes with a "Delete selected" button:
features => { default_html => 1, delete => 'multi' }
You can disable delete by removing the delete key from the "features" parameter key:
features => { default_html => 1 }
=head2 INCLUDED FILES
=head3 CGI SCRIPTS
Two of the included scripts illustrate working implementations of CGI::Browse using the included browse.sql data.
=over
=item * browse.cgi
Shows "each" delete and "default_html" feature.
=item * browse_tmpl.cgi
Shows "multi" delete and uses Template to manage HTML layout.
=back
Additionally, a browse_delete.cgi script is included as a target for the browse*cgi scripts. Its only purpose is to display the CGI variables sent from the form or link-out.
To edit the scripts for your system, include these steps.
=over 4
=item 1. Install CGI::Browse.
=item 2. Set script ownership (chown) and permissions (chmod) if necessary.
=item 3. Run the included browse.sql script against your database.
=item 4. Edit browse.cgi and change the database "mydb" to your database name.
=item 5. Edit browse.cgi and change the user "user" to your user name.
=item 6. Edit browse.cgi and change the password "pass" to your password.
=back
=head3 HTML FILES
The included files are:
=over
=item * browse.css
This file can be edited and placed in your traditional styles directory, or the styles can be added to your choice of CSS file.
=item * browse.js
This file is included for illustration, but the generated version should be used since the included URLs are built according to your script's need. (The scripts reset the "action" for the form.)
=item * browse.tmpl
This file can be edited and placed in your traditional template directory, or you can use whatever template variables you wish in your own tmpl file.
=back
=head1 INTERFACE
The module has only one public method besides new().
=over
=item * build()
Returns a hashref or html depending on the "default_html" feature setting (see above). The included hashref-keys/tmpl-variables are:
browse_styles
browse_script
browse_action
browse_table
browse_sorted
browse_start
browse_prevnext
browse_show
browse_goto
browse_control
browse_delete
=back
The following methods are considered private because they are already called by build(), but may be useful depending on your implementation.
=over
=item * _build_styles()
( run in 0.832 second using v1.01-cache-2.11-cpan-ceb78f64989 )