protected override void CreateChildControls() { this.chkUseStandardGitClient = new CheckBox { Text = "Use Standard Git Client" }; this.txtGitExecutablePath = new SourceControlFileFolderPicker { ServerId = this.EditorContext.ServerId, Required = false, }; var ctlExePathField = new StandardFormField("Git Executable Path:", this.txtGitExecutablePath); this.Controls.Add( new FormFieldGroup( "Git Client", "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client.", false, new StandardFormField(string.Empty, this.chkUseStandardGitClient), ctlExePathField ) ); this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField); }
protected override void CreateChildControls() { this.chkUseStandardGitClient = new CheckBox { Text = "Use Standard Git Client" }; this.txtGitExecutablePath = new SourceControlFileFolderPicker { ServerId = this.EditorContext.ServerId, Required = false, }; var ctlExePathField = new StandardFormField("Git Executable Path:", this.txtGitExecutablePath); this.Controls.Add( new FormFieldGroup( "Git Client", "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client.", false, new StandardFormField(string.Empty, this.chkUseStandardGitClient), ctlExePathField ) ); this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField); }
protected override void CreateChildControls() { this.chkUseStandardGitClient = new CheckBox { Text = "Use Standard Git Client" }; this.txtGitExecutablePath = new SourceControlFileFolderPicker { ServerId = this.EditorContext.ServerId, Required = false }; this.txtOrganizationName = new ValidatingTextBox { Required = false, DefaultText = "Optional", Width = 300 }; this.txtUserName = new ValidatingTextBox { Required = true, Width = 300 }; this.txtPassword = new PasswordTextBox { Required = true, Width = 300 }; var ctlExePathField = new StandardFormField("Git Executable Path:", this.txtGitExecutablePath); this.Controls.Add( new FormFieldGroup( "Organization", "Optionally provide the organization name which owns the repositories.", false, new StandardFormField( "Organization:", this.txtOrganizationName ) ), new FormFieldGroup( "Authentication", "Provide the user name and password of a GitHub user which has access to the desired repositories.", false, new StandardFormField( "User Name:", this.txtUserName ), new StandardFormField( "Password:"******"Git Client", "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client.", false, new StandardFormField(string.Empty, this.chkUseStandardGitClient), ctlExePathField ) ); this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField); }
protected override void CreateChildControls() { base.CreateChildControls(); //ddlConfigurationFile this.ddlConfigurationFile = new DropDownList { ID = "ddlConfigurationFile", Width = 300, AutoPostBack = true }; this.ddlConfigurationFile.Items.Add(string.Empty); this.ddlConfigurationFile.Items.AddRange( StoredProcs.ConfigurationFiles_GetConfigurationFiles(Application_Id: this.ApplicationId, Deployable_Id: InedoLib.Util.NullIf(this.DeployableId, 0)) .Execute() .ConfigurationFiles_Extended .Select(c => new ListItem { Text = c.FilePath_Text, Value = c.ConfigurationFile_Id.ToString() }) ); this.ddlConfigurationFile.Items.Add(new ListItem { Text = "Type name...", Value = "X", Enabled = false }); this.ddlConfigurationFile.SelectedIndexChanged += this.ddlConfigurationFile_SelectedIndexChanged; //ddlInstance ddlInstance = new DropDownList { ID = "ddlInstance", Width = 300 }; this.txtConfigurationFileName = new ValidatingTextBox { Width = 300 }; this.txtInstanceName = new ValidatingTextBox { Width = 300 }; this.ctl_txtInstanceName = new StandardFormField("Instance Name:", this.txtInstanceName) { Visible = false }; this.ctl_ddlInstance = new StandardFormField("Instance Name:", this.ddlInstance); this.ctl_txtConfigurationFileName = new StandardFormField("Configuration File Name:", this.txtConfigurationFileName) { Visible = false }; this.Controls.Add(new FormFieldGroup("Configuration File", "Configuration file location, select only one. The order of evaluation is configuration file text, disk location, then configuration name.", false, new StandardFormField("Configuration Text:", this.txtConfigText), new StandardFormField("Configuration File Location:", this.ffpConfigFilePath), new StandardFormField("Configuration File:", this.ddlConfigurationFile), ctl_txtConfigurationFileName, ctl_ddlInstance ) ); }
protected override void CreateChildControls() { this.chkUseStandardGitClient = new CheckBox { Text = "Use Standard Git Client" }; this.txtGitExecutablePath = new SourceControlFileFolderPicker { ServerId = this.EditorContext.ServerId, Required = false }; this.txtOrganizationName = new ValidatingTextBox { Required = false, DefaultText = "Optional", Width = 300 }; this.txtUserName = new ValidatingTextBox { Required = true, Width = 300 }; this.txtPassword = new PasswordTextBox { Required = true, Width = 300 }; var ctlExePathField = new StandardFormField("Git Executable Path:", this.txtGitExecutablePath); this.Controls.Add( new FormFieldGroup( "Organization", "Optionally provide the organization name which owns the repositories.", false, new StandardFormField( "Organization:", this.txtOrganizationName ) ), new FormFieldGroup( "Authentication", "Provide the user name and password of a GitHub user which has access to the desired repositories.", false, new StandardFormField( "User Name:", this.txtUserName ), new StandardFormField( "Password:"******"Git Client", "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client.", false, new StandardFormField(string.Empty, this.chkUseStandardGitClient), ctlExePathField ) ); this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField); }
private void AddExtendedInformation() { var ff = new FormFieldGroup("Extended Information", "Extended information for this action.", false); var foo = new StandardFormField(); this.txtExtendedProperties.Rows = 4; this.txtExtensionConfiguration.Rows = 4; if (extensionInstance.UsesExtendedProperties) { ff.FormFields.Add(new StandardFormField("Extended Propeties (name=value):", txtExtendedProperties)); } if (extensionInstance.UsesExtensionConfiguration) { ff.FormFields.Add(new StandardFormField("Extension Configuration (XML fragment):", txtExtensionConfiguration)); } if (extensionInstance.UsesExtendedProperties || extensionInstance.UsesExtensionConfiguration) { this.Controls.Add(ff); } }
private void AddExtendedInformation() { var ff = new FormFieldGroup("Extended Information", "Extended information for this action.", false); var foo = new StandardFormField(); this.txtExtendedProperties.Rows = 4; this.txtExtensionConfiguration.Rows = 4; if (extensionInstance.UsesExtendedProperties) ff.FormFields.Add(new StandardFormField("Extended Propeties (name=value):",txtExtendedProperties)); if(extensionInstance.UsesExtensionConfiguration) ff.FormFields.Add(new StandardFormField("Extension Configuration (XML fragment):",txtExtensionConfiguration)); if (extensionInstance.UsesExtendedProperties || extensionInstance.UsesExtensionConfiguration) this.Controls.Add(ff); }
protected override void CreateChildControls() { var hasProviders = StoredProcs.Providers_GetProviders(Domains.ProviderTypes.SourceControl).Execute().Any(); var ddlProvider = new ActionProviderPicker { AllowNameEntry = false, Visible = hasProviders, ProviderTypeCode = Domains.ProviderTypes.SourceControl }; var ctlNoProviders = new InfoBox { BoxType = InfoBox.InfoBoxTypes.Error, Controls = { new LiteralControl("There are no source control providers set up in BuildMaster. Visit the <a href=\"/Administration/Providers/Overview.aspx?providerTypeCode=S\">Source Control Providers page</a> to add one.") }, Visible = !hasProviders }; var ctlProjectPath = new SourceControlFileFolderPicker { DisplayMode = SourceControlBrowser.DisplayModes.FoldersAndFiles, BindToActionSourceControlProvider = true, Width = 300 }; var ffProjectPath = new StandardFormField("Path of solution or project (.sln, .csproj, etc):", ctlProjectPath); var ctlProjectsInSolution = new CheckBoxList(); var ctlOneProject = new InfoBox { BoxType = InfoBox.InfoBoxTypes.Success, Controls = { new LiteralControl("You have selected a project file, you may click Next to select a configuration file.") }, Visible = false }; var ctlConfigFiles = new CheckBoxList(); var ctlNoConfigFiles = new InfoBox { BoxType = InfoBox.InfoBoxTypes.Warning, Controls = { new LiteralControl("There are no files with .config extension in any of the selected projects, therefore configuration files for this project/solution will have to be created manually.") }, Visible = false }; var ffgTargets = new FormFieldGroup( "Deployment Targets", "Select the location to deploy project outputs.", true ); this.Load += (s, e) => { for (int i = 0; i < this.Projects.Length; i++) { ffgTargets.FormFields.Add( new StandardFormField( this.Projects[i].Name + ":", new SourceControlFileFolderPicker { ID = "ctlDeployTarget" + i, DisplayMode = SourceControlBrowser.DisplayModes.Folders } ) ); } }; this.wizardSteps.SelectProviderAndFile.Controls.Add( new FormFieldGroup( "Source Control", "Select the Source Control Provider and the path of a project or solution.", true, new StandardFormField( "Source Control Provider:", ddlProvider, ctlNoProviders, new Div( new ActionServerPicker { ID = "bm-action-server-id" } ) { ClientIDMode = ClientIDMode.Static, Style = "display: none;" } ), ffProjectPath ) ); this.WizardStepChange += (s, e) => { if (e.CurrentStep != this.wizardSteps.SelectProviderAndFile) return; this.ProviderId = (int)ddlProvider.ProviderId; using (var proxy = Util.Proxy.CreateProviderProxy((int)ddlProvider.ProviderId)) { var scm = proxy.TryGetService<SourceControlProviderBase>(); var fileBytes = (byte[])scm.GetFileContents(ctlProjectPath.Text); if (ctlProjectPath.Text.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)) { var solution = Solution.Load(new MemoryStream(fileBytes, false)); ctlProjectsInSolution.Items.AddRange( solution.Projects .OrderBy(p => p.Name) .Select(p => new ListItem(p.Name, p.ProjectPath)) ); this.SolutionPath = new ProjectInfo(scm.DirectorySeparator, ctlProjectPath.Text).ScmDirectoryName; } else { this.SolutionPath = new ProjectInfo(scm.DirectorySeparator, ctlProjectPath.Text).ScmDirectoryName; this.Projects = new[] { new ProjectInfo(scm.DirectorySeparator, new ProjectInfo(scm.DirectorySeparator, ctlProjectPath.Text).ProjectFileName) }; ctlOneProject.Visible = true; } } }; this.wizardSteps.SelectProjectsInSolution.Controls.Add( new FormFieldGroup( "Projects", "Select the projects in the solution that you would like to create deployables for.", true, new StandardFormField( "", ctlProjectsInSolution, ctlOneProject ) ) ); this.WizardStepChange += (s, e) => { if (e.CurrentStep != this.wizardSteps.SelectProjectsInSolution) return; using (var proxy = Util.Proxy.CreateProviderProxy((int)ddlProvider.ProviderId)) { var scm = proxy.TryGetService<SourceControlProviderBase>(); char dirSeparator = scm.DirectorySeparator; if (ctlProjectPath.Text.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)) { this.Projects = ctlProjectsInSolution.Items .Cast<ListItem>() .Where(i => i.Selected) .Select(i => new ProjectInfo(dirSeparator, i.Value.Replace('\\', dirSeparator))) .ToArray(); } ParseProjects(ctlConfigFiles, ctlNoConfigFiles, scm); } }; this.wizardSteps.SelectConfigFiles.Controls.Add( new FormFieldGroup( "Configuration Files", "Select any configuration files that you would like BuildMaster to manage.", true, new StandardFormField( "", ctlConfigFiles, ctlNoConfigFiles ) ) ); this.WizardStepChange += (s, e) => { if (e.CurrentStep != this.wizardSteps.SelectConfigFiles) return; var dict = this.Projects.ToDictionary(p => p.ScmPath); var configFiles = ctlConfigFiles.Items .Cast<ListItem>() .Where(i => i.Selected) .Select(i => new { Path = i.Value.Split('|')[0], Name = i.Value.Split('|')[1] }) .GroupBy(c => c.Path); foreach (var cfg in configFiles) dict[cfg.Key].ConfigFiles.AddRange(cfg.Select(c => c.Name)); }; this.wizardSteps.SelectDeploymentPaths.Controls.Add(ffgTargets); this.WizardStepChange += (s, e) => { if (e.CurrentStep != this.wizardSteps.SelectDeploymentPaths) return; var controls = this.wizardSteps.SelectDeploymentPaths.Controls .Find<SourceControlFileFolderPicker>() .Where(c => c.ID.StartsWith("ctlDeployTarget")); foreach (var control in controls) this.Projects[int.Parse(control.ID.Substring("ctlDeployTarget".Length))].DeploymentTarget = control.Text; }; this.wizardSteps.Confirmation.Controls.Add( new FormFieldGroup( "Overview", "Confirm that the actions listed here are correct, then click the Execute Recipe button.", true, new StandardFormField( "", new RecipeOverview(this) ) ) ); base.CreateChildControls(); }
protected override void CreateChildControls() { base.CreateChildControls(); this.txtApplicationName = new ValidatingTextBox { Required = true, Width = 300, ValidationExpression = "[0-9a-zA-Z]+" }; try { txtApplicationName.Text = (Environment.UserDomainName ?? "").ToLowerInvariant() + "Extension"; if (!string.IsNullOrEmpty(txtApplicationName.Text)) txtApplicationName.Text = txtApplicationName.Text[0].ToString().ToUpperInvariant() + txtApplicationName.Text.Substring(1); } catch {} this.txtApplicationName.ServerValidate += (s, e) => { var applications = StoredProcs.Applications_GetApplications(null).Execute(); if (applications.Any(app => app.Application_Name.Equals(this.txtApplicationName.Text, StringComparison.OrdinalIgnoreCase))) e.IsValid = false; }; bool hasProviders = StoredProcs.Providers_GetProviders(Domains.ProviderTypes.SourceControl).Execute().Any(); var ddlProvider = new ActionProviderPicker { AllowNameEntry = false, ProviderTypeCode = Domains.ProviderTypes.SourceControl, Visible = hasProviders }; var ctlNoProviders = new InfoBox { BoxType = InfoBox.InfoBoxTypes.Error, Controls = { new LiteralControl("There are no source control providers set up in BuildMaster. Visit the <a href=\"/Administration/Providers/Overview.aspx?providerTypeCode=S\">Source Control Providers page</a> to add one.") }, Visible = !hasProviders }; var ctlMoreThanOneProject = new InfoBox { BoxType = InfoBox.InfoBoxTypes.Error, Controls = { new LiteralControl("There was more than one project in this solution. This application recipe only supports single-project solutions. Please go back to the previous step and select an extension solution with only one project.") }, Visible = false }; var ctlOneProject = new InfoBox { BoxType = InfoBox.InfoBoxTypes.Success, Controls = { new LiteralControl("There solution contains a single project. You may advance to the summary step.") } }; var ctlSolutionPath = new SourceControlFileFolderPicker { DisplayMode = SourceControlBrowser.DisplayModes.FoldersAndFiles, BindToActionSourceControlProvider = true, Width = 300 }; var ffSolutionPath = new StandardFormField("Path of solution file (.sln):", ctlSolutionPath); this.wizardSteps.SelectOrganizationName.Controls.Add( new FormFieldGroup( "Application Name", "For custom extensions, the name should be <em>InitechExtension</em>, where \"Initech\" is your company's name. There's no need to have more than one custom extension per organization<br /><br />" + "For cloning BuildMaster extensions, use the exact name of the extension, for example <em>WindowsSdk</em><br /><br />.", false, new StandardFormField( "Application Name (alpha-numeric only):", txtApplicationName ) ) ); txtApplicationName.Load += (s, e) => this.wizardSteps.DownloadInstructions.ApplicationName = txtApplicationName.Text; this.wizardSteps.SelectProviderAndSolution.Controls.Add( new FormFieldGroup( "Source Control", "Select the Source Control Provider and the path to the extension's solution file.", true, new StandardFormField( "Source Control Provider:", ddlProvider, ctlNoProviders, new Div( new ActionServerPicker { ID = "bm-action-server-id" } ) { Style = "display: none;" } ), ffSolutionPath ) ); this.WizardStepChange += (s, e) => { if (e.CurrentStep != this.wizardSteps.SelectProviderAndSolution) return; this.ProviderId = (int)ddlProvider.ProviderId; using (var proxy = Util.Proxy.CreateProviderProxy(this.ProviderId)) { var scm = proxy.TryGetService<SourceControlProviderBase>(); byte[] fileBytes = scm.GetFileContents(ctlSolutionPath.Text); if (ctlSolutionPath.Text.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)) { var solution = Solution.Load(new MemoryStream(fileBytes)); if (solution.Projects.Count > 1) { ctlMoreThanOneProject.Visible = true; ctlOneProject.Visible = false; } this.SolutionPath = new ProjectInfo(scm.DirectorySeparator, ctlSolutionPath.Text).ScmDirectoryName; this.Project = new ProjectInfo(scm.DirectorySeparator, new ProjectInfo(scm.DirectorySeparator, ctlSolutionPath.Text).ProjectFileName); } } }; this.wizardSteps.OneProjectVerification.Controls.Add( new FormFieldGroup( "One Project Verification", "This step ensures that there is only one project in the selected solution.", true, new StandardFormField( "", ctlMoreThanOneProject, ctlOneProject ) ) ); this.wizardSteps.Confirmation.Controls.Add( new FormFieldGroup( "Summary", "This is a summary of the details of the application that will be created. The application's deployment plan may be modified after creation if necessary.", true, new StandardFormField( "", new Summary(this) ) ) ); }
protected override void CreateChildControls() { base.CreateChildControls(); this.txtOrganizationName = new ValidatingTextBox() { Required = true, Width = 300 }; this.txtOrganizationName.ServerValidate += (s, e) => { var applications = StoredProcs.Applications_GetApplications(null).Execute(); if (applications.Any(app => app.Application_Name.Equals(this.txtOrganizationName.Text.Replace(" ", "") + "Extension", StringComparison.OrdinalIgnoreCase))) e.IsValid = false; }; var ddlProvider = new DropDownList { AutoPostBack = true }; ddlProvider.Items.Add(new ListItem("", "0")); var providerItems = StoredProcs.Providers_GetProviders( Domains.ProviderTypes.SourceControl, null, null ).Execute() .Select(p => new ListItem(p.Provider_Name, p.Provider_Id.ToString())) .ToArray(); ddlProvider.Items.AddRange(providerItems); ddlProvider.Visible = providerItems.Any(); var ctlNoProviders = new InfoBox() { BoxType = InfoBox.InfoBoxTypes.Error, Controls = { new LiteralControl("There are no source control providers set up in BuildMaster. Visit the <a href=\"/Administration/Providers/Overview.aspx?providerTypeCode=S\">Source Control Providers page</a> to add one.") }, Visible = !providerItems.Any() }; var ctlMoreThanOneProject = new InfoBox() { BoxType = InfoBox.InfoBoxTypes.Error, Controls = { new LiteralControl("There was more than one project in this solution. This application recipe only supports single-project solutions. Please go back to the previous step and select an extension solution with only one project.") }, Visible = false }; var ctlOneProject = new InfoBox() { BoxType = InfoBox.InfoBoxTypes.Success, Controls = { new LiteralControl("There solution contains a single project. You may advance to the summary step.") } }; var ctlSolutionPath = new SourceControlFileFolderPicker() { DisplayMode = SourceControlBrowser.DisplayModes.FoldersAndFiles }; var ffSolutionPath = new StandardFormField("Path of solution:", ctlSolutionPath) { Visible = false }; ddlProvider.SelectedIndexChanged += (s, e) => { ctlSolutionPath.SourceControlProviderId = int.Parse(ddlProvider.SelectedValue); this.ProviderId = ctlSolutionPath.SourceControlProviderId; ffSolutionPath.Visible = ctlSolutionPath.SourceControlProviderId > 0; }; this.wizardSteps.SelectOrganizationName.Controls.Add( new FormFieldGroup( "Organization Name", "This should be your company or division name, e.g. \"Initech\". <br /><br />This is used to generate the sample code and also create the application name.", true, new StandardFormField( "Organization Name:", txtOrganizationName ) ) ); txtOrganizationName.Load += (S,E) => this.wizardSteps.DownloadInstructions.OrganizationName = txtOrganizationName.Text; this.wizardSteps.SelectProviderAndSolution.Controls.Add( new FormFieldGroup( "Source Control", "Select the Source Control Provider and the path to the extension's solution file.", true, new StandardFormField( "Source Control Provider:", ddlProvider, ctlNoProviders ), ffSolutionPath ) ); this.WizardStepChange += (s, e) => { if (e.CurrentStep != this.wizardSteps.SelectProviderAndSolution) return; using (var scm = Util.Providers.CreateProviderFromId<SourceControlProviderBase>(ctlSolutionPath.SourceControlProviderId)) { var fileBytes = scm.GetFileContents(ctlSolutionPath.Text); if (ctlSolutionPath.Text.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)) { var solution = Solution.Load(new MemoryStream(fileBytes)); if (solution.Projects.Count > 1) { ctlMoreThanOneProject.Visible = true; ctlOneProject.Visible = false; } this.SolutionPath = new ProjectInfo(scm.DirectorySeparator, ctlSolutionPath.Text).ScmDirectoryName; this.Project = new ProjectInfo(scm.DirectorySeparator, new ProjectInfo(scm.DirectorySeparator, ctlSolutionPath.Text).ProjectFileName); } } }; this.wizardSteps.OneProjectVerification.Controls.Add( new FormFieldGroup( "One Project Verification", "This step ensures that there is only one project in the selected solution.", true, new StandardFormField( "", ctlMoreThanOneProject, ctlOneProject ) ) ); this.wizardSteps.Confirmation.Controls.Add( new FormFieldGroup( "Summary", "This is a summary of the details of the application that will be created. The application's deployment plan may be modified after creation if necessary.", true, new StandardFormField( "", new Summary(this) ) ) ); }
protected override void CreateChildControls() { base.CreateChildControls(); //ddlConfigurationFile this.ddlConfigurationFile = new DropDownList { ID = "ddlConfigurationFile", Width = 300, AutoPostBack = true }; this.ddlConfigurationFile.Items.Add(string.Empty); this.ddlConfigurationFile.Items.AddRange( StoredProcs.ConfigurationFiles_GetConfigurationFiles(Application_Id: this.ApplicationId, Deployable_Id: InedoLib.Util.NullIf(this.DeployableId, 0)) .Execute() .ConfigurationFiles_Extended .Select(c => new ListItem { Text = c.FilePath_Text, Value = c.ConfigurationFile_Id.ToString() }) ); this.ddlConfigurationFile.Items.Add(new ListItem { Text = "Type name...", Value = "X", Enabled = false }); this.ddlConfigurationFile.SelectedIndexChanged += this.ddlConfigurationFile_SelectedIndexChanged; //ddlInstance ddlInstance = new DropDownList { ID = "ddlInstance", Width = 300 }; this.txtConfigurationFileName = new ValidatingTextBox { Width = 300 }; this.txtInstanceName = new ValidatingTextBox { Width = 300 }; this.ctl_txtInstanceName = new StandardFormField("Instance Name:", this.txtInstanceName) { Visible = false }; this.ctl_ddlInstance = new StandardFormField("Instance Name:", this.ddlInstance); this.ctl_txtConfigurationFileName = new StandardFormField("Configuration File Name:", this.txtConfigurationFileName) { Visible = false }; this.Controls.Add(new FormFieldGroup("Configuration File", "Configuration file location, select only one. The order of evaluation is configuration file text, disk location, then configuration name.", false, new StandardFormField("Configuration Text:", this.txtConfigText), new StandardFormField("Configuration File Location:", this.ffpConfigFilePath), new StandardFormField("Configuration File:", this.ddlConfigurationFile), ctl_txtConfigurationFileName, ctl_ddlInstance ) ); }