Changeset 829
- Timestamp:
- Mar 25, 2015, 9:18:42 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Dictionary/Dictionary.php
r816 r829 34 34 class PageDictionary extends Page 35 35 { 36 37 function WriteTranslatNames($Text, $mode) 38 { 39 $Output = ''; 40 if ($mode == 0) $Output .= '..'.T('Found names of items, places and NPC'); 41 if ($mode == 1) $Output .= '..'.T('All untranslated'); 42 if ($mode == 2) $Output .= '..'.T('Untranslated'); 43 $Output .= '<table class="BaseTable">'; 44 $Output .= '<tr><th>'.T('Original').'</th>'.'<th>'.T('Translation').'</th></tr>'; 45 46 $TablesColumn = array 47 ( 48 'TextGameObject' => 'Name', 49 'TextCreature' => 'name', 50 'TextItem' => 'Name', 51 'TextTransport' => 'Name', 52 'TextAreaTriggerTeleport' => 'Name', 53 'TextAreaTriggerTavern' => 'Name', 54 'Dictionary' => 'Text', 55 'TextArea' => 'Name', 56 'TextAreaPOI' => 'Name', 57 'TextCharacterClass' => 'Name', 58 'TextCharacterRace' => 'Name1', 59 'TextItemSubClass' => 'Name', 60 'TextCreatureType' => 'Name', 61 ); 62 63 $buff = GetTranslatNames($Text,$mode,GetTranslatNamesArray()); 64 65 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 66 foreach($buff as $Line) { 36 function WriteTranslatNames($Text, $mode) 37 { 38 $Output = ''; 39 if ($mode == 0) $Output .= '..'.T('Found names of items, places and NPC'); 40 if ($mode == 1) $Output .= '..'.T('All untranslated'); 41 if ($mode == 2) $Output .= '..'.T('Untranslated'); 42 $Output .= '<table class="BaseTable">'; 43 $Output .= '<tr><th>'.T('Original').'</th>'.'<th>'.T('Translation').'</th></tr>'; 44 45 // TODO: Remove static table names in code. They should be controlled from database 46 $TablesColumn = array 47 ( 48 'TextGameObject' => 'Name', 49 'TextCreature' => 'name', 50 'TextItem' => 'Name', 51 'TextTransport' => 'Name', 52 'TextAreaTriggerTeleport' => 'Name', 53 'TextAreaTriggerTavern' => 'Name', 54 'Dictionary' => 'Text', 55 'TextArea' => 'Name', 56 'TextAreaPOI' => 'Name', 57 'TextCharacterClass' => 'Name', 58 'TextCharacterRace' => 'Name1', 59 'TextItemSubClass' => 'Name', 60 'TextCreatureType' => 'Name', 61 ); 62 63 $buff = GetTranslatNames($Text,$mode,GetTranslatNamesArray()); 64 65 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 66 foreach($buff as $Line) 67 { 67 68 if ($mode == 0) 68 69 { … … 76 77 { 77 78 $Output .= '<tr><td>'.$Line[2].'</td>'; 78 79 if ($Line[3] <> '') $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&ID='.$Line[0]).'">'.$Line[3].'</a></td></tr>'; 79 80 else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&ID='.$Line[0]).'">Překládat</a></td></tr>'; 80 81 } 81 }82 $Output .= '</table>';83 return($Output);84 }85 86 function DictionaryInsert()87 {88 $Output = '';89 if($this->System->User->Licence(LICENCE_USER))90 {91 $Output .= '<form action="?action=save" method="post">'.82 } 83 $Output .= '</table>'; 84 return($Output); 85 } 86 87 function DictionaryInsert() 88 { 89 $Output = ''; 90 if($this->System->User->Licence(LICENCE_USER)) 91 { 92 $Output .= '<form action="?action=save" method="post">'. 92 93 '<fieldset><legend>Vložení nového slova</legend>'. 93 94 '<table><tr><td>'. … … 100 101 '</fieldset>'. 101 102 '</form>'; 102 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 103 return($Output); 104 } 105 106 function DictionarySave() 107 { 108 if($this->System->User->Licence(LICENCE_USER)) 109 { 110 if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) 111 { 112 // Check if original text exists and determine entry id 113 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '. 114 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']); 103 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 104 return($Output); 105 } 106 107 function DictionarySave() 108 { 109 if($this->System->User->Licence(LICENCE_USER)) 110 { 111 if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) 112 { 113 // Check if original text exists and determine entry id 114 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '. 115 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']); 116 if($DbResult->num_rows > 0) 117 { 118 $DbRow = $DbResult->fetch_assoc(); 119 $Entry = $DbRow['Entry']; 120 } else 121 { 122 $DbResult = $this->Database->query('SELECT MAX(`Entry`) FROM `Dictionary`'); 123 $DbRow = $DbResult->fetch_row(); 124 $Entry = $DbRow[0] + 1; 125 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 126 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$this->System->Config['OriginalLanguage'].');'); 127 } 128 129 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 130 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id); 131 if($DbResult->num_rows > 0) 132 { 133 $DbRow = $DbResult->fetch_assoc(); 134 $this->Database->query('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", '. 135 '`Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']); 136 } else 137 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 138 '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'. 139 $_POST['Description'].'", '.$this->System->User->Id.', '.$_POST['Language'].')'); 140 $Output = ShowMessage('Záznam byl uložen!'); 141 } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL); 142 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 143 return($Output); 144 } 145 146 function DictionaryRemove() 147 { 148 if($this->System->User->Licence(LICENCE_USER)) 149 { 150 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 151 $Output = ShowMessage(T('Record removed')); 152 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 153 return($Output); 154 } 155 156 function DictionaryModify() 157 { 158 if($this->System->User->Licence(LICENCE_USER)) 159 { 160 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); 115 161 if($DbResult->num_rows > 0) 116 162 { 117 163 $DbRow = $DbResult->fetch_assoc(); 118 $Entry = $DbRow['Entry']; 119 } else 120 { 121 $DbResult = $this->Database->query('SELECT MAX(`Entry`) FROM `Dictionary`'); 122 $DbRow = $DbResult->fetch_row(); 123 $Entry = $DbRow[0] + 1; 124 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 125 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$this->System->Config['OriginalLanguage'].');'); 126 } 127 128 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 129 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id); 130 if($DbResult->num_rows > 0) 131 { 132 $DbRow = $DbResult->fetch_assoc(); 133 $this->Database->query('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", '. 134 '`Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']); 135 } else 136 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 137 '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'. 138 $_POST['Description'].'", '.$this->System->User->Id.', '.$_POST['Language'].')'); 139 $Output = ShowMessage('Záznam byl uložen!'); 140 } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL); 141 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 142 return($Output); 143 } 144 145 function DictionaryRemove() 146 { 147 if($this->System->User->Licence(LICENCE_USER)) 148 { 149 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 150 $Output = ShowMessage(T('Record removed')); 151 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 152 return($Output); 153 } 154 155 function DictionaryModify() 156 { 157 if($this->System->User->Licence(LICENCE_USER)) 158 { 159 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); 160 if($DbResult->num_rows > 0) 161 { 162 $DbRow = $DbResult->fetch_assoc(); 163 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '. 164 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$this->System->Config['OriginalLanguage'].')'); 165 $DbRow2 = $DbResult->fetch_assoc(); 166 $Output = '<form action="?action=save" method="post">'. 167 '<fieldset><legend>Upravení slova</legend>'. 168 '<input type="hidden" name="id" value="'.$_GET['id'].'"/>'. 169 '<table><tr><td>'. 170 'Původní anglické slovo:</td><td><input type="text" name="Original" value="'.$DbRow2['Text'].'" /></td></tr>'. 171 '<tr><td>Přeložené:</td><td><input type="text" name="Translated" value="'.$DbRow['Text'].'" /></td></tr>'. 172 '<tr><td>'.T('Language').':</td><td>'.WriteLanguages($DbRow['Language']).'</td></tr>'. 173 '<tr><td>'.T('Description').':</td><td><input type="text" name="Description" value="'.$DbRow['Description'].'" /></td></tr>'. 174 '<tr><td colspan="2"><input type="submit" value="'.T('Save').'" /></td></tr>'. 175 '</td></tr></table>'. 176 '</fieldset>'. 177 '</form>'; 178 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 179 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 180 return($Output); 181 } 182 183 function DictionaryGroup() 184 { 185 global $TranslationTree; 186 187 $Output = ''; 188 $GroupId = LoadGroupIdParameter(); 189 if(array_key_exists('mode', $_GET)) $mode = $_GET['mode']; 190 else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated 191 $Table = $TranslationTree[$GroupId]['TablePrefix']; 192 193 if(array_key_exists('ID', $_GET)) 194 { 195 $TextID = $_GET['ID']; 196 $Output .= T('Translated names related to translation text').': <a target="_NEW" href="'.$this->System->Link('/form.php?group='.$GroupId.'&ID='.$TextID).'">'.$TextID.'</a><br />'. 164 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '. 165 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$this->System->Config['OriginalLanguage'].')'); 166 $DbRow2 = $DbResult->fetch_assoc(); 167 $Output = '<form action="?action=save" method="post">'. 168 '<fieldset><legend>Upravení slova</legend>'. 169 '<input type="hidden" name="id" value="'.$_GET['id'].'"/>'. 170 '<table><tr><td>'. 171 'Původní anglické slovo:</td><td><input type="text" name="Original" value="'.$DbRow2['Text'].'" /></td></tr>'. 172 '<tr><td>Přeložené:</td><td><input type="text" name="Translated" value="'.$DbRow['Text'].'" /></td></tr>'. 173 '<tr><td>'.T('Language').':</td><td>'.WriteLanguages($DbRow['Language']).'</td></tr>'. 174 '<tr><td>'.T('Description').':</td><td><input type="text" name="Description" value="'.$DbRow['Description'].'" /></td></tr>'. 175 '<tr><td colspan="2"><input type="submit" value="'.T('Save').'" /></td></tr>'. 176 '</td></tr></table>'. 177 '</fieldset>'. 178 '</form>'; 179 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 180 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 181 return($Output); 182 } 183 184 function DictionaryGroup() 185 { 186 global $TranslationTree; 187 188 $Output = ''; 189 $GroupId = LoadGroupIdParameter(); 190 if(array_key_exists('mode', $_GET)) $mode = $_GET['mode']; 191 else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated 192 $Table = $TranslationTree[$GroupId]['TablePrefix']; 193 194 if(array_key_exists('ID', $_GET)) 195 { 196 $TextID = $_GET['ID']; 197 $Output .= T('Translated names related to translation text').': <a target="_NEW" href="'.$this->System->Link('/form.php?group='.$GroupId.'&ID='.$TextID).'">'.$TextID.'</a><br />'. 197 198 '<a href="?action=group&mode=1&group='.$GroupId.'&ID='.$TextID.'" title="'.T('Show all similar results').'">'.T('All').'</a> '. 198 199 '<a href="?action=group&mode=0&group='.$GroupId.'&ID='.$TextID.'" title="'.T('Show all exact results').'">'.T('Exact').'</a> '. 199 200 '<a href="?action=group&mode=2&group='.$GroupId.'&ID='.$TextID.'" title="'.T('Show all untranslated').'">'.T('Untranslated').'</a> '; 200 $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID); 201 $Line = $DbResult->fetch_assoc(); 202 if(!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL); 203 else 204 { 205 $Text = ''; 206 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 207 $Text .= ' '.$Line[$TextItem['Column']]; 208 $Output .= $this->WriteTranslatNames($Text, $mode); 209 } 210 } 211 return($Output); 212 } 213 214 function DictionaryShow() 215 { 216 global $LanguageList; 217 218 $Output = '<form action="?" method="get" style="margin: 0px; padding: 0px;">'. 219 '<table style="width: 100%; height: 100%;">'; 220 221 if(array_key_exists('search', $_GET)) $Search = $_GET['search']; 222 else $Search = ''; 223 224 $Output .= '<tr><td> 225 <input type="text" value="'.$Search.'" name="search" size="30" /> 226 <input type="submit" value="'.T('Search').'" />'; 227 if($this->System->User->Licence(LICENCE_USER)) 228 $Output .= ' <a href="?action=insert">'.T('Add word').'</a>'; 229 230 $Output .= '</td></tr>'. 231 '<tr><td>'.T('Language').': '; 232 $Lang = '<a href="?language=">'.T('All').'</a>'; 233 if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 234 else $Output .= $Lang; 235 foreach($LanguageList as $Language) 236 if($Language['Enabled'] == 1) 237 { 238 $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>'; 239 if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 240 else $Output .= $Lang; 241 } 242 $Output .= '</td></tr>'. 243 '<tr><td>'; 244 //<div style="overflow: auto; width: 100%; height: 100%;">'); 245 246 if(!is_numeric($_SESSION['language'])) $LanguageFilter = ''; 247 else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')'; 248 249 if($Search <> '') 250 { 251 $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. 252 ' (LOWER(`T2`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. 253 '(LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%"))'; 254 } else $Condition = ''; 255 $sql = 'SELECT `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId`, '. 201 $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID); 202 $Line = $DbResult->fetch_assoc(); 203 if(!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL); 204 else 205 { 206 $Text = ''; 207 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 208 $Text .= ' '.$Line[$TextItem['Column']]; 209 $Output .= $this->WriteTranslatNames($Text, $mode); 210 } 211 } 212 return($Output); 213 } 214 215 function DictionaryShow() 216 { 217 global $LanguageList; 218 219 $Output = '<form action="?" method="get" style="margin: 0px; padding: 0px;">'. 220 '<table style="width: 100%; height: 100%;">'; 221 222 if(array_key_exists('search', $_GET)) $Search = $_GET['search']; 223 else $Search = ''; 224 225 $Output .= '<tr><td> 226 <input type="text" value="'.$Search.'" name="search" size="30" /> 227 <input type="submit" value="'.T('Search').'" />'; 228 if($this->System->User->Licence(LICENCE_USER)) 229 $Output .= ' <a href="?action=insert">'.T('Add word').'</a>'; 230 231 $Output .= '</td></tr>'. 232 '<tr><td>'.T('Language').': '; 233 $Lang = '<a href="?language=">'.T('All').'</a>'; 234 if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 235 else $Output .= $Lang; 236 foreach($LanguageList as $Language) 237 if($Language['Enabled'] == 1) 238 { 239 $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>'; 240 if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 241 else $Output .= $Lang; 242 } 243 $Output .= '</td></tr>'. 244 '<tr><td>'; 245 246 if(!is_numeric($_SESSION['language'])) $LanguageFilter = ''; 247 else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')'; 248 249 if($Search <> '') 250 { 251 $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. 252 ' (LOWER(`T2`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. 253 '(LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%"))'; 254 } else $Condition = ''; 255 $sql = 'SELECT `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId`, '. 256 256 '`Language`.`Name` AS `LangName`, `T1`.`Id` AS `Id`, '. 257 257 '`T1`.`Entry`, `T2`.`Text` AS `Original`, `T1`.`Text` AS `Translated`, `T1`.`Description` '. … … 263 263 $LanguageFilter.$Condition; 264 264 265 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');266 $DbRow = $DbResult->fetch_row();267 $PageList = GetPageList($DbRow[0]);268 269 $Output .= $PageList['Output'];270 271 if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];272 else $LanguageName = 'Překlad';273 $TableColumns = array(274 array('Name' => 'Original', 'Title' => T('English')),275 array('Name' => 'Translated', 'Title' => $LanguageName),276 );277 if(!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language'));278 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description'));279 $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator'));280 if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));281 $Order = GetOrderTableHeader($TableColumns, 'Original');282 $Output .= '<table class="BaseTable">'.$Order['Output'];283 284 $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit'];285 $DbResult = $this->Database->query($sql_page);286 while($Line = $DbResult->fetch_assoc())287 {288 $Output .= '<tr>'.289 '<td>'.$Line['Original'].'</td>'.290 '<td><strong>'.$Line['Translated'].'</strong></td>';291 if(!is_numeric($_SESSION['language'])) $Output .= '<td>'.$Line['LangName'].'</td>';292 $Output .= '<td>'.$Line['Description'].'</td>'.293 '<td><a href="'.$this->System->Link('/user.php?user='.$Line['UserId']).'">'.$Line['UserName'].'</a></td>';294 if($this->System->User->Licence(LICENCE_USER))295 {296 if($Line['UserId'] == $this->System->User->Id)297 $Output .= '<td><a href="?action=remove&id='.$Line['Id'].'" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'.298 ' <a href="?action=modify&id='.$Line['Id'].'">'.T('Modify').'</a></td>';299 else $Output .= '<td></td>';300 }301 $Output .= '</tr>';302 }303 $Output .= '</table>'.265 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`'); 266 $DbRow = $DbResult->fetch_row(); 267 $PageList = GetPageList($DbRow[0]); 268 269 $Output .= $PageList['Output']; 270 271 if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 272 else $LanguageName = 'Překlad'; 273 $TableColumns = array( 274 array('Name' => 'Original', 'Title' => T('English')), 275 array('Name' => 'Translated', 'Title' => $LanguageName), 276 ); 277 if(!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language')); 278 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description')); 279 $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator')); 280 if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action')); 281 $Order = GetOrderTableHeader($TableColumns, 'Original'); 282 $Output .= '<table class="BaseTable">'.$Order['Output']; 283 284 $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit']; 285 $DbResult = $this->Database->query($sql_page); 286 while($Line = $DbResult->fetch_assoc()) 287 { 288 $Output .= '<tr>'. 289 '<td>'.$Line['Original'].'</td>'. 290 '<td><strong>'.$Line['Translated'].'</strong></td>'; 291 if(!is_numeric($_SESSION['language'])) $Output .= '<td>'.$Line['LangName'].'</td>'; 292 $Output .= '<td>'.$Line['Description'].'</td>'. 293 '<td><a href="'.$this->System->Link('/user.php?user='.$Line['UserId']).'">'.$Line['UserName'].'</a></td>'; 294 if($this->System->User->Licence(LICENCE_USER)) 295 { 296 if($Line['UserId'] == $this->System->User->Id) 297 $Output .= '<td><a href="?action=remove&id='.$Line['Id'].'" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'. 298 ' <a href="?action=modify&id='.$Line['Id'].'">'.T('Modify').'</a></td>'; 299 else $Output .= '<td></td>'; 300 } 301 $Output .= '</tr>'; 302 } 303 $Output .= '</table>'. 304 304 $PageList['Output']. 305 '</td></tr>'. 306 '</table></form>'; 307 return($Output); 305 '</td></tr>'. 306 '</table></form>'; 307 return($Output); 308 } 309 310 function Show() 311 { 312 global $LanguageList; 313 314 $this->Title = T('Dictionary'); 315 316 $LanguageList = GetLanguageList(); 317 318 if(!isset($_SESSION['language'])) 319 { 320 if($this->System->User->Licence(LICENCE_USER)) 321 { 322 $_SESSION['language'] = $this->System->User->Language; 323 } else $_SESSION['language'] = ''; 324 } 325 if(array_key_exists('language', $_GET)) 326 { 327 if($_GET['language'] == '') $_SESSION['language'] = ''; 328 else $_SESSION['language'] = $_GET['language'] * 1; 329 } 330 331 $Output = '<h3>'.T('Dictionary').'</h3>'; 332 333 $ShowList = true; 334 if(array_key_exists('action', $_GET)) 335 { 336 if($_GET['action'] == 'group') 337 { 338 $Output .= $this->DictionaryGroup(); 339 $ShowList = false; 340 } 341 else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert(); 342 else if($_GET['action'] == 'save') $Output .= $this->DictionarySave(); 343 else if($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove(); 344 else if($_GET['action'] == 'modify') $Output .= $this->DictionaryModify(); 345 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 346 } 347 if($ShowList == true) $Output .= $this->DictionaryShow(); 348 return($Output); 349 } 308 350 } 309 310 function Show()311 {312 global $LanguageList;313 314 $this->Title = T('Dictionary');315 316 $LanguageList = GetLanguageList();317 318 if(!isset($_SESSION['language']))319 {320 if($this->System->User->Licence(LICENCE_USER))321 {322 $_SESSION['language'] = $this->System->User->Language;323 } else $_SESSION['language'] = '';324 }325 if(array_key_exists('language', $_GET)) {326 if($_GET['language'] == '') $_SESSION['language'] = '';327 else $_SESSION['language'] = $_GET['language'] * 1;328 }329 330 $Output = '<h3>'.T('Dictionary').'</h3>';331 332 $ShowList = true;333 if(array_key_exists('action', $_GET))334 {335 if($_GET['action'] == 'group') {336 $Output .= $this->DictionaryGroup();337 $ShowList = false;338 }339 else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert();340 else if($_GET['action'] == 'save') $Output .= $this->DictionarySave();341 else if($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove();342 else if($_GET['action'] == 'modify') $Output .= $this->DictionaryModify();343 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL);344 }345 if($ShowList == true) $Output .= $this->DictionaryShow();346 return($Output);347 }348 } -
trunk/Modules/Referrer/Referrer.php
r816 r829 90 90 $Output .= $Banner.' <textarea rows="2" cols="30">'.htmlspecialchars($Banner).'</textarea><br />'; 91 91 $Output .= $BannerSmall.' <textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />'; 92 93 if($this->System->User->Licence(LICENCE_ADMIN)) { 92 94 93 95 $MonthAge = 3; … … 153 155 $Output .= '</table>'; 154 156 $Output .= $PageList['Output']; 157 158 } 155 159 return($Output); 156 160 } -
trunk/Modules/User/Registration.php
r816 r829 8 8 else $Human = false; 9 9 if(array_key_exists('user', $_POST)) $UserName = $_POST['user']; 10 else $UserName = '';10 else $UserName = ''; 11 11 if(array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 12 else $Email = '';12 else $Email = ''; 13 13 if(array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 14 else $Team = '';14 else $Team = ''; 15 15 if(array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 16 else $Language = 1;16 else $Language = 1; 17 17 18 $Output = '<form action="?" method="post" >18 $Output = '<form action="?" method="post" class="Form"> 19 19 <fieldset><legend>'.T('New user registration').'</legend> 20 20 <table> 21 21 <tr><td colspan="2">Pozorně si přečtěte <a href="info.php">pokyny k překladu</a> a řiďte se jimi. Překládat je nutno včetně háčků a čárek!<br/><br/></td></tr> 22 22 <tr> 23 <t d>Jsi člověk? </td>';23 <th class="Left">Jsi člověk?</th>'; 24 24 if($Human) $Checked = ' checked="checked"'; 25 else $Checked = '';25 else $Checked = ''; 26 26 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> 27 27 </tr> 28 28 <tr> 29 <t d>Jméno:</td>29 <th class="Left">Jméno:</th> 30 30 <td><input type="text" name="user" value="'.$UserName.'"/></td> 31 31 </tr> 32 32 <tr> 33 <t d>Heslo:</td>33 <th class="Left">Heslo:</th> 34 34 <td><input type="password" name="pass" /></td> 35 35 </tr> 36 36 <tr> 37 <t d>Potvrzení Hesla: </td>37 <th class="Left">Potvrzení Hesla:</th> 38 38 <td><input type="password" name="pass2" /></td> 39 39 </tr> 40 40 <tr> 41 <t d>Email: </td>41 <th class="Left">Email:</th> 42 42 <td><input type="text" name="Email" value="'.$Email.'"/></td> 43 43 </tr> 44 44 <tr> 45 <t d>Normálně budu překládat do: </td>45 <th class="Left">Normálně budu překládat do:</th> 46 46 <td>'.WriteLanguages($Language).'</td> 47 47 </tr> 48 48 <tr> 49 <t d>Patřím do týmu: </td>';49 <th class="Left">Patřím do týmu:</th>'; 50 50 if($Team == '') $Selected = ' selected="selected"'; 51 else $Selected = ''; 52 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option> 53 '; 51 else $Selected = ''; 52 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option>'; 54 53 $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`'); 55 54 while($Line = $DbResult->fetch_assoc()) … … 59 58 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.$Line['Name'].'</option>'; 60 59 } 61 $Output .= '</select></td> 62 </tr>'; 60 $Output .= '</select>'; 63 61 $Output .= '</td></tr>'. 64 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection('').'</td></tr>';62 '<tr><th class="Left">Upřednostněná verze klienta:</th><td>'.ClientVersionSelection('').'</td></tr>'; 65 63 66 $Output .= '<tr><td>';67 64 $Query = 'SELECT * FROM UserTagType'; 68 65 $DbResult = $this->Database->query($Query); 69 $Output .= 'Vyberte pravidla, kterými se při překladu chcete řídit:</td><td>'; 70 while ($UserTag = $DbResult->fetch_array()) { 66 $Output .= '<tr><th class="Left">'. 67 'Vyberte pravidla, kterými se při překladu chcete řídit:</th><td>'; 68 while ($UserTag = $DbResult->fetch_array()) 69 { 71 70 $checked = false; 72 71 … … 77 76 78 77 $Output .= '<tr> 79 <th ><input type="submit" value="Registrovat" /></th>78 <th colspan="2" class="Center"><input type="submit" value="Registrovat" /></th> 80 79 </tr> 81 80 </table></fieldset></form>'; … … 128 127 $ShowForm = false; 129 128 130 //tag129 // User tags 131 130 $Query = 'SELECT * FROM UserTagType'; 132 131 $DbResult = $this->Database->query($Query); -
trunk/Modules/User/User.php
r816 r829 60 60 function Show() 61 61 { 62 $Output = '<form action="'.$this->System->Link('/?action=login').'" method="post" >'.62 $Output = '<form action="'.$this->System->Link('/?action=login').'" method="post" class="Form">'. 63 63 '<fieldset><legend>'.T('Login').'</legend> 64 64 <table> 65 65 <tr> 66 <t d>'.T('Name').':</td><td><input type="text" name="LoginUser" size="13" /></td>67 </tr> 68 <tr> 69 <t d>'.T('Password').':</td><td><input type="password" name="LoginPass" size="13" /></td>70 </tr> 71 <tr> 72 <t d>'.T('Stay logged').':</td><td><input type="checkbox" name="StayLogged" /></td>73 </tr> 74 <tr> 75 <th ><input type="submit" value="'.T('Do login').'" /></th>66 <th class="Left">'.T('Name').':</th><td><input type="text" name="LoginUser" size="13" /></td> 67 </tr> 68 <tr> 69 <th class="Left">'.T('Password').':</th><td><input type="password" name="LoginPass" size="13" /></td> 70 </tr> 71 <tr> 72 <th class="Left">'.T('Stay logged').':</th><td><input type="checkbox" name="StayLogged" /></td> 73 </tr> 74 <tr> 75 <th class="Center"colspan="2"><input type="submit" value="'.T('Do login').'" /></th> 76 76 </tr> 77 77 </table> -
trunk/includes/Version.php
r828 r829 6 6 // and system will need database update. 7 7 8 $Revision = 82 8; // Subversion revision8 $Revision = 829; // Subversion revision 9 9 $DatabaseRevision = 811; // Database structure revision 10 $ReleaseTime = '2015-03-2 0';10 $ReleaseTime = '2015-03-25'; -
trunk/style/style.css
r828 r829 574 574 margin-left: auto; 575 575 margin-right: auto; 576 } 577 578 .Form tr .Left 576 text-align: center; 577 } 578 579 .Form fieldset 580 { 581 display: inline-block; 582 text-align: left; 583 } 584 585 .Form fieldset table tr .Left 579 586 { 580 587 text-align: right; 581 588 font-weight: normal; 582 } 589 padding-right: 6px; 590 } 591 592 .Form fieldset table tr .Center 593 { 594 text-align: center; 595 font-weight: normal; 596 }
Note:
See TracChangeset
for help on using the changeset viewer.