lemonldap-ng/lemonldap-ng-portal/example/index_skin.pl

62 lines
1.9 KiB
Perl
Raw Normal View History

2008-05-10 20:05:46 +02:00
#!/usr/bin/perl
use Lemonldap::NG::Portal::SharedConf;
use HTML::Template;
use strict;
2008-05-10 20:05:46 +02:00
my $portal = Lemonldap::NG::Portal::SharedConf->new(
{
# ACCESS TO CONFIGURATION
# By default, Lemonldap::NG uses the default lemonldap-ng.ini file to
# know where to find its configuration
2009-12-04 10:59:21 +01:00
# (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
# You can specify by yourself this file :
#configStorage => { confFile => '/path/to/my/file' },
# or set explicitely parameters :
#configStorage => {
2009-12-04 10:59:21 +01:00
# type => 'File',
# dirName => '/usr/local/lemonldap-ng/data//conf'
#},
# Note that YOU HAVE TO SET configStorage here if you've declared this
# portal as SOAP configuration server in the manager
# OTHERS
# You can also overload any parameter issued from manager
# configuration. Example:
#globalStorage => 'Apache::Session::File',
#globalStorageOptions => {
# 'Directory' => '/var/lib/lemonldap-ng/sessions/',
# 'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/',
#},
# Note that YOU HAVE TO SET globalStorage here if you've declared this
# portal as SOAP session server in the manager
2008-05-10 20:05:46 +02:00
}
);
# Get skin and template parameters
my ( $templateName, %templateParams ) = $portal->display();
2010-01-13 13:46:19 +01:00
# HTML template creation
2010-01-13 13:19:55 +01:00
my $template = HTML::Template->new(
filename => "$templateName",
2010-01-13 13:19:55 +01:00
die_on_bad_params => 0,
cache => 0,
global_vars => 1,
loop_context_vars => 1,
filter => [
sub { $portal->translate_template(@_) },
sub { $portal->session_template(@_) }
],
2010-01-13 13:19:55 +01:00
);
2010-01-13 13:46:19 +01:00
# Give parameters to the template
2010-01-13 13:19:55 +01:00
while ( my ( $k, $v ) = each %templateParams ) {
$template->param( $k, $v );
2008-05-10 20:05:46 +02:00
}
2010-01-13 13:46:19 +01:00
# Display it
2010-01-13 13:19:55 +01:00
print $portal->header('text/html; charset=utf-8');
print $template->output;