private void AddServerInformation()
        {
            var ff = new FormFieldGroup("Server", "Server used for this action. If not populated then the server defined for the Artifactory extension will be used.", false);

            ff.FormFields.Add(new StandardFormField("Server:", txtServer));
            this.Controls.Add(ff);
        }
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox { Width = 300 };

            this.txtUserName = new ValidatingTextBox { Width = 300 };

            this.txtDomain = new ValidatingTextBox { Width = 300 };

            this.txtPassword = new PasswordTextBox { Width = 270 };

            ddlAuthentication = new DropDownList();
            ddlAuthentication.Items.Add(new ListItem("System", "system"));
            ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var ffgAuthentication = new FormFieldGroup("Authentication",
                    "The method used for authenticating a connection to Team Foundation Server",
                    false,
                    new StandardFormField("Authentication:", ddlAuthentication)
                );

            var ffgCredentials = new FormFieldGroup("Credentials",
                    "Specify the credentials of the account you would like to use to connect to Team Foundation Server",
                    false,
                    new StandardFormField("Username:"******"Password:"******"Domain:", txtDomain)
                );

            CUtil.Add(this,
                new FormFieldGroup("TFS Server Name",
                    "The name of the Team Foundation Server to connect to, e.g. http://tfsserver:8080/tfs",
                    false,
                    new StandardFormField(
                        "Server Name:",
                        txtBaseUrl,
                        new RenderClientScriptDelegator(w =>
                        {
                            w.WriteLine(
                                // jQuery code used to hide the Credentials section if the "System" account is to be used
@"$().ready(function(){
    var onAuthorizationChange = function(){
        if($('#" + ddlAuthentication.ClientID + @" option:selected').val() == 'system') {
            $('#" + ffgCredentials.ClientID + @"').hide();
        }
        else {
            $('#" + ffgCredentials.ClientID + @"').show();
        }
    };
    onAuthorizationChange();
    $('#" + ddlAuthentication.ClientID + @"').change(onAuthorizationChange);
});");
                        })
                    )
                ),
                ffgAuthentication,
                ffgCredentials
              );

            base.CreateChildControls();
        }
Beispiel #3
0
 private void AddServiceInformation()
 {
     if (extensionInstance.UsesServiceName)
     {
         var ff = new FormFieldGroup("Cloud Service",
                                     "Information about the cloud service.",
                                     false);
         ff.FormFields.Add(new StandardFormField("Service Name:", this.txtServiceName));
         this.Controls.Add(ff);
     }
 }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            this.txtTargetAssembly = new ValidatingTextBox()
            {
                Width = 300,
                Required = true
            };

            this.cbQueue = new CheckBox()
            {
                Text = "Queue for background generation"
            };

            this.ddlMode = new DropDownList();
            this.ddlMode.AutoPostBack = true;
            this.ddlMode.Items.Add(new ListItem("Install", "Install"));
            this.ddlMode.Items.Add(new ListItem("Uninstall", "Uninstall"));
            this.ddlMode.Items.Add(new ListItem("Update", "Update"));
            this.ddlMode.SelectedValue = "Install";
            this.ddlMode.SelectedIndexChanged += ddlMode_SelectedIndexChanged;

            this.ffgTargetAssembly = new FormFieldGroup(
                "Target Assembly",
                "The absolute path to the .NET assembly or its strong name if it is installed in the GAC.",
                false,
                new StandardFormField("Absolute path or strong name of assembly:", this.txtTargetAssembly));

            this.ffgOptions = new FormFieldGroup(
                "Options",
                "Additional options for NGen.",
                true,
                new StandardFormField(string.Empty, this.cbQueue));

            CUtil.Add(this,
                new FormFieldGroup(
                    "Action",
                    "The NGen action to perform.",
                    false,
                    new StandardFormField("Action:", this.ddlMode)
                    ),
                this.ffgTargetAssembly,
                this.ffgOptions);
        }
