App-ZofCMS

 view release on metacpan or  search on metacpan

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

    return 1;
}

1;
__END__

=encoding utf8

=head1 NAME

App::ZofCMS::Plugin::AntiSpamMailTo - "smart" HTML escapes to protect mailto:foo@bar.com links from not-so-smart spam bots

=head1 SYNOPSIS

In your Main Config file or ZofCMS template:

    # include the plugin
    plugins => [ qw/AntiSpamMailTo/ ],

    # then this:
    plug_anti_spam_mailto => 'bar',

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

        file    => 'bar.png',
        type    => 'UPCA', # default
        format  => 'png',  # default
        no_text => 0,      # default
        height  => 50,     # default
    },

In your HTML::Template template (in case errors occur):

    <tmpl_if name='plug_barcode_error'>
        <p>Error: <tmpl_var escape='html' name='plug_barcode_error'></p>
    </tmpl_if>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS> that provides means to generate various
types of barcodes and either output them directly to the browser or save them as
an image.

This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config> and
L<App::ZofCMS::Template>

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

        code    => '12345678901',
        height  => 50,
    },

B<Optional>. Takes positive integer numbers as a value. Specifies the height of the
generated barcode image. B<Defaults to:> C<50>

=head1 ERROR HANDLING

    <tmpl_if name='plug_barcode_error'>
        <p>Error: <tmpl_var escape='html' name='plug_barcode_error'></p>
    </tmpl_if>

In an error occurs while generating the barcode (i.e. wrong code length was specified
or some I/O error occurred if saving to a file), the plugin will set
the C<< $t->{t}{plug_barcode_error} >> (where C<$t> is ZofCMS Template hashref)
to the error message.

=head1 SEE ALSO

L<GD::Barcode>

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

}

sub form_html_template {
    return <<'END_HTML';
<tmpl_if name='save_success'>
    <p class="success-message">Successfully saved</p>
</tmpl_if>
<form action="" method="POST" id="plug_bool_settings_manager_form">
<div>
    <input type="hidden" name="page"
        value="<tmpl_var escape='html' name='page'>">
    <input type="hidden" name="pbsm_save_settings" value="1">
    <ul>
    <tmpl_loop name='settings'>
        <li id="pbsm_container_<tmpl_var escape='html' name='id'>">
            <input type="checkbox"
                id="pbsm_<tmpl_var escape='html' name='id'>"
                name="<tmpl_var escape='html' name='id'>"
                <tmpl_if name='is_checked'>checked</tmpl_if>
                ><label for="pbsm_<tmpl_var escape='html' name='id'>"
                    class="checkbox_label"> <tmpl_var escape='html' name='value'></label>
        </li>
    </tmpl_loop>
    </ul>

    <tmpl_var name="submit_button">
</div>
</form>
END_HTML
}

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


    return;
}

sub _get_D_form_template {
    return <<'END_HTML';
<form class="delete_button_form delete_form" method="POST" action=""
><div
    ><input type="hidden"
        name="page"
        value="<tmpl_var escape='html' name='page'>"
    ><input type="hidden"
        name="crud_delete"
        value="1"
    ><input type="hidden"
        name="crud_id"
        value="[<<ITEM:ID>>]"
    ><input type="image"
        alt="Delete"
        class="delete_button_no_style"
        src="/pics/delete-button.png"
></div></form>
END_HTML
}

sub _get_U_form_template {
    return <<'END_HTML';
<form class="update_button_form update_form" method="POST" action=""
><div
    ><input type="hidden"
        name="page"
        value="<tmpl_var escape='html' name='page'>"
    ><input type="hidden"
        name="crud_update"
        value="1"
    ><input type="hidden"
        name="crud_id"
        value="[<<ITEM:ID>>]"
    ><input type="image"
        alt="Update"
        class="update_button"
        src="/pics/update-button.png"
></div></form>
END_HTML
}

sub _get_CU_form_template {
    return <<'END_HTML';
<tmpl_if name='create_success'>
    <p class="success-message">Item has been successfully added. <a href="<tmpl_var escape='html' name='page'>">Add another one</a></p>
</tmpl_if>
<tmpl_if name='update_success'>
    <p class="success-message">Item has been successfully updated. <a href="<tmpl_var escape='html' name='page'>">Back to the form</a></p>
</tmpl_if>
<tmpl_unless name='hide_form'>
    <form action="" method="POST" id="crud_<tmpl_if name='is_create'>c<tmpl_else>u</tmpl_if>form"<tmpl_if name='has_files'> enctype="multipart/form-data"</tmpl_if>>
    <div>
        <input type="hidden" name="page"
            value="<tmpl_var escape='html' name='page'>">
        <input type="hidden" name="crud_<tmpl_if name='is_create'>create<tmpl_else>update_save</tmpl_if>" value="1">

        <tmpl_unless name='is_create'>
            <input type="hidden" name="crud_id"
                value="<tmpl_var escape='html' name='id'>">
        </tmpl_unless>

        <tmpl_loop name='errors'>
            <p class="error"><tmpl_var escape='html' name='error'></p>
        </tmpl_loop>

        <p class="crud_form_note">Fields marked with
            an asterisk(*) are mandatory.</p>
        <ul>
            <tmpl_loop name='elements'>
            <li>
                <tmpl_if name='el_text'>
                    <label for="<tmpl_var escape='html' name='id'>">
                        <tmpl_unless name='optional'>
                        *</tmpl_unless><tmpl_var
                            escape='html' name='text'>:</label>
                    <input type="text"
                        class="input_text"
                        name="<tmpl_var escape='html' name='name'>"
                        value="<tmpl_var escape='html' name='value'>"
                        id="<tmpl_var escape='html' name='id'>">
                </tmpl_if>
                <tmpl_if name='el_textarea'>
                    <label for="<tmpl_var escape='html' name='id'>"
                        class="textarea_label"
                        ><tmpl_unless name='optional'>
                        *</tmpl_unless><tmpl_var
                            escape='html' name='text'>:</label>
                    <textarea cols="60" rows="5"
                        name="<tmpl_var escape='html' name='name'>"
                        id="<tmpl_var escape='html' name='id'>"
                        ><tmpl_var escape='html' name='value'></textarea>
                </tmpl_if>
                <tmpl_if name='el_file'>
                    <tmpl_if name='is_create'>
                        <label for="<tmpl_var escape='html' name='id'>"
                            ><tmpl_unless name='optional'>
                        *</tmpl_unless><tmpl_var
                            escape='html' name='text'>:</label>
                        <input type="file"
                            class="input_file"
                            name="<tmpl_var escape='html' name='name'>"
                            id="<tmpl_var escape='html' name='id'>">
                    <tmpl_else>
                        Can't change files.
                    </tmpl_if>
                </tmpl_if>
            </li>
            </tmpl_loop>
        </ul>

        <input type="submit" value="Submit">
    </div>

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

                <td>Description</td>
                <td>Add Time</td>
            </tr>
        </thead>
        <tbody>
            <tmpl_loop name='crud_items'>
                <tr>
                    <td>
                    <tmpl_var name='crud_d_form'>
                    <tmpl_var name='crud_u_form'>
                    <a href="<tmpl_var escape='html' name='file'>"
                        target="_blank"><tmpl_var
                        escape='html' name='item'></a></td>
                    <td><tmpl_var name='description'></td>
                    <td><tmpl_var name='foo1'></td>
                    <td><tmpl_var name='foo2'></td>
                    <td><tmpl_var escape='html' name='time'></td>
                </tr>
            </tmpl_loop>
        </tbody>
        </table>
    <tmpl_else>
        <p>Currently there are no items in the database.</p>
    </tmpl_if>

=head1 DESCRIPTION

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

        <table>
        <thead>
            <tr>
                <td>Item</td>
                <td>Employee's Performance Record #</td>
            </tr>
        </thead>
        <tbody>
            <tmpl_loop name='crud_items'>
                <tr>
                    <td><tmpl_var escape='html' name='item'></td>
                    <td><tmpl_var escape='html'
                        name='employee_s_performance_record__'></td>
                </tr>
            </tmpl_loop>
        </tbody>
        </table>
    <tmpl_else>
        <p>Currently there are no items in the database.</p>
    </tmpl_if>

=head4 hashref

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

                <td>Description</td>
                <td>Add Time</td>
            </tr>
        </thead>
        <tbody>
            <tmpl_loop name='crud_items'>
                <tr>
                    <td>
                    <tmpl_var name='crud_d_form'>
                    <tmpl_var name='crud_u_form'>
                    <a href="<tmpl_var escape='html' name='file'>"
                        ><tmpl_var escape='html' name='item'></a></td>
                    <td><tmpl_var name='description'></td>
                    <td><tmpl_var name='foo1'></td>
                    <td><tmpl_var name='foo2'></td>
                    <td><tmpl_var escape='html' name='time'></td>
                </tr>
            </tmpl_loop>
        </tbody>
        </table>
    <tmpl_else>
        <p>Currently there are no items in the database.</p>
    </tmpl_if>

=head2 C<crud_success_message>

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

false if the user isn't allowed to I<List> (see C<can> configuration
argument).

