Commit 4cfa1be5 authored by Xavier Guimard's avatar Xavier Guimard

Unminify conftree.js (#908)

parent 2b5fdbb2
...@@ -202,6 +202,7 @@ minify: $(JSDSTFILES) $(CSSDSTFILES) ...@@ -202,6 +202,7 @@ minify: $(JSDSTFILES) $(CSSDSTFILES)
# #
json: $(MANAGERJSONDST) json: $(MANAGERJSONDST)
$(MAKE) minify
$(MANAGERJSONDST): $(MANAGERJSONSRC) $(MANAGERJSONDST): $(MANAGERJSONSRC)
./scripts/jsongenerator.pl ./scripts/jsongenerator.pl
......
...@@ -66,15 +66,15 @@ sub run { ...@@ -66,15 +66,15 @@ sub run {
printf STDERR $format, $self->confTreeFile; printf STDERR $format, $self->confTreeFile;
$mainTree = Lemonldap::NG::Manager::Build::CTrees::cTrees(); $mainTree = Lemonldap::NG::Manager::Build::CTrees::cTrees();
my $script = my $script = 'function templates(tpl,key){
'function templates(tpl,key){' var ind;
. 'var ind;' var scalarTemplate=function(r){
. 'var scalarTemplate=function(r){' return{
. 'return{' "id":tpl+"s/"+(ind++),
. '"id":tpl+"s/"+(ind++),' "title":r,
. '"title":r,' "get":tpl+"s/"+key+"/"+r};};
. '"get":tpl+"s/"+key+"/"+r};};' switch(tpl){
. 'switch(tpl){'; ';
# To build confTree.js, each special node is scanned from # To build confTree.js, each special node is scanned from
# Lemonldap::NG::Manager::Build::CTrees # Lemonldap::NG::Manager::Build::CTrees
...@@ -82,11 +82,14 @@ sub run { ...@@ -82,11 +82,14 @@ sub run {
@cnodesKeys = (); @cnodesKeys = ();
my $jsonTree = []; my $jsonTree = [];
$self->scanTree( $mainTree->{$node}, $jsonTree, '__KEY__', '' ); $self->scanTree( $mainTree->{$node}, $jsonTree, '__KEY__', '' );
$jsonEnc->pretty(1);
my $tmp = $jsonEnc->encode($jsonTree); my $tmp = $jsonEnc->encode($jsonTree);
$tmp =~ s!"__KEY__!tpl+"s/"+key+"/"+"!mg; $tmp =~ s!"__KEY__!tpl+"s/"+key+"/"+"!mg;
$tmp =~ s/"(true|false)"/$1/sg; $tmp =~ s/"(true|false)"/$1/sg;
$tmp =~ s/:\s*"(\d+)"\s*(["\}])/:$1$2/sg; $tmp =~ s/:\s*"(\d+)"\s*(["\}])/:$1$2/sg;
$script .= "case'$node':return$tmp;"; $script .= " case'$node':
return$tmp;
";
# Second step, Manager/Constants.pm file will contain datas issued from # Second step, Manager/Constants.pm file will contain datas issued from
# this scan # this scan
...@@ -100,7 +103,10 @@ sub run { ...@@ -100,7 +103,10 @@ sub run {
push @ignoreKeys, $node; push @ignoreKeys, $node;
} }
$script .= 'default:return [];}}'; $script .= '
default:return [];
}
}';
open F, ">", $self->confTreeFile or die $!; open F, ">", $self->confTreeFile or die $!;
print F $script; print F $script;
close F; close F;
...@@ -117,15 +123,16 @@ sub run { ...@@ -117,15 +123,16 @@ sub run {
$mainTree = Lemonldap::NG::Manager::Build::Tree::tree(); $mainTree = Lemonldap::NG::Manager::Build::Tree::tree();
my $jsonTree = []; my $jsonTree = [];
$self->scanTree( $mainTree, $jsonTree, '', '' ); $self->scanTree( $mainTree, $jsonTree, '', '' );
$script = 'function setScopeVars(scope){'; $script = "\nfunction setScopeVars(scope) {\n";
foreach my $v (@angularScopeVars) { foreach my $v (@angularScopeVars) {
$script .= "scope.$v->[0]=scope$v->[1];scope.getKey(scope.$v->[0]);"; $script .= " scope.$v->[0]=scope$v->[1];scope.getKey(scope.$v->[0]);\n";
} }
$script .= '}'; $script .= "}\n";
open F, ">>", $self->confTreeFile || die $!; open F, ">>", $self->confTreeFile || die $!;
print F $script; print F $script;
close F; close F;
open F, ">", $self->structFile || die $!; open F, ">", $self->structFile || die $!;
$jsonEnc->pretty(0);
my $tmp = $jsonEnc->encode($jsonTree); my $tmp = $jsonEnc->encode($jsonTree);
$tmp =~ s/"(true|false)"/$1/sg; $tmp =~ s/"(true|false)"/$1/sg;
$tmp =~ s/:\s*"(\d+)"\s*(["\}])/:$1$2/sg; $tmp =~ s/:\s*"(\d+)"\s*(["\}])/:$1$2/sg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment