You are a member of groups:
[% FOREACH group = login_group %]
[% th.bullet %] [% group.name %]
[% END %]
B
True/false determining whether the user is logged in or not.
Example:
[% IF OI.logged_in %]
You are very special, logged-in user!
[% END %]
B
True/false depending on whether the user is an administrator. The
definition of 'is an administrator' depends on the authentication
class being used -- by default it means that the user is the superuser
or a member of the 'site admin' group. But you can modify this based
on your needs, and make the result available to all templates with
this property.
Example:
[% IF OI.is_admin %]
You are an administrator -- you have the power! It feels great,
eh?
[% END %]
B
Contains all information currently held in the session. Note that
other handlers may during the request process have modified the
session. Therefore, what is in this variable is not guaranteed to be
already saved in the database. However, as the request progresses
OpenInteract will sync up any changes to the session database.
Note that this information is B. You will not get an error
if you try to set or change a value from the template, but the
information will persist only for that template.
Example:
[% session = OI.session %]
Number of items in your shopping cart:
[% session.num_shopping_cart_items %]
B
What the 'return url' is currently set to. The return url is what we
come back to if we have to do something like logout.
Logout and return to this page
B
A hashref representing a container with all error messages as
generated by error handlers. The error handler and the template need
to coordinate on a naming scheme so you know where to find your
messages.
Note that future work may restrict this to the errors for your
template only.
Example:
[% error_messages = OI.error_hold %]
User [% error_messages.loginbox.login_name %] does not exist in
the system.
B
A hashref with keys of 'none', 'read', and 'write' which gives you the
value used by the system to represent the security levels.
Example:
[% IF obj.tmp_security_level < OI.security_level.write %]
... do stuff ...
[% END %]
B
A hashref with the keys of 'user', 'group' and 'world' which gives you
the value used by the system to represent the security scopes. This
will rarely be used but exists for completeness with
C.
[% security_scope = OI.security_scope %]
[% FOREACH scope = security_scope.keys %]
OI defines [% scope %] as [% security_scope.$scope %]
[% END %]
B
Returns the server configuration object (or hashref) -- whatever is
returned by calling in normal code:
$R->CONFIG;
The ID of the site admin group is:
[% OI.server_config.default_objects.site_admin_group %]
=head1 NOTICE
The following were removed from the old module
L:
=over 4
=item *
B
Removed. Use:
[% date_format( 'now' ) %]
For the default format, or use your own format:
[% date_format( 'now', '%Y-%m-%d' ) %]
=item *
B
Instead, use the built-in 'format' plugin:
[% USE format %]
[% score_line = format( 'Place: %02d Score: %5.2f' ) %]
[% FOREACH finisher = score_list -%]
[%- score_line( finisher.place, finisher.score ) -%]
[% END -%]
See C for more info.
=item *
B
Instead, use the built-in 'Dumper' plugin:
[% USE Dumper %]
[% Dumper.dump( my_complex structure ) %]
And you also get:
[% Dumper.dump_html( my_complex structure ) %]
See C for more info.
=back
=head1 BUGS
None known.
=head1 TO DO
B
Make it easy for websites to create their own plugins that can be
accessed through the 'OI.' plugin. For instance, a package owner could
define a set of additional behaviors to go along with a package. In a
file distributed with the package, the plugins could be listed:
conf/template_plugins.dat:
------------------------------
OpenInteract::Plugin::MyPackage1
OpenInteract::Plugin::MyPackage2
------------------------------
And stored within the server-wide configuration object. Then when we
call C in this plugin, we could do something similar to the
C<_populate> method in C where we peek
into the C<@EXPORT_OK> array and copy the code refs into a hash which
we can then check via C.
One problem with that is name collision -- two packages might both
define a 'do_stuff' action, and in this case the last one would
win. No good.
Maybe we prepend the package name to the action? Also no good -- the
whole idea is to make the template environment transparent....
=head1 SEE ALSO
L
L for borrowed code
Slashcode (http://www.slashcode.com) for inspiration
=head1 COPYRIGHT
Copyright (c) 2001-2002 intes.net, inc.. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 AUTHORS
Chris Winters