=head2 C<crud_items>

   <tmpl_loop name='crud_items'>
        <tr>
            <td>
            <tmpl_var name='crud_d_form'>
            <tmpl_var name='crud_u_form'>
            <a href="<tmpl_var escape='html' name='file'>"
                ><tmpl_var escape='html' name='item'></a></td>
            <td><tmpl_var name='description'></td>
            <td><tmpl_var name='foo1'></td>
            <td><tmpl_var name='foo2'></td>
            <td><tmpl_var escape='html' name='time'></td>
        </tr>
    </tmpl_loop>

A loop containing records returned by the List operation. This variable
will be empty if the user isn't allowed to I<List> (see C<can> configuration
argument). The variables in the loop are as follows:

=head3 All items from C<items> configuration argument

    <a href="<tmpl_var escape='html' name='file'>"
        ><tmpl_var escape='html' name='item'></a></td>
    <td><tmpl_var name='description'></td>
    <td><tmpl_var name='foo1'></td>
    <td><tmpl_var name='foo2'></td>
    <td><tmpl_var escape='html' name='time'></td>

All the items you specified in the C<items> configuration argument will be
present here, even if that item was set as a subref in the C<items>.
You can also add extra keys here through C<list_sub> sub specified in the
configuration. B<Note:> any C<file> items will contain filename
I<and> directory specified in the C<file_dir> argument. You can modify that
using C<list_sub> sub.

=head3 C<crud_can_d>

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


        %$plug_conf,
    };
}

sub _comments_template {
    return <<'END_TEMPLATE';
<ul class="zofcms_comments">
<tmpl_loop name="comments">
    <li id="zofcms_comment_<tmpl_var name="comment_number">">
        <p class="zofcms_comments_name"><a href="#zofcms_comment_<tmpl_var name="comment_number">"><tmpl_var escape="html" name="name"></a></p>
        <p class="zofcms_comments_date"><tmpl_var escape="html" name="date"></p>
        <p class="zofcms_comments_comment"><tmpl_var name="comment"></p>
    </li>
</tmpl_loop>
</ul>
END_TEMPLATE
}

sub _form_template {
    return <<'END_TEMPLATE';
<tmpl_if name="success"><p class="success">Your comment was successfuly added.</p>
<p>Feel free to go back to the <a href="/index.pl?page=<tmpl_var name="back_to_comments_page" escape="html">">original page</a>.</p>
<tmpl_else>
<tmpl_if name="error"><p class="error"><tmpl_var name="error"></p></tmpl_if>
<form class="zofcms_comments" action="" method="POST">
<fieldset>
    <legend>Create new comment</legend>
    <input type="hidden" name="zofcms_comments_page" value="<tmpl_var name="comments_page" escape="html">">
    <input type="hidden" name="zofcms_comments_username" value="your user name">
    <input type="hidden" name="page" value="<tmpl_var escape="html"name="page">">
    <ul>
        <li>
            <label for="zofcms_comments_name">Name: </label
            ><input type="text" name="zofcms_comments_name"
            id="zofcms_comments_name" value="<tmpl_var escape="html" name="name">">
        </li>
        <li>
            <label for="zofcms_comments_email">E-mail: </label
            ><input type="text" name="zofcms_comments_email"
            id="zofcms_comments_email" value="<tmpl_var escape="html" name="email">">
        </li>
        <li>
            <label for="zofcms_comments_comment">Comment: </label
            ><textarea name="zofcms_comments_comment"
            id="zofcms_comments_comment" cols="40" rows="10"><tmpl_var name="comment" escape="html"></textarea>
        </li>
    </ul>
    <input id="zofcms_comments_submit" type="submit" value="Post">
</fieldset>
</form>
</tmpl_if>
END_TEMPLATE
}

sub _get_mail_template {

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

    );

    $conf{protocol} = $conf{protocol}->( $t, $q, $config )
        if ref $conf{protocol} eq 'CODE';

    my $original_page = $q->{page};
    $original_page = ''
        if $original_page eq 'index' and $conf{quiet_index};

    my $q_page = ($q->{dir} || '') . ($original_page || '');
    my @q_args = map uri_escape($_),
        grep { $_ ne 'dir' and $_ ne 'page' } sort keys %$q;

    my $q_string = join '&', map "$_=" . uri_escape( $q->{$_} ), @q_args;

    my %uris;
    if ( $conf{is_mod_rewrite} ) {

        %uris = (
            page    => $q_page,
            page_q  => $q_page
                . ( length($q_string) ? '?' . $q_string : '' ),
        );
    }
    else {
        %uris = (
            page    => '/index.pl?page=' . uri_escape($q_page),
            page_q  => '/index.pl?page=' . uri_escape($q_page)
                . ( length($q_string) ? '&' . $q_string : '' ),
        );
    }

    $uris{page_full} = join '', $conf{protocol},
        @ENV{ qw/SERVER_NAME  REQUEST_URI/ };

    $uris{"$conf{prefix}$_"} = delete $uris{$_}
        for keys %uris;

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

=encoding utf8

=head1 NAME

App::ZofCMS::Plugin::CurrentPageURI - ZofCMS plugin to automatically add current page URI into templates

=head1 SYNOPSIS

In your L<HTML::Template> template:

    <tmpl_var escape='html' name='page'>
    <tmpl_var escape='html' name='page_q'>
    <tmpl_var escape='html' name='page_full'>

In your ZofCMS Template:

    plugins => [ qw/CurrentPageURI/ ],

If current page's URI is C<http://zcms/?text=lalala>, the results are:

    /
    /?text=lalala
    http://zcms/?text=lalala

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

plugin will rename pages called C<index> to empty string. In other
words, while normally webroot URI would result in query parameter
C<< $q->{page} >> set to value C<index> and the plugin spitting out
the URI as C</index>; when C<quiet_index> is turned on, the plugin will
modify it to C</> (without the C<index> part). Note: this does B<NOT>
modify the value in the query parameters hashref; the change is
local to the plugin. B<Defaults to:> C<1>

