protected override void Render(HtmlTextWriter writer) { base.Render(writer); writer.Write("<script type=\"text/javascript\">$(function(){"); writer.Write("BmSkytapResourcePicker("); InedoLib.Util.JavaScript.WriteJson( writer, new { ajaxUrl = DynamicHttpHandling.GetJavascriptDataUrl(this.AjaxHandler), token = GetToken(this.Configurer), selector = "#" + this.ClientID } ); writer.Write(");"); writer.Write("});</script>"); }
protected override void CreateChildControls() { this.ddlCollection = new ComboSelect(); this.ddlCollection.Items.AddRange( from c in this.collections.Value orderby c.Name select new ListItem(c.Name, c.Id.ToString()) ); if (this.HasProviderWiql()) { this.Controls.Add( new InfoBox( InfoBox.InfoBoxTypes.Info, new P("There is a custom WIQL query defined at the provider level. That query will override any project or area filtering here."), new P("However, you may still specify a custom WIQL query here to override the provider's WIQL query.") ) ); } this.ddlUseWiql = new ComboSelect { Items = { new ListItem("Not using a custom query", "False"), new ListItem("Custom WIQL query", "True") } }; this.ctlProject = new HiddenField { ID = "ctlProject" }; this.ctlAreaPath = new HiddenField { ID = "ctlAreaPath" }; var ctlNoWiql = new Div( new SlimFormField("Project:", this.ctlProject), new SlimFormField("Area Path:", this.ctlAreaPath) ); this.txtCustomWiql = new TextBox { TextMode = TextBoxMode.MultiLine, Rows = 5 }; var ctlWiql = new SlimFormField("Custom query:", this.txtCustomWiql); this.Controls.Add( new SlimFormField("Collection:", this.ddlCollection), new SlimFormField("Query mode:", this.ddlUseWiql), ctlNoWiql, ctlWiql, new RenderJQueryDocReadyDelegator( w => { w.Write("TfsIssueTrackingApplicationFilterEditor_Init("); InedoLib.Util.JavaScript.WriteJson( w, new { ddlCollection = ddlCollection.ClientID, ddlUseWiql = ddlUseWiql.ClientID, ctlWiql = ctlWiql.ClientID, ctlNoWiql = ctlNoWiql.ClientID, ctlProject = ctlProject.ClientID, ctlArea = ctlAreaPath.ClientID, getProjectsUrl = DynamicHttpHandling.GetJavascriptDataUrl <int, string, object>(GetProjects), getAreasUrl = DynamicHttpHandling.GetJavascriptDataUrl <int, string, string, object>(GetAreas), applicationId = this.EditorContext.ApplicationId } ); w.Write(");"); } ) ); }