Changeset 818 for trunk/Modules/Export


Ignore:
Timestamp:
Feb 23, 2015, 12:32:54 AM (10 years ago)
Author:
chronos
Message:
  • Modified: Do not link to external jquery script which can change in future and break function.
Location:
trunk/Modules/Export
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/ExportOutput.php

    r816 r818  
    99function CreateZipFromDir(&$Zip, $Path, $ZipPath)
    1010{
    11   //echo($Path.'<br />');
    1211  $FileList = scandir($Path);
    1312  foreach($FileList as $FileName)
     
    1514    if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
    1615    {
    17       //echo($Path.$FileName.'<br />');
    1816      if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
    1917        else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName);
     
    226224}
    227225
    228 function ShowProgress($Export) {
    229     global $System;
    230     $Output = '';
    231     $Output .= 'Fronta zpracování exportů. Zobrazuje procenta dokončení: <br /><br />';
    232 
    233 
    234       $Output .= '<script src="http://code.jquery.com/jquery-latest.js"></script>'.
    235                '<script>'.
    236                   '$(document).ready(function() {'.
    237                   'var refreshId = setInterval(function() {'.
    238                   '$("#progress").load("'.$System->Link('/Modules/Export/Progress.php?RedirectId='.$_GET['ExportId']).'"); '.
    239                   '}, 1000);'.
    240                   '});'.
    241                '</script>';
    242 
    243 
    244       $Output .= ' <strong><div id="progress"></div></strong><br />';
    245 
    246     $DbResult = $System->Database->query('SELECT * FROM `ExportTask` LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '.
    247     ' (`Export`.`OutputType` = 9 OR  `Export`.`OutputType` = 10 ) AND `TimeFinish` IS NULL AND `TimeStart` < NOW()-10000');
    248     if($DbResult->num_rows > 0) {
    249       $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR);
    250 
    251     }
    252     return ($Output);
     226function ShowProgress($Export)
     227{
     228  global $System;
     229
     230  $Output = '';
     231  $Output .= 'Fronta zpracování exportů. Zobrazuje procenta dokončení: <br /><br />';
     232
     233  $Output .= '<script src="'.$System->Link('/style/jquery.js').'"></script>'.
     234    '<script>'.
     235    '$(document).ready(function() {'.
     236    'var refreshId = setInterval(function() {'.
     237    '$("#progress").load("'.$System->Link('/Modules/Export/Progress.php?RedirectId='.$_GET['ExportId']).'"); '.
     238    '}, 1000);'.
     239    '});'.
     240    '</script>';
     241
     242  $Output .= ' <strong><div id="progress"></div></strong><br />';
     243
     244  $DbResult = $System->Database->query('SELECT * FROM `ExportTask` '.
     245    'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` '.
     246    'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND (`TimeFinish` IS NULL) AND (`TimeStart` < (NOW() - 10000))');
     247  if($DbResult->num_rows > 0)
     248  {
     249    $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR);
     250  }
     251  return ($Output);
    253252}
    254253
     
    285284  {
    286285    $Output .= '<strong>Souhrný EXE balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe').'">Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe</a></strong><br/>';
    287 
    288286  } else {
    289 
    290287    $Output .= ShowProgress($Export);
    291288  }
  • trunk/Modules/Export/Progress.php

    r816 r818  
    33include_once(dirname(__FILE__).'/../../includes/global.php');
    44
    5   $System = new System();
    6   $System->DoNotShowPage = true;
    7   $System->Run();
     5$System = new System();
     6$System->DoNotShowPage = true;
     7$System->Run();
    88
     9$Output = '';
     10if(!array_key_exists('RedirectId', $_GET)) exit;
    911
    10     $Output = '';
    11     $DbResult = $System->Database->query('SELECT * FROM `ExportTask`'.
    12     ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE  (`Export`.`OutputType` = 9 OR  `Export`.`OutputType` = 10 ) AND `TimeFinish` IS NULL  OR `Export` ='.$_GET['RedirectId'].' ORDER BY `Progress` DESC');// `Export`='.$Export->Id
    13     while($Task = $DbResult->fetch_assoc()) {
    14       $Export = '<a href="'.$System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>';
    15       if ($_GET['RedirectId'] == $Task['Export'])
    16         $Export = ''.$Export.' (tento)';
    17       $Output .= ' <strong>Export '.$Export.': <div id="progress'.$Task['Export'].'">'.ProgressBar(300, $Task['Progress']).'</div></strong><br />';
    18       if ( $Task['Progress'] > 99 )   echo '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
     12$DbResult = $System->Database->query('SELECT * FROM `ExportTask` '.
     13 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '.
     14 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '.
     15 '(`TimeFinish` IS NULL) OR (`Export` ='.($_GET['RedirectId'] * 1).') ORDER BY `Progress` DESC'); // `Export`='.$Export->Id
     16while($Task = $DbResult->fetch_assoc())
     17{
     18  $Export = '<a href="'.$System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>';
     19  if ($_GET['RedirectId'] == $Task['Export'])
     20    $Export = ''.$Export.' (tento)';
     21  $Output .= ' <strong>Export '.$Export.': <div id="progress'.$Task['Export'].'">'.ProgressBar(300, $Task['Progress']).'</div></strong><br />';
     22  if($Task['Progress'] > 99)
     23    echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    1924      'setTimeout("parent.location.href=\''.$System->Link('/export/?Action=View&Tab=7&ExportId='.$_GET['RedirectId']).'\'", 500)'.
    20       '</script>';
    21     }
     25      '</script>');
     26}
    2227
    23     echo $Output;
    24     //echo ''.ProgressBar(300, $Task['Progress']).'';
    25 
     28echo($Output);
     29//echo ''.ProgressBar(300, $Task['Progress']).'';
Note: See TracChangeset for help on using the changeset viewer.