#!/usr/bin/perl # # $Id: Interpreter.pl,v 1.8 2006/01/23 21:39:30 ddoughty Exp $ # # Source File: Interpreter.pl # Get config require 'sitecfg.pl'; require 'testlib.pl'; &app_initialize; print "Content-Type: text/html\n\n"; if (&get_session($FORM{'tid'})) { $FORM{'submit'} =~ s/\+/ /g; if ($FORM{'submit'} eq 'Save Changes') { $sNotice = "Translations updated"; &UpdateTranslation(); } elsif ($FORM{'submit'} eq 'printtable') { &PrintPrintForm(); } elsif ($FORM{'submit'} eq 'printenglish') { &PrintEnglishForm(); } else { $sNotice = ""; &PrintForm(); } } sub PrintForm { $nshref = ($SESSION{'browserapp'} eq MSIE) ? "" : "HREF=\"#top\""; if ($SESSION{'uac'} =~ /txlatr./ ) { $sPrintlink=""; $logoutbutton = "
\"Log
\n
\n"; $logoutjscript = " function log_out(objForm) { var sURL; sURL = \"$PATHS{'cgiroot'}/logout.pl?tid=$SESSION{'tid'}&idle=N\"; top.document.location.replace(sURL); }\n"; } else { $logoutbutton = ""; $logoutjscript = ""; $sPrintlink="Print-Translations Print-English"; } $idEnglish = "enu"; @sEnglish = &get_phrases($idEnglish); $txtEnglish = $LANGUAGE_ID{$idEnglish}; $idTranslation = $FORM{'lang'}; @sTranslation = &get_phrases($idTranslation); $txtTranslation = $LANGUAGE_ID{$idTranslation}; $basefont=""; $fontface=""; $fontend = ""; if ($FORM{'lang'} eq 'arb') { $charset="iso-8859-6";} elsif ($FORM{'lang'} eq 'cyr') { $charset="iso-8859-5"; # $charset="koi8-r"; $basefont=""; $fontface=""; $fontend = ""; } else { $charset="iso-8859-1";} $locator = "
\n"; $locator = join('', $locator, "\[-\]\ \; "); $locator = join('', $locator, "\[A\]\ \; "); $locator = join('', $locator, "\[B\]\ \; "); $locator = join('', $locator, "\[C\]\ \; "); $locator = join('', $locator, "\[D\]\ \; "); $locator = join('', $locator, "\[E\]\ \; "); $locator = join('', $locator, "\[F\]\ \; "); $locator = join('', $locator, "\[G\]\ \; "); $locator = join('', $locator, "\[H\]\ \; "); $locator = join('', $locator, "\[I\]\ \; "); $locator = join('', $locator, "\[JL\]\ \; "); $locator = join('', $locator, "\[M\]\ \; "); $locator = join('', $locator, "\[N\]\ \; "); $locator = join('', $locator, "\[O\]\ \; "); $locator = join('', $locator, "\[P\]\ \; "); $locator = join('', $locator, "\[Q\]\ \; "); $locator = join('', $locator, "\[R\]\ \; "); $locator = join('', $locator, "\[S\]\ \; "); $locator = join('', $locator, "\[T\]\ \; "); $locator = join('', $locator, "\[U\]\ \; "); $locator = join('', $locator, "\[V\]\ \; "); $locator = join('', $locator, "\[W\]\ \; "); $locator = join('', $locator, "\[Y\]\ \; "); $locator = join('', $locator, "\[+\]\ \;
\n"); $locator = join('', $locator, "
\n"); $pad = "000"; for (0 .. $#sEnglish) { $x = "$_"; $y = int(4 - length($x)); if ($y) {$x = join('', substr($pad,0,$y), $x);} $locator = join('', $locator, "\[$x\]\ \; "); } print " Test-Central $txtEnglish-$txtTranslation Translation $basefont
"; for (0 .. $#sEnglish) { $sconv = $sTranslation[$_]; chop ($sconv); $sconv =~ s/\&\;/\&/g; $sconv =~ s/
/\r\n/g; $rows=1; $cols=length($sEnglish[$_]); $size=length($sEnglish[$_]); if ($cols < 20) { $cols = 30; $inputtype = ""; } else { if ($cols > 19) {$cols = 60}; $rows = int($size / 25); if ($rows < 2) { $rows = 2;} if ($rows > 5) { $rows = 5;} $inputtype = ""; }; print " "; } print "
Test-Central $txtEnglish-$txtTranslation Phrase Translations
$sPrintlink\ \; $sNotice\ \;
SYMBOL MODE:    (to return here, click the symbol link)   (to goto logout, click end)
$locator
Text ID $txtEnglish
$txtTranslation
x$_ $sEnglish[$_]
$fontface$inputtype$fontend
top end symbols
\ \;
$logoutbutton
"; } sub UpdateTranslation { $idEnglish = "enu"; @sEnglish = &get_phrases($idEnglish); @sTranslation = &get_phrases($FORM{'lang'}); $txtTranslation = $language; $idTranslation = $languageid; for (0 .. $#sEnglish) { chop ($sTranslation[$_]); $id = "x$_"; if ($FORM{$id} ne '') { $sTranslation[$_] = $FORM{$id}; $sTranslation[$_] =~ s/\+/ /g; if ($FORM{'lang'} ne 'kor') { $sTranslation[$_] =~ s/\&/\&\;/g; } $sTranslation[$_] =~ s/\r//g; $sTranslation[$_] =~ s/\n/
/g; } else { if ($sTranslation[$_] ne '') { if ($FORM{'lang'} ne 'kor') { $sTranslation[$_] =~ s/\&/\&\;/g; } $sTranslation[$_] =~ s/\r//g; $sTranslation[$_] =~ s/\n/
/g; } else { $sTranslation[$_] = "$FORM{'lang'}-$_"; } } } &put_phrases($FORM{'lang'}); &PrintForm(); } sub PrintPrintForm { $idEnglish = "enu"; @sEnglish = &get_phrases($idEnglish); $txtEnglish = $LANGUAGE_ID{$idEnglish}; $idTranslation = $FORM{'lang'}; @sTranslation = &get_phrases($idTranslation); $txtTranslation = $LANGUAGE_ID{$idTranslation}; $basefont=""; $fontface=""; $fontend = ""; if ($FORM{'lang'} eq 'arb') { $charset="iso-8859-6";} elsif ($FORM{'lang'} eq 'cyr') { $charset="iso-8859-5"; # $charset="koi8-r"; $basefont=""; $fontface=""; $fontend = ""; } else { $charset="iso-8859-1";} print " Test-Central $txtEnglish-$txtTranslation Translation $basefont
"; for (0 .. $#sEnglish) { $sconv = $sTranslation[$_]; chop ($sconv); $sconv =~ s/\&\;/\&/g; $sconv =~ s/
/\r\n/g; $rows=1; $cols=length($sEnglish[$_])+8; $size=length($sEnglish[$_]); if ($cols < 60) { $inputtype = ""; } else { if ($cols > 59) {$cols = 60}; $rows = int($size / 25); if ($rows < 2) { $rows = 2;} if ($rows > 5) { $rows = 5;} $inputtype = ""; }; print " "; } print "
Test-Central $txtEnglish-$txtTranslation Phrase Translations
Text ID $txtEnglish
$txtTranslation
x$_ $sEnglish[$_]
$fontface$inputtype$fontend
"; } sub PrintEnglishForm { $idEnglish = "enu"; @sEnglish = &get_phrases($idEnglish); $txtEnglish = $LANGUAGE_ID{$idEnglish}; $fontface=""; $fontend = ""; $charset="iso-8859-1"; print " Test-Central $txtEnglish Phrases
"; for (0 .. $#sEnglish) { print " "; } print "
Test-Central $txtEnglish Phrases
Text ID $txtEnglish
x$_ $sEnglish[$_]
"; }