Beispiel #5
0
        private void AddActionOptions()
        {
            var ff = new FormFieldGroup("Action Options",
                                        "Other options for the action.",
                                        false);

            if (extensionInstance.UsesTreatWarningsAsError)
            {
                ff.FormFields.Add(new StandardFormField("Treat Warnings as Errors", chkWarningsAsError));
            }
            if (extensionInstance.UsesWaitForCompletion)
            {
                ff.FormFields.Add(new StandardFormField("Wait For Completion", chkWaitForCompletion));
            }
            if (extensionInstance.UsesTreatWarningsAsError || extensionInstance.UsesWaitForCompletion)
            {
                this.Controls.Add(ff);
            }
        }
Beispiel #6
0
        private void AddDeploymentInformation()
        {
            var ff = new FormFieldGroup("Deployment",
                                        "Information about the deployment and environment (production|staging).",
                                        false);

            if (extensionInstance.UsesDeploymentName)
            {
                ff.FormFields.Add(new StandardFormField("Deployment Name:", txtDeploymentName));
            }
            if (extensionInstance.UsesSlotName)
            {
                ff.FormFields.Add(new StandardFormField("Deployment Slot:", txtSlotName));
            }
            if (extensionInstance.UsesDeploymentName || extensionInstance.UsesSlotName)
            {
                this.Controls.Add(ff);
            }
        }
        protected override void CreateChildControls()
        {
            this.txtGacFiles = new TextBox();
            txtGacFiles.TextMode = TextBoxMode.MultiLine;
            txtGacFiles.Rows = 4;
            txtGacFiles.Columns = 30;
            txtGacFiles.Width = Unit.Pixel(300);

            this.chkForceRefresh = new CheckBox();
            chkForceRefresh.Text = "Force refresh";
            chkForceRefresh.Checked = true;

            var GacFilesFieldGroup =
                new FormFieldGroup("Files",
                    "Files listed (entered one per line) will be added to the GAC.",
                    true,
                    new StandardFormField("Files:", txtGacFiles),
                    new StandardFormField("", chkForceRefresh)
                );

            this.Controls.Add(GacFilesFieldGroup);
        }
