Changeset 880 for trunk/Modules/Translation/Form.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Form.php
r859 r880 10 10 $this->Title = T('Translation'); 11 11 $Action = ''; 12 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];13 14 if ($Action == 'delete') $Output = $this->Delete();12 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 13 14 if ($Action == 'delete') $Output = $this->Delete(); 15 15 else $Output = $this->ShowForm(); 16 return ($Output);16 return $Output; 17 17 } 18 18 … … 26 26 $this->GroupId = $GroupId; 27 27 $Table = $TranslationTree[$GroupId]['TablePrefix']; 28 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];28 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 29 29 else $Action = ''; 30 30 31 if (array_key_exists('ID', $_GET))31 if (array_key_exists('ID', $_GET)) 32 32 { 33 33 $TextID = $_GET['ID'] * 1; … … 36 36 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 37 37 $Line = $DbResult->fetch_assoc(); 38 if (!$Line)38 if (!$Line) 39 39 { 40 40 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); … … 47 47 else $Language = '`Language` != '.$this->System->Config['OriginalLanguage']; 48 48 $Columns = ''; 49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 50 50 $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,'; 51 51 … … 56 56 $DbResult = $this->Database->query($sql.$join.$where); 57 57 while ($LineSearch = $DbResult->fetch_assoc()) { 58 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)59 if ($TextItem['Visible'] == 1)58 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 59 if ($TextItem['Visible'] == 1) 60 60 if (($LineAJ[$TextItem['Column']] <> '') and 61 61 ($LineSearch[$TextItem['Column']] <> '') and … … 74 74 $LineAJ = $DbResult->fetch_assoc(); 75 75 } 76 if (!$LineAJ)76 if (!$LineAJ) 77 77 { 78 78 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); … … 80 80 { 81 81 82 if ($Line['User'] != '')82 if ($Line['User'] != '') 83 83 { 84 84 $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); … … 89 89 $Output .= T('Group').': <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 90 90 91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 92 92 $Output .= T('Translated by').': <a href="'.$this->System->Link('/user/?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />'; 93 if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))93 if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 94 94 { 95 95 $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); … … 105 105 } 106 106 $Output .= 'Text: '; 107 if ($Line['Language'] <> 0)108 { 109 if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';107 if ($Line['Language'] <> 0) 108 { 109 if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>'; 110 110 else $Output .= ' <b>'.T('Stored in unfinished').'</b> '; 111 111 } else $Output .= ' <b>'.T('Original version').'</b> '; … … 120 120 $Version = $DbResult->fetch_row(); 121 121 $Version = $Version[0]; 122 if ($Version > 0)122 if ($Version > 0) 123 123 { 124 124 $Output .= '<form action="comparison.php" method="get"><a href="'.$this->System->Link('/TranslationList.php?group='. … … 128 128 <input type="hidden" name="ID2" value="'.$TextID.'" />'; 129 129 130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user 131 131 $Output .= '<select onchange="this.form.submit();" name="ID1"> 132 132 <option value="-1">'.T('Select text for comparison').'</option> 133 133 <option value="-1">'.T('Show/compare all').'</option>'; 134 134 $DataID = $this->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].')'); 135 while ($Version = $DataID->fetch_array())135 while ($Version = $DataID->fetch_array()) 136 136 { 137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'.137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'. 138 138 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' ('.T('taken over').')</option>'; 139 139 else 140 140 { 141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original');141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original'); 142 142 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 143 143 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. … … 155 155 156 156 // Special characters: $B - New line, $N - Name, $C - profession 157 if ($this->System->User->Licence(LICENCE_USER))157 if ($this->System->User->Licence(LICENCE_USER)) 158 158 { 159 159 $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>'; 160 160 // TODO: Remove fixed group id condition 161 // if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))161 // if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 162 162 $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&group='. 163 163 $GroupId.'&ID='.$LineAJ['ID']).'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">'.T('Search in names').'</a>'; … … 169 169 } 170 170 171 if ($TranslationTree[$GroupId]['WowheadName'] != '')171 if ($TranslationTree[$GroupId]['WowheadName'] != '') 172 172 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName']. 173 173 '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; … … 187 187 <td>'.T('Original').'</td> 188 188 <td>'; 189 if ($Line['Language'] <> 0) $Language = $Line['Language'];190 else if ($this->System->User->Id != 0)189 if ($Line['Language'] <> 0) $Language = $Line['Language']; 190 else if ($this->System->User->Id != 0) 191 191 { 192 192 $Language = $this->System->User->Language; 193 193 } else $Language = 0; 194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 195 195 else { 196 196 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')'); 197 if ($DbResult3->num_rows > 0)197 if ($DbResult3->num_rows > 0) 198 198 { 199 199 $Language = $DbResult3->fetch_assoc(); … … 209 209 '<script>'; 210 210 $Output .= '$(document).ready(function() {'; 211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 212 212 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 213 213 … … 215 215 '</script>'; 216 216 217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)218 if ($TextItem['Visible'] == 1)217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 218 if ($TextItem['Visible'] == 1) 219 219 { 220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 221 221 { 222 if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))222 if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings'))) 223 223 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 224 224 else $Output .= '<tr><th>'.T($TextItem['Name']).'</th>'; 225 225 $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td> 226 226 <td>'; 227 if ($this->System->User->Licence(LICENCE_USER))227 if ($this->System->User->Licence(LICENCE_USER)) 228 228 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 229 229 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 230 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';230 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 231 231 } 232 232 } else … … 235 235 } 236 236 $Output .= '</table></div>'; 237 if ($this->System->User->Licence(LICENCE_USER)) {237 if ($this->System->User->Licence(LICENCE_USER)) { 238 238 $Output .= '</form>'; 239 239 240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and 241 241 $this->System->Config['Web']['EnableGoogleTranslate']) 242 242 { 243 243 $Output .= '<br/><table class="BaseTable">'. 244 244 '<tr><th>'.T('Google translator').':</th><th>'.T('Not translated').'</th><th>'.T('Translated').'</th>'; 245 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)246 if ($TextItem['Visible'] == 1)245 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 246 if ($TextItem['Visible'] == 1) 247 247 if ($LineAJ[$TextItem['Column']] <> '') 248 248 $Output .= '<tr><td>'.$TextItem['Column'].'</td>'. … … 256 256 } 257 257 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 258 return ($Output);258 return $Output; 259 259 } 260 260 … … 263 263 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 264 264 265 if ($this->System->User->Licence(LICENCE_MODERATOR))265 if ($this->System->User->Licence(LICENCE_MODERATOR)) 266 266 { 267 267 $GroupId = LoadGroupIdParameter(); … … 273 273 $this->System->ModuleManager->Modules['Log']->WriteLog('Překlad byl smazán! <a href="'.$this->System->Link('/form.php?group='.$this->GroupId.'&ID='.$TextID).'">'.$TextID.'</a>', LOG_TYPE_MODERATOR); 274 274 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 275 return ($Output);275 return $Output; 276 276 } 277 277 }
Note:
See TracChangeset
for help on using the changeset viewer.