public function __construct()
 {
     parent::__construct();
     $this->blnEnable = false;
     $this->strName = t('Mozilla l10n dashboard');
     $this->Enable();
     $this->blnEnable = $this->blnEnable && function_exists('json_decode');
     $this->strUrl = sprintf($this->strUrl, QApplication::$TargetLanguage->LanguageCode);
     if ($this->blnEnable) {
         NarroProject::RegisterPreference('Code name on mozilla l10n dashboard', true, NarroProjectType::Mozilla, 'text', 'e.g. fx_aurora, see <a href="https://l10n-stage-sj.mozilla.org/shipping/dashboard">https://l10n-stage-sj.mozilla.org/shipping/dashboard</a>', '');
     }
 }
Esempio n. 2
0
 protected function RepositorySetup()
 {
     NarroProject::RegisterPreference('SVN commit path', false, 0, 'text', 'The url to commit this project to SVN.', '');
     NarroProject::RegisterPreference('Username for SVN', false, 0, 'text', '', '');
     $this->objProject->SetPreferenceValueByName('SVN commit path', $this->txtRepositoryUrl->Text);
     $this->objProject->SetPreferenceValueByName('Username for SVN', $this->txtUsername->Text);
     $this->objProject->Save();
     $this->strSSHKey = sprintf('%s/svn_%d_%s_%d', __TMP_PATH__, QApplication::$User->UserId, QApplication::$TargetLanguage->LanguageCode, $this->objProject->ProjectId);
     $strProcLogFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-svn.log';
     copy($this->fileSSHPrivateKey->File, $this->strSSHKey);
     chmod($this->strSSHKey, 0600);
     $mixProcess = NarroUtils::Exec(sprintf('svn checkout %s %s_svn', escapeshellarg($this->txtRepositoryUrl->Text), $this->strSSHKey), $arrOutput, $arrError, $intRetVal, false, array('SVN_SSH' => sprintf('ssh -o StrictHostKeyChecking=no -l %s -p 22 -i %s', escapeshellarg($this->txtUsername->Text), escapeshellarg($this->strSSHKey)), 'HOME' => __TMP_PATH__), __TMP_PATH__, true);
     if ($intRetVal == 0) {
         NarroUtils::RecursiveCopy($this->objProject->DefaultTranslationPath, $this->strSSHKey . '_svn');
         $mixProcess = NarroUtils::Exec('svn add -q ./*', $arrOutput, $arrError, $intRetVal, false, array('SVN_SSH' => sprintf('ssh -o StrictHostKeyChecking=no -l %s -p 22 -i %s', escapeshellarg($this->txtUsername->Text), escapeshellarg($this->strSSHKey)), 'HOME' => __TMP_PATH__), $this->strSSHKey . '_svn', true);
         return $intRetVal;
     } else {
         return $intRetVal;
     }
 }
