Rev 13623 | Rev 14239 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 13623 | Rev 13905 | ||
---|---|---|---|
Line 256... | Line 256... | ||
256 | out( "$DOSSIER_edit_area/wimsoef.js", $EDIT_AERA_OEF) ; |
256 | out( "$DOSSIER_edit_area/wimsoef.js", $EDIT_AERA_OEF) ; |
257 | out( "$DOSSIER_edit_area/wims.js", $EDIT_AERA) ; |
257 | out( "$DOSSIER_edit_area/wims.js", $EDIT_AERA) ; |
258 | out( "$DOSSIER_edit_area/wimsdoc.js", $EDIT_AERA_DOC) ; |
258 | out( "$DOSSIER_edit_area/wimsdoc.js", $EDIT_AERA_DOC) ; |
259 | 259 | ||
260 | sub anstype { my ($lang)=@_ ; |
260 | sub anstype { my ($lang)=@_ ; |
261 | my %HASH ; |
261 | my %HASH ; |
262 | my %HELP ; |
262 | my %HELP ; |
263 | open (IN, "$helpdir/$lang/reply.phtml") ; |
263 | open (IN, "$helpdir/$lang/reply.phtml") ; |
264 |
|
264 | while (<IN>) {my $line = $_; my @t=(); |
265 | next if ($line =~ /^\!set/) ; |
265 | next if ($line =~ /^\!set/) ; |
266 | next if !($line) ; |
266 | next if !($line) ; |
267 | if ($line =~ /\\\n/) { |
267 | if ($line =~ /\\\n/) { |
268 | my @L= split( ',', $line) ; |
268 | my @L= split( ',', $line) ; |
269 | my $t1 = $L[0] ; $t1=~ s/\|/,/ ; |
269 | my $t1 = $L[0] ; $t1=~ s/\|/,/ ; |
270 | my @ta=split(',',$t1) ; |
270 | my @ta=split(',',$t1) ; |
271 | if ($ta[1]) {@t=split(' ',$ta[1]) ; } else {@t=($L[0])}; |
271 | if ($ta[1]) {@t=split(' ',$ta[1]) ; } else {@t=($L[0])}; |
272 | for my $tag (@t) { $HASH{$tag} = cleanup3($L[1] . ' ' . (($L[2]) ? $L[2]: '')); $HELP{$tag}=$ta[0] ;} |
272 | for my $tag (@t) { $HASH{$tag} = cleanup3($L[1] . ' ' . (($L[2]) ? $L[2]: '')); $HELP{$tag}=$ta[0] ;} |
273 |
|
273 | } |
274 |
|
274 | } |
275 | close IN ; |
275 | close IN ; |
276 | my $text =''; |
276 | my $text =''; |
277 | my $Text = "var anstypename='$name{'anstype'}{$lang}';\n" ; |
277 | my $Text = "var anstypename='$name{'anstype'}{$lang}';\n" ; |
278 |
|
278 | my $var=join ("$End{'anstype'}\',\'$Begin{'anstype'}", sort keys(%HASH)) ; |
279 |
|
279 | $Text .="var anstype = [ '$Begin{'anstype'}$var$End{'anstype'}' ];\n" ; |
280 |
|
280 | for my $tag (keys(%HASH)){ |
281 |
|
281 | $text .= begin_js("$Begin{'anstype'}$tag$End{'anstype'}") |
282 |
|
282 | . title_js($tag,'title') |
283 |
|
283 | . middle_js($HASH{$tag},'out', $lang) |
284 |
|
284 | . end_js("<a target=\"wims_help\" href=\"wims.cgi?lang=$lang&module=adm%2Fcreatexo&modtoolhelp=yes&+special_parm=reply,$HELP{$tag}\">++>></a>") ; |
285 |
|
285 | } |
286 |
|
286 | $Text .= function_js($text,'anstype') ; |
287 |
|
287 | $EDIT_AERA_OEF .= "\n, \'anstype\' : \n[ \' type=" . join ("\', 'type=", sort keys(%HASH)) . "\']" if $lang=~/en/ ; |
288 |
|
288 | out ("$DOSSIER/$lang/anstype" . "_bd\.js", $Text) ; |
289 | - | ||
290 | } |
289 | } |
291 | 290 | ||
292 | sub slib {my ($lang)= @_ ; |
291 | sub slib {my ($lang)= @_ ; |
293 | my $Text = "var slibname='$name{'slib'}{$lang}';\n" ; |
292 | my $Text = "var slibname='$name{'slib'}{$lang}';\n" ; |
294 | my @list_keyword=(); |
293 | my @list_keyword=(); |
295 | my %HASH ; |
294 | my %HASH ; |
296 | my $slibdirhelp="$helpdir/$lang/slib"; |
295 | my $slibdirhelp="$helpdir/$lang/slib"; |
297 | for my $file (glob("$slibdir/*/*")) { |
296 | for my $file (glob("$slibdir/*/*")) { |
298 | #for example file=$slibdir/function/integrate |
297 | #for example file=$slibdir/function/integrate |
299 | $file =~s/$slibdir\///; |
298 | $file =~s/$slibdir\///; |
300 | my $text=''; my $tag=''; |
299 | my $text=''; my $tag=''; |
301 | my $filehelp="$slibdirhelp/$file" ; |
300 | my $filehelp="$slibdirhelp/$file" ; |
302 | if (!open(IN, "$filehelp")) { $filehelp="$slibdirhelp/en/$file"; } |
301 | if (!open(IN, "$filehelp")) { $filehelp="$slibdirhelp/en/$file"; } |
303 | if (!open(IN, "$filehelp")) { $filehelp="$slibdir/$file"; } |
302 | if (!open(IN, "$filehelp")) { $filehelp="$slibdir/$file"; } |
304 | for my $fff ("$slibdir/$file",$filehelp) { |
303 | for my $fff ("$slibdir/$file",$filehelp) { |
305 | open (IN, ("$fff")); |
304 | open (IN, ("$fff")); |
306 | while (<IN>) {my $line=$_; |
305 | while (<IN>) {my $line=$_; |
307 | if ($line=~/^ *!exit/) { last ;} |
306 | if ($line=~/^ *!exit/) { last ;} |
308 | if ($line=~ s/^ *slib_(\w+) *=//){ |
307 | if ($line=~ s/^ *slib_(\w+) *=//){ |
309 | $tag=$1; |
308 | $tag=$1; |
310 | $line=cleanup($line) ; |
309 | $line=cleanup($line) ; |
311 | if ($tag=~/parms/) { |
310 | if ($tag=~/parms/) { |
312 | $line=~s/\\//; |
311 | $line=~s/\\//; |
313 | $HASH{nbparm}{$file}=$line; |
312 | $HASH{nbparm}{$file}=$line; |
314 | } else |
313 | } else |
315 | { |
314 | { |
316 | $HASH{$tag}{$file}=$line ; |
315 | $HASH{$tag}{$file}=$line ; |
317 | } |
316 | } |
318 | } else { |
317 | } else { |
319 | next if !($tag) ; |
318 | next if !($tag) ; |
320 | if ($tag=~/parms/) { |
319 | if ($tag=~/parms/) { |
321 | chomp $line ; |
320 | chomp $line ; |
322 | next if ($line) ; |
321 | next if ($line) ; |
323 | my @parm=split(",", $line) ; |
322 | my @parm=split(",", $line) ; |
324 | if (($parm[1]) && ($parm[1] =~ s/\\//)) { |
323 | if (($parm[1]) && ($parm[1] =~ s/\\//)) { |
325 | $HASH{$tag}{$file}.= cleanup3($parm[1]) . ","; |
324 | $HASH{$tag}{$file}.= cleanup3($parm[1]) . ","; |
326 | } |
325 | } |
327 | else |
326 | else { |
328 |
|
327 | $HASH{$tag}{$file}= (($HASH{$tag}{$file})? $HASH{$tag}{$file}:' ') . (($parm[1]) ? cleanup3($parm[1]):'') ; |
329 | } |
328 | } |
330 | # $HASH{$tag}{$file} .= "\[$parm[0]\]" if ($parm[0]); |
329 | # $HASH{$tag}{$file} .= "\[$parm[0]\]" if ($parm[0]); |
331 | } |
330 | } |
332 | else { |
331 | else { |
333 | $HASH{$tag}{$file} .= cleanup($line); |
332 | $HASH{$tag}{$file} .= cleanup($line); |
334 | $tag='' if !($line=~/\\$/) ; |
333 | $tag='' if !($line=~/\\$/) ; |
335 | } |
334 | } |
336 | } |
335 | } |
337 | } |
336 | } |
338 | close IN; |
337 | close IN; |
339 | } |
338 | } |
340 | push @list_keyword, $file if ($HASH{'title'}{$file}); |
339 | push @list_keyword, $file if ($HASH{'title'}{$file}); |
341 | $tag=''; |
340 | $tag=''; |
342 |
|
341 | } |
343 | my $var=join ("$End{'slib'}\',\'$Begin{'slib'}", @list_keyword) ; |
342 | my $var=join ("$End{'slib'}\',\'$Begin{'slib'}", @list_keyword) ; |
344 | $Text .="var slib = [ '$Begin{'slib'}$var$End{'slib'}' ];\n" ; |
343 | $Text .="var slib = [ '$Begin{'slib'}$var$End{'slib'}' ];\n" ; |
345 | my $text='' ; |
344 | my $text='' ; |
346 | for my $file (@list_keyword) { |
345 | for my $file (@list_keyword) { |
347 | next if !($HASH{'title'}{$file}) ; |
346 | next if !($HASH{'title'}{$file}) ; |
Line 379... | Line 378... | ||
379 | my $tag=''; |
378 | my $tag=''; |
380 | my $Text="var specialname= '$name{'special'}{$lang}';\n"; |
379 | my $Text="var specialname= '$name{'special'}{$lang}';\n"; |
381 | for my $meth (@file) { |
380 | for my $meth (@file) { |
382 | #print $meth . "\n"; |
381 | #print $meth . "\n"; |
383 | open (IN, "$dir/$meth.phtml"); |
382 | open (IN, "$dir/$meth.phtml"); |
384 | while (<IN>) {my $line=$_; |
383 | while (<IN>) {my $line=$_; |
385 | next if !($line) ; |
384 | next if !($line) ; |
386 | if ($line =~ /^:/) { |
385 | if ($line =~ /^:/) { |
387 | chomp $line; |
386 | chomp $line; |
388 | $tag=$line; $tag=~ s/://; |
387 | $tag=$line; $tag=~ s/://; |
389 | } |
388 | } |
390 | else |
389 | else |
391 | { |
390 | { |
392 | $HASH{$tag}{$meth} .= cleanup($line) . "\\n" ; |
391 | $HASH{$tag}{$meth} .= cleanup($line) . "\\n" ; |
393 | } |
392 | } |
394 | } |
393 | } |
395 | } |
394 | } |
396 | my $var=join (" }\', \'\\\\special{", @phtml) ; |
395 | my $var=join (" }\', \'\\\\special{", @phtml) ; |
397 | ### cas particulier |
396 | ### cas particulier |
Line 429... | Line 428... | ||
429 | out ("$DOSSIER/$lang/$f" . "_bd\.js",$Text) ; |
428 | out ("$DOSSIER/$lang/$f" . "_bd\.js",$Text) ; |
430 | 429 | ||
431 | } |
430 | } |
432 | ##file : nom du fichier, n nombre de lignes dans chaque record |
431 | ##file : nom du fichier, n nombre de lignes dans chaque record |
433 | sub tableau { my ($file, $lang) = @_ ; |
432 | sub tableau { my ($file, $lang) = @_ ; |
434 | ### mettre $file à la place ensuite |
433 | ### mettre $file à la place ensuite |
435 | my $file1="$helpdir/$lang/$file"; |
434 | my $file1="$helpdir/$lang/$file"; |
436 | my $cities=$file ; |
435 | my $cities=$file ; |
437 | if ($file =~ /if/){ $cities .= 'f' } ; |
436 | if ($file =~ /if/){ $cities .= 'f' } ; |
438 | my @list_keyword; |
437 | my @list_keyword; |
439 | my @List_keyword; |
438 | my @List_keyword; |
440 | my $text=''; |
439 | my $text=''; |
441 | ##bug s'il n'y a pas de documentation |
440 | ##bug s'il n'y a pas de documentation |
442 | open (IN, $file1); |
441 | open (IN, $file1); |
443 | my $cnt=0 ;my $nl; |
442 | my $cnt=0 ;my $nl; |
444 | my $Text = '' ; |
443 | my $Text = '' ; |
445 | while (<IN>) { my $line=$_; |
444 | while (<IN>) { my $line=$_; |
446 | chomp $line ; |
445 | chomp $line ; |
447 | next if !($line) ; |
446 | next if !($line) ; |
448 | next if ($line=~ /^(!!)/); |
447 | next if ($line=~ /^(!!)/); |
449 | if ($line =~ /!changeto/){ die "$file1 should be translated"}; |
448 | if ($line =~ /!changeto/){ die "$file1 should be translated"}; |
450 | if ($line =~ s /^://) { |
449 | if ($line =~ s /^://) { |
451 | $cnt ++ ; |
450 | $cnt ++ ; |
452 | if ($cnt == 1 ) { $Text = "var $cities" . "name= '" . cleanup3($line) . "';\n "; } |
451 | if ($cnt == 1 ) { $Text = "var $cities" . "name= '" . cleanup3($line) . "';\n "; } |
453 | next if $cnt < 3 ; |
452 | next if $cnt < 3 ; |
454 | $line =~ s/:// ; |
453 | $line =~ s/:// ; |
455 | if($text) { $text .= end_js("") ;} |
454 | if($text) { $text .= end_js("") ;} |
456 | |
455 | if ($text) {$text .= begin_js($Begin{$file} . $line . $End{$file}) ;} |
457 |
|
456 | else |
458 | |
457 | { $text = begin_js($Begin{$file} . $line . $End{$file}) ; }; |
459 | push @list_keyword, $line; |
458 | push @list_keyword, $line; |
460 | $line =~ s/(\(|\)|\.|,|\[|\]| )//g ; |
459 | $line =~ s/(\(|\)|\.|,|\[|\]| )//g ; |
461 | push @List_keyword, $line; |
460 | push @List_keyword, $line; |
462 | $nl=0; |
461 | $nl=0; |
463 | |
462 | } |
464 | |
463 | else { |
465 | |
464 | next if $cnt<3 ; if ($line =~ /^(\d)/) { my $arg=$1 ; next } |
466 | |
465 | $nl ++ ; |
467 | |
466 | $line = cleanup($line); if ($line =~ /help=/) { $line = '' ;} |
468 | |
467 | if ($nl==1 && !($file=~/oefcommand/)){ |
469 | |
468 | if ($line) { $text .= syntax_js($line,$lang) ; } |
470 |
|
469 | } |
471 |
|
470 | else { |
472 | |
471 | if ($line) { $text .= middle_js($line,1,$lang) ; } |
473 | } |
472 | } |
474 | } |
473 | } |
475 | |
474 | } |
476 | close IN ; |
475 | close IN ; |
477 | |
476 | $text .= end_js("") ; |
478 | my $var=join ("$End{$file}\', \'$Begin{$file}", @list_keyword) ; |
477 | my $var=join ("$End{$file}\', \'$Begin{$file}", @list_keyword) ; |
479 | $Text .="var $cities= [ \'$Begin{$file}$var$End{$file}\' ];\n" |
478 | $Text .="var $cities= [ \'$Begin{$file}$var$End{$file}\' ];\n" |
480 | . function_js($text,$cities) ; |
479 | . function_js($text,$cities) ; |
481 | out ("$DOSSIER/$lang/$cities" . "_bd\.js",$Text) ; |
480 | out ("$DOSSIER/$lang/$cities" . "_bd\.js",$Text) ; |
482 | |
481 | if ($lang=~/en/){ |
483 | |
482 | if ($debut_oef==1) { $EDIT_AERA_OEF .= "\n" ; $debut_oef=0 } else {$EDIT_AERA_OEF .= "\n," }; |
484 | |
483 | $EDIT_AERA_OEF .= " \'$cities\' : \n[ \'" . join ("\', '", @List_keyword) . "\']" ; |
485 | |
484 | if ($cities=~ /(iff|oefparm4)/) { |
486 | |
485 | if ($debut_wims==1) {$EDIT_AERA .= "\n" ; $debut_wims=0 } else {$EDIT_AERA .= "\n," }; |
487 | |
486 | push @List_keyword, ('or', 'and') ; |
488 | |
487 | $EDIT_AERA .= " \'compare\' : \n[ \'" . join ("\', '", @List_keyword) . "\']" ; |
489 | |
488 | } |
490 | } |
489 | } |
491 | } |
490 | } |
492 | 491 | ||
493 | sub wimscommand { my ($d) = @_; |
492 | sub wimscommand { my ($d) = @_; |
494 | my @wimslist = () ; |
493 | my @wimslist = () ; |
Line 500... | Line 499... | ||
500 | push @wimslist, ("endif","next","else") ; |
499 | push @wimslist, ("endif","next","else") ; |
501 | @wimslist ; |
500 | @wimslist ; |
502 | } |
501 | } |
503 | ### subroutine for "editor" |
502 | ### subroutine for "editor" |
504 | sub begin_js {my ($t)= @_ ; |
503 | sub begin_js {my ($t)= @_ ; |
505 | "case \'$t\' \:\nchaine_aide=" |
504 | "case \'$t\' \:\nchaine_aide=" |
506 | } |
505 | } |
507 | sub syntax_js {my ($line,$lang)=@_ ; |
506 | sub syntax_js {my ($line,$lang)=@_ ; |
508 | "\'<div class=\"syntax\"><div class=\"title\">$name{'syntax'}{$lang}</div><code>$line</code></div>\'+\n" |
507 | "\'<div class=\"syntax\"><div class=\"title\">$name{'syntax'}{$lang}</div><code>$line</code></div>\'+\n" |
509 | } |
508 | } |
510 | sub middle_js {my ($line,$tag,$lang)=@_ ; |
509 | sub middle_js {my ($line,$tag,$lang)=@_ ; |
- | 510 | if(!$line) {$line='' ;} |
|
511 | if ($tag) { $line="<div class=\"title\">$name{'explanation'}{$lang}</div>$line" } |
511 | if ($tag) { $line="<div class=\"title\">$name{'explanation'}{$lang}</div>$line" } |
512 | "\'<div class=\"explication\">$line</div>\'+\n"; |
512 | "\'<div class=\"explication\">$line</div>\'+\n"; |
513 | } |
513 | } |
514 | 514 | ||
515 | sub middle1_js {my ($line,$tag,$lang)=@_ ; |
515 | sub middle1_js {my ($line,$tag,$lang)=@_ ; |
516 | if ($tag) { $line="<div class=\"title\">$name{'example'}{$lang}</div>$line" } |
516 | if ($tag) { $line="<div class=\"title\">$name{'example'}{$lang}</div>$line" } |
517 | "\'<div class=\"exemple\">$line</div>\'+\n"; |
517 | "\'<div class=\"exemple\">$line</div>\'+\n"; |
518 | } |
518 | } |
519 | 519 | ||
520 | sub title_js {my ($line,$tag)=@_ ; |
520 | sub title_js {my ($line,$tag)=@_ ; |
521 | "\'<div class=\"title\">$line</div>\'+\n"; |
521 | "\'<div class=\"title\">$line</div>\'+\n"; |
522 | } |
522 | } |
523 | 523 | ||
524 | sub end_js {my ($text)=@_ ; |
524 | sub end_js {my ($text)=@_ ; |
525 | "\'$text\' ; return chaine_aide; |
525 | "\'$text\' ; return chaine_aide; |
526 | break; |
526 | break; |
527 | ////********************\n |
527 | ////********************\n |
528 | " |
528 | " |
529 | } |
529 | } |
530 | sub function_js {my ($text,$tag)=@_ ; |
530 | sub function_js {my ($text,$tag)=@_ ; |
531 | "function $tag" . "fun(instruction){ |
531 | "function $tag" . "fun(instruction){ |
532 | switch(instruction) |
532 | switch(instruction) |
533 | { |
533 | { |
534 | $text |
534 | $text |
535 | } |
535 | } |
536 | }" |
536 | }" |
537 | } |
537 | } |
538 | 538 | ||
539 | sub cleanup { my ($txt)=@_ ; |
539 | sub cleanup { my ($txt)=@_ ; |
540 | return $txt if !($txt) ; |
540 | return $txt if !($txt) ; |
541 | $txt=~ s/\\\b/\/g ; |
541 | $txt=~ s/\\\b/\/g ; |