line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## @file |
2
|
|
|
|
|
|
|
# Lemonldap::NG manager main file |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
## @class |
5
|
|
|
|
|
|
|
# Lemonldap::NG manager main class |
6
|
|
|
|
|
|
|
package Lemonldap::NG::Manager; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1725
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
9
|
1
|
|
|
1
|
|
385
|
use Lemonldap::NG::Handler::CGI qw(:globalStorage :locationRules); #inherits |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Lemonldap::NG::Common::Conf; #link protected conf Configuration |
11
|
|
|
|
|
|
|
use Lemonldap::NG::Common::Conf::Constants; #inherits |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '1.4.1'; |
14
|
|
|
|
|
|
|
our @ISA = qw( |
15
|
|
|
|
|
|
|
Lemonldap::NG::Handler::CGI |
16
|
|
|
|
|
|
|
Lemonldap::NG::Manager::Downloader |
17
|
|
|
|
|
|
|
Lemonldap::NG::Manager::Uploader |
18
|
|
|
|
|
|
|
Lemonldap::NG::Manager::Request |
19
|
|
|
|
|
|
|
Lemonldap::NG::Manager::_Struct |
20
|
|
|
|
|
|
|
Lemonldap::NG::Manager::_i18n |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
## @cmethod Lemonldap::NG::Manager new(hashRef args) |
24
|
|
|
|
|
|
|
# Class constructor. |
25
|
|
|
|
|
|
|
#@param args hash reference |
26
|
|
|
|
|
|
|
#@return Lemonldap::NG::Manager object |
27
|
|
|
|
|
|
|
sub new { |
28
|
|
|
|
|
|
|
my ( $class, $args ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Output UTF-8 |
31
|
|
|
|
|
|
|
binmode( STDOUT, ':utf8' ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Try to load local configuration parameters |
34
|
|
|
|
|
|
|
my $conf = Lemonldap::NG::Common::Conf->new( $args->{configStorage} ) |
35
|
|
|
|
|
|
|
or Lemonldap::NG::Handler::CGI->abort( 'Unable to get configuration', |
36
|
|
|
|
|
|
|
$Lemonldap::NG::Common::Conf::msg ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
if ( my $globalconf = $conf->getConf() ) { |
39
|
|
|
|
|
|
|
$args->{$_} ||= $globalconf->{$_} foreach (qw/portal/); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
if ( my $localconf = $conf->getLocalConf(MANAGERSECTION) ) { |
43
|
|
|
|
|
|
|
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $self = $class->SUPER::new($args) |
47
|
|
|
|
|
|
|
or $class->abort( 'Unable to start ' . __PACKAGE__, |
48
|
|
|
|
|
|
|
'See Apache logs for more' ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Default values |
51
|
|
|
|
|
|
|
$self->{managerSkin} = "default" unless defined $self->{managerSkin}; |
52
|
|
|
|
|
|
|
$self->{managerCss} = "accordion.css" unless defined $self->{managerCss}; |
53
|
|
|
|
|
|
|
$self->{managerCssTheme} = "ui-lightness" |
54
|
|
|
|
|
|
|
unless defined $self->{managerCssTheme}; |
55
|
|
|
|
|
|
|
$self->{managerTreeAutoClose} = "true" |
56
|
|
|
|
|
|
|
unless defined $self->{managerTreeAutoClose}; |
57
|
|
|
|
|
|
|
$self->{managerTreeJqueryCss} = "true" |
58
|
|
|
|
|
|
|
unless defined $self->{managerTreeJqueryCss}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Save conf if ?data= |
61
|
|
|
|
|
|
|
if ( my $rdata = $self->rparam('data') ) { |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$self->lmLog( "Manager request: Save data $rdata", 'debug' ); |
64
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits |
65
|
|
|
|
|
|
|
$self->confUpload($rdata); |
66
|
|
|
|
|
|
|
$self->quit(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# File upload/download |
70
|
|
|
|
|
|
|
elsif ( my $rfile = $self->rparam('file') ) { |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$self->lmLog( "Manager request: File $rfile", 'debug' ); |
73
|
|
|
|
|
|
|
my @params = ('file'); |
74
|
|
|
|
|
|
|
if ( my $rfilename = $self->rparam('filename') ) { |
75
|
|
|
|
|
|
|
push @params, ${$rfilename}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits |
78
|
|
|
|
|
|
|
$self->fileUpload(@params); |
79
|
|
|
|
|
|
|
$self->quit(); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# URL upload/download |
83
|
|
|
|
|
|
|
elsif ( my $rurl = $self->rparam('url') ) { |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$self->lmLog( "Manager request: URL $rurl", 'debug' ); |
86
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits |
87
|
|
|
|
|
|
|
$self->urlUpload('url'); |
88
|
|
|
|
|
|
|
$self->quit(); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Reload menu |
92
|
|
|
|
|
|
|
elsif ( my $menu = $self->param('menu') ) { |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$self->lmLog( "Manager request: Menu reload for num $menu", 'debug' ); |
95
|
|
|
|
|
|
|
$self->{cfgNum} = $menu; |
96
|
|
|
|
|
|
|
print $self->header( -type => 'text/html;charset=utf-8' ); |
97
|
|
|
|
|
|
|
print $self->menu(); |
98
|
|
|
|
|
|
|
$self->quit(); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Ask requests |
102
|
|
|
|
|
|
|
elsif ( my $rreq = $self->rparam('request') ) { |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
$self->lmLog( "Manager request: $rreq", 'debug' ); |
105
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Request; #inherits |
106
|
|
|
|
|
|
|
$self->request($rreq); |
107
|
|
|
|
|
|
|
$self->quit(); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Else load conf |
111
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Downloader; #inherits |
112
|
|
|
|
|
|
|
$self->{cfgNum} = $self->param('cfgNum') |
113
|
|
|
|
|
|
|
|| $self->confObj->lastCfg(); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
if ( my $p = $self->param('node') ) { |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$self->lmLog( "Manager request: load node $p", 'debug' ); |
118
|
|
|
|
|
|
|
print $self->header( -type => 'text/html; charset=utf8', ); |
119
|
|
|
|
|
|
|
print $self->node($p); |
120
|
|
|
|
|
|
|
$self->quit(); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
if ( $self->param('cfgAttr') ) { |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
$self->lmLog( "Manager request: load configuration attributes", |
125
|
|
|
|
|
|
|
'debug' ); |
126
|
|
|
|
|
|
|
$self->sendCfgParams( $self->conf ); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
return $self; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
## @method string menu() |
133
|
|
|
|
|
|
|
# Build the tree menu. |
134
|
|
|
|
|
|
|
# @return HTML string |
135
|
|
|
|
|
|
|
sub menu { |
136
|
|
|
|
|
|
|
my $self = shift; |
137
|
|
|
|
|
|
|
require Lemonldap::NG::Manager::Downloader; |
138
|
|
|
|
|
|
|
return |
139
|
|
|
|
|
|
|
' |
140
|
|
|
|
|
|
|
. $self->li( 'root', 'root' ) |
141
|
|
|
|
|
|
|
. $self->span( |
142
|
|
|
|
|
|
|
id => 'root', |
143
|
|
|
|
|
|
|
text => "Configuration $self->{cfgNum}", |
144
|
|
|
|
|
|
|
data => $self->{cfgNum}, |
145
|
|
|
|
|
|
|
js => 'cfgDatas', |
146
|
|
|
|
|
|
|
help => 'default' |
147
|
|
|
|
|
|
|
) |
148
|
|
|
|
|
|
|
. ' |
149
|
|
|
|
|
|
|
. $self->node() |
150
|
|
|
|
|
|
|
. ''; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
1; |
154
|
|
|
|
|
|
|
__END__ |