=head1 HTML::Template VARIABLES

    <tmpl_var escape='html' name='page'>
    <tmpl_var escape='html' name='page_q'>
    <tmpl_var escape='html' name='page_full'>

If current page's URI is C<http://zcms/?text=lalala> and all the
defaults are used, the output will be:

    /
    /?text=lalala
    http://zcms/?text=lalala

Plugin adds three variables into C<{t}> ZofCMS Template special key,
for you to use in your L<HTML::Template> Template. Below their
default names are shown; plugin's argument C<prefix> specifies the
string to prepend to these default names. Examples show output
when current page's URI is C<http://zcms/?text=lalala>.

=head2 C<page>

    <tmpl_var escape='html' name='page'>

    Output: /

This variable will contain the current page's URI relative to
web-root and query parameters omitted.

=head2 C<page_q>

    <tmpl_var escape='html' name='page_q'>

    Output: /?text=lalala

This variable will contain the current page's URI relative to
web-root with all query parameters appended. The query parameters
will be escaped using L<URI::Escape>.

=head2 C<page_full>

    <tmpl_var escape='html' name='page_full'>

    Output: http://zcms/?text=lalala

This variable will contain the current page's full URI all query
parameters appended. B<Note:> this variale will actually be
derived from C<%ENV>, thus the query escapes might be less strict
as they won't be done by this plugin.

=head1 REQUIRED MODULES

This plugin needs L<URI::Escape> version 3.29 or greater.

=head1 REPOSITORY

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

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

            my ( $t, $q, $config ) = @_;
            return
                unless $q->{single};

            return $q->{single} == 1
            ? 'comments' : [ qw/comments posts etc/ ];
        }
    }

B<Optional>. Pneumonic: B<n>ew lines. Keys/indexes specified in
C<n> argument will have HTML entities escaped and new lines converted
to C<< <br> >> HTML elements.

Takes either a string, subref or an arrayref as a value. If the value is a subref,
that subref will be executed and its return value will be assigned
to C<n> as if it was already there. The C<@_> will contain
(in that order) ZofCMS Template hashref, query parameters hashref and
L<App::ZofCMS::Config> object. Passing (or returning from the sub)
a string is the same as passing an arrayref with just that string in it.
If set to C<undef> no processing will be done for new lines.

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

C<exit()>, unless C<no_exit> is set to a true value. Should that be
the case, it is your responsibility to call C<exit()> at a later time;
although, OpenOffice didn't seem to mind extraneous HTML code added
to the Excel file. B<Defaults to:> C<0>

=head1 HTML::Template TEMPLATE VARIABLES

=head2 C<plug_data_to_excel_error>

    <tmpl_if name='plug_data_to_excel_error'>
        <tmpl_var escape='html' name='plug_data_to_excel_error'>
    </tmpl_if>

Should an error occur (e.g. when you give the plugin invalid
C<data> argument), the plugin will place the description of
the error into C<plug_data_to_excel_error> key of C<{t}> ZofCMS
Template special key.

=head1 REQUIRED MODULES

The plugin requires the following modules/versions

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

                or
                ( defined $q_value and $q_value eq $out[$_] )
            ) ? 1 : 0,

        }, 0..$#out,
    ];
}

sub _html_template {
    return <<'TEMPLATE_END';
<select name="<tmpl_var escape='html' name='select_name'>" class="<tmpl_var escape='html' name='select_class'>"<tmpl_if name='select_id'> id="<tmpl_var escape='html' name='select_id'>"</tmpl_if>><tmpl_loop name='options'>
    <option value="<tmpl_var escape='html' name='value'>"<tmpl_if name='selected'> selected</tmpl_if>><tmpl_var escape='html' name='vis_value'></option></tmpl_loop>
</select>
TEMPLATE_END
}


1;
__END__

=encoding utf8

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


sub new { bless {}, shift }

sub process {
    my ( $self, $template, $query, $config ) = @_;

    my %conf = (
        t_prefix => 'dumper_',
        use_qq   => 1,
        pre      => 1,
        escape_html => 1,
        line_length => 150,
        %{ delete $config->conf->{plug_dumper} || {} },
        %{ delete $template->{plug_dumper}     || {} },
    );

    if ( $conf{use_qq} ) {
        $Data::Dumper::Useqq = 1;
    }

    my $t_dump = Dumper $template;

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

    $template->{t}{ $conf{t_prefix} . 't' } = $t_dump;
    $template->{t}{ $conf{t_prefix} . 'q' } = Dumper $query;
    $template->{t}{ $conf{t_prefix} . 'c' } = Dumper $config->conf;

    if ( $conf{line_length } ) {
        for ( qw/tt td t q c/ ) {
            $template->{t}{ $conf{t_prefix} . $_ } =~ s/(.{$conf{line_length}})(?!\n)/$1\n/g;
        }
    }

    if ( $conf{escape_html} ) {
        encode_entities $template->{t}{ $conf{t_prefix} . $_ }
            for qw/tt td t q c/;
    }

    if ( $conf{pre} ) {
        $template->{t}{ $conf{t_prefix} . $_ }
        = qq|<pre style="font-family: 'DejaVu Sans Mono', monotype;">|
            . $template->{t}{ $conf{t_prefix} . $_ } . q|</pre>|
            for qw/tt td t q c/;
    }

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


You need to add the plugin to the list of plugins to execute (duh!). By setting the priority
of the plugin you can make dumps before or after some plugins executed.

=head2 C<plug_dumper>

    plug_dumper => {
        t_prefix    => 'dumper_',
        use_qq      => 1,
        pre         => 1,
        escape_html => 1,
        line_length => 80,
    },

The plugin takes configuration via C<plug_dumper> first-level key that can be either
in ZofCMS template or Main Config file, same keys set in ZofCMS template will override
those keys set in Main Config file. As opposed to many ZofCMS plugins,
L<App::ZofCMS::Plugin::Debug::Dumper> will B<still> execute even if the C<plug_dumper>
key is not set to anything.

The C<plug_dumper> key takes a hashref as a value. Possible keys/values of that hashref

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

make, e.g. C<"\n">s instead of generating real new lines in output. See L<Data::Dumper> for
more information. B<Defaults to:> C<1>

=head3 C<pre>

    { pre => 1, }

B<Optional>. Can be set to either true or false values. When set to a true value the plugin
will wrap all the generated dumps into HTML C<< <pre></pre> >> tags. B<Defaults to:> C<1>

=head3 C<escape_html>

    { escape_html => 1, }

B<Optional>. Can be set to either true or false values. When set to a true value the plugin
will escape HTML code in the dumps. B<Defaults to:> C<1>

=head3 C<line_length>

    { line_length => 150, }

B<Optional>. The C<line_length> key takes a positive integer as a value. This value will
specify the maximum length of each line in generated dumps. Strictly speaking it will
stick a C<\n> after every C<line_length> characters that are not C<\n>.
B<Special value> or C<0> will B<disable> line length feature. B<Defaults to:> C<150>

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

            -f $_ ? ( is_file => 1 ) : ()
        )
    }, bsd_glob $glob;

    return \@files;
}

sub _get_template {
    return <<'END';
    <ul class="<tmpl_var name='class'>">
        <tmpl_if name="dir_tree_back"><li><a href="/index.pl?page=<tmpl_var name='page'>&<tmpl_var name='q_name'>=<tmpl_var escape='html' name='dir_tree_back'>">UP</a></li></tmpl_if>
    <tmpl_loop name='dir_tree_list'>
        <li>
            <tmpl_if name="is_file">
            <a target="_blank" href="/<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            <tmpl_else>
            <a href="/index.pl?page=<tmpl_var name='page'>&<tmpl_var name='q_name'>=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            </tmpl_if>
        </li>
    </tmpl_loop>
    </ul>
END
}


