Changeset 552 for trunk/Modules/Translation/Form.php
- Timestamp:
- Jun 19, 2013, 5:53:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Form.php
r550 r552 17 17 return $Text; 18 18 } 19 19 20 20 function Show() 21 { 22 global $System, $Config, $User, $TranslationTree; 23 $Output = ''; 24 25 $GroupId = LoadGroupIdParameter(); 26 $Table = $TranslationTree[$GroupId]['TablePrefix']; 27 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 28 else $Action = ''; 29 30 if(array_key_exists('ID', $_GET)) 31 { 32 $TextID = $_GET['ID'] * 1; 33 34 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 35 $Line = $DbResult->fetch_assoc(); 36 if(!$Line) 37 { 38 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); 39 } else 40 { 41 42 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$Config['OriginalLanguage'].') AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 43 $LineAJ = $DbResult->fetch_assoc(); 44 if(!$LineAJ) 45 { 46 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 47 } else 48 { 49 50 if($Line['User'] != '') 51 { 52 $IDUser = $System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); 53 $LineUser = $IDUser->fetch_array(); 54 } else 55 $LineUser = array('Name' => ''); 56 57 $Output .= 'Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 58 59 if(($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 60 $Output .= 'Přeložil: <strong>'.$LineUser['Name'].'</strong> dne '.HumanDate($Line['ModifyTime']).'<br />'; 61 if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 62 { 63 $DbResult = $System->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); 64 $Language = $DbResult->fetch_assoc(); 65 // echo $Language['Language'].' '.$Line['Take']; 66 67 $DbResult = $System->Database->query('SELECT `Name` FROM `Language` WHERE `Id` ='.$Language['Language']); 68 $Lang = $DbResult->fetch_assoc(); 69 70 $Output .= 'Původní text: <strong>'. 71 ' ID <a href="form.php?group='.$GroupId.'&ID='.$Line['Take'].'">'.$Line['Take'].'</a></strong>'. 72 ' ('.$Lang['Name'].')'. 73 ' <br />'; 74 } 75 $Output .= 'Text: '; 76 if($Line['Language'] <> 0) 77 { 78 if($Line['Complete'] == 1) $Output .= ' <b>Hotov</b>'; 79 else $Output .= ' <b> Uložen v rozepsaných</b> '; 80 } else $Output .= ' <b>Anglická, původní verze</b> '; 81 82 $Output .= '<br />'. 83 'Verze: <b>'.GetVersionWOW($Line['VersionStart']).' - '.GetVersionWOW($Line['VersionEnd']).'</b>'. 84 '<br />'; 85 86 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> '.$Config['OriginalLanguage'].') AND (`Complete` = 1)'); 87 $Version = $DbResult->fetch_row(); 88 $Version = $Version[0]; 89 if($Version > 0) 90 { 91 $Output .= '<form action="comparison.php" method="get"><a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a> 92 <input type="hidden" name="group" value="'.$GroupId.'" /> 93 <input type="hidden" name="entry" value="'.$Line['Entry'].'" /> 94 <input type="hidden" name="ID2" value="'.$TextID.'" /> 95 <select onchange="this.form.submit();" name="ID1"> 96 <option value="-1">Vyberte text k porovnání</option> 97 <option value="-1">Zobrazit/porovnat všechny</option>'; 98 $DataID = $System->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'].') AND (`Complete` = 1)'); 99 while($Version = $DataID->fetch_array()) 100 { 101 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' (převzato)</option>'; 102 else 103 { 104 if($Version['Language'] == 0) $Version['UserName'] = 'Předloha'; 105 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 106 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. 107 GetVersionWOW($Version['VersionEnd']).')</option>'; 108 } 109 } 110 $Output .= '</select></form>'; 111 } else 112 { 113 $Output .= '<a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a>'; 114 } 115 116 // Special characters: $B - New line, $N - Name, $C - profession 117 $Output .= '<form action="save.php?group='.$GroupId.'" method="post"><div>'; 118 if($User->Licence(LICENCE_USER)) 119 { 120 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 121 $Output .= '<a href="dictionary.php?action=group&group='.$GroupId.'&ID='.$LineAJ['ID'].'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">Vyhledat v názvech</a>'; 122 $Output .= ' <input type="submit" value="Uložit do rozepsaných" name="save" title="Klikněte na uložit pro pozdější dokončení překladu" />'. 123 '<input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> '; 124 FollowingTran($TextID, $Table, $GroupId, true); 125 FollowingTran($TextID, $Table, $GroupId); 126 } 127 128 if($TranslationTree[$GroupId]['WowheadName'] != '') 129 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].'='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; 130 else $WowheadLink = $LineAJ['Entry']; 131 132 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" /> 133 <input type="hidden" name="user" value="'.$User->Id.'" /> 134 <input type="hidden" name="ID" value="'.$TextID.'" /> 135 <table class="BaseTable"> 136 <tr> 137 <th>Číslo textu: '.$WowheadLink.'</th> 138 <th>Nepřeložené</th> 139 <th>Přeložené</th> 140 </tr> 141 <tr> 142 <th>Jazyk</th> 143 <td>Anglický</td> 144 <td> 145 Přeloženo do:'; 146 if($Line['Language'] <> 0) $Language = $Line['Language']; 147 else if($User->Id != 0) 148 { 149 $Language = $User->Language; 150 } else $Language = 0; 151 $Output .= WriteLanguages($Language). 152 '</td></tr>'; 153 154 // Difference highlighting 155 $Text = ''; 156 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 157 if($TextItem['Visible'] == 1) 158 $Text = $Text.' '.$LineAJ[$TextItem['Column']]; 159 160 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) { 161 //<span class="edit">barvou.</span> 162 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text','TextCreature' => 'name')); 163 } else { 164 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text')); 165 } 166 167 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 168 if($TextItem['Visible'] == 1) 169 { 170 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 171 { 172 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) 173 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 174 else $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 175 $Output .= '<td>'.str_replace("\n", '<br/>', $this->ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td> 176 <td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>'; 177 } 178 } else 179 { 180 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />'; 181 } 182 $Output .= '</table></div></form>'; 183 } 184 } 185 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 186 return($Output); 187 } 21 { 22 global $System, $Config, $User, $TranslationTree; 23 $Output = ''; 24 25 $GroupId = LoadGroupIdParameter(); 26 $Table = $TranslationTree[$GroupId]['TablePrefix']; 27 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 28 else $Action = ''; 29 30 if(array_key_exists('ID', $_GET)) 31 { 32 $TextID = $_GET['ID'] * 1; 33 34 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 35 $Line = $DbResult->fetch_assoc(); 36 if(!$Line) 37 { 38 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); 39 } else 40 { 41 42 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$Config['OriginalLanguage'].') AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 43 $LineAJ = $DbResult->fetch_assoc(); 44 if(!$LineAJ) 45 { 46 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 47 } else 48 { 49 50 if($Line['User'] != '') 51 { 52 $IDUser = $System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); 53 $LineUser = $IDUser->fetch_array(); 54 } else 55 $LineUser = array('Name' => ''); 56 57 $Output .= 'Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 58 59 if(($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 60 $Output .= 'Přeložil: <strong>'.$LineUser['Name'].'</strong> dne '.HumanDate($Line['ModifyTime']).'<br />'; 61 if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 62 { 63 $DbResult = $System->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); 64 $Language = $DbResult->fetch_assoc(); 65 // echo $Language['Language'].' '.$Line['Take']; 66 67 $DbResult = $System->Database->query('SELECT `Name` FROM `Language` WHERE `Id` ='.$Language['Language']); 68 $Lang = $DbResult->fetch_assoc(); 69 70 $Output .= 'Původní text: <strong>'. 71 ' ID <a href="form.php?group='.$GroupId.'&ID='.$Line['Take'].'">'.$Line['Take'].'</a></strong>'. 72 ' ('.$Lang['Name'].')'. 73 ' <br />'; 74 } 75 $Output .= 'Text: '; 76 if($Line['Language'] <> 0) 77 { 78 if($Line['Complete'] == 1) $Output .= ' <b>Hotov</b>'; 79 else $Output .= ' <b> Uložen v rozepsaných</b> '; 80 } else $Output .= ' <b>Anglická, původní verze</b> '; 81 82 $Output .= '<br />'. 83 'Verze: <b>'.GetVersionWOW($Line['VersionStart']).' - '.GetVersionWOW($Line['VersionEnd']).'</b>'. 84 '<br />'; 85 86 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> '.$Config['OriginalLanguage'].') AND (`Complete` = 1)'); 87 $Version = $DbResult->fetch_row(); 88 $Version = $Version[0]; 89 if($Version > 0) 90 { 91 $Output .= '<form action="comparison.php" method="get"><a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a> 92 <input type="hidden" name="group" value="'.$GroupId.'" /> 93 <input type="hidden" name="entry" value="'.$Line['Entry'].'" /> 94 <input type="hidden" name="ID2" value="'.$TextID.'" /> 95 <select onchange="this.form.submit();" name="ID1"> 96 <option value="-1">Vyberte text k porovnání</option> 97 <option value="-1">Zobrazit/porovnat všechny</option>'; 98 $DataID = $System->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'].') AND (`Complete` = 1)'); 99 while($Version = $DataID->fetch_array()) 100 { 101 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' (převzato)</option>'; 102 else 103 { 104 if($Version['Language'] == 0) $Version['UserName'] = 'Předloha'; 105 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 106 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. 107 GetVersionWOW($Version['VersionEnd']).')</option>'; 108 } 109 } 110 $Output .= '</select></form>'; 111 } else 112 { 113 $Output .= '<a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a>'; 114 } 115 116 // Special characters: $B - New line, $N - Name, $C - profession 117 if($User->Licence(LICENCE_USER)) 118 { 119 $Output .= '<form action="save.php?group='.$GroupId.'" method="post"><div>'; 120 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 121 $Output .= '<a href="dictionary.php?action=group&group='.$GroupId.'&ID='.$LineAJ['ID'].'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">Vyhledat v názvech</a>'; 122 $Output .= ' <input type="submit" value="Uložit do rozepsaných" name="save" title="Klikněte na uložit pro pozdější dokončení překladu" />'. 123 '<input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> '; 124 FollowingTran($TextID, $Table, $GroupId, true); 125 FollowingTran($TextID, $Table, $GroupId); 126 } 127 128 if($TranslationTree[$GroupId]['WowheadName'] != '') 129 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].'='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; 130 else $WowheadLink = $LineAJ['Entry']; 131 132 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" /> 133 <input type="hidden" name="user" value="'.$User->Id.'" /> 134 <input type="hidden" name="ID" value="'.$TextID.'" /> 135 <table class="BaseTable"> 136 <tr> 137 <th>Číslo textu: '.$WowheadLink.'</th> 138 <th>Nepřeložené</th> 139 <th>Přeložené</th> 140 </tr> 141 <tr> 142 <th>Jazyk</th> 143 <td>Anglický</td> 144 <td>'; 145 if($Line['Language'] <> 0) $Language = $Line['Language']; 146 else if($User->Id != 0) 147 { 148 $Language = $User->Language; 149 } else $Language = 0; 150 if($User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 151 else { 152 $DbResult3 = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1'); 153 if($DbResult3->num_rows > 0) 154 { 155 $Language = $DbResult3->fetch_assoc(); 156 $Output .= $Language['Name']; 157 } 158 } 159 160 $Output .= '</td></tr>'; 161 162 // Difference highlighting 163 $Text = ''; 164 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 165 if($TextItem['Visible'] == 1) 166 $Text = $Text.' '.$LineAJ[$TextItem['Column']]; 167 168 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) { 169 //<span class="edit">barvou.</span> 170 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text','TextCreature' => 'name')); 171 } else { 172 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text')); 173 } 174 175 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 176 if($TextItem['Visible'] == 1) 177 { 178 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 179 { 180 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) 181 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 182 else $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 183 $Output .= '<td>'.str_replace("\n", '<br/>', $this->ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td> 184 <td>'; 185 if($User->Licence(LICENCE_USER)) $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 186 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 187 if($User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 188 } 189 } else 190 { 191 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />'; 192 } 193 $Output .= '</table></div>'; 194 if($User->Licence(LICENCE_USER)) $Output .= '</form>'; 195 } 196 } 197 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 198 return($Output); 199 } 188 200 }
Note:
See TracChangeset
for help on using the changeset viewer.