Changeset 425 for branches/CombinedTextTables/form.php
- Timestamp:
- Apr 8, 2010, 7:58:16 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CombinedTextTables/form.php
r420 r425 5 5 function ColorNames($Text, $names) 6 6 { 7 8 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 9 foreach($names as $Line) { 10 if ($Line[3] <> '') { 11 $Text = str_replace($Line[2],'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text); 12 $Text = str_replace(strtolower($Line[2]),'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text); 13 } else { 14 $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); 15 $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); 16 } 7 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 8 foreach($names as $Line) 9 { 10 if($Line[3] <> '') 11 { 12 $Text = str_replace($Line[2], '<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text); 13 $Text = str_replace(strtolower($Line[2]), '<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>', $Text); 14 } else 15 { 16 $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); 17 $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); 18 } 17 19 } 18 20 return $Text; … … 22 24 23 25 $GroupId = LoadGroupIdParameter(); 24 $ Table = $TranslationTree[$GroupId]['TablePrefix'];26 $Group = $TranslationTree[$GroupId]; 25 27 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 26 28 else $Action = ''; 27 29 28 if(array_key_exists('ID', $_GET) )30 if(array_key_exists('ID', $_GET) and is_numeric($_GET['ID'])) 29 31 { 30 $TextID = $_GET['ID'] * 1;32 $TextID = $_GET['ID']; 31 33 32 $DbResult = $Database->SQLCommand('SELECT * FROM ` '.$Table.'` WHERE `ID` = '.$TextID);34 $DbResult = $Database->SQLCommand('SELECT * FROM `Translation` WHERE `ID` = '.$TextID); 33 35 $Line = mysql_fetch_assoc($DbResult); 34 36 if(!$Line) ErrorMessage('Překlad nenalezen.'); 35 37 36 $DbResult = $Database->SQLCommand('SELECT * FROM ` '.$Table.'` WHERE `Language` = 0 AND `Entry` = '.$Line['Entry'].' AND `VersionEnd` = '.$Line['VersionEnd'].'LIMIT 1');38 $DbResult = $Database->SQLCommand('SELECT * FROM `Translation` WHERE (`Language` = 0) AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 37 39 $LineAJ = mysql_fetch_assoc($DbResult); 38 40 if(!$Line) ErrorMessage('Anglický originál k překladu nenalezen.'); 41 $DbResult = $System->Database->query('SELECT * FROM `TranslationItem` WHERE `Translation`='.$LineAJ['Id']); 42 while($DbRow = $DbResult->fetch_assoc()) 43 $LineAJ['Item'.$DbRow['Sequence']] = $DbRow['Value']; 39 44 40 45 $IDUser = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); … … 45 50 if(($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 46 51 echo('Přeložil: <strong>'.$LineUser['Name'].'</strong> <br />'); 47 if(($Line[' Take'] <> 0) and ($Line['Take'] <> $Line['ID']))52 if(($Line['Original'] <> 0) and ($Line['Original'] <> $Line['Id'])) 48 53 { 49 $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT `Language`,`VersionStart`,`VersionEnd` FROM ` '.$Table.'` WHERE `ID` = '.$Line['Take']));54 $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `Translation` WHERE `ID` = '.$Line['Original'])); 50 55 // echo $Language['Language'].' '.$Line['Take']; 51 56 if($Language['Language'] <> 0) 52 echo('Převzato z: <a href="form.php?group='.$GroupId.'&ID='.$Line[' Take'].'">'.$Line['Take'].'</a> <br />');57 echo('Převzato z: <a href="form.php?group='.$GroupId.'&ID='.$Line['Original'].'">'.$Line['Original'].'</a> <br />'); 53 58 } 54 59 echo('Text: '); … … 63 68 echo('<br />'); 64 69 65 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` '.$Table.'` WHERE `Entry` = '.$Line['Entry'].' AND `Language` <> 0');70 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Translation` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> 0)'); 66 71 $Version = mysql_fetch_row($DbResult); 67 72 $Version = $Version[0]; … … 75 80 <option value="-1">Vyberte text k porovnání</option> 76 81 <option value="-1">Zobrazit/porovnat všechny</option>'); 77 $DataID = $Database->SQLCommand('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'].')');82 $DataID = $Database->SQLCommand('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `Translate`.`User`) AS `UserName` FROM `Translate` WHERE (`Entry` = '.$Line['Entry'].') AND (`Id` <> '.$Line['Id'].')'); 78 83 while($version = mysql_fetch_array($DataID)) 79 84 { 80 if ($version['I D'] == $Line['Take']) echo('<option value="'.$version['ID'].'">'.$version['ID'].' - '.$version['User'].' (převzato)</option>');85 if ($version['Id'] == $Line['Original']) echo('<option value="'.$version['Id'].'">'.$version['Id'].' - '.$version['User'].' (převzato)</option>'); 81 86 else 82 87 { 83 88 if($version['Language'] == 0) $version['UserName'] = 'Předloha'; 84 echo('<option value="'.$version['I D'].'">'.$version['ID'].' - '.$Version['UserName'].' ('.GetVersionWOW($version['VersionStart']).' - '.GetVersionWOW($version['VersionEnd']).')</option>');89 echo('<option value="'.$version['Id'].'">'.$version['Id'].' - '.$Version['UserName'].' ('.GetVersionWOW($version['VersionStart']).' - '.GetVersionWOW($version['VersionEnd']).')</option>'); 85 90 } 86 91 } … … 95 100 if($User->Licence(LICENCE_USER)) 96 101 { 97 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) echo('<a href="dictionary.php?group='.$GroupId.'&ID='.$LineAJ['I D'].'" 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>');102 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) echo('<a href="dictionary.php?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>'); 98 103 echo(' <input type="submit" value="Uložit do rozepsaných" name="save" title="Klikněte na uložit pro pozdější dokončení překladu" /> 99 104 <input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> '); 100 FollowingTran($TextID, $Table, $GroupId, true);101 FollowingTran($TextID, $Table, $GroupId);105 //FollowingTran($TextID, $Table, $GroupId, true); 106 //FollowingTran($TextID, $Table, $GroupId); 102 107 } 103 108 … … 128 133 echo('</td></tr>'); 129 134 130 //zvýrazňování jmen 131 $Text = ''; 132 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 133 if($TextItem['Visible'] == 1) 134 $Text = $Text.' '.$LineAJ[$TextItem['Column']]; 135 /* 136 // zvýrazňování jmen 137 $Text = ''; 138 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 139 if($TextItem['Visible'] == 1) 140 if(array_key_exists('Item'.$TextItem['Sequence'], $LineAJ)) 141 $Text = $Text.' '.$LineAJ['Item'.$TextItem['Sequence']]; 135 142 136 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) { 137 //<span class="edit">barvou.</span> 138 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text','TextCreature' => 'name')); 139 } else { 140 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text')); 143 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 144 { 145 //<span class="edit">barvou.</span> 146 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextCreature' => 'name')); 147 } else 148 { 149 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text')); 141 150 } 142 151 //print_r($names); 143 144 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 145 if($TextItem['Visible'] == 1) 146 { 147 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 152 */ 153 $names = array(); 154 155 $DbResult = $System->Database->query('SELECT * FROM TranslationItem WHERE Translation='.$TextID); 156 while($TranslationItem = $DbResult->fetch_assoc()) 157 { 158 $TextItem = $TranslationTree[$GroupId]['Items'][$TranslationItem['Sequence']]; 159 if($TextItem['Visible'] == 1) 160 { 161 if(($LineAJ['Item'.$TranslationItem['Sequence']] <> '') or ($TranslationItem['Value'] <> '')) 162 { 163 //if($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) echo('<tr><th>'.$LineAJ['ShortCut'].'</th>'); 164 //else 165 echo('<tr><th>'.$TextItem['Name'].'</th>'); 166 167 echo('<td>'.str_replace("\n", '<br/>', ColorNames(htmlspecialchars($LineAJ['Item'.$TranslationItem['Sequence']]),$names)).'</td>'. 168 '<td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="Item'.$TranslationItem['Sequence'].'" name="Item'.$TranslationItem['Sequence'].'">'.htmlspecialchars($TranslationItem['Value']).'</textarea></td></tr>'); 169 } 170 } else 148 171 { 149 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) echo('<tr><th>'.$LineAJ['ShortCut'].'</th>'); 150 else echo('<tr><th>'.$TextItem['Name'].'</th>'); 151 echo('<td>'.str_replace("\n", '<br/>', ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td> 152 <td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>'); 172 echo('<input id="Item'.$TranslationItem['Sequence'].'" name="Item'.$TranslationItem['Sequence'].'" type="hidden" value="'.htmlspecialchars($TranslationItem['Value']).'" />'); 153 173 } 154 } else155 {156 echo('<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />');157 174 } 158 175 echo('</table></div></form>');
Note:
See TracChangeset
for help on using the changeset viewer.