1;
__END__

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

In your Main Config file or ZofCMS Template:

    plugins     => [ qw/DirTreeBrowse/ ],
    plug_dir_tree => {
        auto_html => 1,
        start     => 'pics',
    },

In you L<HTML::Template> template:

    <p>We are at: <tmpl_var escape='html' name='dir_tree_path'></p>
    <tmpl_var name='dir_tree_auto'>

=head2 MORE FLEXIBLE VARIANT

In your Main Config file or ZofCMS Template:

    plugins     => [ qw/DirTreeBrowse/ ],
    plug_dir_tree => {
        start     => 'pics',
    },

In your L<HTML::Template> template:

    <p>We are at: <tmpl_var escape='html' name='dir_tree_path'></p>

    <ul>
        <tmpl_if name="dir_tree_back">
            <li><a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='dir_tree_back'>">UP</a></li>
        </tmpl_if>
    <tmpl_loop name='dir_tree_list'>
        <li>
            <tmpl_if name="is_file">
            <a href="/<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            <tmpl_else>
            <a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            </tmpl_if>
        </li>
    </tmpl_loop>
    </ul>

=head1 DESCRIPTION

The module is an L<App::ZofCMS> plugin that provides means to display a browseable directory
three (list of files and other dirs).

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

    plug_dir_tree => {
        start  => 'pics',
        q_name => 'dir_tree',
    }

B<Optional>. The plugin uses one query parameter to reference its position in the directory
tree. The C<q_name> key specifies the name of that query parameter. Unless you are using
the C<auto_html> option, make sure that your links include this query parameter along
with C<< <tmpl_var name="path"> >>. In other words, if your C<q_name> is set to C<dir_tree>
you'd make your links:
C<< <a href="/index.pl?page=/page_with_this_plugin&dir_tree=<tmpl_var escape='html' name='path'>"> >>. B<Defaults to:> C<dir_tree>

=head3 C<t_prefix>

    plug_dir_tree => {
        start    => 'pics',
        t_prefix => 'dir_tree_',
    }

B<Optional>. The C<t_prefix> specifies the prefix to use for several keys that plugin creates
in C<{t}> ZofCMS Template special key. See C<HTML::Template VARIABLES> section below for

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

in that current path will be replaced by whatever C<display_path_separator> is set to.
B<By default> is not specified.

=head1 HTML::Template VARIABLES

The samples below assume that the plugin is run with all of its optional arguments set to
defaults.

=head2 When C<auto_html> is turned on

    <p>We are at: <tmpl_var escape='html' name='dir_tree_path'></p>
    <tmpl_var name='dir_tree_auto'>

=head3 C<dir_tree_path>

    <p>We are at: <tmpl_var escape='html' name='dir_tree_path'></p>

The C<< <tmpl_var name='dir_three_path'> >> variable will contain the current path in the
directory tree.

=head3 C<dir_tree_auto>

    <tmpl_var name='dir_tree_auto'>

The C<< <tmpl_var name='dir_tree_auto'> >> is available when C<auto_html> option is turned
on in the plugin. The generated HTML code would be pretty much as the C<MORE FLEXIBLE VARIANT>
section in C<SYNOPSIS> demonstrates.

=head2 When C<auto_html> is turned off

    <p>We are at: <tmpl_var escape='html' name='dir_tree_path'></p>
    <ul>
        <tmpl_if name="dir_tree_back">
            <li><a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='dir_tree_back'>">UP</a></li>
        </tmpl_if>
    <tmpl_loop name='dir_tree_list'>
        <li>
            <tmpl_if name="is_file">
            <a href="/<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            <tmpl_else>
            <a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            </tmpl_if>
        </li>
    </tmpl_loop>
    </ul>

=head3 C<dir_tree_path>

    <p>We are at: <tmpl_var escape='html' name='dir_tree_path'></p>

The C<< <tmpl_var name='dir_three_path'> >> variable will contain the current path in the
directory tree.

=head3 C<dir_tree_back>

    <tmpl_if name="dir_tree_back">
        <li><a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='dir_tree_back'>">UP</a></li>
    </tmpl_if>

The C<dir_tree_back> will be available when the user browsed to some directory inside the
C<start> directory. It will contain the path to the parent directory so the user could
traverse up the tree.

=head3 C<dir_tree_list>

    <tmpl_loop name='dir_tree_list'>
        <li>
            <tmpl_if name="is_file">
            <a href="/<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            <tmpl_else>
            <a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
            </tmpl_if>
        </li>
    </tmpl_loop>

The C<dir_tree_list> will contain data structure suitable for C<< <tmpl_loop name=""> >>. Each
item of that loop would be an individual file or a directory. The variables that
are available in that loop are as follows:

=head4 C<is_file>

    <tmpl_if name="is_file">
        <a target="_blank" href="/<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
    <tmpl_else>
        <a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>
    </tmpl_if>

The C<is_file> will be set whenever the item is a file (as opposed to being a directory).
As the example above shows, you'd use this variable as a C<< <tmpl_if name=""> >> to adjust
your links to open the file instead of trying to make the plugin "browse" that file as
a directory.

=head4 C<path>

    <a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>

The C<path> variable will contain the path to the directory/file (including the name
of that directory/file) starting from the C<start> directory. You'd want to include that
as a value of C<q_name> query parameter so the user could traverse the dirs.

=head4 C<name>

    <a href="/index.pl?page=/&dir_tree=<tmpl_var escape='html' name='path'>"><tmpl_var escape='html' name='name'></a>

The C<name> variable will contain just the name of the file/directory without it's path. You'd
want to use this for for displaying the names of the files/dirs to the user.

=head1 REPOSITORY

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

=head1 BUGS

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

    return 0;
}

sub _email_template {
    return <<'END_HTML';
<h1>Feature Suggestion</h1>

<dl>
    <tmpl_if name='has_name'>
        <dt>From:</dt>
            <dd><tmpl_var escape='html' name='name'></dd>
    </tmpl_if>

    <tmpl_if name='has_email'>
        <dt>Email:</dt>
            <dd><a href="mailto:<tmpl_var escape='html' name='email'>"><tmpl_var escape='html' name='email'></a></dd>
    </tmpl_if>

    <dt>Suggestion:</dt>
        <dd><tmpl_var name='suggestion'></dd>
</dl>
END_HTML
}

sub _get_form_html_template {
    return <<'END_HTML';
<tmpl_if name="send_success">
    <p class="success-message">Successfully sent.</p>
<tmpl_else>
    <form action="" method="POST" id="plugfsb_form">
    <div>
        <input type="hidden" name="page" value="<tmpl_var escape='html' name='page'>">
        <input type="hidden" name="plugfsb_send" value="1">

        <tmpl_if name="error">
            <p class="error"><tmpl_var escape='html' name='error'></p>
        </tmpl_if>

        <ul>
            <tmpl_unless name="no_identification">
                <li><label for="plugfsb_name">Your name:</label
                    ><input type="text" class="input_text"
                        name="plugfsb_name" id="plugfsb_name"
                        value="<tmpl_var escape='html' name='name'>"></li>
                <li><label for="plugfsb_email">Your email:</label
                    ><input type="text" class="input_text"
                        name="plugfsb_email" id="plugfsb_email"
                        value="<tmpl_var escape='html' name='email'>"></li>
            </tmpl_unless>
            <li><label for="plugfsb_suggestion" class="textarea_label">Your suggestion:</label
                ><textarea id="plugfsb_suggestion" cols="60" rows="5"
                    name="plugfsb_suggestion"
                ><tmpl_var escape='html' name='suggestion'></textarea></li>
        </ul>

        <tmpl_var name='submit_button'>
    </div>
    </form>
</tmpl_if>
END_HTML
}

