App-ZofCMS

 view release on metacpan or  search on metacpan

lib/App/ZofCMS/Plugin/StartPage.pm  view on Meta::CPAN

up saved start page setting. If C<undef> is specified or the
subref returns an C<undef> or an empty list, plugin will stop further
processing. If subref is specified, its return value will be assigned to
C<login> as if it was already there. The C<@_> of the subref will
contain C<$t>, C<$q>, and C<$config> (in that order), where C<$t> is
ZofCMS Template hashref, C<$q> is query parameters hashref,
and C<$config> is the L<App::ZofCMS::Config> object.
B<Defaults to:> C<< sub { $_[0]->{d}{user}{login} } >>

=head3 C<label_text>

    plug_start_page => {
        label_text => 'Start page:',
    ...

B<Optional>. Takes a string as a value. Specifies the text for the
C<< <label> >> element in the start page selection form.
B<Defaults to:> C<Start page:>

=head3 C<default_page>

    plug_start_page => {
        default_page => undef,
    ...

    plug_start_page => {
        default_page => 'http://mind-power-book.com/',
    ...

B<Optional>. Takes either C<undef> or a string as a value.
If set to a string and the user does not have saved start page
setting, then the user will be redirected to C<default_page> URI.
If C<default_page> is not specified (C<undef>), then user will not
be redirected anywhere (that is, when their start page was never
chosen). B<Defaults to:> C<undef>

=head3 C<submit_button>

    plug_start_page => {
        submit_button => q|<input type="submit" class="input_submit"|
                            . q| value="Save">|,
    ...

B<Optional>. Takes HTML code as a value. Specifies the HTML
code for the submit button of the start page selecting form.
Feel free to insert here any extra HTML code you might require.
B<Defaults to:>
C<< <input type="submit" class="input_submit" value="Save"> >>

=head1 HTML::Template VARIABLES

If C<no_redirect> argument (see above) is set to a true value, the
plugin will stick C<plug_start_page_form> variable into C<{t}>
ZofCMS Template special key. It will contain the start page selecting
form in it.

    <tmpl_var name='plug_start_page_form'>

=head1 GENERATED HTML CODE

Here's what plugin generated start page selecting form looks like:

    <p class="success-message">Successfully saved</p>

    <form action="" method="POST" id="plug_start_page_form">
    <div>
        <input type="hidden" name="page" value="/index">
        <input type="hidden" name="plugsp_save_settings" value="1">

        <label for="plugsp_page">Start page:</label
        ><select id="plugsp_page" name="plugsp_page"
        >
            <option value="http://google.ca/">Google</option>
            <option value="http://zoffix.com/"
                selected
            >Zoffix Znet Portal</option>
            <option value="http://mind-power-book.com/">Mind Power Book</option>
        <input type="submit" class="input_submit" value="Save">
    </div>
    </form>

The value for C<page> hidden C<< <input> >> is derived by the plugin
automagically. The C<< <p class="success-message">Successfully saved</p>
>> element is shown only when the user saves their settings. The text
for the C<< <label> >> is controlled by the C<label_text> argument,
and the HTML code of the submit button is controlled by
C<submit_button>.

=head1 REQUIRED MODULES

Plugin likes to play with these modules:

    App::ZofCMS::Plugin::Base => 0.0106,
    HTML::Template            => 2.9,
    DBI                       => 1.609,

=head1 REPOSITORY

Fork this module on GitHub:
L<https://github.com/zoffixznet/App-ZofCMS>

=head1 BUGS

To report bugs or request features, please use
L<https://github.com/zoffixznet/App-ZofCMS/issues>

If you can't access GitHub, you can email your request
to C<bug-App-ZofCMS at rt.cpan.org>

=head1 AUTHOR

Zoffix Znet <zoffix at cpan.org>
(L<http://zoffix.com/>, L<http://haslayout.net/>)

=head1 LICENSE

You can use and distribute this module under the same terms as Perl itself.
See the C<LICENSE> file included in this distribution for complete
details.

=cut



( run in 2.396 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )