Changeset 806 for trunk/Modules
- Timestamp:
- May 25, 2014, 12:14:02 AM (11 years ago)
- Location:
- trunk/Modules/Translation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Form.php
r752 r806 203 203 $Output .= '</td></tr>'; 204 204 205 //todo javascri tp205 //todo javascript 206 206 207 207 $Output .= '<script src="http://code.jquery.com/jquery-latest.js"></script>'. … … 209 209 $Output .= '$(document).ready(function() {'; 210 210 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 211 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/ Modules/Translation/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");';211 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 212 212 213 213 $Output .= '});'. … … 238 238 239 239 $Output .= '<table class="BaseTable">'. 240 '<tr><th> Translátor:</th><th>Nepřeložené</th><th>Přeložené</th>';240 '<tr><th>Překladač:</th><th>Nepřeložené</th><th>Přeložené</th>'; 241 241 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 242 242 if($TextItem['Visible'] == 1) -
trunk/Modules/Translation/LoadNames.php
r764 r806 1 1 <?php 2 include_once(dirname(__FILE__).'/../../includes/global.php');3 4 $System = new System();5 $System->DoNotShowPage = true;6 $System->Run();7 8 9 2 10 function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) { 11 global $System; 12 $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); 13 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 3 class PageLoadNames extends Page 4 { 5 function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) 6 { 7 $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); 8 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 14 9 15 // if (strlen($orig) < strlen($Text)-1) { 16 if ($Group <> '') { 17 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace.'" class="edit"><a class="edit" target="_NEW2" href="'.$System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 18 } else { 19 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace.'" class="edit"><a class="edit" target="_NEW2" href="'.$System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text); 20 } 21 // } 22 return ($Text); 10 // if (strlen($orig) < strlen($Text)-1) { 11 if ($Group <> '') 12 { 13 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace. 14 '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 15 } else { 16 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace. 17 '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text); 18 } 19 // } 20 return ($Text); 23 21 } 24 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) { 25 global $System; 26 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 27 28 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'.$System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 29 return ($Text); 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) 23 { 24 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 25 26 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'. 27 $this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 28 return ($Text); 30 29 } 31 30 … … 48 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 49 48 if ($Line[3] <> '') { 50 $Text = ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]);49 $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 51 50 52 51 } else { 53 $Text = ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]);52 $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 54 53 } 55 54 } … … 57 56 } 58 57 59 60 $Text = ''; 61 function LoadNames() { 62 global $System,$TranslationTree; 63 $Output = ''; 64 if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; 65 $Table = $TranslationTree[$GroupId]['TablePrefix']; 66 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); 67 $LineAJ = $DbResult->fetch_assoc(); 68 $Column = $_GET['Column']; 69 //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]]; 58 function LoadNames() 59 { 60 global $TranslationTree; 61 62 $Output = ''; 63 if(array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; 64 else return(ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL)); 65 if(!array_key_exists('ID', $_GET)) return(ShowMessage(T('ID not specified'), MESSAGE_CRITICAL)); 66 if(!array_key_exists('Column', $_GET)) return(ShowMessage(T('Column not specified'), MESSAGE_CRITICAL)); 67 $Table = $TranslationTree[$GroupId]['TablePrefix']; 68 $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); 69 $LineAJ = $DbResult->fetch_assoc(); 70 $Column = $_GET['Column']; 71 //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]]; 70 72 $Text = $LineAJ[$Column]; 71 73 $names = array(); 72 if ($ System->User->Licence(LICENCE_USER))74 if ($this->System->User->Licence(LICENCE_USER)) 73 75 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 74 76 { … … 83 85 } 84 86 //$LineAJ[$Column] 85 return ( ColorNames(htmlspecialchars($Text),$names));87 return ($this->ColorNames(htmlspecialchars($Text),$names)); 86 88 } 87 echo str_replace("\n", '<br/>',LoadNames()); 89 90 function Show() 91 { 92 $this->RawPage = true; 93 return(str_replace("\n", '<br/>', $this->LoadNames())); 94 } 95 } -
trunk/Modules/Translation/Translation.php
r765 r806 6 6 include_once(dirname(__FILE__).'/TranslationList.php'); 7 7 include_once(dirname(__FILE__).'/Progress.php'); 8 include_once(dirname(__FILE__).'/LoadNames.php'); 8 9 9 10 class ModuleTranslation extends AppModule … … 29 30 $this->System->RegisterPage('progress', 'PageProgress'); 30 31 $this->System->RegisterPage('TranslationList.php', 'PageTranslationList'); 32 $this->System->RegisterPage('LoadNames.php', 'PageLoadNames'); 31 33 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'), 32 34 'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS));
Note:
See TracChangeset
for help on using the changeset viewer.