1;

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

=head1 EMAIL TEMPLATE

If C<email_template> argument is not specified, the plugin will use its
default email template shown here:

    <h1>Feature Suggestion</h1>

    <dl>
        <tmpl_if name='has_name'>
            <dt>From:</dt>
                <dd><tmpl_var escape='html' name='name'></dd>
        </tmpl_if>

        <tmpl_if name='has_email'>
            <dt>Email:</dt>
                <dd><a href="mailto:<tmpl_var escape='html'
                    name='email'>"
                    ><tmpl_var escape='html' name='email'></a></dd>
        </tmpl_if>

        <dt>Suggestion:</dt>
            <dd><tmpl_var name='suggestion'></dd>
    </dl>

The L<HTML::Template> template variables available here as as follows:

=head2 C<< <tmpl_var escape='html' name='name'> >>

    From: <tmpl_var escape='html' name='name'>

If C<user_name> argument is specified, this variable will contain its value.
Otherwise, it will either contain what the user specifies in the
C<Your name> field in the form, or won't be set at all.

=head2 C<< <tmpl_var escape='html' name='email'> >>

    Email: <tmpl_var escape='html' name='email'>

If C<user_email> argument is specified, this variable will contain its
value. Otherwise, it will either contain what the user specifies in the
C<Your email> field in the form, or won't be set at all.

=head2 C<< <tmpl_var name='suggestion'> >>

    Suggestion: <tmpl_var name='suggestion'>

This variable will contain what the user types in the C<Suggestion> box
in the form. B<Note:> HTML entities will be escaped here and new
lines replaced with C<< <br> >> elements; thus, do not use C<escape="html">
C<< <tmpl_var> >> attribute here.

=head2 C<< <tmpl_if name='has_name'> >>

    <tmpl_if name='has_name'>
        I HAS NAME!!!
    </tmpl_if>

Set to a true value if either C<user_name> argument is set to something,
or the user fills the C<Your name> field in the form.

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

        list => {
            list1 => 'pics',
            list2 => 'pics2',
        },
    },

In your L<HTML::Template> template:

    <ul>
    <tmpl_loop name='list1'>
        <li><a href="/<tmpl_var escape='html' name='path'>"><tmpl_var name='name'></a></li>
    </tmpl_loop>
    </ul>

    <ul>
    <tmpl_loop name='list2'>
        <li><a href="/<tmpl_var escape='html' name='path'>"><tmpl_var name='name'></a></li>
    </tmpl_loop>
    </ul>

=head1 DESCRIPTION

Module is a L<App::ZofCMS> plugin which provides means to display lists of files.

This documentation assumes you've read L<App::ZofCMS>,
L<App::ZofCMS::Config> and L<App::ZofCMS::Template>

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

B<Optional>. Takes either true or false values,
specifies whether or not to create the C<name> C<< <tmpl_var name=""> >> in the
output. See C<HTML::Template TEMPLATES> section below. B<Defaults to:> C<1> (*do* create)

=head1 HTML::Template TEMPLATES

In HTML::Template templates you'd show the file lists in the following fashion:

    <ul>
    <tmpl_loop name='plug_file_list'>
        <li><a href="/<tmpl_var escape='html' name='path'>"><tmpl_var name='name'></a></li>
    </tmpl_loop>
    </ul>

The name of the C<< <tmpl_loop name=""> >> is what you specified (directly or indirectly)
as keys in the C<list> hashref (see above). Inside the loop there are two
C<< <tmpl_var name=""> >> that you can use:

=head2 C<< <tmpl_var name='path'> >>

The C<< <tmpl_var name='path'> >> will contain the path to the file, that is the directory

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


In your ZofCMS Template:

    plugins => [ qw/FileToTemplate/ ],
    t  => {
        foo => '<FTTR:index.tmpl>',
    },

In you L<HTML::Template> template:

    <tmpl_var escape='html' name='foo'>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS>; it provides functionality to either read (slurp)
or C<do()> files and stick them in place of "tags".. read on to understand more.

This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config> and
L<App::ZofCMS::Template>

=head1 ADDING THE PLUGIN

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

        qw/GetRemotePageTitle/
    ],

    plug_get_remote_page_title => {
        uri => 'http://zoffix.com',
    },

In HTML::Template file:

    <tmpl_if name='plug_remote_page_title_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_remote_page_title_error'></p>
    <tmpl_else>
        <p>Title: <tmpl_var escape='html' name='plug_remote_page_title'></p>
    </tmpl_if>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS> that provides means to get page titles from
remote URIs which can be utilized when automatically parsing URIs posted in coments, etc.

This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config> and
L<App::ZofCMS::Template>

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

    LWP::UserAgent->new(
        agent    => "Opera 9.5",
        timeout  => 30,
        max_size => 2000,
    ),

=head1 PLUGIN'S OUTPUT

    # uri argument set to a string
    <tmpl_if name='plug_remote_page_title_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_remote_page_title_error'></p>
    <tmpl_else>
        <p>Title: <tmpl_var escape='html' name='plug_remote_page_title'></p>
    </tmpl_if>


    # uri argument set to an arrayref
    <ul>
        <tmpl_loop name='plug_remote_page_title'>
        <li>
            <tmpl_if name='error'>
                Got error: <tmpl_var escape='html' name='error'>
            <tmpl_else>
                Title: <tmpl_var escape='html' name='title'>
            </tmpl_if>
        </li>
        </tmpl_loop>
    </ul>

Plugin will set C<< $t->{t}{plug_remote_page_title} >> (where C<$t> is ZofCMS Template
hashref) to either a string or an
arrayref when C<uri> plugin's argument is set to a string or arrayref respectively. Thus,
for arrayref values you'd use a C<< <tmpl_loop> >> plugins will use two variables
inside that loop: C<error> and C<title>; the C<error> variable will be present when

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

In HTML::Template template:

    <form action="" method="POST">
    <div>
        <label>Enter an expression: <input type="text" name="calc"></label>
        <input type="submit" value="Calculate">
    </div>
    </form>

    <tmpl_if name='plug_google_calculator_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_google_calculator_error'></p>
    <tmpl_else>
        <p>Result: <tmpl_var escape='html' name='plug_google_calculator'></p>
    </tmpl_if>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS> that provides a simple interface to Google
calculator (L<http://www.google.com/help/calculator.html>).
This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config> and
L<App::ZofCMS::Template>

=head1 FIRST-LEVEL ZofCMS TEMPLATE AND MAIN CONFIG FILE KEYS

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

to calculate. Takes either a literal expression as a string or a subref as a value.
When set to a subref, subref will be executed and its return value will be assigned
to C<expr> as if it was already there (note, C<undef>s will cause the plugin to
stop further processing). The sub's C<@_> will contain the following (in that order):
ZofCMS Template hashref, query parameters hashref and L<App::ZofCMS::Config> object.
B<Defaults to:> C<undef>

=head1 PLUGIN OUTPUT

    <tmpl_if name='plug_google_calculator_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_google_calculator_error'></p>
    <tmpl_else>
        <p>Result: <tmpl_var escape='html' name='plug_google_calculator'></p>
    </tmpl_if>

=head2 C<plug_google_calculator>

    <p>Result: <tmpl_var escape='html' name='plug_google_calculator'></p>

If result was calculated successfully, the plugin will set
C<< $t->{t}{plug_google_calculator} >> to the result string where C<$t> is ZofCMS Template
hashref.

=head2 C<plug_google_calculator_error>

    <tmpl_if name='plug_google_calculator_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_google_calculator_error'></p>
    </tmpl_if>

If an error occured during the calculation, C<< $t->{t}{plug_google_calculator_error} >>
will be set to the error message where C<$t> is ZofCMS Template hashref.

=head1 REPOSITORY

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

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

        qw/GoogleTime/
    ],

    plug_google_time => {
        location => 'Toronto',
    },

