Changeset 859


Ignore:
Timestamp:
Jan 21, 2016, 10:20:04 AM (9 years ago)
Author:
chronos
Message:
  • Modified: Function GetTranslationTree moved from global to Translation module where it belongs.
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r858 r859  
    77
    88$Version = '1.0-alfa';
    9 $Revision = 858; // Subversion revision
     9$Revision = 859; // Subversion revision
    1010$DatabaseRevision = 857; // Database structure revision
    11 $ReleaseTime = '2016-01-20';
     11$ReleaseTime = '2016-01-21';
  • trunk/Modules/Admin/Admin.php

    r857 r859  
    1111    $this->License = 'GNU/GPL';
    1212    $this->Description = 'Administrator section of the web';
    13     $this->Dependencies = array();
     13    $this->Dependencies = array('Translation');
    1414  }
    1515
     
    114114  function RepairVersionEnd()
    115115  {
    116     global $TranslationTree;
     116    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    117117
    118118    $Output = '';
     
    150150  function MergeSameText()
    151151  {
    152     global $TranslationTree;
     152    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    153153
    154154    $Output = '';
     
    204204  function DbcStructure()
    205205  {
    206     global $TranslationTree;
     206    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    207207
    208208    $Output = '';
  • trunk/Modules/Dictionary/Dictionary.php

    r851 r859  
    1111    $this->License = 'GNU/GPL';
    1212    $this->Description = 'Custom dictionary for better translation coordination';
    13     $this->Dependencies = array();
     13    $this->Dependencies = array('Translation');
    1414  }
    1515
     
    6262    );
    6363
    64     $buff = GetTranslatNames($Text,$mode,GetTranslatNamesArray());
     64    $buff = GetTranslatNames($Text, $mode, GetTranslatNamesArray());
    6565
    6666    // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     
    7373          $Output .= '<tr><td>'.$Line[2].'</td>';
    7474          if ($Line[3] <> '') $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">'.$Line[3].'</a></td></tr>';
    75           else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">Překládat</a></td></tr>';
     75          else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">'.T('Translate').'</a></td></tr>';
    7676        }
    7777      } else
     
    7979        $Output .= '<tr><td>'.$Line[2].'</td>';
    8080        if ($Line[3] <> '') $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">'.$Line[3].'</a></td></tr>';
    81           else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">Překládat</a></td></tr>';
     81          else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">'.T('Translate').'</a></td></tr>';
    8282      }
    8383    }
     
    185185  function DictionaryGroup()
    186186  {
    187     global $TranslationTree;
     187    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    188188
    189189    $Output = '';
  • trunk/Modules/Export/CreateAddon.php

    r816 r859  
    103103  function MakeLanguageFiles()
    104104  {
    105     global $TranslationTree, $CreatedFileList;
     105    global $CreatedFileList;
     106
     107    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    106108
    107109    $Output = '';
     
    217219  function MakeClientStrings()
    218220  {
    219     global $TranslationTree;
     221    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    220222
    221223    $this->LoadFilters();
  • trunk/Modules/Export/Export.php

    r838 r859  
    7373  function BuildQuery($Group, $Version = '')
    7474  {
    75     global $TranslationTree;
     75    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    7676    $this->SaveAllUsers();
    7777
     
    153153  function ExportToMangosSQL()
    154154  {
    155     global $TranslationTree;
     155    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    156156
    157157    $this->LoadFilters();
     
    221221  function ExportToAoWoWSQL()
    222222  {
    223     global $TranslationTree, $AoWoWconf;
     223    global $AoWoWconf;
     224
     225    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    224226
    225227    //require_once('../aowow/configs/config.php');
     
    314316  function ExportToDBC()
    315317  {
    316     global $TranslationTree;
     318    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    317319
    318320    $this->LoadFilters();
     
    425427  function ExportToLua()
    426428  {
    427     global $TranslationTree;
     429    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    428430
    429431    $this->LoadFilters();
     
    642644  function ExportToXML()
    643645  {
    644     global $TranslationTree;
     646    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    645647
    646648    $this->LoadFilters();
     
    707709    $this->License = 'GNU/GPL';
    708710    $this->Description = 'Allow parametric export of translated texts to various supported output formats';
    709     $this->Dependencies = array();
     711    $this->Dependencies = array('Translation');
    710712  }
    711713
  • trunk/Modules/Export/Page.php

    r851 r859  
    157157  function ExportViewTranslators()
    158158  {
    159     global $TranslationTree;
     159    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    160160
    161161    $Output = '';
     
    319319  function ExportViewLanguages()
    320320  {
    321     global $TranslationTree;
     321    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    322322
    323323    $Output = '';
     
    410410  function ExportViewGroups()
    411411  {
    412     global $TranslationTree;
     412    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    413413
    414414    $Output = '';
  • trunk/Modules/Import/Import.php

    r838 r859  
    1515    $this->License = 'GNU/GPL';
    1616    $this->Description = 'Support for import of data.';
    17     $this->Dependencies = array();
     17    $this->Dependencies = array('Translation');
    1818  }
    1919
     
    183183  function ImportLUA()
    184184  {
    185     global $TranslationTree, $PatchVersion;
     185    global $PatchVersion;
     186
     187    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    186188    $Output = 'Načítání textů z LUA souboru...';
    187189
     
    237239  function UpdateTranslated()
    238240  {
    239     global $TranslationTree, $PatchVersion, $Config;
    240 
     241    global $PatchVersion, $Config;
     242
     243    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    241244    $Output = '<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />';
    242245    foreach($TranslationTree as $Group)
     
    341344  function ImportDBC()
    342345  {
    343     global $System, $TranslationTree, $Config;
    344 
     346    global $System, $Config;
     347
     348    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    345349    $Output = 'Načítání textů z DBC souboru...';
    346350    if(($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != ''))
     
    392396  function ImportGroup($GroupId)
    393397  {
    394     global $TranslationTree;
     398    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    395399
    396400    $this->Group = $TranslationTree[$GroupId];
     
    406410  function ImportSQL()
    407411  {
    408     global $TranslationTree, $PatchVersion;
    409 
    410     $Output= '';
     412    global $PatchVersion;
     413
     414    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
     415    $Output = '';
    411416    $File = new FileStream();
    412417    $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/sql/'.$this->Group['MangosTable'].'.sql');
  • trunk/Modules/Import/Manage.php

    r848 r859  
    4343  function ShowMenu()
    4444  {
    45     global $TranslationTree, $System;
    46 
     45    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    4746    $Output = '<strong>Import zdrojů:</strong><br/>'.
    4847      '<a href="?action=instructions">Instrukce pro přípravu zdrojových souborů</a><br/>'.
    4948      '<a href="?action=update_translated">Zaktualizovat verze přeložených</a><br/><br/>'.
    50       'Verze klienta použitá pro import: <strong>'.$System->Config['Web']['GameVersion'].'</strong><br/>';
    51     $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Group`');
     49      'Verze klienta použitá pro import: <strong>'.$this->System->Config['Web']['GameVersion'].'</strong><br/>';
     50    $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Group`');
    5251    $DbRow = $DbResult->fetch_row();
    5352    $PageList = GetPageList($DbRow[0]);
     
    6867    $Output .= $Order['Output'];
    6968
    70     $DbResult = $System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
     69    $DbResult = $this->System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    7170    while($Group = $DbResult->fetch_assoc())
    7271    {
  • trunk/Modules/Import/cmd.php

    r848 r859  
    99$System->Run();
    1010$Import = new Import($System);
     11$TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    1112
    1213$Output = '';
  • trunk/Modules/Log/Log.php

    r857 r859  
    1313    $this->License = 'GNU/GPL';
    1414    $this->Description = 'Log various application events';
    15     $this->Dependencies = array('Error', 'News');
     15    $this->Dependencies = array('Error', 'News', 'Translation');
    1616
    1717    $this->Excludes = array();
     
    121121  function ShowList()
    122122  {
    123     global $TranslationTree;
     123    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    124124
    125125    $this->Title = T('System log');
  • trunk/Modules/Translation/Comparison.php

    r847 r859  
    4040  function Show()
    4141  {
    42     global $TranslationTree;
     42    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    4343
    4444    $Output = '';
  • trunk/Modules/Translation/Form.php

    r848 r859  
    1919  function ShowForm()
    2020  {
    21     global $TranslationTree;
     21    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    2222
    2323    $Output = '';
     
    261261  function Delete()
    262262  {
    263     global $TranslationTree;
     263    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    264264
    265265    if($this->System->User->Licence(LICENCE_MODERATOR))
  • trunk/Modules/Translation/LoadNames.php

    r843 r859  
    5858  function LoadNames()
    5959  {
    60     global $TranslationTree;
     60    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    6161
    6262    $Output = '';
     
    7979          } else {
    8080            if(($GroupId == 13)) {
    81               $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextGlobalString' => 'Text', 'TextArea' => 'Name', 'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',),false);
     81              $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text',
     82                'TextGlobalString' => 'Text', 'TextArea' => 'Name',
     83                'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',), false);
    8284            } else {
    8385              $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
  • trunk/Modules/Translation/Save.php

    r848 r859  
    176176  function Show()
    177177  {
    178     global $TranslationTree, $Message, $MessageType;
     178    global $Message, $MessageType;
    179179
    180180    $Output = '';
     181    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    181182
    182183    unset($Message);
  • trunk/Modules/Translation/Translation.php

    r854 r859  
    2424  function DoStart()
    2525  {
    26     global $TranslationTree;
     26    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    2727
    2828    $this->System->RegisterPage('comparison.php', 'PageTranslationComparison');
     
    135135    return($Output);
    136136  }
     137
     138  function GetTranslationTree()
     139  {
     140    if(isset($this->TranslationTree)) return($this->TranslationTree);
     141    else {
     142      $Result = array();
     143      $Groups = array();
     144      $DbResult = $this->System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`');
     145      while($DbRow = $DbResult->fetch_assoc())
     146        $Groups[T($DbRow['Name'])] = $DbRow;
     147      ksort($Groups);
     148      foreach($Groups as $Group)
     149      {
     150        $Group['Items'] = array();
     151        $Group['Game'] = T($Group['Name']);
     152        $Result[$Group['Id']] = $Group;
     153      }
     154      $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
     155      while($DbRow = $DbResult->fetch_assoc())
     156      {
     157        $Result[$DbRow['Group']]['Items'][] = $DbRow;
     158      }
     159      $this->TranslationTree = $Result;
     160      return($Result);
     161    }
     162  }
    137163}
  • trunk/Modules/Translation/TranslationList.php

    r855 r859  
    1818  function ShowFilter($GroupId = 0)
    1919  {
    20     global $TranslationTree;
     20    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    2121
    2222    $Filter = array('SQL' => '');
     
    251251  function ShowTranslationList($Filter)
    252252  {
    253     global $TranslationTree;
     253    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    254254
    255255    $Output = $Filter['Output'];
     
    310310  function ShowGroupList($Filter)
    311311  {
    312     global $TranslationTree;
     312    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    313313
    314314    $Output = $Filter['Output'];
     
    333333  function ShowMenu()
    334334  {
    335     global $TranslationTree;
     335    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    336336
    337337    $GroupId = GetParameter('group', 0, true);
  • trunk/Modules/Translation/UserLevel.php

    r833 r859  
    2121function GetXPFromTranslation($UserId)
    2222{
    23   global $System, $TranslationTree, $xp_from_word, $from_diakrit, $Config;
     23  global $System, $xp_from_word, $from_diakrit, $Config;
     24
     25  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    2426
    2527  $xp = 0;
     
    7274function UserLevelUpdate($UserId)
    7375{
    74   global $System, $TranslationTree, $Config;
     76  global $System, $Config;
    7577
     78  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    7679  // Main code for users
    7780  $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId);
  • trunk/includes/Global.php

    r858 r859  
    336336}
    337337
    338 function GetTranslationTree()
    339 {
    340   global $System;
    341 
    342   $Result = array();
    343   $Groups = array();
    344   $DbResult = $System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`');
    345   while($DbRow = $DbResult->fetch_assoc())
    346     $Groups[T($DbRow['Name'])] = $DbRow;
    347   ksort($Groups);
    348   foreach($Groups as $Group)
    349   {
    350     $Group['Items'] = array();
    351     $Group['Game'] = T($Group['Name']);
    352     $Result[$Group['Id']] = $Group;
    353   }
    354   $DbResult = $System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
    355   while($DbRow = $DbResult->fetch_assoc())
    356   {
    357     $Result[$DbRow['Group']]['Items'][] = $DbRow;
    358   }
    359   return($Result);
    360 }
    361 
    362338$Moderators = array('Překladatel', 'Moderátor', 'Administrátor');
    363339
     
    459435function LoadGroupIdParameter()
    460436{
    461   global $TranslationTree;
     437  global $System;
     438  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    462439
    463440  if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;
     
    556533function GetIDbyName($Table)
    557534{
    558   global $TranslationTree;
     535  global $System;
     536
     537  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    559538
    560539  foreach($TranslationTree as $TableID => $Value)
  • trunk/includes/System.php

    r858 r859  
    9191  function Run()
    9292  {
    93     global $ScriptStartTime, $TranslationTree, $StopAfterUpdateManager,
     93    global $ScriptStartTime, $StopAfterUpdateManager,
    9494      $UpdateManager;
    9595
     
    116116      $this->ModuleManager->Start();
    117117    }
    118 
    119     // TODO: Global initialized variable should be removed
    120     $TranslationTree = GetTranslationTree();
    121118
    122119    // Initialize application modules
     
    450447  function ShowTranslatedMenu()
    451448  {
    452     global $TranslationTree;
     449    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    453450
    454451    $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">';
     
    522519    $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2);
    523520
    524     $Output = '</td>'.
    525       '<td class="menu2">';
    526     $Output .= $this->ShowTranslatedMenu();
    527     $Output .= '</td>'.
    528       '</tr><tr>'.
     521    $Output = '</td>';
     522    if($this->System->ModuleManager->ModulePresent('Translation'))
     523    {
     524      $Output .= '<td class="menu2">';
     525      $Output .= $this->ShowTranslatedMenu();
     526      $Output .= '</td>';
     527    }
     528    $Output .= '</tr><tr>'.
    529529      '<td colspan="4" class="page-bottom">'.T('Version').': '.$Version.' '.T('Revision').': '.$Revision.' ('.HumanDate($ReleaseTime).')'.
    530530      ' &nbsp; <a href="http://svn.zdechov.net/trac/wowpreklad/browser/trunk">'.T('Source code').'</a> &nbsp; '.
  • trunk/locale/cs.php

    r857 r859  
    514514        'Users' => 'Uživatelé',
    515515        'Moderator' => 'Moderátor',
     516        'Translate' => 'Překládat',
    516517      ),
    517518      'URL' => array(
Note: See TracChangeset for help on using the changeset viewer.