Changeset 831 for trunk/Modules/Translation
- Timestamp:
- Aug 24, 2015, 9:57:27 PM (9 years ago)
- Location:
- trunk/Modules/Translation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Save.php
r826 r831 42 42 43 43 // Get all similar english texts 44 $Filter = '';44 $Filter = array(); 45 45 foreach($Group['Items'] as $GroupItem) 46 if(($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != '')) 47 $Filter .= ' OR (`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")'; 48 if(substr($Filter, 0, 3) == ' OR') $Filter = ' AND ('.substr($Filter, 3).')'; 49 50 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter); 46 if(($GroupItem['Visible'] == 1)) 47 $Filter[] = '(`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")'; 48 if(count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')'; 49 50 $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter; 51 echo($Query."\n"); 52 $DbResult = $this->Database->query($Query); 51 53 while($EnglishFound = $DbResult->fetch_assoc()) 52 54 { … … 120 122 $CompleteParts = 0; 121 123 $Completable = true; 122 $OnlyRank = true;123 124 foreach($Group['Items'] as $GroupItem) 124 125 { … … 131 132 if(array_key_exists($GroupItem['Column'], $_POST)) 132 133 { 133 if (44 <> $GroupItem['Id']) $OnlyRank = false;134 134 $Values .= ', "'.$_POST[$GroupItem['Column']].'"'; 135 135 $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); … … 144 144 } 145 145 if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 146 else $NewComplete = 0;146 else $NewComplete = 0; 147 147 if($SourceText['ID'] == $EnglishFound['ID']) 148 148 { … … 156 156 $Columns .= ', `Complete`, `CompleteParts`'; 157 157 $Values .= ', '.$NewComplete.', '.$CompleteParts; 158 159 if (!$OnlyRank) 160 { 161 $this->Database->query('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 162 $LastID = $this->Database->insert_id; 163 164 $Output .= 'Text <a href="'.$this->System->Link('/form.php?group='. 165 $GroupId.'&ID='.$LastID).'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 166 $GroupId.'&user=0&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen jako '. 167 $CompleteText[$NewComplete].'. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.<br/>'; 168 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="'. 169 $this->System->Link('/form.php?group='.$GroupId.'&ID='.$LastID).'">'. 170 $LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 171 $GroupId.'&user=0&text=&entry=&action=filter">'. 172 $TranslationTree[$GroupId]['Name'].'</a> uložen jako '.$CompleteText[$NewComplete]. 173 '. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', LOG_TYPE_TRANSLATION); 174 } 158 $this->Database->query('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 159 $LastID = $this->Database->insert_id; 160 161 $Output .= 'Text <a href="'.$this->System->Link('/form.php?group='. 162 $GroupId.'&ID='.$LastID).'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 163 $GroupId.'&user=0&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen jako '. 164 $CompleteText[$NewComplete].'. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.<br/>'; 165 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="'. 166 $this->System->Link('/form.php?group='.$GroupId.'&ID='.$LastID).'">'. 167 $LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 168 $GroupId.'&user=0&text=&entry=&action=filter">'. 169 $TranslationTree[$GroupId]['Name'].'</a> uložen jako '.$CompleteText[$NewComplete]. 170 '. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', LOG_TYPE_TRANSLATION); 175 171 } 176 172 } … … 178 174 } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL); 179 175 180 181 // Address and redirecting 182 $Output .= '<br />Překládat: <a href="TranslationList.php?group='.$GroupId.'&state=1&user=0&entry=">Nepřeložené</a> '; 183 184 $prev = FollowingTran($TextID, $Table, $GroupId, True); 185 $next = FollowingTran($TextID, $Table, $GroupId); 186 $Output .= '<br /><br />'; 187 $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$this->System->User->Id); 188 $redirecting = $DbResult->fetch_assoc(); 189 190 switch($redirecting['Redirecting']) 191 { 192 case 1: 193 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 194 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('TranslationList.php?group='.$GroupId.'&state=1&user=0').'\'", 1500)'. 195 '</script>'; 196 break; 197 case 2: 198 if($next <> '') 199 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 200 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. 201 '</script>'; 202 break; 203 case 3: 204 if($prev <> '') 205 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 206 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. 207 '</script>'; 208 break; 209 } 210 211 $Output .= 'Z této stránky můžete být automaticky přesměrování. Nastavit kam chcete být přesměrování si můžete v <a href="'. 212 $this->System->Link('/Options.php').'" title="Nastavení uživatele">Nastavení</a>'; 176 $Output .= $this->ShowRedirection($GroupId, $Table, $TextID); 213 177 214 178 // Update flag for experience info load … … 245 209 return($Output); 246 210 } 211 212 function ShowRedirection($GroupId, $Table, $TextID) 213 { 214 // Address and redirecting 215 $Output = '<br />Překládat: <a href="TranslationList.php?group='.$GroupId.'&state=1&user=0&entry=">Nepřeložené</a> '; 216 217 $prev = FollowingTran($TextID, $Table, $GroupId, True); 218 $next = FollowingTran($TextID, $Table, $GroupId); 219 $Output .= '<br /><br />'; 220 $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$this->System->User->Id); 221 $redirecting = $DbResult->fetch_assoc(); 222 223 switch($redirecting['Redirecting']) 224 { 225 case 1: 226 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 227 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('TranslationList.php?group='.$GroupId.'&state=1&user=0').'\'", 1500)'. 228 '</script>'; 229 break; 230 case 2: 231 if($next <> '') 232 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 233 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. 234 '</script>'; 235 break; 236 case 3: 237 if($prev <> '') 238 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 239 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. 240 '</script>'; 241 break; 242 } 243 244 $Output .= 'Z této stránky můžete být automaticky přesměrování. Nastavit kam chcete být přesměrování si můžete v <a href="'. 245 $this->System->Link('/Options.php').'" title="Nastavení uživatele">Nastavení</a>'; 246 return($Output); 247 } 247 248 } -
trunk/Modules/Translation/TranslationList.php
r817 r831 184 184 ')'; 185 185 } 186 if($Filter['State'] == CompletionState::All) $Filter['SQL'] .= $UserFilter.$VersionFilter.''; 187 else if($Filter['State'] == CompletionState::NotTranslated) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 186 if($Filter['State'] == CompletionState::All) { 187 $Filter['SQL'] .= $UserFilter.$VersionFilter; 188 } else 189 if($Filter['State'] == CompletionState::NotTranslated) { 190 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 188 191 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 189 192 '(`Sub`.`Language` <> '.$this->System->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter. 190 193 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '. 191 194 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 192 else if($Filter['State'] == CompletionState::Translated) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 193 else if($Filter['State'] == CompletionState::NotFinished) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 195 } else 196 if($Filter['State'] == CompletionState::Translated) { 197 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 198 } else 199 if($Filter['State'] == CompletionState::NotFinished) { 200 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 194 201 ') AND (`T`.`Complete` = 0)'; 195 else if($Filter['State'] == CompletionState::Original) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 196 else if($Filter['State'] == CompletionState::NotFinishedNotTranslated) $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 202 } else 203 if($Filter['State'] == CompletionState::Original) { 204 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 205 } else 206 if($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 207 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 197 208 ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 198 ') AND (`T`.`Complete` = 0)' .199 '';200 elseif($Filter['State'] == CompletionState::Missing1) {209 ') AND (`T`.`Complete` = 0)'; 210 } else 211 if($Filter['State'] == CompletionState::Missing1) { 201 212 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 202 213 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 203 } 204 elseif($Filter['State'] == CompletionState::Missing2) {214 } else 215 if($Filter['State'] == CompletionState::Missing2) { 205 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 206 217 $Filter['SQL'] .= ' '. $WithoutAlter;
Note:
See TracChangeset
for help on using the changeset viewer.