2009-12-17 20:20:17 +01:00
|
|
|
## @file
|
|
|
|
# Lemonldap::NG manager main file
|
|
|
|
|
|
|
|
## @class
|
|
|
|
# Lemonldap::NG manager main class
|
2006-12-18 12:32:33 +01:00
|
|
|
package Lemonldap::NG::Manager;
|
|
|
|
|
|
|
|
use strict;
|
2009-12-17 20:20:17 +01:00
|
|
|
use Lemonldap::NG::Handler::CGI qw(:globalStorage :locationRules); #inherits
|
|
|
|
use Lemonldap::NG::Manager::Help; #inherits
|
2010-03-01 21:32:28 +01:00
|
|
|
use Lemonldap::NG::Common::Conf; #link protected conf Configuration
|
|
|
|
use Lemonldap::NG::Common::Conf::Constants; #inherits
|
2006-12-18 12:32:33 +01:00
|
|
|
|
2009-12-13 16:40:33 +01:00
|
|
|
our $VERSION = '0.93';
|
2009-12-11 19:17:00 +01:00
|
|
|
our @ISA = qw(
|
|
|
|
Lemonldap::NG::Handler::CGI
|
|
|
|
Lemonldap::NG::Manager::Downloader
|
|
|
|
Lemonldap::NG::Manager::Uploader
|
|
|
|
Lemonldap::NG::Manager::_Struct
|
|
|
|
Lemonldap::NG::Manager::_i18n
|
|
|
|
);
|
2006-12-18 12:32:33 +01:00
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
## @cmethod Lemonldap::NG::Manager new(hashRef args)
|
|
|
|
# Class constructor.
|
|
|
|
#@param args hash reference
|
|
|
|
#@return Lemonldap::NG::Manager object
|
2006-12-18 12:32:33 +01:00
|
|
|
sub new {
|
2006-12-23 16:42:58 +01:00
|
|
|
my ( $class, $args ) = @_;
|
2010-01-09 15:48:35 +01:00
|
|
|
|
|
|
|
# Try to load local configuration parameters
|
2010-03-09 22:42:31 +01:00
|
|
|
my $conf = Lemonldap::NG::Common::Conf->new( $args->{configStorage} )
|
|
|
|
or Lemonldap::NG::Handler::CGI->abort( 'Unable to get configuration',
|
|
|
|
$Lemonldap::NG::Common::Conf::msg );
|
|
|
|
if ( my $localconf = $conf->getLocalConf(MANAGERSECTION) ) {
|
|
|
|
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
|
2010-01-09 15:48:35 +01:00
|
|
|
}
|
|
|
|
|
2010-03-09 22:42:31 +01:00
|
|
|
my $self = $class->SUPER::new($args)
|
|
|
|
or $class->abort( 'Unable to start ' . __PACKAGE__,
|
|
|
|
'See Apache logs for more' );
|
|
|
|
|
2010-01-09 15:48:35 +01:00
|
|
|
# Default values
|
2010-03-01 21:32:28 +01:00
|
|
|
$self->{managerSkin} = "default" unless defined $self->{managerSkin};
|
|
|
|
$self->{managerCss} = "accordion.css" unless defined $self->{managerCss};
|
2010-01-28 11:09:02 +01:00
|
|
|
$self->{managerTreeAutoClose} = "true"
|
|
|
|
unless defined $self->{managerTreeAutoClose};
|
|
|
|
$self->{managerTreeJqueryCss} = "true"
|
|
|
|
unless defined $self->{managerTreeJqueryCss};
|
2010-01-09 15:48:35 +01:00
|
|
|
|
2010-01-28 11:09:02 +01:00
|
|
|
# Display help if ?help=
|
2009-12-23 10:37:38 +01:00
|
|
|
if ( $self->param('help') ) {
|
2009-12-11 19:17:00 +01:00
|
|
|
print $self->header_public( $ENV{SCRIPT_FILENAME},
|
|
|
|
-type => 'text/html; charset=utf8' );
|
2010-01-28 11:09:02 +01:00
|
|
|
&Lemonldap::NG::Manager::Help::import( $self->{language} );
|
2009-12-11 19:17:00 +01:00
|
|
|
my $chap = $self->param('help');
|
|
|
|
eval { no strict "refs"; &{"help_$chap"} };
|
|
|
|
$self->quit();
|
|
|
|
}
|
2010-01-28 11:09:02 +01:00
|
|
|
|
|
|
|
# Save conf if ?data=
|
2009-12-11 19:17:00 +01:00
|
|
|
elsif ( my $rdata = $self->rparam('data') ) {
|
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits
|
|
|
|
$self->confUpload($rdata);
|
|
|
|
$self->quit();
|
|
|
|
}
|
2010-01-28 11:09:02 +01:00
|
|
|
|
2010-03-12 18:54:16 +01:00
|
|
|
# File upload/download
|
2010-03-11 17:43:21 +01:00
|
|
|
elsif ( my $rfile = $self->rparam('file') ) {
|
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits
|
2010-03-12 18:54:16 +01:00
|
|
|
my $result = $self->fileUpload('file');
|
|
|
|
my %headers = (
|
|
|
|
-type => 'text/html',
|
|
|
|
-Content_Length => length($result)
|
|
|
|
);
|
|
|
|
if ( my $rfilename = $self->rparam('filename') ) {
|
|
|
|
$headers{-type} = 'application/octet-stream';
|
|
|
|
$headers{-attachment} = ${$rfilename};
|
|
|
|
$result =~ s/{.*"content":"(.*)"}$/$1/g;
|
|
|
|
}
|
|
|
|
print $self->header(%headers).$result;
|
2010-03-12 13:56:14 +01:00
|
|
|
$self->quit();
|
|
|
|
}
|
|
|
|
|
2010-01-28 11:09:02 +01:00
|
|
|
# Else load conf
|
2009-12-11 19:17:00 +01:00
|
|
|
require Lemonldap::NG::Manager::Downloader; #inherits
|
|
|
|
$self->{cfgNum} =
|
|
|
|
$self->param('cfgNum')
|
|
|
|
|| $self->confObj->lastCfg()
|
|
|
|
|| 'UNAVAILABLE';
|
|
|
|
if ( my $p = $self->param('node') ) {
|
|
|
|
print $self->header( -type => 'text/html; charset=utf8', );
|
|
|
|
print $self->node($p);
|
|
|
|
$self->quit();
|
|
|
|
}
|
2009-12-30 18:02:23 +01:00
|
|
|
if ( $self->param('cfgAttr') ) {
|
2009-12-30 21:00:54 +01:00
|
|
|
$self->sendCfgParams( $self->conf );
|
2009-12-30 18:02:23 +01:00
|
|
|
}
|
2009-12-11 19:17:00 +01:00
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
## @method string menu()
|
|
|
|
# Build the tree menu.
|
|
|
|
# @return HTML string
|
2009-12-11 19:17:00 +01:00
|
|
|
sub menu {
|
2006-12-18 12:32:33 +01:00
|
|
|
my $self = shift;
|
2009-12-17 20:20:17 +01:00
|
|
|
require Lemonldap::NG::Manager::Downloader;
|
2009-12-11 19:17:00 +01:00
|
|
|
return
|
|
|
|
'<ul class="simpleTree">'
|
|
|
|
. $self->li( 'root', 'root' )
|
2010-01-04 14:28:10 +01:00
|
|
|
. $self->span(
|
|
|
|
id => 'root',
|
|
|
|
text => "Configuration $self->{cfgNum}",
|
|
|
|
data => $self->{cfgNum},
|
|
|
|
js => 'cfgDatas',
|
|
|
|
help => 'default'
|
|
|
|
)
|
2009-12-11 19:17:00 +01:00
|
|
|
. '<ul>'
|
|
|
|
. $self->node()
|
|
|
|
. '</ul></li></ul>';
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
2009-12-13 16:40:33 +01:00
|
|
|
__END__
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2010-01-03 09:09:59 +01:00
|
|
|
=encoding utf8
|
|
|
|
|
2009-12-13 16:40:33 +01:00
|
|
|
Lemonldap::NG::Manager - Perl extension for managing Lemonldap::NG Web-SSO
|
|
|
|
system.
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
2010-01-09 15:48:35 +01:00
|
|
|
See example/index.pl
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
Lemonldap::NG::Manager provides a web interface to manage Lemonldap::NG Web-SSO
|
|
|
|
system.
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
L<Lemonldap::NG::Handler>, L<Lemonldap::NG::Portal>, L<CGI>,
|
|
|
|
http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/Presentation
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
|
|
=head1 BUG REPORT
|
|
|
|
|
|
|
|
Use OW2 system to report bug or ask for features:
|
|
|
|
L<http://forge.objectweb.org/tracker/?group_id=274>
|
|
|
|
|
|
|
|
=head1 DOWNLOAD
|
|
|
|
|
|
|
|
Lemonldap::NG is available at
|
|
|
|
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
|
|
|
|
Copyright (C) 2006-2009 by Xavier Guimard
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or,
|
|
|
|
at your option, any later version of Perl 5 you may have available.
|
|
|
|
|
|
|
|
=cut
|