Rev 13084 | Rev 13733 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 13084 | Rev 13732 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | 2 | ||
3 | use strict "vars"; |
3 | use strict "vars"; |
4 | use strict "subs"; |
4 | use strict "subs"; |
5 | use locale; |
5 | use locale; |
6 | use warnings; |
6 | use warnings; |
7 | $/ = undef; |
- | |
8 | 7 | ||
- | 8 | my $wimsconf="../../log/wims.conf"; |
|
- | 9 | my $wimsdefault="../../public_html/bases/sys/defaults.conf"; |
|
- | 10 | my %listcolor; |
|
- | 11 | open(IN, "$wimsconf"); |
|
- | 12 | while (<IN>) { |
|
- | 13 | for my $t ("ref_bgcolor","ref_button_bgcolor","ref_button_help_bgcolor" ) { |
|
- | 14 | if (/$t/) { $listcolor{$t}=$_; $listcolor{$t} =~ s/$t=//;} |
|
- | 15 | } |
|
- | 16 | }; |
|
- | 17 | close(IN); |
|
- | 18 | open(IN, "$wimsdefault"); |
|
- | 19 | while (<IN>) { |
|
- | 20 | for my $t ("ref_bgcolor","ref_button_bgcolor","ref_button_help_bgcolor" ) { |
|
- | 21 | if (/$t/ && !$listcolor{$t}) { |
|
- | 22 | $listcolor{$t}=$_; $listcolor{$t} =~ s/DF_$t=//;} |
|
- | 23 | } |
|
- | 24 | }; |
|
- | 25 | close(IN); |
|
- | 26 | ||
- | 27 | $/ = undef; |
|
9 | ##{ |
28 | ##{ |
10 | ## last if (/^$/); |
29 | ## last if (/^$/); |
11 | ## if (/^(.*)$/) { $dir=$1 } |
30 | ## if (/^(.*)$/) { $dir=$1 } |
12 | ##} |
31 | ##}; |
13 | 32 | ||
14 | my $char="---"; |
33 | my $char="---"; |
15 | 34 | ||
16 | for my $f (glob("*/*.css.template")) { |
35 | for my $f (glob("*/*.css.template")) { |
17 | print "\nGeneration de $f"; |
36 | print "\nGeneration de $f"; |
18 | my $f1= $f |
37 | my $f1= $f; $f1 =~ s/.template//; my $f2 = "$f1.tmp.css"; |
19 | my @f3=split("/",$f1); |
38 | my @f3=split("/",$f1); |
20 | my $f3=$f3[0]; |
39 | my $f3=$f3[0]; |
21 | my $TEXT ="/*! generated from $f - do not modify directly */\n" |
40 | my $TEXT ="/*! generated from $f - do not modify directly */\n"; |
22 | my %colors; |
41 | my %colors; |
23 | open(IN,"$f"); |
42 | open(IN,"$f"); |
24 | while (<IN> ) { |
43 | while (<IN> ) { |
25 | my $line=$_ |
44 | my $line=$_; |
26 | $line =~ s/#[^\n]+//g |
45 | $line =~ s/#[^\n]+//g; |
27 | $line =~ s/--- (.*) ---/treate($1)/ge |
46 | $line =~ s/--- (.*) ---/treate($1)/ge; |
28 | $TEXT .= $line |
47 | $TEXT .= $line; |
29 | } |
48 | } |
30 | close IN |
49 | close IN; |
31 | $TEXT .= "\n"; |
50 | $TEXT .= "\n"; |
32 | # lecture de oefcolors |
51 | # lecture de oefcolors |
33 | my $fc="$f3/oefcolors"; |
52 | my $fc="$f3/oefcolors"; |
34 | if (!(-e $fc)) { $fc="oefcolors" }; |
53 | if (!(-e $fc)) { $fc="oefcolors" }; |
35 | open(INN, "$fc"); |
54 | open(INN, "$fc"); |
Line 42... | Line 61... | ||
42 | my $colors=\%colors; |
61 | my $colors=\%colors; |
43 | for my $k (keys %{$colors}) { |
62 | for my $k (keys %{$colors}) { |
44 | $TEXT =~ s/color: *$k/color:$colors{$k}/g; |
63 | $TEXT =~ s/color: *$k/color:$colors{$k}/g; |
45 | } |
64 | } |
46 | 65 | ||
47 | out("$f2" ,$TEXT) |
66 | out("$f2" ,$TEXT); |
48 | $/ = undef; |
67 | $/ = undef; |
49 | system("java -jar yuicompressor $f2 -o $f1 -v; rm $f2"); |
68 | system("java -jar yuicompressor $f2 -o $f1 -v; rm $f2"); |
50 | } |
69 | } |
51 | 70 | ||
52 | sub t { my ($c1,$c2,$L)=@_; $L->{$c1}=$c2}; |
71 | sub t { my ($c1,$c2,$L)=@_; $L->{$c1}=$c2}; |
53 | 72 | ||
54 | sub treate { my ($c)= @_ |
73 | sub treate { my ($c)= @_; |
55 | return if ((!$c) || ($c =~ /#/)); |
74 | return if ((!$c) || ($c =~ /#/)); |
56 | # print "\ntraitement du fichier $c"; |
75 | # print "\ntraitement du fichier $c"; |
57 | open(INN, $c); |
76 | open(INN, $c); |
58 | my $text = <INN> |
77 | my $text = <INN>; |
59 | close(INN) |
78 | close(INN); |
- | 79 | for my $a (keys %listcolor){ |
|
- | 80 | $text=~ s/wims_$a/$listcolor{$a}/g; |
|
- | 81 | } |
|
60 | "\n/*! from $c */\n$text" |
82 | "\n/*! from $c */\n$text"; |
61 | }; |
83 | }; |
62 | 84 | ||
63 | sub out { my ($bloc, $text) = @_ |
85 | sub out { my ($bloc, $text) = @_; |
64 | open (OUT, ">$bloc") || warn "Creation du bloc $bloc impossible"; |
86 | open (OUT, ">$bloc") || warn "Creation du bloc $bloc impossible"; |
65 | print OUT $text |
87 | print OUT $text; close OUT; |
66 | } |
88 | } |