In HTML::Template file:

    <tmpl_if name='plug_google_time_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_google_time_error'></p>
    <tmpl_else>
        <p>Time: <tmpl_var escape='html' name='plug_google_time'></p>
    </tmpl_if>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS> that provides means to obtain times for different
locations using Google.

This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config> and
L<App::ZofCMS::Template>

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


    LWP::UserAgent->new(
        agent    => "Opera 9.5",
        timeout  => 30,
    ),

=head1 PLUGIN'S OUTPUT

    # location argument set to a string
    <tmpl_if name='plug_google_time_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_google_time_error'></p>
    <tmpl_else>
        <p>Time: <tmpl_var escape='html' name='plug_google_time'></p>
    </tmpl_if>


    # location argument set to an arrayref
    <ul>
        <tmpl_loop name='plug_google_time'>
        <li>
            <tmpl_if name='error'>
                Got error: <tmpl_var escape='html' name='error'>
            <tmpl_else>
                Time: <tmpl_var escape='html' name='time'>
            </tmpl_if>
        </li>
        </tmpl_loop>
    </ul>

Plugin will set C<< $t->{t}{plug_google_time} >> (where C<$t> is ZofCMS Template
hashref) to either a string or an
arrayref when C<location> plugin's argument is set to a string or arrayref respectively. Thus,
for arrayref values you'd use a C<< <tmpl_loop> >> plugins will use three variables
inside that loop: C<error>, C<time> and C<hash>; the C<error> variable will be present when

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

=head1 SYNOPSIS

In your Main Config file or ZofCMS Template:

    plugins => [ qw/HTMLFactory::PageToBodyId/ ],

    body_id => 'override', # including the key overrides the plugin's value

In your L<HTML::Template> template:

    <tmpl_var escape='html' name='body_id'>

=head1 DESCRIPTION

The module is a small plugin for L<App::ZofCMS>. Its purpose is to automatically generate a
value for an C<id=""> attribute that is to be put on C<< <body> >> HTML element; this value
would be used to differentiate different pages on the site and is generated from query C<dir>
and C<page> parameters.

This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config>
and L<App::ZofCMS::Template>

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

            Foo::Bar::Baz
            Carp
        /,
    ],

In HTML::Template template:

    <ul>
        <tmpl_loop name='plug_installed_module_checker'>
        <li>
            <tmpl_var escape='html' name='info'>
        </li>
        </tmpl_loop>
    </ul>

=head1 DESCRIPTION

The module is a utility plugin for L<App::ZofCMS> that provides means to check for whether
or not a particular module is installed on the server and get module's version if it is
installed.

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

B<Mandatory>. Takes an arrayref as a value.
Can be specified in either ZofCMS Template or Main Config File; if set in
both, the value in ZofCMS Template takes precedence. Each element of the arrayref
must be a module name that you wish to check for "installedness".

=head1 OUTPUT

    <ul>
        <tmpl_loop name='plug_installed_module_checker'>
        <li>
            <tmpl_var escape='html' name='info'>
        </li>
        </tmpl_loop>
    </ul>

Plugin will set C<< $t->{t}{plug_installed_module_checker} >> (where C<$t> is ZofCMS Template
hashref) to an arrayref of hashrefs; thus, you'd use a C<< <tmpl_loop> >> to view the info.
Each hashref will have only one key - C<info> - with information about whether or
not a particular module is installed.

=head1 REPOSITORY

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


sub _make_id {
    my ( $self, $text ) = @_;
    $text =~ s/\W/_/g;
    return lc "nav_$text";
}

sub _get_html_template {
    return <<'END';
<ul id="nav"><tmpl_loop name="nav">
        <li id="<tmpl_var escape="html" name="id">"><a href="<tmpl_var escape="html" name="href">" title="<tmpl_var escape="html" name="title">"><tmpl_var escape="html" name="text"></a></li></tmpl_loop>
</ul>
END
}

1;
__END__

=encoding utf8

=head1 NAME

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


    return $self->{DBH};
}

sub list_html_template {
    return <<'END_HTML';
<tmpl_if name='is_disabled'>
    <tmpl_if name='has_disabled_items'>
        <ul class="plug_list_html_template_disabled">
            <tmpl_loop name='items'>
                <li id="ppof_order_list_disabled_item_<tmpl_var escape='html'
                    name='name'>"><tmpl_var name='value'></li>
            </tmpl_loop>
        </ul>
    </tmpl_if>
<tmpl_else>
    <tmpl_if name='has_enabled_items'>
        <ul class="plug_list_html_template">
            <tmpl_loop name='items'>
                <li id="ppof_order_list_item_<tmpl_var escape='html'
                    name='name'>"><tmpl_var name='value'></li>
            </tmpl_loop>
        </ul>
    </tmpl_if>
</tmpl_if>
END_HTML
}

sub form_html_template {
    return <<'END_HTML';
<form action="" method="POST" id="plug_preferential_order_form">
<div>
    <input type="hidden" name="page" value="<tmpl_var escape='html' name='q_page'>">
    <input type="hidden" name="ppof_save_order" value="1">

    <tmpl_if name='is_saved'>
        <p class="success-message">Successfully saved</p>
    </tmpl_if>

    <div id="ppof_enabled_container">
        <tmpl_if name='has_disabled'>
            <tmpl_var name='enabled_label'>
        </tmpl_if>
        <ul id="ppof_order" class="ppof_list">
            <tmpl_loop name='items'>
                <li id="ppof_order_item_<tmpl_var escape='html' name='name'>"><tmpl_var name='form_name'></li>
            </tmpl_loop>
        </ul>
    </div>

    <tmpl_if name='has_disabled'>
        <div id="ppof_enabled_container">
            <tmpl_var name='disabled_label'>
            <ul id="ppof_order_disabled" class="ppof_list">
                <tmpl_loop name='items_disabled'>
                    <li id="ppof_order_item_<tmpl_var escape='html' name='name'>"><tmpl_var name='form_name'></li>
                </tmpl_loop>
            </ul>
        </div>
    </tmpl_if>

    <tmpl_var name='submit_button'>
</div>
</form>
END_HTML
}

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


=head2 "Enabled" Sorted List

    <ul class="plug_list_html_template">
        <li id="ppof_order_list_item_forum4">Foo:</li>
        <li id="ppof_order_list_item_forum"><a href="#">Forum</a></li>
    </ul>

The end parts of C<id=""> attributes on the list items are derived from
the "keys" in C<items> arrayref. Note that HTML in the values are
not escaped.

=head2 "Disabled" Sorted List

    <ul class="plug_list_html_template_disabled">
        <li id="ppof_order_list_disabled_item_forum2">Bar</li>
        <li id="ppof_order_list_disabled_item_forum3">Meow</li>
    </ul>

The end parts of C<id=""> attributes on the list items are derived from
the "keys" in C<items> arrayref. HTML in the values (innards of
C<< <li> >>s) are not escaped.

=head1 REQUIRED MODULES

This plugins lives on these modules:

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

=head1 REPOSITORY

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

    );

    return $template;
}

