public function btnExport_Click($strFormId, $strControlId, $strParameter) { if (!$this->fileToUpload->Display) { $this->fileToUpload->Display = true; return false; } $objFileImporter = NarroFileType::GetFileImporter($this->objFile->TypeId); $objFileImporter->User = QApplication::$User; $objFileImporter->Project = $this->objFile->Project; $objFileImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE); $objFileImporter->TargetLanguage = QApplication::$TargetLanguage; $objFileImporter->File = $this->objFile; $strTempFileName = tempnam(__TMP_PATH__, QApplication::$TargetLanguage->LanguageCode); if (file_exists($this->fileToUpload->File)) { $objFileImporter->ExportFile($this->fileToUpload->File, $strTempFileName); unlink($this->fileToUpload->File); } else { $objFileImporter->ExportFile($this->objFile->Project->DefaultTemplatePath . $this->objFile->FilePath, $strTempFileName); } ob_clean(); header(sprintf('Content-Disposition: attachment; filename="%s"', $this->objFile->FileName)); readfile($strTempFileName); unlink($strTempFileName); exit; }
public function btnImport_Click($strFormId, $strControlId, $strParameter) { if (!$this->fileToUpload->Display) { $this->fileToUpload->Display = true; return false; } $objFileImporter = NarroFileType::GetFileImporter($this->objNarroFile->TypeId); $objFileImporter->User = QApplication::$User; $objFileImporter->Project = $this->objNarroFile->Project; $objFileImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE); $objFileImporter->TargetLanguage = QApplication::$TargetLanguage; $objFileImporter->CheckEqual = true; $objFileImporter->File = $this->objNarroFile; $objFileImporter->OnlySuggestions = !QApplication::HasPermissionForThisLang('Can approve', $this->objNarroFile->ProjectId); $objFileImporter->ApproveAlreadyApproved = QApplication::HasPermissionForThisLang('Can approve', $this->objNarroFile->ProjectId); $objFileImporter->Approve = QApplication::HasPermissionForThisLang('Can approve', $this->objNarroFile->ProjectId); $strTempFileName = tempnam(__TMP_PATH__, QApplication::$TargetLanguage->LanguageCode); $objFileImporter->ImportFile($this->objNarroFile->Project->DefaultTemplatePath . $this->objNarroFile->FilePath, $this->fileToUpload->File); }
public function __construct($objNarroProject = null, $objParentObject, $strControlId = null) { // Call the Parent try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // Call SetupNarroProject to either Load/Edit Existing or Create New $this->SetupNarroProject($objNarroProject); // Create/Setup Controls for NarroProject's Data Fields $this->lblMessage_Create(); $this->lstProjectCategory_Create(); $this->lstProjectCategory->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId); $this->txtProjectName_Create(); $this->txtProjectName->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId); $this->lstProjectType_Create(); $this->lstProjectType->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId); $this->txtProjectDescription_Create(); $this->txtProjectDescription->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId); $this->txtActive_Create(); if (count(NarroProject::$AvailablePreferences) && $this->objProject->ProjectId) { $this->pnlPreferences = new NarroProjectPreferencesPanel($this->objProject, $this); } if (QApplication::HasPermission('Can import project', $this->objProject->ProjectId)) { $this->pnlTextsSource = new NarroProjectTextSourcePanel($this->objProject, NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE), $this); } // Create/Setup ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References // Create/Setup Button Action controls $this->btnSave_Create(); $this->btnReset_Create(); $this->btnCancel_Create(); $this->btnDelete_Create(); $this->strTemplate = __NARRO_INCLUDES__ . '/narro/panel/NarroProjectEditPanel.tpl.php'; }
} QApplication::$User = $objUser; $objProject = NarroProject::Load($intProjectId); if (!$objProject instanceof NarroProject) { NarroLogger::LogInfo(sprintf('Project with id=%s does not exist in the database.', $intProjectId)); return false; } $objLanguage = NarroLanguage::LoadByLanguageCode($strTargetLanguage); if (!$objLanguage instanceof NarroLanguage) { NarroLogger::LogInfo(sprintf('Language %s does not exist in the database.', $strTargetLanguage)); return false; } QApplication::$TargetLanguage = $objLanguage; $objNarroImporter->TargetLanguage = $objLanguage; NarroLogger::LogInfo(sprintf('Target language is %s', $objNarroImporter->TargetLanguage->LanguageName)); $objNarroImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode($strSourceLanguage); if (!$objNarroImporter->SourceLanguage instanceof NarroLanguage) { NarroLogger::LogInfo(sprintf('Language %s does not exist in the database.', $strSourceLanguage)); return false; } NarroLogger::LogInfo(sprintf('Source language is %s', $objNarroImporter->SourceLanguage->LanguageName)); $objNarroImporter->Project = $objProject; $objNarroImporter->User = $objUser; if (array_search('--template-directory', $argv) !== false) { $objNarroImporter->TemplatePath = $argv[array_search('--template-directory', $argv) + 1]; } else { $objNarroImporter->TemplatePath = $objNarroImporter->Project->DefaultTemplatePath; } if (array_search('--translation-directory', $argv) !== false) { $objNarroImporter->TranslationPath = $argv[array_search('--translation-directory', $argv) + 1]; } else {
public static function InitializeLanguage() { global $argv; if (strstr($_SERVER['REQUEST_URI'], '_devtools')) { return false; } if (strstr($_SERVER['REQUEST_URI'], 'image.php')) { return false; } if (strstr($_SERVER['REQUEST_URI'], 'profile.php')) { return false; } QApplication::$SourceLanguage = NarroLanguage::LoadByLanguageCode(__SOURCE_LANGUAGE_CODE__); // language passed through the l parameter if (@$_REQUEST['l']) { QApplication::$TargetLanguage = NarroLanguage::LoadByLanguageCode(@$_REQUEST['l']); } elseif (isset($argv) && ($strLanguage = $argv[array_search('--translation-lang', $argv) + 1])) { QApplication::$TargetLanguage = NarroLanguage::LoadByLanguageCode($strLanguage); } else { if (QApplication::$User->UserId != NarroUser::ANONYMOUS_USER_ID) { $objGuessedLanguage = NarroLanguage::LoadByLanguageCode(QApplication::$User->GetPreferenceValueByName('Language')); if (!$objGuessedLanguage instanceof NarroLanguage || !$objGuessedLanguage->Active) { $objGuessedLanguage = null; } } if (!$objGuessedLanguage) { $objGuessedLanguage = QApplication::GetBrowserLanguage(); if (!$objGuessedLanguage instanceof NarroLanguage || !$objGuessedLanguage->Active) { $objGuessedLanguage = null; } } if (!$objGuessedLanguage) { $objGuessedLanguage = NarroLanguage::QuerySingle(QQ::Equal(QQN::NarroLanguage()->Active, true)); } if (!$objGuessedLanguage) { die('There are no active languages in the database.'); } else { if (!isset($_REQUEST['openid_mode']) && !isset($argv)) { QApplication::Redirect(sprintf('projects.php?l=%s', $objGuessedLanguage->LanguageCode)); exit; } else { QApplication::$TargetLanguage = $objGuessedLanguage; } } } if (QApplication::$TargetLanguage->Active == false && !isset($argv)) { die(sprintf('The language %s is not active. Please ask the administrator to activate or check your URL if this is not the language you wanted.', QApplication::$TargetLanguage->LanguageName)); } }
/** * This Form_Validate event handler allows you to specify any custom Form Validation rules. * It will also Blink() on all invalid controls, as well as Focus() on the top-most invalid control. */ protected function Form_Validate() { // By default, we report the result of validation from the parent $blnToReturn = parent::Form_Validate(); // Custom Validation Rules // TODO: Be sure to set $blnToReturn to false if any custom validation fails! // Check for records that may violate Unique Clauses if (($objNarroLanguage = NarroLanguage::LoadByLanguageName($this->txtLanguageName->Text)) && $objNarroLanguage->LanguageId != $this->mctNarroLanguage->NarroLanguage->LanguageId) { $blnToReturn = false; $this->txtLanguageName->Warning = QApplication::Translate("Already in Use"); } if (($objNarroLanguage = NarroLanguage::LoadByLanguageCode($this->txtLanguageCode->Text)) && $objNarroLanguage->LanguageId != $this->mctNarroLanguage->NarroLanguage->LanguageId) { $blnToReturn = false; $this->txtLanguageCode->Warning = QApplication::Translate("Already in Use"); } $blnFocused = false; foreach ($this->GetErrorControls() as $objControl) { // Set Focus to the top-most invalid control if (!$blnFocused) { $objControl->Focus(); $blnFocused = true; } // Blink on ALL invalid controls $objControl->Blink(); } return $blnToReturn; }
public static function LoadByUserId($intUserId, $objOptionalClauses = null) { $objUser = NarroUser::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroUser()->UserId, $intUserId)), QQ::ExpandAsArray(QQN::NarroUser()->NarroUserRoleAsUser)); if (!$objUser instanceof NarroUser) { return false; } foreach ($objUser->_NarroUserRoleAsUserArray as $objRole) { /* @var $objRole NarroUserRole */ $arrRolePermission = NarroRolePermission::LoadArrayByRoleId($objRole->RoleId, QQ::Expand(QQN::NarroRolePermission()->Permission)); foreach ($arrRolePermission as $objRolePermission) { $objUser->arrPermissions[$objRolePermission->Permission->PermissionName . '-' . $objRole->LanguageId . '-' . $objRole->ProjectId] = $objRolePermission; } } if (isset($objUser->Preferences['Language'])) { $objLanguage = NarroLanguage::LoadByLanguageCode($objUser->Preferences['Language']); if ($objLanguage instanceof NarroLanguage) { $objUser->Language = $objLanguage; } elseif (QApplication::$TargetLanguage instanceof NarroLanguage) { $objUser->Language = QApplication::$TargetLanguage; } } elseif (QApplication::$TargetLanguage instanceof NarroLanguage) { $objUser->Language = QApplication::$TargetLanguage; } return $objUser; }
public function btnImport_Click($strFormId, $strControlId, $strParameter) { if (!QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) { return false; } $strProcLogFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-import-process.log'; $strProcPidFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-import-process.pid'; $strProgressFile = __TMP_PATH__ . '/import-' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode; if ($strParameter == 1) { if (NarroUtils::IsProcessRunning('import', $this->objProject->ProjectId)) { $this->objImportProgress->Translated = NarroProgress::GetProgress($this->objProject->ProjectId, 'import'); $this->objImportProgress->MarkAsModified(); } else { $this->lblImport->Text = t('Import finished.'); if (QApplication::$UseAjax) { QApplication::ExecuteJavaScript('if (typeof lastImportId != \'undefined\') clearInterval(lastImportId)'); } if (file_exists($strProcLogFile) && filesize($strProcLogFile)) { NarroLogger::LogInfo(sprintf('There are messages from the background process: %s', file_get_contents($strProcLogFile))); } if (file_exists($strProcLogFile)) { unlink($strProcLogFile); } if (file_exists($strProcPidFile)) { unlink($strProcPidFile); } if (file_exists($strProgressFile)) { unlink($strProgressFile); } $this->lblImport->Visible = true; $this->btnImport->Visible = true; $this->btnKillProcess->Visible = false; $this->objImportProgress->Translated = 0; $this->objImportProgress->Visible = false; } $this->pnlLogViewer->MarkAsModified(); } elseif ($strParameter == 2) { $this->pnlLogViewer->ProjectId = $this->objProject->ProjectId; $this->pnlLogViewer->LanguageId = QApplication::GetLanguageId(); $this->pnlLogViewer->DateStart = QDateTime::Now(); NarroProgress::ClearProgressFileName($this->objProject->ProjectId, 'import'); set_time_limit(0); if (file_exists($strProcLogFile)) { unlink($strProcLogFile); } if (file_exists($strProcPidFile)) { unlink($strProcPidFile); } if (file_exists($strProgressFile)) { unlink($strProgressFile); } $objNarroImporter = new NarroProjectImporter(); /** * Get boolean options */ $objNarroImporter->CheckEqual = true; $objNarroImporter->Approve = $this->chkApproveImportedTranslations->Checked; $objNarroImporter->ApproveAlreadyApproved = !$this->chkApproveOnlyNotApproved->Checked; $objNarroImporter->OnlySuggestions = !$this->chkImportSourceTexts->Checked; $objNarroImporter->Project = $this->objProject; $objNarroImporter->ImportUnchangedFiles = $this->chkImportUnchangedFiles->Checked; $objNarroImporter->User = QApplication::$User; $objNarroImporter->TargetLanguage = QApplication::$TargetLanguage; $objNarroImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE); try { $objNarroImporter->TranslationPath = $this->pnlTranslationsSource->Directory; $objNarroImporter->TemplatePath = $this->objProject->DefaultTemplatePath; } catch (Exception $objEx) { NarroLogger::LogError(sprintf('An error occurred during import: %s', $objEx->getMessage())); $this->lblImport->Text = sprintf(t('Import failed: %s'), $objEx->getMessage()); return false; } try { $objNarroImporter->ImportProject(); } catch (Exception $objEx) { NarroLogger::LogError(sprintf('An error occurred during import: %s', $objEx->getMessage())); $this->lblImport->Text = sprintf(t('Import failed: %s'), $objEx->getMessage()); } $this->lblImport->Visible = true; $this->btnImport->Visible = true; $this->btnKillProcess->Visible = false; $this->objImportProgress->Visible = false; $this->pnlLogViewer->MarkAsModified(); } else { $this->pnlLogViewer->ProjectId = $this->objProject->ProjectId; $this->pnlLogViewer->LanguageId = QApplication::GetLanguageId(); $this->pnlLogViewer->DateStart = QDateTime::Now(); NarroProgress::ClearProgressFileName($this->objProject->ProjectId, 'import'); $this->pnlLogViewer->MarkAsModified(); $this->btnImport->Visible = false; $this->btnKillProcess->Visible = QApplication::HasPermission('Administrator', $this->objProject, QApplication::$TargetLanguage->LanguageCode) && !$this->btnImport->Visible; $this->objImportProgress->Visible = true; $this->objImportProgress->Translated = 0; $this->lblImport->Text = ''; try { $strCommand = sprintf(__PHP_CLI_PATH__ . ' ' . escapeshellarg(sprintf('%s/includes/narro/importer/narro-cli.php', __DOCROOT__ . __SUBDIRECTORY__)) . ' --import --minloglevel 3 --project %d --user %d --check-equal ' . ($this->chkApproveImportedTranslations->Checked ? '--approve ' : '') . ($this->chkImportUnchangedFiles->Checked ? '--import-unchanged-files ' : '') . ($this->chkApproveOnlyNotApproved->Checked ? '' : '--approve-already-approved ') . (!$this->chkImportSourceTexts->Checked || !QApplication::HasPermission('Can import project', $this->objProject->ProjectId) ? '--only-suggestions ' : '') . ' --template-lang %s --translation-lang %s --template-directory %s --translation-directory %s', (int) $this->objProject->ProjectId, (int) QApplication::$User->UserId, escapeshellarg(NarroLanguage::SOURCE_LANGUAGE_CODE), escapeshellarg(QApplication::$TargetLanguage->LanguageCode), escapeshellarg($this->objProject->DefaultTemplatePath), escapeshellarg($this->pnlTranslationsSource->Directory)); } catch (Exception $objEx) { NarroLogger::LogError(sprintf('An error occurred during import: %s', $objEx->getMessage())); $this->lblImport->Text = sprintf(t('Import failed: %s'), $objEx->getMessage()); $this->lblImport->Visible = true; $this->btnImport->Visible = true; $this->btnKillProcess->Visible = QApplication::HasPermission('Administrator', $this->objProject, QApplication::$TargetLanguage->LanguageCode) && !$this->btnImport->Visible; $this->objImportProgress->Translated = 0; $this->objImportProgress->Visible = false; $this->pnlLogViewer->MarkAsModified(); return false; } if (file_exists($strProcLogFile) && is_writable($strProcLogFile)) { unlink($strProcLogFile); } NarroUtils::Exec($strCommand, $arrOutput, $arrError, $intRetVal, true); if ($intRetVal == 0) { if (QApplication::$UseAjax) { QApplication::ExecuteJavaScript(sprintf('lastImportId = setInterval("qc.pA(\'%s\', \'%s\', \'QClickEvent\', \'1\')", %d);', $strFormId, $strControlId, 2000)); } else { $this->btnImport_Click($strFormId, $strControlId, 1); } } else { $this->objImportProgress->Visible = false; NarroLogger::LogError('Failed to launch a background process, there will be no progress displayed, and it might take a while, please wait for more messages'); $this->pnlLogViewer->MarkAsModified(); /** * try importing without launching a background process */ if (QApplication::$UseAjax) { QApplication::ExecuteJavaScript(sprintf('lastImportId = setTimeout("qc.pA(\'%s\', \'%s\', \'QClickEvent\', \'2\')", %d);', $strFormId, $strControlId, 2000)); } else { $this->btnImport_Click($strFormId, $strControlId, 2); } } } }
public function btnExport_Click($strFormId, $strControlId, $strParameter) { if (!QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) { return false; } $strProcLogFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-export-process.log'; if ($strParameter == 1) { if (NarroUtils::IsProcessRunning('export', $this->objProject->ProjectId)) { $this->objExportProgress->Translated = NarroProgress::GetProgress($this->objProject->ProjectId, 'export'); $this->objExportProgress->MarkAsModified(); } else { $this->lblExport->Text = t('Export finished.'); if (QApplication::$UseAjax) { QApplication::ExecuteJavaScript('if (typeof lastExportId != \'undefined\') clearInterval(lastExportId)'); } if (file_exists($strProcLogFile) && filesize($strProcLogFile)) { NarroLogger::LogInfo(sprintf('There are messages from the background process: %s', file_get_contents($strProcLogFile))); } $this->lblExport->Visible = true; $this->btnExport->Visible = true; $this->btnKillProcess->Visible = false; $this->objExportProgress->Translated = 0; $this->objExportProgress->Visible = false; QApplication::$PluginHandler->DisplayExportMessage($this->objProject); if (is_array(QApplication::$PluginHandler->PluginReturnValues)) { foreach (QApplication::$PluginHandler->PluginReturnValues as $strPluginName => $mixReturnValue) { if (count($mixReturnValue) == 2 && $mixReturnValue[0] instanceof NarroProject && is_string($mixReturnValue[1]) && $mixReturnValue[1] != '') { $this->lblExport->Text .= sprintf('<br /><span class="info"><b>%s</b>: %s</span>', $strPluginName, nl2br($mixReturnValue[1])); } } } } $this->pnlLogViewer->MarkAsModified(); } elseif ($strParameter == 2) { $this->pnlLogViewer->DateStart = QDateTime::Now(); $this->pnlLogViewer->ProjectId = $this->objProject->ProjectId; $this->pnlLogViewer->LanguageId = QApplication::GetLanguageId(); NarroProgress::ClearProgressFileName($this->objProject->ProjectId, 'import'); set_time_limit(0); if ($this->chkCleanDirectory->Checked) { NarroUtils::RecursiveDelete($this->objProject->DefaultTranslationPath . '/*'); } $objNarroImporter = new NarroProjectImporter(); /** * Get boolean options */ $objNarroImporter->ExportedSuggestion = $this->lstExportSuggestionType->SelectedValue; $objNarroImporter->Project = $this->objProject; $objNarroImporter->ExportAuthorList = $this->txtAuthor->Text; $objNarroImporter->User = QApplication::$User; $objNarroImporter->TargetLanguage = QApplication::$TargetLanguage; $objNarroImporter->SourceLanguage = NarroLanguage::LoadByLanguageCode(NarroLanguage::SOURCE_LANGUAGE_CODE); try { $objNarroImporter->TranslationPath = $this->objProject->DefaultTranslationPath; $objNarroImporter->TemplatePath = $this->objProject->DefaultTemplatePath; } catch (Exception $objEx) { NarroLogger::LogError(sprintf('An error occurred during export: %s', $objEx->getMessage())); $this->lblExport->Text = t('Export failed.'); } try { $objNarroImporter->ExportProject(); } catch (Exception $objEx) { NarroLogger::LogError(sprintf('An error occurred during export: %s', $objEx->getMessage())); $this->lblExport->Text = t('Export failed.'); } $this->lblExport->Visible = true; $this->btnExport->Visible = true; $this->btnKillProcess->Visible = false; $this->objExportProgress->Visible = false; $this->pnlLogViewer->MarkAsModified(); } else { $this->pnlLogViewer->DateStart = QDateTime::Now(); $this->pnlLogViewer->ProjectId = $this->objProject->ProjectId; $this->pnlLogViewer->LanguageId = QApplication::GetLanguageId(); if ($this->chkCleanDirectory->Checked) { NarroUtils::RecursiveDelete($this->objProject->DefaultTranslationPath . '/*'); } $this->btnExport->Visible = false; $this->btnKillProcess->Visible = $this->btnKillProcess->Visible = QApplication::HasPermission('Administrator', $this->objProject, QApplication::$TargetLanguage->LanguageCode); $this->objExportProgress->Visible = true; $this->objExportProgress->Translated = 0; $this->lblExport->Text = ''; try { $strCommand = sprintf('%s %s --export --project %d --user %d --template-lang %s --translation-lang %s --template-directory %s --translation-directory %s --exported-suggestion %d --export-author-list %s', __PHP_CLI_PATH__, escapeshellarg(sprintf('%s/includes/narro/importer/narro-cli.php', __DOCROOT__ . __SUBDIRECTORY__)), (int) $this->objProject->ProjectId, (int) QApplication::$User->UserId, escapeshellarg(NarroLanguage::SOURCE_LANGUAGE_CODE), escapeshellarg(QApplication::$TargetLanguage->LanguageCode), escapeshellarg($this->objProject->DefaultTemplatePath), escapeshellarg($this->objProject->DefaultTranslationPath), (int) $this->lstExportSuggestionType->SelectedValue, escapeshellarg($this->txtAuthor->Text)); } catch (Exception $objEx) { NarroLogger::LogError(sprintf('An error occurred during export: %s', $objEx->getMessage())); $this->lblExport->Text = t('Export failed.'); $this->lblExport->Visible = true; $this->btnExport->Visible = true; $this->btnKillProcess->Visible = false; $this->objExportProgress->Translated = 0; $this->objExportProgress->Visible = false; $this->pnlLogViewer->MarkAsModified(); return false; } if (file_exists($strProcLogFile) && is_writable($strProcLogFile)) { unlink($strProcLogFile); } $mixProcess = proc_open("{$strCommand} &", array(2 => array("file", $strProcLogFile, 'a')), $foo); if ($mixProcess) { if (QApplication::$UseAjax) { QApplication::ExecuteJavaScript(sprintf('lastExportId = setInterval("qc.pA(\'%s\', \'%s\', \'QClickEvent\', \'1\')", %d);', $strFormId, $strControlId, 2000)); } else { $this->btnExport_Click($strFormId, $strControlId, 1); } } else { $this->objExportProgress->Visible = false; NarroLogger::LogError('Failed to launch a background process, there will be no progress displayed, and it might take a while, please wait for more messages'); $this->pnlLogViewer->MarkAsModified(); /** * try exporting without launching a background process */ if (QApplication::$UseAjax) { QApplication::ExecuteJavaScript(sprintf('lastExportId = setTimeout("qc.pA(\'%s\', \'%s\', \'QClickEvent\', \'2\')", %d);', $strFormId, $strControlId, 2000)); } else { $this->btnExport_Click($strFormId, $strControlId, 2); } } } }