public function __construct(NarroProject $objProject, NarroLanguage $objLanguage, $objParentObject, $strControlId = null) { parent::__construct($objProject, $objLanguage, $objParentObject, $strControlId); 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->txtRepositoryUrl = new QTextBox($this); $this->txtRepositoryUrl->Name = t('Mercurial commit path'); $this->txtRepositoryUrl->Text = $this->objProject->GetPreferenceValueByName('Mercurial commit path'); $this->txtRepositoryUrl->Instructions = t('e.g. ssh://hg.mozilla.org/releases/l10n/mozilla-aurora/ro'); $this->txtRepositoryUrl->PreferedRenderMethod = 'RenderWithName'; $this->txtRepositoryUrl->Required = true; $this->txtUsername = new QTextBox($this); $this->txtUsername->Name = t('Username for Mercurial'); $this->txtUsername->Text = $this->objProject->GetPreferenceValueByName('Username for Mercurial'); $this->txtUsername->Instructions = ''; $this->txtUsername->Required = true; $this->txtUsername->PreferedRenderMethod = 'RenderWithName'; $this->txtPassword = new QTextBox($this); $this->txtPassword->Name = t('Password for Mercurial'); $this->txtPassword->Text = ''; // @todo finish the implementation to support passwords as well $this->txtPassword->Display = false; $this->txtPassword->Instructions = t('Not needed if you use a private SSH key'); $this->txtPassword->PreferedRenderMethod = 'RenderWithName'; $this->fileSSHPrivateKey = new QFileControl($this); $this->fileSSHPrivateKey->Name = t('Private SSH key for Mercurial'); $this->fileSSHPrivateKey->Required = true; $this->fileSSHPrivateKey->Instructions = t("Uploading a private key is really unsecure unless you're using https. Proceed with caution."); $this->fileSSHPrivateKey->PreferedRenderMethod = 'RenderWithName'; $this->txtCommitUsername = new QTextBox($this); $this->txtCommitUsername->Required = true; $this->txtCommitUsername->Name = t('Author shown in the commit message'); $this->txtCommitUsername->Text = sprintf('%s <%s>', QApplication::$User->RealName, QApplication::$User->Email); $this->txtCommitUsername->Instructions = t('Usually, this is something like Alexandru Szasz <*****@*****.**>'); $this->txtCommitUsername->PreferedRenderMethod = 'RenderWithName'; $this->txtCommitMessage = new QTextBox($this); $this->txtCommitMessage->Required = true; $this->txtCommitMessage->Name = t('The commit message'); $this->txtCommitMessage->Text = t('Commit from Narro'); $this->txtCommitMessage->Instructions = t('Be creative or leave it as it is'); $this->txtCommitMessage->PreferedRenderMethod = 'RenderWithName'; $this->chkForce = new QCheckBox($this); $this->chkForce->Text = t('Force'); $this->chkForce->Instructions = t('This would pass -f to hg and usually creates a new head'); $this->chkForce->PreferedRenderMethod = 'RenderWithName'; $this->chkForce->Display = false; $this->btnTest = new QButton($this); $this->btnTest->Text = 'Test before commit'; $this->btnTest->CausesValidation = $this; $this->btnTest->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnTest_Click')); $this->btnCommit = new QButton($this); $this->btnCommit->CausesValidation = $this; $this->btnCommit->Text = 'Commit'; $this->btnCommit->Display = false; $this->btnCommit->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnCommit_Click')); $this->lblOutput = new QLabel($this); $this->lblOutput->TagName = 'pre'; $this->lblOutput->HtmlEntities = false; }
public function __construct(NarroProject $objProject, NarroLanguage $objLanguage, $objParentObject, $strControlId = null) { parent::__construct($objProject, $objLanguage, $objParentObject, $strControlId); 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->txtRepositoryUrl = new QTextBox($this); $this->txtRepositoryUrl->Name = t('SVN commit path'); $this->txtRepositoryUrl->Text = $this->objProject->GetPreferenceValueByName('SVN commit path'); $this->txtRepositoryUrl->Instructions = t('e.g. svn+ssh://hg.mozilla.org/releases/l10n/mozilla-aurora/ro'); $this->txtRepositoryUrl->PreferedRenderMethod = 'RenderWithName'; $this->txtRepositoryUrl->Required = true; $this->txtUsername = new QTextBox($this); $this->txtUsername->Name = t('Username for SVN'); $this->txtUsername->Text = $this->objProject->GetPreferenceValueByName('Username for SVN'); $this->txtUsername->Instructions = ''; $this->txtUsername->Required = true; $this->txtUsername->PreferedRenderMethod = 'RenderWithName'; $this->fileSSHPrivateKey = new QFileControl($this); $this->fileSSHPrivateKey->Name = t('Private SSH key for SVN'); $this->fileSSHPrivateKey->Required = true; $this->fileSSHPrivateKey->Instructions = t("Uploading a private key is really unsecure unless you're using https. Proceed with caution."); $this->fileSSHPrivateKey->PreferedRenderMethod = 'RenderWithName'; $this->txtCommitMessage = new QTextBox($this); $this->txtCommitMessage->Required = true; $this->txtCommitMessage->TextMode = QTextMode::MultiLine; $this->txtCommitMessage->Name = t('The commit message'); $this->txtCommitMessage->Text = sprintf(t('Commit from Narro by %s'), sprintf('%s <%s>', QApplication::$User->RealName, QApplication::$User->Email)); $this->txtCommitMessage->Instructions = t('Be creative or leave it as it is'); $this->txtCommitMessage->PreferedRenderMethod = 'RenderWithName'; $this->btnTest = new QButton($this); $this->btnTest->Text = 'Test before commit'; $this->btnTest->CausesValidation = $this; $this->btnTest->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnTest_Click')); $this->btnCommit = new QButton($this); $this->btnCommit->CausesValidation = $this; $this->btnCommit->Text = 'Commit'; $this->btnCommit->Display = false; $this->btnCommit->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnCommit_Click')); $this->lblOutput = new QLabel($this); $this->lblOutput->TagName = 'pre'; $this->lblOutput->HtmlEntities = false; }