|
|
|
@ -52,6 +52,8 @@ $Data::Dumper::Sortkeys = sub { |
|
|
|
|
]; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
$Data::Dumper::Deparse = 1; |
|
|
|
|
|
|
|
|
|
sub run { |
|
|
|
|
my $self = shift; |
|
|
|
|
$self = $module->new(@_) unless ref $self; |
|
|
|
@ -184,8 +186,7 @@ EOF |
|
|
|
|
: () |
|
|
|
|
} keys(%$attributes) |
|
|
|
|
}; |
|
|
|
|
my $defaultAttr = Dumper($defaultValues); |
|
|
|
|
$defaultAttr =~ s/^\$VAR1\s*=/sub defaultValues {\n return/; |
|
|
|
|
my $defaultAttr = mydump($defaultValues,'defaultValues'); |
|
|
|
|
$defaultAttr = "# This file is generated by $module. Don't modify it by hand |
|
|
|
|
package Lemonldap::NG::Common::Conf::DefaultValues; |
|
|
|
|
|
|
|
|
@ -223,11 +224,9 @@ $defaultAttr} |
|
|
|
|
( $_ => {@r} ); |
|
|
|
|
} keys(%$attributes) |
|
|
|
|
}; |
|
|
|
|
$managerAttr = Dumper($managerAttr); |
|
|
|
|
$managerAttr =~ s/^\$VAR1\s*=/sub attributes {\n return/; |
|
|
|
|
$managerAttr = mydump($managerAttr,'attributes'); |
|
|
|
|
my $managerTypes = |
|
|
|
|
Dumper( Lemonldap::NG::Manager::Build::Attributes::types() ); |
|
|
|
|
$managerTypes =~ s/^\$VAR1\s*=/sub types {\n return/; |
|
|
|
|
mydump( Lemonldap::NG::Manager::Build::Attributes::types(),'types' ); |
|
|
|
|
$managerAttr = "# This file is generated by $module. Don't modify it by hand |
|
|
|
|
package Lemonldap::NG::Manager::Attributes; |
|
|
|
|
|
|
|
|
@ -252,6 +251,14 @@ $managerAttr} |
|
|
|
|
print STDERR "done\n"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub mydump { |
|
|
|
|
my ($obj, $subname) = splice @_; |
|
|
|
|
my $t = Dumper($obj); |
|
|
|
|
$t =~ s/^\s*(?:use strict;|package .*?;|)\n//gm; |
|
|
|
|
$t =~ s/^\$VAR1\s*=/sub $subname {\n return/; |
|
|
|
|
return $t; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub scanTree { |
|
|
|
|
my ( $self, $tree, $json, $prefix, $path ) = splice @_; |
|
|
|
|
unless ( ref($tree) eq 'ARRAY' ) { |
|
|
|
@ -391,7 +398,144 @@ system. |
|
|
|
|
=head1 DESCRIPTION |
|
|
|
|
|
|
|
|
|
Lemonldap::NG::Manager::Build is used only to build javascript files and |
|
|
|
|
Lemonldap::NG constants Perl files |
|
|
|
|
Lemonldap::NG constants Perl files. It has to be launched after each change. |
|
|
|
|
|
|
|
|
|
=head2 DEVELOPPER CORNER |
|
|
|
|
|
|
|
|
|
To add a new parameter, you have to: |
|
|
|
|
|
|
|
|
|
=over |
|
|
|
|
|
|
|
|
|
=item declare it in Manager/Build/Attributes.pm; |
|
|
|
|
|
|
|
|
|
=item declare its position in the tree in Manager/Build/Tree.pm (or |
|
|
|
|
Manager/Build/CTrees.pm for complex nodes); |
|
|
|
|
|
|
|
|
|
=item refresh files using this (or launch any build makefile target at the |
|
|
|
|
root of the Lemonldap::NG project sources). |
|
|
|
|
|
|
|
|
|
=back |
|
|
|
|
|
|
|
|
|
See below for details. |
|
|
|
|
|
|
|
|
|
=head3 Attribute declaration |
|
|
|
|
|
|
|
|
|
Set your new attribute as a key of attributes() function that points to a hash |
|
|
|
|
ref containing: |
|
|
|
|
|
|
|
|
|
=over |
|
|
|
|
|
|
|
|
|
=item type (required): |
|
|
|
|
|
|
|
|
|
the type of the content. It must be declared in sub |
|
|
|
|
types() in the same file (except if attribute embeds its own tests) and must |
|
|
|
|
correspond to a form stored in the static/forms/ directory; |
|
|
|
|
|
|
|
|
|
=item help (optional): |
|
|
|
|
|
|
|
|
|
the relative HTML path to the help page (relative to |
|
|
|
|
/doc/pages/documentation/<version>/); |
|
|
|
|
|
|
|
|
|
=item default (recommended): |
|
|
|
|
|
|
|
|
|
a default value to set if not defined; |
|
|
|
|
|
|
|
|
|
=item select (optional): |
|
|
|
|
|
|
|
|
|
required only if type is `select`. In this case, it |
|
|
|
|
must contains an array of { k => <keyName>, v => <display name> } hashref |
|
|
|
|
|
|
|
|
|
=item documentation (recommended): |
|
|
|
|
|
|
|
|
|
some words for other developpers |
|
|
|
|
|
|
|
|
|
=item test (optional): |
|
|
|
|
|
|
|
|
|
if test is not defined for this type or if test must |
|
|
|
|
be more restrictive, set her a regular expression or a subroutine. Arguments |
|
|
|
|
passed to subroutine are (keyValue, newConf, currentKey), it returns 2 |
|
|
|
|
arguments: a boolean result and a message (if non empty will be displayed as |
|
|
|
|
warning or error depending of result); |
|
|
|
|
|
|
|
|
|
=item msgFail (optional): |
|
|
|
|
|
|
|
|
|
for regexp based tests, message to display in case of |
|
|
|
|
error. Words to translate have to be written as so: __toTranslate__; |
|
|
|
|
|
|
|
|
|
=item keyTest (optional): |
|
|
|
|
|
|
|
|
|
for keys/values attributes, test to be applied on |
|
|
|
|
key; |
|
|
|
|
|
|
|
|
|
=item keyMsgFail (optional): |
|
|
|
|
|
|
|
|
|
for regexp based key tests, same as msgFail for |
|
|
|
|
keys test; |
|
|
|
|
|
|
|
|
|
=back |
|
|
|
|
|
|
|
|
|
If you decide to declare a new type, you have to declare the following |
|
|
|
|
properties: |
|
|
|
|
|
|
|
|
|
=over |
|
|
|
|
|
|
|
|
|
=item test, msgFail, keyTest, keyMsgFail as shown above, |
|
|
|
|
|
|
|
|
|
=item form: the form to use if it doesn't have the same name. |
|
|
|
|
|
|
|
|
|
=back |
|
|
|
|
|
|
|
|
|
=head3 Tree positioning |
|
|
|
|
|
|
|
|
|
The tree is now very simple: it contains nodes and leaf. Leaf are designed only |
|
|
|
|
by their attribute name. All description must be done in the file described |
|
|
|
|
above. Nodes are array member designed as this: |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
title => 'titleToTranslate', |
|
|
|
|
help => 'helpUrl', |
|
|
|
|
form => 'relativeUrl', |
|
|
|
|
nodes => [ |
|
|
|
|
... nodes or leaf ... |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Explanations: |
|
|
|
|
|
|
|
|
|
=over |
|
|
|
|
|
|
|
|
|
=item title (required): |
|
|
|
|
|
|
|
|
|
it must contain an entry of static/languages/lang.json |
|
|
|
|
|
|
|
|
|
=item help (recommended): |
|
|
|
|
|
|
|
|
|
as above, the relative HTML path to the help page |
|
|
|
|
(relative to /doc/pages/documentation/<version>/); |
|
|
|
|
|
|
|
|
|
=item form (optional): |
|
|
|
|
|
|
|
|
|
the name of a static/forms/<name>.html file |
|
|
|
|
|
|
|
|
|
=item nodes: |
|
|
|
|
|
|
|
|
|
array of sub nodes and leaf attached to this node |
|
|
|
|
|
|
|
|
|
=item group: |
|
|
|
|
|
|
|
|
|
must never be used in conjunction with nodes. Array of leafs only |
|
|
|
|
to be displayed in the same form |
|
|
|
|
|
|
|
|
|
=item nodes_cond: |
|
|
|
|
|
|
|
|
|
array of sub nodes that will be displayed with a filter. Not |
|
|
|
|
yet documented here, see the source code of site/static/js/filterFunctions.js. |
|
|
|
|
|
|
|
|
|
=item nodes_filter: |
|
|
|
|
|
|
|
|
|
filter entry in site/static/js/filterFunctions.js for the same feature. |
|
|
|
|
|
|
|
|
|
=back |
|
|
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
|
|
|
|
|
|
|
|