Beispiel #8
0
        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 AddServiceInformation()
 {
     if (extensionInstance.UsesServiceName)
     {
         var ff = new FormFieldGroup("Cloud Service",
                     "Information about the cloud service.",
                     false);
         ff.FormFields.Add(new StandardFormField("Service Name:", this.txtServiceName));
         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);
 }
 private void AddDeploymentInformation()
 {
     var ff = new FormFieldGroup("Deployment",
                 "Information about the deployment and environment (production|staging).",
                 false);
     if(extensionInstance.UsesDeploymentName)
         ff.FormFields.Add(new StandardFormField("Deployment Name:", txtDeploymentName));
     if (extensionInstance.UsesSlotName)
         ff.FormFields.Add(new StandardFormField("Deployment Slot:", txtSlotName));
     if (extensionInstance.UsesDeploymentName || extensionInstance.UsesSlotName)
         this.Controls.Add(ff);
 }
 private void AddActionOptions()
 {
     var ff = new FormFieldGroup("Action Options",
                 "Other options for the action.",
                 false);
     if (extensionInstance.UsesTreatWarningsAsError)
         ff.FormFields.Add(new StandardFormField("Treat Warnings as Errors",chkWarningsAsError));
     if (extensionInstance.UsesWaitForCompletion)
         ff.FormFields.Add(new StandardFormField("Wait For Completion", chkWaitForCompletion));
     if (extensionInstance.UsesTreatWarningsAsError || extensionInstance.UsesWaitForCompletion)
         this.Controls.Add(ff);
 }
        protected override void CreateChildControls()
        {
            txtBaseUrl = new ValidatingTextBox()
            {
                Width = Unit.Pixel(300)
            };
            
            txtCustomReleaseNumberFieldName = new ValidatingTextBox()
            {
                Width = Unit.Pixel(300)
            };
            
            txtUserName = new ValidatingTextBox()
            {
                Width= Unit.Pixel(300)
            };
            
            txtDomain = new ValidatingTextBox()
            {
                Width = Unit.Pixel(300)
            };
            
            txtPassword = new PasswordTextBox()
            {
                Width = Unit.Pixel(270)
            };

            this.chkAllowHtml = new CheckBox { Text = "Allow HTML in issue descriptions" };
            
            ddlAuthentication = new DropDownList();
            ddlAuthentication.Items.Add(new ListItem("System", "system"));
            ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            // ffgAuthentication
            FormFieldGroup ffgAuthentication = new FormFieldGroup("Authentication",
                    "The method used for authenticating a connection to Team Foundation Server.",
                    false,
                    new StandardFormField("Authentication:", ddlAuthentication)
                );

            // ffgCredentials
            FormFieldGroup ffgCredentials = new FormFieldGroup("Credentials",
                    "Specify the credentials of the account you would like to use to connect to the Team Foundation Server.",
                    false,
                    new StandardFormField("Username:"******"Password:"******"Domain:", txtDomain)
                );

            this.Controls.Add(
                new FormFieldGroup(
                    "Team Foundation Server URL",
                    "The base URL of the Team Foundation Server, for example: http://tfsserver:port/vdir",
                    false,
                    new StandardFormField(
                        "Base Server URL:",
                        txtBaseUrl,
                        new RenderJQueryDocReadyDelegator(w =>
                        {
                            w.WriteLine(
                                // jQuery code used to hide the Credentials section if the "System" account is to be used
@"var onAuthorizationChange = function(){
        if($('#" + ddlAuthentication.ClientID + @" option:selected').val() == 'system') {
            $('#" + ffgCredentials.ClientID + @"').hide();
        }
        else {
            $('#" + ffgCredentials.ClientID + @"').show();
        }
    };
    onAuthorizationChange();
    $('#" + ddlAuthentication.ClientID + @"').change(onAuthorizationChange);");
                        })
                    )
                ),
                ffgAuthentication,
                ffgCredentials,
                new FormFieldGroup(
                    "Custom Release Number Field",
                    "If you store your TFS work item release numbers in a custom field, enter the full field \"refname\" of the custom field here - otherwise leave this field blank and \"Iteration\" will be used to retrieve them.<br /><br />For more information on custom work item types, visit <a href=\"http://msdn.microsoft.com/en-us/library/ms400654.aspx\" target=\"_blank\">http://msdn.microsoft.com/en-us/library/ms400654.aspx</a>",
                    false,
                    new StandardFormField(
                        "Custom Field:",
                        txtCustomReleaseNumberFieldName
                    )
                ),
                new FormFieldGroup(
                    "Options",
                    "Specify additional options.",
                    false,
                    new StandardFormField(string.Empty, this.chkAllowHtml)
                )
            );

            base.CreateChildControls();
        }
        protected override void CreateChildControls()
        {
            ddlVersion = new DropDownList();
            ddlVersion.Items.Add(new ListItem("(auto detect)", ""));
            ddlVersion.Items.Add(new ListItem("2.0", "2.0.50727"));
            ddlVersion.Items.Add(new ListItem("3.5", "3.5"));
            ddlVersion.Items.Add(new ListItem("4.0", "4.0.30319"));

            txtProjectFilePath = new ValidatingTextBox()
            {
                Width = 300
            };

            txtMSBuildTarget = new ValidatingTextBox()
            {
                Width = 300,
                Required = true
            };

            txtAdditionalProperties = new ValidatingTextBox()
            {
                Width = 300,
                TextMode = TextBoxMode.MultiLine,
                Rows = 5
            };

            this.Controls.Add(
                new FormFieldGroup(".NET Framework Version",
                    "The version of the .NET Framework to use when building this project.",
                    false,
                    new StandardFormField("Version:", ddlVersion)
                )
            );

            FormFieldGroup FilePathFieldGroup =
                new FormFieldGroup("MSBuild File Path",
                    "The path of the msbuild file.",
                    false,
                    new StandardFormField("MSBuild File Path:", txtProjectFilePath)
                );

            FormFieldGroup TargetFieldGroup =
                new FormFieldGroup("MSBuild Target",
                    "The MSBuild Target property. For example: Build",
                    false,
                    new StandardFormField("MSBuild Target:", txtMSBuildTarget)
                );

            FormFieldGroup PropertiesFieldGroup =
                new FormFieldGroup("MSBuild Properties",
                    "Additional properties, separated by newlines.  Example:<br />WarningLevel=2<br />Optimize=false",
                    true,
                    new StandardFormField("MSBuild Properties:", txtAdditionalProperties)
                );

            this.Controls.Add(FilePathFieldGroup, TargetFieldGroup, PropertiesFieldGroup);
        }
        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();
        }