protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox
            {
                DefaultText = "ex: http://tfsserver:80/tfs",
                Required    = true
            };

            this.txtCustomReleaseNumberFieldName = new ValidatingTextBox {
                DefaultText = "iteration"
            };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.chkAllowHtml = new CheckBox {
                Text = "Allow HTML in issue descriptions"
            };

            this.txtCustomClosedStates = new ValidatingTextBox()
            {
                TextMode    = TextBoxMode.MultiLine,
                Rows        = 3,
                DefaultText = "Closed\r\nResolved"
            };

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

            this.ddlUseWiql = new DropDownList
            {
                ID    = "ddlUseWiql",
                Items =
                {
                    new ListItem("Not using a custom query", "False"),
                    new ListItem("Custom WIQL query",        "True")
                }
            };

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
                );

            this.txtWiql = new ValidatingTextBox
            {
                TextMode = TextBoxMode.MultiLine,
                Rows     = 5
            };

            var ctlWiql = new SlimFormField("WIQL query:", this.txtWiql)
            {
                HelpText = "This will be sent to TFS directly, after BuildMaster variables have been replaced. This WIQL query should return all issues "
                           + "for the current BuildMaster release. Any release-level or higher BuildMaster variables may be used in this query."
            };

            var ctlNoWiql = new SlimFormField("Release number field:", this.txtCustomReleaseNumberFieldName)
            {
                HelpText = HelpText.FromHtml("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>")
            };

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new SlimFormField("Query mode:", this.ddlUseWiql),
                ctlNoWiql,
                ctlWiql,
                new SlimFormField("Options:", this.chkAllowHtml),
                new RenderJQueryDocReadyDelegator(
                    w =>
            {
                w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                w.Write("});");
                w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);

                w.Write("$('#{0}').change(function(){{", this.ddlUseWiql.ClientID);
                w.Write("if($(this).val() == 'False') {{ $('#{0}').hide(); $('#{1}').show(); }} else {{ $('#{0}').show(); $('#{1}').hide(); }}", ctlWiql.ClientID, ctlNoWiql.ClientID);
                w.Write("});");
                w.Write("$('#{0}').change();", this.ddlUseWiql.ClientID);
            }
                    ),
                new SlimFormField("Closed statuses:", this.txtCustomClosedStates)
            {
                HelpText = "The newline-separated list of issue states in TFS that BuildMaster will use to determine if a synchronized issue is closed."
            }
                );
        }
Exemplo n.º 2
0
        protected override void CreateChildControls()
        {
            this.ctlServerPicker = new ActionServerPicker {
                ServerId = 1, ID = "ctlServerPicker"
            };

            this.txtBaseUrl = new ValidatingTextBox();

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

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

            var sffAuthentication = new SlimFormField("Authentication:", this.ddlAuthentication)
            {
                ID = "sffAuthentication"
            };

            var sffCredentials = new SlimFormField("Credentials:",
                                                   new Div(new Div("Username:"******"Password / access token:"), new Div(this.txtPassword)),
                                                   new Div(new Div("Domain:"), new Div(this.txtDomain))
                                                   )
            {
                ID       = "sffCredentials",
                HelpText = HelpText.FromHtml("For Visual Studio Online, either <a href=\"https://www.visualstudio.com/en-us/integrate/get-started/auth/overview\" target=\"_blank\">Alternate Credentials or Personal Access Tokens</a> must be used in the password field.")
            };

            this.Controls.Add(
                new SlimFormField("TFS client:", this.ctlServerPicker)
            {
                HelpText = "The server where the TFS Client (Visual Studio or Team Explorer) is installed."
            },
                new SlimFormField("TFS collection url:", this.txtBaseUrl)
            {
                HelpText = "The is the api of the TFS Collection to use, e.g. http://tfsserver:8080/tfs"
            },
                sffAuthentication,
                sffCredentials,
                new RenderJQueryDocReadyDelegator(w =>
            {
                w.WriteLine(
                    @"  var onAuthorizationChange = function(){
        if($('#" + ddlAuthentication.ClientID + @" option:selected').val() == 'system') {
            $('#" + sffCredentials.ClientID + @"').hide();
        }
        else {
            $('#" + sffCredentials.ClientID + @"').show();
        }
    };
    onAuthorizationChange();
    $('#" + this.ddlAuthentication.ClientID + @"').change(onAuthorizationChange);
");
            })
                );
        }