Changeset 214


Ignore:
Timestamp:
Jun 22, 2009, 9:22:20 PM (15 years ago)
Author:
maron
Message:

Podpora více verzí textů, zobrazení verze ve formuláři překládání, úprava ukládání aby se dala uložit u jednoho uživatele více verzí, aby se ukládaly čísla verzí podle předlohy, úprava seznamu nepřeložených aby se zobrazovali pouze nejnovější nepřeložené texty, oprava generování souboru addonu pagebook_1, oprava logu a přidání položky pro import

Location:
trunk
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/TranslationList.php

    r210 r214  
    128128
    129129  WritePages('?group='.$GroupId.'&action=notran', 'AS items WHERE items.Language = 0 AND
    130     NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry)');
     130    NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry) AND VersionEnd = "'.GetBuildNumber($Config['Web']['GameVersion']).'"');
    131131
    132132  WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language = 0) AND
    133     NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry)) ', $_SESSION['limitx'].','.$_SESSION['limity'], 'notran');
     133    NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry))  AND VersionEnd = "'.GetBuildNumber($Config['Web']['GameVersion']).'"', $_SESSION['limitx'].','.$_SESSION['limity'], 'notran');
    134134} else
    135135if($Action == 'nocomplete')
     
    141141  WritePages('?group='.$GroupId.'&amp;action=notran', 'AS items WHERE items.Language = 0 AND
    142142    NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry)  AND (sub.Complete = 1)) AND
    143     EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry  AND (sub.Complete = 0))');
     143    EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry  AND (sub.Complete = 0)) AND VersionEnd = "'.GetBuildNumber($Config['Web']['GameVersion']).'"');
    144144
    145145  WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language = 0) AND
    146146    NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry)  AND (sub.Complete = 1)) AND
    147    EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry)  AND (sub.Complete = 0))', $_SESSION['limitx'].','.$_SESSION['limity'], 'nocomplete');
     147   EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry)  AND (sub.Complete = 0)) AND VersionEnd = "'.GetBuildNumber($Config['Web']['GameVersion']).'"', $_SESSION['limitx'].','.$_SESSION['limity'], 'nocomplete');
    148148} else
    149149if($Action == 'Translate')
  • trunk/export/create_addon.php

    r200 r214  
    6969  $string = ReplaceVarInText($string);
    7070  return($string);
     71}
     72
     73function NotCancel($string)
     74{
     75        //echo (strpos($string,'<html>'));
     76  if (strpos($string,'<html>') > -1) {
     77        return(false);
     78  } else {
     79    return(true);
     80  }
    7181}
    7282
     
    125135        $en = trim(ReplaceEnText($Line['Original'])); 
    126136        $cz = ReplaceCzText($Line['Translation']);
    127         if(($en <> '') and ($cz <> ''))
     137        if(($en <> '') and ($cz <> '') and (NotCancel($en)))
    128138            {
    129139          $Buffer .= "\n".'["'.$en.'"]="'.$cz.'",';
  • trunk/export/index.php

    r200 r214  
    151151            case 'AoWoWImport':
    152152                    require_once('../aowow/configs/config.php');
     153                  echo('<div style="font-size: xx-small;">');
    153154        echo('Gewneruji SQL kód ');
    154155        $AoWoWSQL = ExportToAoWoWSQL($ExportSetting);
     
    190191                    $Database->SelectDatabase($Config['Database']['Database']);   
    191192                    $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
     193                echo('</div>');
    192194        WriteLog('Plnění AoWoW databáze překladem', 4);
    193195            break;
  • trunk/form.php

    r198 r214  
    2828  if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
    2929  {
    30     $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT Language FROM '.$Table.' Where ID = '.$Line['Take']));
     30    $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT Language,VersionStart,VersionEnd FROM '.$Table.' Where ID = '.$Line['Take']));
    3131    // echo $Language['Language'].'  '.$Line['Take'];
    3232    if($Language['Language'] <> 0)
     
    3737  {
    3838    if($Line['Complete'] == 1) echo(' <b>Hotov</b><br />');
    39       else echo(' <b> Uložen v rozepsaných</b><br />');
     39      else echo(' <b> Uložen v rozepsaných</b> ');
    4040  } else
    4141  {
    42     echo(' <b>Anglická, původní verze</b><br />');
     42    echo(' <b>Anglická, původní verze</b> ');
    4343  }
     44        echo (GetVersionWOW($Line['VersionStart']).' - '.GetVersionWOW($Line['VersionEnd']));
     45        echo('<br />');
    4446   
    4547  $version = mysql_fetch_array($Database->SQLCommand('SELECT count(*) FROM '.$Table.' Where entry = '.$Line['entry'].' AND Language <> 0'));
  • trunk/import/index.php

    r195 r214  
    33include('../includes/global.php');
    44include('../includes/dbc.php');
    5 
    6 function ImportSQLMangos()
    7 {
    8   global $Database, $TranslationTree, $Config;
    9 
    10   echo('Načítání textů z databáze MaNGOSu...');
    11   foreach($TranslationTree as $Group)
    12   {
    13     if(($Group['MangosTable'] != '') and ($Group['TablePrefix'] != ''))
    14     {
    15           echo('<br />'.$Group['Name'].'<br />');
    16           $DbName = $Config['Database']['MangosPrefix'].$Group['MangosDatabase'];
    17           $Columns = '`'.$DbName.'`.`'.$Group['MangosTable'].'`.`'.$Group['MangosTableIndex'].'`';
    18           $Where = '';
    19           foreach($Group['Items'] as $GroupItem)
    20           {
    21         $Columns .= ', `'.$DbName.'`.`'.$Group['MangosTable'].'`.`'.$GroupItem['MangosColumn'].'` AS `'.$GroupItem['Column'].'`';
    22                 $Where .= ' OR `'.$DbName.'`.`'.$Group['MangosTable'].'`.`'.$GroupItem['MangosColumn'].'` != "" ';
    23           }
    24           $Where = substr($Where, 4);
    25           $Query = 'SELECT '.$Columns.' FROM `'.$DbName.'`.`'.$Group['MangosTable'].'` WHERE '.$Where;
    26           //echo($Query.'<br />');     
    27           $Count = 0;
    28           $NewCount = 0;
    29           $DbResult = $Database->SQLCommand($Query);
    30           while($DbRow = mysql_fetch_assoc($DbResult))
    31           {
    32                 //echo('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$DbRow[$Group['MangosTableIndex']].' AND Language=0'."<br>");
    33             $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$DbRow[$Group['MangosTableIndex']].' AND Language=0');
    34             if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
    35             {
    36               $DbRow2 = mysql_fetch_assoc($DbResult2);
    37                   //echo($DbRow2['ID']);
    38                   $ColumnsValues = '';
    39               foreach($Group['Items'] as $GroupItem)
    40                   {
    41                 $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.addslashes($DbRow[$GroupItem['Column']]).'"';
    42                   }
    43                   $ColumnsValues = substr($ColumnsValues, 2);
    44                   echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>");
    45                   //print_r($DbRow2);
    46                   $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']);
    47             } else
    48             {
    49                   $Columns = 'entry, language';
    50                   $Values = $DbRow[$Group['MangosTableIndex']].', 0';
    51               foreach($Group['Items'] as $GroupItem)
    52                   {
    53                 $Columns .= ', `'.$GroupItem['Column'].'`';
    54                     $Values .= ', "'.addslashes($DbRow[$GroupItem['Column']]).'"';
    55                   }
    56                   //$Columns = substr($Columns, 2);
    57                   //$Values = substr($Values, 2);
    58                   $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    59                   echo('# ');
    60                   //echo('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'."<br>");
    61               $NewCount++;
    62             }
    63             $Count++;
    64           }
    65           echo('<br />Celkem: '.$Count.'  Nových: '.$NewCount.'<br />');
    66         }
    67   }
    68   echo('Dokončeno.</div>');
    69 }
    70 
    71 function ImportDBC()
    72 {
    73   global $Database, $TranslationTree, $Config;
    74 
    75   echo('Načítání textů z DBC souborů...');
    76   foreach($TranslationTree as $Group)
    77   {
    78     if(($Group['DBCFileName'] != '') and ($Group['TablePrefix'] != ''))
    79     {
    80       echo('<br />'.$Group['Name'].'<br />');   
    81           $DBCFile = new DBCFile();
    82           $DBCFile->OpenFile('../source/'.$Config['Web']['GameVersion'].'/dbc/'.$Group['DBCFileName'].'.dbc', $Group['DBCColumns']);
    83           $ItemCount = $DBCFile->GetRecordCount();
    84           $NewCount = 0;
    85           $Count = 0;
    86           for($i = 0; $i < $ItemCount; $i++)
    87       {
    88         $ItemId = $DBCFile->GetUint($i, 0); 
    89         $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0');
    90         if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
    91             {
    92                   $DbRow2 = mysql_fetch_assoc($DbResult2);
    93                   //echo($DbRow2['ID']);
    94                   $ColumnsValues = '';
    95               foreach($Group['Items'] as $GroupItem)
    96                   {
    97                 $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.addslashes($DBCFile->GetString($i, $GroupItem['DBCColumnIndex'])).'"';
    98                   }
    99                   $ColumnsValues = substr($ColumnsValues, 2);
    100                   echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>");
    101                   //print_r($DbRow2);
    102                   $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']);
    103             } else
    104             {
    105                   $Columns = 'entry, language';
    106                   $Values = $ItemId.', 0';
    107               foreach($Group['Items'] as $GroupItem)
    108                   {
    109                 $Columns .= ', `'.$GroupItem['Column'].'`';
    110                     $Values .= ', "'.addslashes($DBCFile->GetString($i, $GroupItem['DBCColumnIndex'])).'"';
    111                   }
    112                   //$Columns = substr($Columns, 2);
    113                   //$Values = substr($Values, 2);
    114                   $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    115                   echo('# ');
    116                   //echo('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'."<br>");
    117               $NewCount++;
    118             }
    119             $Count++;
    120           }
    121           echo('<br />Celkem: '.$Count.'  Nových: '.$NewCount.'<br />');
    122     }   
    123   }
    124   echo('Dokončeno.</div>');
    125 }
    126 
    127 function ImportLUA()
    128 {
    129   global $Database, $TranslationTree, $PatchVersion, $Config;
    130 
    131   echo('Načítání textů z LUA souborů...');
    132   foreach($TranslationTree as $Group)
    133   {
    134     if(($Group['LuaFileName'] != '') and ($Group['TablePrefix'] != ''))
    135     {
    136       echo('<br />'.$Group['Name'].'<br />');   
    137           $File = new FileStream();
    138           $File->OpenFile('../source/'.$Config['Web']['GameVersion'].'/lua/'.$Group['LuaFileName'].'.lua');
    139           $NewCount = 0;
    140           $Count = 0;
    141           while(!$File->EOF())
    142           {
    143                 $Line = $File->ReadLine();
    144                 if(strpos($Line, '=') !== false)
    145             {
    146                   $LineParts = explode(';', $Line);
    147           $LineParts2 = explode('=', $LineParts[0]);
    148                   $Value['ShortCut'] = trim($LineParts2[0]);
    149                   $Value['Text'] = substr(trim($LineParts2[1]), 1, -1);
    150                   $Value['Comment'] = addslashes(substr(trim($LineParts[1]), 3));
    151 
    152           $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE ShortCut="'.$Value['ShortCut'].'" AND (Language=0)');
    153           if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
    154               {
    155                     $ColumnsValues = '';
    156                 foreach($Group['Items'] as $GroupItem)
    157                     {
    158               $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.$Value[$GroupItem['Column']].'"';
    159                     }
    160             $ColumnsValues = substr($ColumnsValues, 2);
    161 
    162                     $DbRow2 = mysql_fetch_assoc($DbResult2);
    163                     echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>");
    164                     $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']);
    165               } else
    166               {
    167                         $Entry = 1;
    168                         $DbResult = $Database->SQLCommand('SELECT MAX(`entry`) FROM `'.$Group['TablePrefix'].'`');
    169                         if(mysql_num_rows($DbResult) > 0)
    170                         {
    171                           $DbRow = mysql_fetch_row($DbResult);
    172                           $Entry += $DbRow[0];
    173             }
    174                                                
    175                     $Columns = 'entry, language, ShortCut';
    176                     $Values = $Entry.', 0, "'.$Value['ShortCut'].'"';
    177                 foreach($Group['Items'] as $GroupItem)
    178                     {
    179                   $Columns .= ', `'.$GroupItem['Column'].'`';
    180                       $Values .= ', "'.$Value[$GroupItem['Column']].'"';
    181                     }
    182                     $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    183                     echo('# ');
    184                 $NewCount++;
    185               }
    186                 };     
    187         $Count++;
    188           }
    189           echo('<br />Celkem: '.$Count.'  Nových: '.$NewCount.'<br />');
    190     }   
    191   }
    192   echo('Dokončeno.</div>');
    193 }
     5include('import_lua.php');
     6include('import_sql_mangos.php');
     7include('import_dbc.php');
     8include('update_version.php');
    1949
    19510ShowPage();
     
    22035          break;
    22136    case 'lua':
    222           ImportLUA();
     37          ImportLUA($Config['Web']['GameVersion']); //$Config['Web']['GameVersion']
     38          UpdateVersion();
    22339          break;
    22440    case 'xml':
     
    22945  }
    23046  WriteLog('Plnění databáze', 4);
     47  echo('</div>');
     48
    23149}
    23250 
  • trunk/includes/global_function.php

    r199 r214  
    177177  array('4', 'Moderátor', 'orange', 'Operace administrátorů a moderátorů'),
    178178  array('10', 'Chyby', 'red', 'Zachycené chybové hlášení'),
     179  array('11', 'Import', '#A020F0', 'Záznam změn při importu'),
    179180);
    180181
     
    223224  }
    224225 
    225   $Next = mysql_fetch_array($Database->SQLCommand($sql));
     226  $Next = mysql_fetch_assoc($Database->SQLCommand($sql));
    226227  if($Next)
    227228  {
     
    232233}
    233234
     235function GetBuildNumber($Version)
     236{
     237  global $Database;
     238       
     239  $sql = 'SELECT BuildNumber FROM `wow_client_version` WHERE Version = "'.$Version.'"';
     240  $BuildNumber = mysql_fetch_assoc($Database->SQLCommand($sql));
     241  return($BuildNumber['BuildNumber']);
     242}
     243
     244function GetVersionWOW($BuildNumber)
     245{
     246  global $Database;
     247       
     248  $sql = 'SELECT Version FROM `wow_client_version` WHERE BuildNumber = "'.$BuildNumber.'"';
     249  $Version = mysql_fetch_assoc($Database->SQLCommand($sql));
     250  return($Version['Version']);
     251}
     252
    234253?>
  • trunk/log.php

    r213 r214  
    5252  foreach($LogTypes as $Index => $LogItem)
    5353  {
    54     echo('<span style="color:'.$LogItem[2].'"><a href="log.php?type='.$LogItem[0].'" title="'.$LogItem[3].'">'.$LogItem[1].'</a></span> ');
     54    echo('<a href="log.php?type='.$LogItem[0].'" style="color:'.$LogItem[2].'" title="'.$LogItem[3].'">'.$LogItem[1].'</a> ');
    5555  }
    5656
  • trunk/save.php

    r209 r214  
    2626             
    2727  $LineAJ = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE Language = 0 AND entry = '.$entry));
    28   $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$entry));
     28  $LineTake = mysql_fetch_array($Database->SQLCommand('SELECT VersionEnd,VersionStart FROM '.$Table.' WHERE ID = '.$TextID));
     29  $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$entry.'
     30   AND VersionStart = '.$LineTake['VersionStart'].' AND VersionEnd = '.$LineTake['VersionEnd']));
    2931  if(!$Line)
    3032  {
    31         $Columns = '`Language` , `User` , `Complete` , `Take`';
    32         $Values = $Language.','.$UserID.','.$complete.','.$TextID;
     33        $Columns = '`Language` , `User` , `Complete` , `Take` , `VersionStart` , `VersionEnd`';
     34        $Values = $Language.','.$UserID.','.$complete.','.$TextID.','.$LineTake['VersionStart'].','.$LineTake['VersionEnd'];
    3335        foreach($TranslationTree[$GroupId]['Items'] as $GroupItem)
    3436        {
     
    6062        while($SameTranLine = mysql_fetch_assoc($SameTranID))
    6163        {
    62                 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$SameTranLine['entry']));
     64                $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$SameTranLine['entry'].'
     65                 AND VersionStart = '.$LineTake['VersionStart'].' AND VersionEnd = '.$LineTake['VersionEnd']));
    6366                if(!$Line) {
    6467         if ($GroupItem['Column'] <> 'ShortCut')       
Note: See TracChangeset for help on using the changeset viewer.