sub _form_template {
    return <<'END_FORM';
<tmpl_if name="success">
    <p class="quicknote_success"><tmpl_var name="success"></p>
<tmpl_else>
<form class="quicknote" action="<tmpl_var escape="html" name="action">" method="POST">
<div>
    <tmpl_if name="error">
        <p class="quicknote_error"><tmpl_var name="error"></p>
    </tmpl_if>
    <input type="hidden" name="quicknote_username" value="your full name">
    <input type="hidden" name="page" value="<tmpl_var name="page">">
    <ul>
        <li>
            <label for="quicknote_name">Name:</label
            ><input type="text" name="quicknote_name" id="quicknote_name"
            value="<tmpl_var escape="html" name="name">">
        </li>
        <li>
            <label for="quicknote_email">E-mail: </label
            ><input type="text" name="quicknote_email" id="quicknote_email"
            value="<tmpl_var escape="html" name="email">">
        </li>
        <li>
            <label for="quicknote_message">Message: </label
            ><textarea name="quicknote_message" id="quicknote_message"
            cols="40" rows="10"><tmpl_var escape="html" name="message"></textarea>
        </li>
    </ul>
    <input type="submit" id="quicknote_submit" value="Send">
</div>
</form>
</tmpl_if>
END_FORM
}


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

=head1 SYNOPSIS

Include the plugin

    plugins => [
        qw/RandomBashOrgQuote/
    ],

In HTML::Template file:

    <pre><tmpl_var escape='html' name='plug_random_bash_org_quote'></pre>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS> that provides means to fetch a random
quote from L<http://bash.org/>.

This documentation assumes you've read L<App::ZofCMS>, L<App::ZofCMS::Config> and
L<App::ZofCMS::Template>

=head1 TO RUN THE PLUGIN

    plugins => [
        qw/RandomBashOrgQuote/
    ],

Unlike many other plugins, this plugin does not have any configuration options and will
run if it's included in the list of plugins to run.

=head1 OUTPUT

    <pre><tmpl_var escape='html' name='plug_random_bash_org_quote'></pre>

Plugin will set C<< $t->{t}{plug_random_bash_org_quote} >> to the fetched random quote
or to an error message if an error occured; in case of an error the message will be prefixed
with C<Error:> (in case you wanna mingle with that).

=head1 REPOSITORY

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

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

    plug_send_file => [
        '../zcms_site/config.txt',  # filename to send; this one is outside the webdir
        'attachment',               # optional to set content-disposition to attachment
        'text/plain',               # optional to set content-type instead of guessing one
        'LOL.txt',                  # optional to set filename instead of using same as original
    ],

In your HTML::Template template:

    <tmpl_if name='plug_send_file_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_send_file_error'></p>
    </tmpl_if>

=head1 DESCRIPTION

The module is a plugin for L<App::ZofCMS> that provides means for flexible sending of files
(e.g. sending it as an attachment (for download) or changing the filename), most important
feature of the plugin is that you can use it to send files outside of web-accessible
directory which in conjunction with say L<App::ZofCMS::Plugin::UserLogin> can provide user
account restricted file sending.

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

B<Optional>. Speficies the filename to use when sending the file. Note that this applies
even when content disposition type is set to C<inline> for when the user would want
to save the file. When set to C<undef>, the plugin will use the same name as the original
file. B<Defaults to:> C<undef>.

=head1 HTML::Template VARIABLES - ERROR HANDLING

=head2 C<plug_send_file_error>

    <tmpl_if name='plug_send_file_error'>
        <p class="error">Got error: <tmpl_var escape='html' name='plug_send_file_error'></p>
    </tmpl_if>

If the plugin cannot read the file you specified for sending, it will set the
C<plug_send_file_error> key inside C<t> ZofCMS Template special key to the error message (to
the value of C<$!> to be specific) and will stop processing (i.e. won't send any files
or C<exit()>).

=head2 "default" Content-Type

If plugin was told to derive the right Content-Type of the file, but it couldn't derive one,

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

            push @{ $opt[$_] }, pop @{ $opt[ $_-1 ] }
        }
    }

    return @opt
}


sub _html_template {
    return <<'END_TEMPLATE';
<select id="<tmpl_var escape='html' name='id'>" name="<tmpl_var escape='html' name='name'>"><tmpl_loop name="options">
        <option value="<tmpl_var escape='html' name='value'>"><tmpl_var escape='html' name='name'></option></tmpl_loop>
</select>
END_TEMPLATE
}


1;
__END__

=encoding utf8

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

}

sub form_html_template {
    return <<'END_HTML';
<tmpl_if name='save_success'>
    <p class="success-message">Successfully saved</p>
</tmpl_if>
<form action="" method="POST" id="plug_start_page_form">
<div>
    <input type="hidden" name="page"
        value="<tmpl_var escape='html' name='page'>">
    <input type="hidden" name="plugsp_save_settings" value="1">

    <label for="plugsp_page"><tmpl_var escape='html'
        name='label_text'></label
    ><select id="plugsp_page" name="plugsp_page"
    ><tmpl_loop name='pages'>
        <option value="<tmpl_var escape='html' name='page'>"
            <tmpl_if name='is_selected'>selected</tmpl_if>
        ><tmpl_var escape='html' name='name'></option>
    </tmpl_loop>

    <tmpl_var name="submit_button">
</div>
</form>
END_HTML
}

1;
__END__

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

            background: <tmpl_var name="bg_hover">;
        }
        <tmpl_loop name="tags">.<tmpl_var name="class"><tmpl_var name="class_num"> { font-size: <tmpl_var name="num"><tmpl_var name="unit">; }
        </tmpl_loop>
END
    );
}

sub _tag_template {
    return HTML::Template->new_scalar_ref( \ <<'END'
<ul id="<tmpl_var escape="html" name="id">"><tmpl_loop name="tags">
    <li class="<tmpl_var escape="html" name="class">"><a href="<tmpl_var escape="html" name="href">"><tmpl_var escape="html" name="tag"></a></li></tmpl_loop>
</ul>
END
    );
}

1;
__END__

=encoding utf8

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

    return ''
        unless defined $opts->{smart_deny}
            and length $opts->{smart_deny};

    use Data::Dumper;


    my $appended_value = $opts->{redirect_on_restricted} =~ /\?/
    ? '' : '?';

    $appended_value .= $opts->{smart_deny} . '=' . uri_escape( $ENV{REQUEST_URI} );

    return $appended_value;
}

sub login_form_template {
    return <<'END_TEMPLATE';
<form action="" method="POST" id="zofcms_plugin_login">
<div><tmpl_if name="error"><p class="error"><tmpl_var escape="html" name="error"></p></tmpl_if>
    <input type="hidden" name="page" value="<tmpl_var escape="html" name="page">">
    <input type="hidden" name="zofcms_plugin_login" value="login_user">
    <tmpl_if name="smart_deny">
        <input type="hidden" name="<tmpl_var escape="html" name="smart_deny_name">" value="<tmpl_var escape="html" name="smart_deny_value">">
    </tmpl_if>
    <ul>
        <li>
            <label for="zofcms_plugin_login_login">Login: </label
            ><input type="text" class="input_text" name="login" id="zofcms_plugin_login_login" value="<tmpl_var escape='html' name='cookie_login'>">
        </li>
        <li>
            <label for="zofcms_plugin_login_pass">Password: </label
            ><input type="password" class="input_password" name="pass" id="zofcms_plugin_login_pass">
        </li>
    </ul>
    <tmpl_var name='login_button'>
</div>
</form>
END_TEMPLATE
}

