source: trunk/form.php@ 525

Last change on this file since 525 was 525, checked in by chronos, 12 years ago
  • Opraveno: Zobrazení porovnání překladů.
  • Opraveno: Zobrazení stavu dokončení pro všechny překlady.
  • Přidáno: V seznamu překladů přidán sloupec Jazyk.
  • Opraveno: Místa, kde s pevným indexem anglického originálu upravena na nastavitelný.
File size: 8.6 KB
Line 
1<?php
2
3include('includes/global.php');
4
5function ColorNames($Text, $names)
6{
7 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
8 foreach($names as $Line) {
9 if ($Line[3] <> '') {
10 $Text = str_replace($Line[2],'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text);
11 $Text = str_replace(strtolower($Line[2]),'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text);
12 } else {
13 $Text = str_replace($Line[2],'<span title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>',$Text);
14 $Text = str_replace(strtolower($Line[2]),'<span title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>',$Text);
15 }
16 }
17 return $Text;
18}
19
20$Output = '';
21
22$GroupId = LoadGroupIdParameter();
23$Table = $TranslationTree[$GroupId]['TablePrefix'];
24if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
25 else $Action = '';
26
27if(array_key_exists('ID', $_GET))
28{
29 $TextID = $_GET['ID'] * 1;
30
31 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID);
32 $Line = $DbResult->fetch_assoc();
33 if(!$Line)
34 {
35 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL);
36 } else
37 {
38
39 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$Config['OriginalLanguage'].') AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1');
40 $LineAJ = $DbResult->fetch_assoc();
41 if(!$LineAJ)
42 {
43 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL);
44 } else
45 {
46
47 if($Line['User'] != '')
48 {
49 $IDUser = $System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']);
50 $LineUser = $IDUser->fetch_array();
51 } else
52 $LineUser = array('Name' => '');
53
54 $Output .= 'Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />';
55
56 if(($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))
57 $Output .= 'Přeložil: <strong>'.$LineUser['Name'].'</strong> dne '.HumanDate($Line['ModifyTime']).'<br />';
58 if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
59 {
60 $DbResult = $System->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']);
61 $Language = $DbResult->fetch_assoc();
62 // echo $Language['Language'].' '.$Line['Take'];
63
64 $DbResult = $System->Database->query('SELECT `Name` FROM `Language` WHERE `Id` ='.$Language['Language']);
65 $Lang = $DbResult->fetch_assoc();
66
67 $Output .= 'Původní text: <strong>'.
68 ' ID <a href="form.php?group='.$GroupId.'&amp;ID='.$Line['Take'].'">'.$Line['Take'].'</a></strong>'.
69 ' ('.$Lang['Name'].')'.
70 ' <br />';
71 }
72 $Output .= 'Text: ';
73 if($Line['Language'] <> 0)
74 {
75 if($Line['Complete'] == 1) $Output .= ' <b>Hotov</b>';
76 else $Output .= ' <b> Uložen v rozepsaných</b> ';
77 } else $Output .= ' <b>Anglická, původní verze</b> ';
78
79 $Output .= '<br />'.
80 'Verze: <b>'.GetVersionWOW($Line['VersionStart']).' - '.GetVersionWOW($Line['VersionEnd'].'</b>').
81 '<br />';
82
83 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> '.$Config['OriginalLanguage'].') AND (`Complete` = 1)');
84 $Version = $DbResult->fetch_row();
85 $Version = $Version[0];
86 if($Version > 0)
87 {
88 $Output .= '<form action="comparison.php" method="get"><a href="TranslationList.php?group='.$GroupId.'&amp;user=0&amp;state=2&amp;entry='.$Line['Entry'].'&amp;text=">Počet verzí: <strong>'.$Version.'</strong></a>
89 <input type="hidden" name="group" value="'.$GroupId.'" />
90 <input type="hidden" name="entry" value="'.$Line['Entry'].'" />
91 <input type="hidden" name="ID2" value="'.$TextID.'" />
92 <select onchange="this.form.submit();" name="ID1">
93 <option value="-1">Vyberte text k porovnání</option>
94 <option value="-1">Zobrazit/porovnat všechny</option>';
95 $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)');
96 while($Version = $DataID->fetch_array())
97 {
98 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' (převzato)</option>';
99 else
100 {
101 if($Version['Language'] == 0) $Version['UserName'] = 'Předloha';
102 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.
103 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '.
104 GetVersionWOW($Version['VersionEnd']).')</option>';
105 }
106 }
107 $Output .= '</select></form>';
108 } else
109 {
110 $Output .= '<a href="TranslationList.php?group='.$GroupId.'&amp;user=0&amp;state=2&amp;entry='.$Line['Entry'].'&amp;text=">Počet verzí: <strong>'.$Version.'</strong></a>';
111 }
112
113// Speciální znaky: $B - Odřádkování, $N - Jméno, $C - povolání
114 $Output .= '<form action="save.php?group='.$GroupId.'" method="post"><div>';
115 if($User->Licence(LICENCE_USER))
116 {
117 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
118 $Output .= '<a href="dictionary.php?group='.$GroupId.'&amp;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>';
119 $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" />
120 <input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> ';
121 FollowingTran($TextID, $Table, $GroupId, true);
122 FollowingTran($TextID, $Table, $GroupId);
123 }
124
125 if($TranslationTree[$GroupId]['WowheadName'] != '')
126 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].'='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>';
127 else $WowheadLink = $LineAJ['Entry'];
128
129 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" />
130 <input type="hidden" name="user" value="'.$User->Id.'" />
131 <input type="hidden" name="ID" value="'.$TextID.'" />
132 <table class="BaseTable">
133 <tr>
134 <th>Číslo textu: '.$WowheadLink.'</th>
135 <th>Nepřeložené</th>
136 <th>Přeložené</th>
137 </tr>
138 <tr>
139 <th>Jazyk</th>
140 <td>Anglický</td>
141 <td>
142 Přeloženo do:';
143 if($Line['Language'] <> 0) $Language = $Line['Language'];
144 else if($User->Id != 0)
145 {
146 $Language = $User->Language;
147 } else $Language = 0;
148 $Output .= WriteLanguages($Language).
149 '</td></tr>';
150
151 //zvýrazňování jmen
152 $Text = '';
153 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
154 if($TextItem['Visible'] == 1)
155 $Text = $Text.' '.$LineAJ[$TextItem['Column']];
156
157 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) {
158 //<span class="edit">barvou.</span>
159 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text','TextCreature' => 'name'));
160 } else {
161 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text'));
162 }
163 //print_r($names);
164
165 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
166 if($TextItem['Visible'] == 1)
167 {
168 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))
169 {
170 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings')))
171 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>';
172 else $Output .= '<tr><th>'.$TextItem['Name'].'</th>';
173 $Output .= '<td>'.str_replace("\n", '<br/>', ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td>
174 <td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>';
175 }
176 } else
177 {
178 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />';
179 }
180 $Output .= '</table></div></form>';
181 }
182 }
183} else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL);
184
185ShowPage($Output);
186
187?>
188
Note: See TracBrowser for help on using the repository browser.