Rev 11931 | Rev 13647 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11931 | Rev 13646 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | sub underscore { my ($a)=@_ ; $a=~ s/\_/ /g ; $a; } |
30 | sub underscore { my ($a)=@_ ; $a=~ s/\_/ /g ; $a; } |
31 | ## hack for suffix |
31 | ## hack for suffix |
32 | sub suffix { my ($a)=@_ ; $a=~ s/(e|s|l|r)\b//; $a; } |
32 | sub suffix { my ($a)=@_ ; $a=~ s/(e|s|l|r)\b//; $a; } |
33 | 33 | ||
34 | sub count { my ($file)=@_ ; |
34 | sub count { my ($file)=@_ ; |
35 | my $refcount={}; |
35 | my $refcount={}; |
36 | open INC, "$file"; |
36 | open INC, "$file"; |
37 | while (<INC>){ |
37 | while (<INC>){ |
38 | if (/^(.*):(.*)/) { my @L=split(' ', $2) ; $refcount->{$1}=$#L+1 } |
38 | if (/^(.*):(.*)/) { my @L=split(' ', $2) ; $refcount->{$1}=$#L+1 } |
39 | }; |
39 | }; |
40 | close INC; |
40 | close INC; |
41 | $refcount |
41 | $refcount |
42 | } |
42 | } |
43 | 43 | ||
44 | if ($option) { |
44 | if ($option) { |
45 | my $refcount= count("$moduledir/A.$LANG"); |
45 | my $refcount= count("$moduledir/A.$LANG"); |
46 | ## initialisation, will not change |
46 | ## initialisation, will not change |
47 | my %refw = hashdomain('domain/domain') ; my $refw=\%refw; |
47 | my %refw = hashdomain('domain/domain') ; my $refw=\%refw; |
48 | my %titw = treate_dict ("domain/domain.$LANG"); my $titw=\%titw; |
48 | my %titw = treate_dict ("domain/domain.$LANG"); my $titw=\%titw; |
49 | my (%Next); for my $a (keys %{$refw->{'next'}}) { $Next{$a}=$refw->{'next'}{$a}; } |
49 | my (%Next); for my $a (keys %{$refw->{'next'}}) { $Next{$a}=$refw->{'next'}{$a}; } |
50 | 50 | ||
51 | my $Tw; |
51 | my $Tw; |
52 | for my $taxo (split(',',$Next{'domain'})){ |
52 | for my $taxo (split(',',$Next{'domain'})){ |
53 | if ( !(defined $titw{$taxo})) { $titw{$taxo}=$taxo} ; |
53 | if ( !(defined $titw{$taxo})) { $titw{$taxo}=$taxo} ; |
54 | $Tw = "!! This file is generated by taxo.pl. Do not modify directly.\n!set lang_exists=yes\n" |
54 | $Tw = "!! This file is generated by taxo.pl. Do not modify directly.\n!set lang_exists=yes\n" |
55 | . '<a class="wims_button float_right" onclick="treeToggleAll(\'#tree_'.$taxo.'\');">$name_fold</a>' |
55 | . '<a class="wims_button float_right" onclick="treeToggleAll(\'#tree_'.$taxo.'\');">$name_fold</a>' |
56 | . "\n!set title= $titw{$taxo}\n<h2>$titw{$taxo}<\/h2>\n" |
56 | . "\n!set title= $titw{$taxo}\n<h2>$titw{$taxo}<\/h2>\n" |
57 | . '<ul id="tree_' .$taxo.'" class="tree">'; |
57 | . '<ul id="tree_' .$taxo.'" class="tree">'; |
58 | One ($Next{$taxo}, $refcount, $taxo, $taxo); |
58 | One ($Next{$taxo}, $refcount, $taxo, $taxo); |
59 | $Tw .= "\n</ul>"; |
59 | $Tw .= "\n</ul>"; |
60 | 60 | ||
61 | sub One { my ($t, $refcount, $taxo, $chemin) = @_; |
61 | sub One { my ($t, $refcount, $taxo, $chemin) = @_; |
62 | return if (!$t); |
62 | return if (!$t); |
63 | for my $tt (split(',', $t)) { |
63 | for my $tt (split(',', $t)) { |
64 | $Tw .= "<li \n". |
64 | $Tw .= "<li \n". |
65 | "!if $tt notitemof \$parm\n". |
65 | "!if $tt notitemof \$parm\n". |
66 | " class=\"closed\"\n". |
66 | " class=\"closed\"\n". |
67 | "!endif\n". |
67 | "!endif\n". |
68 | ">\n"; |
68 | ">\n"; |
69 | my $tt0=$titw->{$tt}; |
69 | my $tt0=$titw->{$tt}; |
70 | if(!$tt0) { $tt0=$tt ; # print $tt ."\n" ; |
70 | if(!$tt0) { $tt0=$tt ; # print $tt ."\n" ; |
71 | }; |
71 | }; |
72 | my $chemin1 .= "$chemin,$tt" ; |
72 | my $chemin1 .= "$chemin,$tt" ; |
73 | my $cc=''; |
73 | my $cc=''; |
74 | my $tt1=underscore($tt); |
74 | my $tt1=underscore($tt); |
75 | my $T; |
75 | my $T; |
76 | if(defined($refcount->{$tt1})) { $T=$refcount->{$tt1}} |
76 | if(defined($refcount->{$tt1})) { $T=$refcount->{$tt1}} |
77 | else { if (defined($refcount->{suffix($tt1)})) { $T= $refcount->{suffix($tt1)}}}; |
77 | else { if (defined($refcount->{suffix($tt1)})) { $T= $refcount->{suffix($tt1)}}}; |
78 | if ($T) { $cc="<sup class=\"pastille taxo_nb_elem\">". $T."</sup>" }; |
78 | if ($T) { $cc="<sup class=\"pastille taxo_nb_elem\">". $T."</sup>" }; |
79 | $Tw .= "<span class=\"tree_icon\" id=\"$tt\">$tt0</span><span class=\"small hidden\">($tt)</span>$cc\n" |
79 | $Tw .= "<span class=\"tree_icon\" id=\"$tt\">$tt0</span><span class=\"small hidden\">($tt)</span>$cc\n" |
80 | . "!set key=$tt0\n"; |
80 | . "!set key=$tt0\n"; |
81 | # if ($T) {$Tw .= '!href $search_addr&parm=' . "$tt&browse_parm=$chemin1 🔎 \$wims_name_search\n";} |
81 | # if ($T) {$Tw .= '!href $search_addr&parm=' . "$tt&browse_parm=$chemin1 🔎 \$wims_name_search\n";} |
82 | $Tw .= '!href $search_addr&parm=' . "$tt&browse_parm=$chemin1 🔎 \$wims_name_search\n"; |
82 | $Tw .= '!href $search_addr&parm=' . "$tt&browse_parm=$chemin1 🔎 \$wims_name_search\n"; |
83 | $Tw .= "<ul id=\"list_$tt\">"; |
83 | $Tw .= "<ul id=\"list_$tt\">"; |
84 | One($Next{$tt}, $refcount,$taxo, $chemin1); |
84 | One($Next{$tt}, $refcount,$taxo, $chemin1); |
85 | $Tw .= "\n</ul>"; |
85 | $Tw .= "\n</ul>"; |
- | 86 | } |
|
- | 87 | $Tw .= "\n</li>"; |
|
86 | } |
88 | } |
87 | $Tw .= "\n</li>"; |
- | |
88 | } |
- | |
89 | out("$outputtaxo/taxo/$taxo.phtml.$LANG", $Tw); |
89 | out("$outputtaxo/taxo/$taxo.phtml.$LANG", $Tw); |
90 | } |
90 | } |
91 | exit; |
91 | exit; |
92 | } |
92 | } |
93 | #### |
93 | #### |
94 | ## will not be modified in the subroutines |
94 | ## will not be modified in the subroutines |
95 | ## LANG here must be a language for the moment |
95 | ## LANG here must be a language for the moment |
96 | my %titsheet = treate_dict ("$sheetdir/index/tit.$LANG"); my $titsheet=\%titsheet; |
96 | my %titsheet = treate_dict ("$sheetdir/index/tit.$LANG"); my $titsheet=\%titsheet; |
Line 117... | Line 117... | ||
117 | for my $l ('K','1','2','3','4','5','6','7','HS') { push @list, "$ccsstitle$l" } |
117 | for my $l ('K','1','2','3','4','5','6','7','HS') { push @list, "$ccsstitle$l" } |
118 | 118 | ||
119 | taxonomy ('commoncore', 'commoncore', $LANG, '_','_',@list); |
119 | taxonomy ('commoncore', 'commoncore', $LANG, '_','_',@list); |
120 | 120 | ||
121 | sub taxonomy { my ($taxo, $taxo2, $lang, $sep1, $sep2, @list ) = @_ ; |
121 | sub taxonomy { my ($taxo, $taxo2, $lang, $sep1, $sep2, @list ) = @_ ; |
122 |
|
122 | my $vu={}; my $ref; my $desctaxo; |
123 |
|
123 | my ($title, $desc, $tit) = hashtaxo("$ddir/$taxo.$lang", $sep1, $sep2); |
124 |
|
124 | my @title_ = split(',', $title); |
125 |
|
125 | ($title,$desctaxo)=@title_; |
126 |
|
126 | if (!(defined $desctaxo)) { $desctaxo='' }; |
127 |
|
127 | if ($module) { $ref=hashresultat("$indexdir/$taxo2","$indexdir/$taxo2" . "_sheet", $tit); } |
128 |
|
128 | my ($T); |
129 |
|
129 | $T = "!! This file is generated by taxo.pl. Do not modify directly.\n!set lang_exists=yes\n"; |
130 |
|
130 | $T .= '<a class="wims_button float_right" onclick="treeToggleAll(\'#tree_'.$taxo.'\');">$name_fold</a>'; |
131 |
|
131 | $T .= "\n!set title=$title\n!set desctaxo=$desctaxo\n<h2>$title<\/h2>\n"; |
132 |
|
132 | $T .= '<ul id="tree_'.$taxo.'" class="tree">'; |
133 |
|
133 | if (!@list) { @list=sort keys %{$desc} }; |
134 |
|
134 | for my $a (@list) { $T .= one($a, $taxo, $desc, $tit, $ref, $vu); }; |
135 |
|
135 | $T .= "</ul>"; |
136 |
|
136 | if (!$module) { |
137 |
|
137 | $T .= "<input type=\"radio\" name=\"taxon_$taxo\" id=\"empty\" value=\"\"/> $joker"; |
138 |
|
138 | } |
139 |
|
139 | $T .= "<div class=\"wims_credits\">"; |
140 |
|
140 | $T .= " <strong>\$wims_name_credits:</strong> <a href=\"$desctaxo\" target=\"_blank\">$desctaxo</a>"; |
141 |
|
141 | $T .= "</div>"; |
142 |
|
142 | $T .= "<!-- Reload dynamic tree display -->"; |
143 |
|
143 | $T .= "<script type=\"text/javascript\" >"; |
144 |
|
144 | $T .= "autoInit_trees();"; |
145 |
|
145 | $T .= "</script>"; |
146 | - | ||
147 | 146 | ||
148 |
|
147 | out("$outputtaxo/$taxo.phtml.$lang", $T); |
149 | } |
148 | } |
150 | 149 | ||
151 | 150 | ||
152 | sub one {my ($a, $taxo, $desc, $tit, $ref, $vu)=@_; |
151 | sub one {my ($a, $taxo, $desc, $tit, $ref, $vu)=@_; |
153 | return "" if (defined($vu->{$a})); |
152 | return "" if (defined($vu->{$a})); |
154 | $vu->{$a} = 1; |
153 | $vu->{$a} = 1; |
155 | my @prec=split('_',$a); my $prec0=join('_',@prec[0..$#prec-1]); |
154 | my @prec=split('_',$a); my $prec0=join('_',@prec[0..$#prec-1]); |
156 | my $amod = $a; |
155 | my $amod = $a; |
157 | my $T = '<li class="closed">'; |
156 | my $T = '<li class="closed">'; |
158 | if (!$tit->{$a}) { print "warning $a has no title" ; $tit->{$a}=$a}; |
157 | if (!$tit->{$a}) { print "warning $a has no title" ; $tit->{$a}=$a}; |
159 | if (!$ref->{'total'}{$a}) { $ref->{'total'}{$a}=0 } ; |
158 | if (!$ref->{'total'}{$a}) { $ref->{'total'}{$a}=0 } ; |
160 | if (!$ref->{'totalexo'}{$a}) { $ref->{'totalexo'}{$a}=0 } ; |
159 | if (!$ref->{'totalexo'}{$a}) { $ref->{'totalexo'}{$a}=0 } ; |
161 | if (!$module) { |
160 | if (!$module) { |
162 |
|
161 | $T .= "<input type=\"radio\" name=\"taxon_$taxo\" id=\"$amod\" value=\"$amod\"/>" |
163 | . "<label for=\"$amod\">$tit->{$a}</label><span class=\"small hidden\">($a)</span>"; |
162 | . "<label for=\"$amod\">$tit->{$a}</label><span class=\"small hidden\">($a)</span>"; |
164 | } else { |
163 | } else { |
165 | $T .= "<span class=\"tree_icon\" id=\"$amod\">$tit->{$a}</span><span class=\"small hidden\">($a)</span> "; |
164 | $T .= "<span class=\"tree_icon\" id=\"$amod\">$tit->{$a}</span><span class=\"small hidden\">($a)</span> "; |
166 | if ($ref->{'total'}{$a} >0){ |
165 | if ($ref->{'total'}{$a} >0){ |
167 | $T .= "<sup class=\"pastille taxo_nb_modules\">".$ref->{'total'}{$a}." \$name_M</sup>"; |
166 | $T .= "<sup class=\"pastille taxo_nb_modules\">".$ref->{'total'}{$a}." \$name_M</sup>"; |
168 | } |
167 | } |
169 | if ($ref->{'totalexo'}{$a} >0){ |
168 | if ($ref->{'totalexo'}{$a} >0){ |
170 | $T .= "<sup class=\"pastille taxo_nb_exo\">".$ref->{'totalexo'}{$a}." \$name_X</sup>"; |
169 | $T .= "<sup class=\"pastille taxo_nb_exo\">".$ref->{'totalexo'}{$a}." \$name_X</sup>"; |
171 | } |
170 | } |
172 | } |
171 | } |
173 | if ($ref->{'text'}{$a} || $desc->{$a}){ |
172 | if ($ref->{'text'}{$a} || $desc->{$a}){ |
174 | $T .="<ul id=\"list_$amod\">"; |
173 | $T .="<ul id=\"list_$amod\">"; |
175 | if ($ref->{'text'}{$a}){ $T .= $ref->{'text'}{$a}; } |
174 | if ($ref->{'text'}{$a}){ $T .= $ref->{'text'}{$a}; } |
176 | if ($ref->{'sheet'}{$a}){ $T .= $ref->{'sheet'}{$a}; } |
175 | if ($ref->{'sheet'}{$a}){ $T .= $ref->{'sheet'}{$a}; } |
177 | if ($desc->{$a}) { |
176 | if ($desc->{$a}) { |
Line 184... | Line 183... | ||
184 | 183 | ||
185 | sub hashtaxo { my ($file, $sep1, $sep2)=@_; |
184 | sub hashtaxo { my ($file, $sep1, $sep2)=@_; |
186 | my (%desc, %tit, $title); |
185 | my (%desc, %tit, $title); |
187 | open IN, "$file"; |
186 | open IN, "$file"; |
188 | while (<IN>) { |
187 | while (<IN>) { |
189 | ##la premiere ligne est le titre ! |
188 | ##la premiere ligne est le titre ! |
190 | if (!$title) { $title=$_; next} |
189 | if (!$title) { $title=$_; next} |
191 | my ($t0,$t1) = split(":", $_); |
190 | my ($t0,$t1) = split(":", $_); |
192 | my @index = split("$sep1", $t0); |
191 | my @index = split("$sep1", $t0); |
193 | my $cnt = $#index; |
192 | my $cnt = $#index; |
194 | foreach my $a (2..$cnt) { |
193 | foreach my $a (2..$cnt) { |
Line 207... | Line 206... | ||
207 | my @ligne=split(':', $_); |
206 | my @ligne=split(':', $_); |
208 | next if (!$ligne[0]); |
207 | next if (!$ligne[0]); |
209 | my @aa=sortuniq(split(',', $ligne[1])); |
208 | my @aa=sortuniq(split(',', $ligne[1])); |
210 | my $cnt0=$#aa+1; |
209 | my $cnt0=$#aa+1; |
211 | my $cntexo=0; |
210 | my $cntexo=0; |
212 | for my $a (@aa) { |
211 | for my $a (@aa) { |
213 | chomp $a; |
212 | chomp $a; |
214 | my $b = $a; $b =~ s!/!~!g; |
213 | my $b = $a; $b =~ s!/!~!g; |
215 | if (!defined($addr{$a})) {print "warning: module $a does not exist on the server\n"; next}; |
214 | if (!defined($addr{$a})) {print "warning: module $a does not exist on the server\n"; next}; |
216 | if (!$titmodule->{$addr{$a}}) { print "$a\n" ; $titmodule->{$a}=$a}; |
215 | if (!$titmodule->{$addr{$a}}) { print "$a\n" ; $titmodule->{$a}=$a}; |
217 | my $bb= ($titmodule->{$addr{$a}}) ? $titmodule->{$addr{$a}} . "<span class=\"small hidden\">($b)</span>": $b; |
216 | my $bb= ($titmodule->{$addr{$a}}) ? $titmodule->{$addr{$a}} . "<span class=\"small hidden\">($b)</span>": $b; |
Line 258... | Line 257... | ||
258 | $ref{'total'}{$ligne[0]}=0; |
257 | $ref{'total'}{$ligne[0]}=0; |
259 | $ref{'totalexo'}{$ligne[0]}=0; |
258 | $ref{'totalexo'}{$ligne[0]}=0; |
260 | } |
259 | } |
261 | close IN; |
260 | close IN; |
262 | if (-e "$filesheet") { |
261 | if (-e "$filesheet") { |
263 | open IN, "$filesheet"; |
262 | open IN, "$filesheet"; |
264 | while (<IN>){ |
263 | while (<IN>){ |
265 | my @ligne=split(':', $_); |
264 | my @ligne=split(':', $_); |
266 | next if (!$ligne[0]); |
265 | next if (!$ligne[0]); |
267 | my @aa=sortuniq(split(',', $ligne[1])); |
266 | my @aa=sortuniq(split(',', $ligne[1])); |
268 | my $cnt0=$#aa+1; |
267 | my $cnt0=$#aa+1; |
269 | for my $a (@aa) { |
268 | for my $a (@aa) { |
270 | chomp $a; |
269 | chomp $a; |
271 | my $b = canonify($a); |
270 | my $b = canonify($a); |
272 | if($titsheet->{$b}) { $b = $titsheet->{$b} . "<span class=\"small hidden\">($b)</span>" } else { $b =~ s!/!~!g;} |
271 | if($titsheet->{$b}) { $b = $titsheet->{$b} . "<span class=\"small hidden\">($b)</span>" } else { $b =~ s!/!~!g;} |
273 | $ref{'sheet'}{$ligne[0]} .="<li class=\"taxo_module\">\n" |
272 | $ref{'sheet'}{$ligne[0]} .="<li class=\"taxo_module\">\n" |
274 | . "!href target=wims_internal module=adm/sheet\&+job=read\&+sh=$a $b\n</li>"; |
273 | . "!href target=wims_internal module=adm/sheet\&+job=read\&+sh=$a $b\n</li>"; |
275 | } |
274 | } |
276 | $ref{'numsheet'}{$ligne[0]}=$cnt0; |
275 | $ref{'numsheet'}{$ligne[0]}=$cnt0; |
277 | } |
276 | } |
278 | } |
277 | } |
279 |
|
278 | my @modlist=sortuniq(keys %{$tit}); |
280 |
|
279 | for my $id (@modlist) { |
281 |
|
280 | my @ok = grep {/^${id}_/} @modlist; |
282 |
|
281 | push @ok, $id; |
283 |
|
282 | for my $c (@ok) { |
284 | if (!$ref{'num'}{$c}){ $ref{'num'}{$c}=0}; |
283 | if (!$ref{'num'}{$c}){ $ref{'num'}{$c}=0}; |
285 | if (!$ref{'numexo'}{$c}){ $ref{'numexo'}{$c}=0}; |
284 | if (!$ref{'numexo'}{$c}){ $ref{'numexo'}{$c}=0}; |
286 | if (!$ref{'numsheet'}{$c}){ $ref{'numsheet'}{$c}=0}; |
285 | if (!$ref{'numsheet'}{$c}){ $ref{'numsheet'}{$c}=0}; |
287 |
|
286 | $ref{'total'}{$id} += $ref{'num'}{$c} + $ref{'numsheet'}{$c} ; |
288 |
|
287 | $ref{'totalexo'}{$id} += $ref{'numexo'}{$c} ; |
289 |
|
288 | } |
290 | } |
- | |
291 | \%ref; |
289 | \%ref; |
292 | } |
290 | } |
293 | - |