sub logout_form_template {
    return <<'END_TEMPLATE';
<form action="" method="POST" id="zofcms_plugin_login_logout">
<div><tmpl_if name="error"><p class="error"><tmpl_var escape="html" name="error"></p></tmpl_if>
    <input type="hidden" name="page" value="<tmpl_var escape="html" name="page">">
    <input type="hidden" name="zofcms_plugin_login" value="logout_user">
    <tmpl_var name='logout_button'>
</div>
</form>
END_TEMPLATE
}

sub cookie_l {
    my $self = shift;
    @_ and $self->{COOKIE_L} = shift;

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

}

sub _form_template {
    return <<'END';
<tmpl_if name='change_ok'>
    <p id="plug_user_login_change_password_ok" class="success-message">Your password has been successfully changed</p>
<tmpl_else>
    <form action="" method="POST" id="plug_user_login_change_password_form">
    <div>
        <tmpl_if name='error'>
            <p class="error"><tmpl_var escape='html' name='error'></p>
        </tmpl_if>
        <input type="hidden" name="page" value="<tmpl_var escape='html' name='page'>">
        <input type="hidden" name="dir" value="<tmpl_var escape='html' name='dir'>">
        <ul>
            <li>
                <label for="plug_user_login_change_password_pass">Current password: </label
                ><input type="password" class="input_password" name="plug_user_login_change_password_pass" id="plug_user_login_change_password_pass">
            </li>
            <li>
                <label for="plug_user_login_change_password_newpass">New password: </label
                ><input type="password" class="input_password" name="plug_user_login_change_password_newpass" id="plug_user_login_change_password_newpass">
            </li>
            <li>

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

Below is the HTML::Template template that plugin uses for the form as well as successfully
password changes. It is shown here for you to know how to style your password changing
form/success message properly:

    <tmpl_if name='change_ok'>
        <p id="plug_user_login_change_password_ok" class="success-message">Your password has been successfully changed</p>
    <tmpl_else>
        <form action="" method="POST" id="plug_user_login_change_password_form">
        <div>
            <tmpl_if name='error'>
                <p class="error"><tmpl_var escape='html' name='error'></p>
            </tmpl_if>
            <input type="hidden" name="page" value="<tmpl_var escape='html' name='page'>">
            <input type="hidden" name="dir" value="<tmpl_var escape='html' name='dir'>">
            <ul>
                <li>
                    <label for="plug_user_login_change_password_pass">Current password: </label
                    ><input type="password" class="input_password" name="plug_user_login_change_password_pass" id="plug_user_login_change_password_pass">
                </li>
                <li>
                    <label for="plug_user_login_change_password_newpass">New password: </label
                    ><input type="password" class="input_password" name="plug_user_login_change_password_newpass" id="plug_user_login_change_password_newpass">
                </li>
                <li>

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

        );'
    );
}

sub change_pass_form_template {
    return <<'END_HTML';
<form action="" method="POST" id="plug_forgot_password_new_pass_form">
<div>
    <p>Please enter your new password.</p>

    <input type="hidden" name="page" value="<tmpl_var escape='html'
        name='page'>">
    <input type="hidden" name="<tmpl_var escape='html' name='code_name'>"
        value="<tmpl_var escape='html' name='code_value'>">
    <input type="hidden" name="pulfp_has_change_pass" value="1">
    <tmpl_if name='error'>
        <p class="error"><tmpl_var escape='html' name='error'></p>
    </tmpl_if>

    <ul>
        <li>
            <label for="pulfp_pass">New password: </label
            ><input type="password"
                class="input_password"
                name="pulfp_pass"
                id="pulfp_pass">
        </li>

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

</form>
END_HTML
}

sub email_template {
    return <<'END_EMAIL_HTML';
<h2>Password Reset</h2>

<p>Hello. Someone (possibly you) requested a password reset. If that
was you, please follow this link to complete the action:
<a href="<tmpl_var escape='html' name='link'>"><tmpl_var escape='html'
name='link'></a></p>

<p>If you did not request anything, simply ignore this email.</p>
END_EMAIL_HTML
}

sub ask_login_form_template {
    return <<'END_FORM';

<form action="" method="POST" id="plug_forgot_password_form">
<div>
    <p>Please enter your login into the form below and an email with
        further instructions will be sent to you.</p>

    <input type="hidden" name="page" value="<tmpl_var escape='html'
        name='page'>">
    <input type="hidden" name="pulfp_ask_link" value="1">
    <tmpl_if name='error'>
        <p class="error"><tmpl_var escape='html' name='error'></p>
    </tmpl_if>

    <label for="pulfp_login">Your login: </label
    ><input type="text"
        class="input_text"
        name="pulfp_login"
        id="pulfp_login">

    <tmpl_var name="submit_button">
</div>

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


    plug_user_login_forgot_password => {
        email_template => '<p>Blah blah blah...', # use this string as template
    ...

B<Optional>. Takes a scalar, a scalar ref, or C<undef> as a value.
Specifies L<HTML::Template> template to use when generating the email
with the reset link. When set to C<undef>, plugin will use its default
template (see OUTPUT section below). If you're using your own template,
the C<link> template variable will contain the link the user needs to follow
(i.e., use C<< <tmpl_var escape='html' name='link'> >>).
B<Defaults to:> C<undef> (plugin's default, see OUTPUT section below)

=head3 C<login_page>

    plug_user_login_forgot_password => {
        login_page => '/',
    ...

    plug_user_login_forgot_password => {
        login_page => '/my-login-page',

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


The plugin generates a whole bunch of various output; what's below should
cover all the bases:

=head2 Default Email Template

    <h2>Password Reset</h2>

    <p>Hello. Someone (possibly you) requested a password reset. If that
    was you, please follow this link to complete the action:
    <a href="<tmpl_var escape='html' name='link'>"><tmpl_var escape='html'
    name='link'></a></p>

    <p>If you did not request anything, simply ignore this email.</p>

You can change this using C<email_template> argument. When using your
own, use C<< <tmpl_var escape='html' name='link'> >> to insert the
link the user needs to follow.

=head2 "Ask Login" Form Template

    <form action="" method="POST" id="plug_forgot_password_form">
    <div>
        <p>Please enter your login into the form below and an email with
            further instructions will be sent to you.</p>

        <input type="hidden" name="page" value="<tmpl_var escape='html'
            name='page'>">
        <input type="hidden" name="pulfp_ask_link" value="1">
        <tmpl_if name='error'>
            <p class="error"><tmpl_var escape='html' name='error'></p>
        </tmpl_if>

        <label for="pulfp_login">Your login: </label
        ><input type="text"
            class="input_text"
            name="pulfp_login"
            id="pulfp_login">

        <input type="submit"
            class="input_submit"

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

This is the form that asks the user for their login in order to reset
the password. Submit button is plugin's default code, you can control
it with the C<button_send_link> plugin's argument.

=head2 "New Password" Form Template

    <form action="" method="POST" id="plug_forgot_password_new_pass_form">
    <div>
        <p>Please enter your new password.</p>

        <input type="hidden" name="page" value="<tmpl_var escape='html'
            name='page'>">
        <input type="hidden" name="<tmpl_var escape='html'
            name='code_name'>"
            value="<tmpl_var escape='html' name='code_value'>">
        <input type="hidden" name="pulfp_has_change_pass" value="1">
        <tmpl_if name='error'>
            <p class="error"><tmpl_var escape='html' name='error'></p>
        </tmpl_if>

        <ul>
            <li>
                <label for="pulfp_pass">New password: </label
                ><input type="password"
                    class="input_password"
                    name="pulfp_pass"
                    id="pulfp_pass">
            </li>



( run in 0.902 second using v1.01-cache-2.11-cpan-5467b0d2c73 )