Esempio n. 3
0
    ///////////////////////
    // Setup Error Handling
    ///////////////////////
    if (array_key_exists('SERVER_PROTOCOL', $_SERVER)) {
        set_error_handler('QcodoHandleError', error_reporting());
        set_exception_handler('QcodoHandleException');
    }
    spl_autoload_register(array('QApplication', 'Autoload'));
    QApplication::Initialize();
    QApplication::InitializeDatabaseConnections();
    QApplication::$EncodingType = 'UTF-8';
    NarroUser::GetDatabase()->NonQuery("SET NAMES 'utf8'");
    NarroUser::RegisterPreference('Items per page', 'number', t('How many items are displayed per page'), 10);
    NarroUser::RegisterPreference('Font size', 'option', t('The application font size'), 'medium', array('x-small', 'small', 'medium', 'large', 'x-large'));
    NarroUser::RegisterPreference('Language', 'option', t('The language you are translating to'), QApplication::QueryString('l'), array(QApplication::QueryString('l')));
    NarroUser::RegisterPreference('Application language', 'option', t('The language you want to see Narro in'), isset(QApplication::$TargetLanguage) ? QApplication::$TargetLanguage->LanguageCode : NarroLanguage::SOURCE_LANGUAGE_CODE, array(isset(QApplication::$TargetLanguage) ? QApplication::$TargetLanguage->LanguageCode : NarroLanguage::SOURCE_LANGUAGE_CODE));
    NarroUser::RegisterPreference('Special characters', 'text', t('Characters that are not on your keyboard, separated by spaces'), '$€');
    NarroUser::RegisterPreference('Automatically save translations', 'option', t('Save translations when moving to the next text to translate'), 'No', array('Yes', 'No'));
    NarroUser::RegisterPreference('Launch imports and exports in background', 'option', t('Launch imports and exports in background'), 'Yes', array('Yes', 'No'));
    NarroUser::RegisterPreference('Load more texts while scrolling', 'option', t('Whether to load more content if you reach the bottom of the page'), 'No', array('Yes', 'No'));
    if (!isset($argv)) {
        QApplication::SessionOverride();
        QApplication::InitializeSession();
    }
    QApplication::InitializeUser();
    QApplication::InitializeLanguage();
    NarroProject::RegisterPreference('Export translators and reviewers in the file header as a comment', false, 0, 'option', '', 'No', array('Yes', 'No'));
    QApplication::InitializeLogging();
    QApplication::InitializeTranslationEngine();
    QApplication::$PluginHandler = new NarroPluginHandler(dirname(__FILE__) . '/../includes/narro/plugins');
}
 public function btnTest_Click()
 {
     NarroProject::RegisterPreference('Mercurial commit path', false, 0, 'text', 'The url to commit this project to mercurial.', '');
     NarroProject::RegisterPreference('Username for Mercurial', false, 0, 'text', '', '');
     $this->objProject->SetPreferenceValueByName('Mercurial commit path', $this->txtRepositoryUrl->Text);
     $this->objProject->SetPreferenceValueByName('Username for Mercurial', $this->txtUsername->Text);
     $this->objProject->Save();
     $strSSHKey = sprintf('%s/mercurial_%d_%s_%d', __TMP_PATH__, QApplication::$User->UserId, QApplication::$TargetLanguage->LanguageCode, $this->objProject->ProjectId);
     $strProcLogFile = __TMP_PATH__ . '/' . $this->objProject->ProjectId . '-' . QApplication::$TargetLanguage->LanguageCode . '-mercurial.log';
     copy($this->fileSSHPrivateKey->File, $strSSHKey);
     chmod($strSSHKey, 0600);
     file_put_contents($strSSHKey . '_hgrc', sprintf("[paths]\n" . "default = %s\n" . "\n" . "[ui]\n" . "ssh = ssh -i %s -o StrictHostKeyChecking=no -l %s\n" . "username = %s\n", $this->txtRepositoryUrl->Text, $strSSHKey, $this->txtUsername->Text, $this->txtCommitUsername->Text));
     $mixProcess = exec(sprintf('export HOME=%s;export HGRCPATH=%s; hg clone %s %s_mercurial;cd %s_mercurial; cp -f -R %s/* .; hg addremove; hg diff -w --nodates > %s_diff; hg commit -m "%s" %s; hg outgoing', __TMP_PATH__, $strSSHKey . '_hgrc', escapeshellarg($this->txtRepositoryUrl->Text), $strSSHKey, $strSSHKey, escapeshellarg($this->objProject->DefaultTranslationPath), $strSSHKey, escapeshellarg($this->txtCommitMessage->Text), $this->pnlPatchViewer && count($this->pnlPatchViewer->SelectedFiles) ? join(" ", $this->pnlPatchViewer->SelectedFiles) : ""), $arrOutput);
     $this->lblOutput->Text = join("\n", $arrOutput);
     $this->Form->RemoveControl($this->pnlPatchViewer->ControlId);
     $this->pnlPatchViewer = new NarroPatchViewerPanel($strSSHKey . '_diff', $this);
     unlink($strSSHKey);
     unlink($strSSHKey . '_hgrc');
     unlink($strSSHKey . '_diff');
     NarroUtils::RecursiveDelete($strSSHKey . '_mercurial');
     $this->btnCommit->Display = true;
     $this->chkForce->Display = true;
 }