Changeset 571 for trunk/Modules/Export
- Timestamp:
- Aug 26, 2013, 9:49:06 PM (11 years ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/Export.php
r564 r571 11 11 var $ClientVersion; 12 12 var $OrderByUserList; 13 var $TempDir; 14 var $SourceDir; 13 15 14 16 function Init() 15 17 { 16 18 $this->TempDir = dirname(__FILE__).'/../../'.$this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 19 if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 17 20 $this->TempDirRelative = $this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 18 if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 21 $this->SourceDir = dirname(__FILE__).'/../../'.$this->Config['Web']['SourceFolder']; 22 $this->SourceDirRelative = $this->Config['Web']['SourceFolder']; 23 if(!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true); 19 24 } 20 25 … … 27 32 // Filter selected users 28 33 $this->UserNames = ''; 29 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 34 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` '. 35 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '. 36 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 30 37 while($UserLine = $DbResult->fetch_assoc()) 31 38 { … … 90 97 "-- Generované tabulky: "; 91 98 92 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 99 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 100 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 93 101 while($Group = $DbResult->fetch_assoc()) 94 102 { … … 97 105 $Buffer .= "\n\n"; 98 106 99 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 107 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 108 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 100 109 while($Group = $DbResult->fetch_assoc()) 101 110 { … … 215 224 " <translation>\n"; 216 225 217 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 226 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 227 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 218 228 while($Group = $DbResult->fetch_assoc()) 219 229 { … … 233 243 if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column']; 234 244 if($Line[$GroupItem['Column']] != '') 235 $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'.$GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n"; 245 $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'. 246 $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n"; 236 247 } 237 248 $Buffer .= " </item>\n"; … … 251 262 $this->LoadFilters(); 252 263 253 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 264 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 265 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` '. 266 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 254 267 $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n"; 255 268 while($Group = $DbResult->fetch_assoc()) 256 269 { 257 270 $Output .= $Group['Name'].', '; 258 if(file_exists( '../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))271 if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 259 272 { 260 273 // Load string column index list 261 $DbResult2 = $this->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']); 274 $DbResult2 = $this->Database->query('SELECT * FROM `GroupItem` '. 275 'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']); 262 276 $ColumnIndexes = array(); 263 277 $ColumnFormat = array(); … … 276 290 // Open original DBC file 277 291 $SourceDBCFile = new DBCFile(); 278 $SourceDBCFile->OpenFile( '../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat);292 $SourceDBCFile->OpenFile($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); 279 293 280 294 // Create new DBC file … … 322 336 { 323 337 $Output .= $Progress."%\r"; 324 echo($Output);325 $Output = '';338 echo($Output); 339 $Output = ''; 326 340 $OldProgress = $Progress; 327 341 } 328 342 } 329 343 $NewDBCFile->Commit(); 330 } else $Output .= ShowMessage('Zdrojový soubor '. '../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n", MESSAGE_CRITICAL);344 } else $Output .= ShowMessage('Zdrojový soubor '.$this->SourceDirRelative.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n", MESSAGE_CRITICAL); 331 345 } 332 346 $Output .= 'Hotovo <br />'; … … 347 361 $Output .= $Group['Name'].'... '; 348 362 $File = new FileStream(); 349 $File->OpenFile( '../source/'.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua');363 $File->OpenFile($this->SourceDir.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua'); 350 364 $File2 = new FileStream(); 351 365 $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua'); … … 355 369 while($DbRow = $DbResult2->fetch_assoc()) 356 370 $LookupTable[$DbRow['ShortCut']] = $DbRow; 357 //print_r($LookupTable);358 371 359 372 while(!$File->EOF()) … … 419 432 $this->Creator = 'Chronos'; 420 433 $this->License = 'GNU/GPL'; 421 $this->Description = 'Allow parametric export translated texts to various supported output formats';434 $this->Description = 'Allow parametric export of translated texts to various supported output formats'; 422 435 $this->Dependencies = array(); 423 436 } -
trunk/Modules/Export/Page.php
r570 r571 51 51 while($Export = $DbResult->fetch_assoc()) 52 52 { 53 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">Zobrazit</a> <a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">Exportovat</a>'; 53 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">Zobrazit</a> '. 54 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">Exportovat</a>'; 54 55 if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 55 56 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
Note:
See TracChangeset
for help on using the changeset viewer.