/// <summary> /// Creates the control needed to filter (query) values using this field type. /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id">The identifier.</param> /// <param name="required">if set to <c>true</c> [required].</param> /// <returns></returns> public virtual Control FilterControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required) { HtmlGenericControl row = new HtmlGenericControl("div"); row.ID = id; row.AddCssClass("row"); row.AddCssClass("field-criteria"); var compareControl = FilterCompareControl(configurationValues, id, required); var valueControl = FilterValueControl(configurationValues, id, required); bool isLabel = compareControl is Label; if (compareControl != null) { HtmlGenericControl col1 = new HtmlGenericControl("div"); col1.ID = string.Format("{0}_col1", id); row.Controls.Add(col1); col1.AddCssClass(isLabel ? "col-md-2" : "col-md-4"); col1.Controls.Add(compareControl); } HtmlGenericControl col2 = new HtmlGenericControl("div"); col2.ID = string.Format("{0}_col2", id); row.Controls.Add(col2); col2.AddCssClass(isLabel ? "col-md-10" : "col-md-8"); col2.Controls.Add(valueControl); return(row); }
/// <summary> /// Creates the control needed to filter (query) values using this field type. /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id">The identifier.</param> /// <param name="required">if set to <c>true</c> [required].</param> /// <param name="filterMode">The filter mode.</param> /// <returns></returns> public virtual Control FilterControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode) { HtmlGenericControl row = new HtmlGenericControl("div"); row.ID = id; row.AddCssClass("row"); row.AddCssClass("form-row"); row.AddCssClass("field-criteria"); var compareControl = FilterCompareControl(configurationValues, id, required, filterMode); var valueControl = FilterValueControl(configurationValues, id, required, filterMode); string col1Class = string.Empty; string col2Class = "col-md-12"; if (compareControl != null) { HtmlGenericControl col1 = new HtmlGenericControl("div"); col1.ID = string.Format("{0}_col1", id); row.Controls.Add(col1); if (!compareControl.Visible) { col1Class = string.Empty; col2Class = "col-md-12"; } else if (compareControl is Label) { col1Class = "col-md-2"; col2Class = "col-md-10"; } else { col1Class = "col-md-4"; col2Class = "col-md-8"; } col1.AddCssClass(col1Class); col1.Controls.Add(compareControl); } HtmlGenericControl col2 = new HtmlGenericControl("div"); col2.ID = string.Format("{0}_col2", id); row.Controls.Add(col2); col2.AddCssClass(col2Class); if (valueControl != null) { col2.Controls.Add(valueControl); } return(row); }
/// <summary> /// Adds the note HTML in the form: /// <article class="alert alert-info"> /// <i class="fa fa-comment"></i> /// <div class="detail"> <strong>Name/Caption</strong> <span class="muted">relative date</span><br> /// <p>text</p> /// </div> /// </article> /// </summary> /// <param name="note">The note.</param> private void AddNoteHtml(Note note) { var article = new HtmlGenericControl("article"); PlaceHolder phNotes = useTheAfterPH ? phNotesAfter : phNotesBefore; phNotes.Controls.Add(article); article.AddCssClass("alert alert-info"); // The comment icon or possibly a picture of the person who made the comment... article.Controls.Add(new LiteralControl("<i class='fa fa-comment'></i> ")); var divDetail = new HtmlGenericControl("div"); article.Controls.Add(divDetail); divDetail.AddCssClass("detail"); // Add the name/caption string caption = note.Caption; if (string.IsNullOrWhiteSpace(caption) && note.CreatedByPersonAlias != null && note.CreatedByPersonAlias.Person != null) { caption = note.CreatedByPersonAlias.Person.FullName; } divDetail.Controls.Add(new LiteralControl(string.Format("<strong>{0}</strong> <span class='text-muted'>{1}</span>", caption, note.CreatedDateTime.ToRelativeDateString()))); var paragraphText = new HtmlGenericControl("p"); divDetail.Controls.Add(paragraphText); paragraphText.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(note.Text))); }
/// <summary> /// Sets any missing required field error indicators. /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="item">The item.</param> public static void SetErrorIndicators(Control parentControl, IHasAttributes item) { if (item.Attributes != null) { foreach (var attribute in item.Attributes) { if (attribute.Value.IsRequired) { HtmlGenericControl div = parentControl.FindControl(string.Format("attribute_{0}", attribute.Value.Id)) as HtmlGenericControl; RequiredFieldValidator rfv = parentControl.FindControl(string.Format("attribute_rfv_{0}", attribute.Value.Id)) as RequiredFieldValidator; if (div != null && rfv != null) { if (rfv.IsValid) { div.RemoveCssClass("error"); } else { div.AddCssClass("error"); } } } } } }
protected Control GetPagerAnchors() { if (RecordCount < PageSize) { return(new Control()); } var pagerWrapper = new HtmlGenericControl("div"); var pagerDiv = new HtmlGenericControl("div"); pagerDiv.AddCssClass("col-sm-8"); var paginationUl = new HtmlGenericControl("ul"); paginationUl.AddCssClass(PaginationUlClass); paginationUl.Style.Add(HtmlTextWriterStyle.Margin, "0"); AddPagerFirstPageAnchor(paginationUl); AddPagerPreviousButton(paginationUl); AddPagerLi(paginationUl); AddPagerNextButton(paginationUl); AddPagerLastPageAnchor(paginationUl); pagerDiv.Controls.Add(paginationUl); var pageInfoDiv = new HtmlGenericControl("div"); pageInfoDiv.AddCssClass("col-sm-4 text-right"); AddPageInfo(pageInfoDiv); pagerWrapper.Controls.Add(pagerDiv); pagerWrapper.Controls.Add(pageInfoDiv); return(pagerWrapper); }
// displays accounts private void BuildAccountControls() { if (this.Accounts != null) { bool firstAccount = true; foreach (var account in this.Accounts) { HtmlGenericControl formGroup = new HtmlGenericControl("div"); formGroup.AddCssClass("form-group"); phAccounts.Controls.Add(formGroup); CurrencyBox tb = new CurrencyBox(); tb.ID = "tbAccount_" + account.Key; tb.Attributes.Add("name", tb.ID); tb.Attributes.Add("type", "number"); tb.CssClass = "input-account"; if (firstAccount) { tb.CssClass = "input-account active"; firstAccount = false; } Label label = new Label(); label.AssociatedControlID = tb.ID; label.ID = "labelFund_" + account.Key; label.Text = account.Value; formGroup.Controls.Add(label); formGroup.Controls.Add(tb); } } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfGroupGuid = new HiddenField(); _hfGroupGuid.ID = this.ID + "_hfGroupGuid"; _hfGroupId = new HiddenField(); _hfGroupId.ID = this.ID + "_hfGroupId"; _hfGroupTypeId = new HiddenField(); _hfGroupTypeId.ID = this.ID + "_hfGroupTypeId"; _lblGroupName = new Literal(); _lblGroupName.ID = this.ID + "_lblGroupName"; _lbDeleteGroup = new LinkButton(); _lbDeleteGroup.CausesValidation = false; _lbDeleteGroup.ID = this.ID + "_lbDeleteGroup"; _lbDeleteGroup.CssClass = "btn btn-xs btn-danger"; _lbDeleteGroup.Click += lbDeleteGroup_Click; _lbDeleteGroup.Attributes["onclick"] = string.Format("javascript: return Rock.dialogs.confirmDelete(event, '{0}', '{1}');", "group", "Once saved, you will lose all attendance data."); var iDelete = new HtmlGenericControl("i"); _lbDeleteGroup.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); _tbGroupName = new DataTextBox(); _tbGroupName.ID = this.ID + "_tbGroupName"; _tbGroupName.Label = "Check-in Group Name"; // set label when they exit the edit field _tbGroupName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblGroupName.ID); _tbGroupName.SourceTypeName = "Rock.Model.Group, Rock"; _tbGroupName.PropertyName = "Name"; _phGroupAttributes = new PlaceHolder(); _phGroupAttributes.ID = this.ID + "_phGroupAttributes"; Controls.Add(_hfGroupGuid); Controls.Add(_hfGroupId); Controls.Add(_hfGroupTypeId); Controls.Add(_lblGroupName); Controls.Add(_tbGroupName); Controls.Add(_phGroupAttributes); // Locations Grid CreateLocationsGrid(); Controls.Add(_lbDeleteGroup); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); toggleAllAny = new Toggle(); Controls.Add(toggleAllAny); toggleAllAny.ID = this.ID + "_toggleAllAny"; toggleAllAny.ButtonSizeCssClass = "btn-xs"; toggleAllAny.OnText = "All"; toggleAllAny.OffText = "Any"; toggleAllAny.ActiveButtonCssClass = "btn-info"; toggleTrueFalse = new Toggle(); Controls.Add(toggleTrueFalse); toggleTrueFalse.ID = this.ID + "_toggleTrueFalse"; toggleTrueFalse.ButtonSizeCssClass = "btn-xs"; toggleTrueFalse.OnText = "True"; toggleTrueFalse.OffText = "False"; toggleTrueFalse.ActiveButtonCssClass = "btn-info"; btnAddGroup = new LinkButton(); Controls.Add(btnAddGroup); btnAddGroup.ID = this.ID + "_btnAddGroup"; btnAddGroup.Click += btnAddGroup_ServerClick; btnAddGroup.AddCssClass("btn btn-action"); btnAddGroup.CausesValidation = false; var iAddGroup = new HtmlGenericControl("i"); iAddGroup.AddCssClass("fa fa-list-alt"); btnAddGroup.Controls.Add(iAddGroup); btnAddGroup.Controls.Add(new LiteralControl(" Add Filter Group")); btnAddFilter = new LinkButton(); Controls.Add(btnAddFilter); btnAddFilter.ID = this.ID + "_btnAddFilter"; btnAddFilter.Click += btnAddFilter_ServerClick; btnAddFilter.AddCssClass("btn btn-action"); btnAddFilter.CausesValidation = false; var iAddFilter = new HtmlGenericControl("i"); iAddFilter.AddCssClass("fa fa-filter"); btnAddFilter.Controls.Add(iAddFilter); btnAddFilter.Controls.Add(new LiteralControl(" Add Filter")); lbDelete = new LinkButton(); Controls.Add(lbDelete); lbDelete.ID = this.ID + "_lbDelete"; lbDelete.Click += lbDelete_Click; lbDelete.AddCssClass("btn btn-sm btn-danger btn-square"); lbDelete.CausesValidation = false; var iDeleteGroup = new HtmlGenericControl("i"); iDeleteGroup.AddCssClass("fa fa-times"); lbDelete.Controls.Add(iDeleteGroup); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); ddlFilterType = new RockDropDownList(); Controls.Add(ddlFilterType); ddlFilterType.ID = this.ID + "_ddlFilter"; var component = Rock.Reporting.DataFilterContainer.GetComponent(FilterEntityTypeName); if (component != null) { RockPage page = this.Page as RockPage; filterControls = component.CreateChildControls(FilteredEntityType, this); } else { filterControls = new Control[0]; } ddlFilterType.AutoPostBack = true; ddlFilterType.SelectedIndexChanged += ddlFilterType_SelectedIndexChanged; ddlFilterType.Items.Clear(); ddlFilterType.Items.Add(new ListItem(string.Empty)); foreach (var section in AuthorizedComponents) { foreach (var item in section.Value) { ListItem li = new ListItem(item.Value, item.Key); if (!string.IsNullOrWhiteSpace(section.Key)) { li.Attributes.Add("optiongroup", section.Key); } li.Selected = item.Key == FilterEntityTypeName; ddlFilterType.Items.Add(li); } } hfExpanded = new HiddenField(); Controls.Add(hfExpanded); hfExpanded.ID = this.ID + "_hfExpanded"; hfExpanded.Value = "True"; lbDelete = new LinkButton(); Controls.Add(lbDelete); lbDelete.ID = this.ID + "_lbDelete"; lbDelete.CssClass = "btn btn-xs btn-danger "; lbDelete.Click += lbDelete_Click; lbDelete.CausesValidation = false; var iDelete = new HtmlGenericControl("i"); lbDelete.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); }
private void AddPageInfo(Control colDiv5) { var small = new HtmlGenericControl("p"); small.AddCssClass("control-label text-muted"); small.Style.Add(HtmlTextWriterStyle.FontSize, "95%"); small.InnerText = $"Showing Page {PageIndex} of {PageCount} | Total Records : {RecordCount}"; colDiv5.Controls.Add(small); }
protected override void OnInit(EventArgs e) { base.OnInit(e); var service = new PhoneNumberService(); foreach (dynamic item in service.Queryable() .Where(n => n.PersonId == Person.Id) .OrderBy(n => n.NumberTypeValue.Order) .Select(n => new { Number = n.Number, Unlisted = n.IsUnlisted, Type = n.NumberTypeValue.Name } )) { var li = new HtmlGenericControl("li"); ulPhoneNumbers.Controls.Add(li); var anchor = new HtmlGenericControl("a"); li.Controls.Add(anchor); anchor.Attributes.Add("href", "#"); anchor.AddCssClass("highlight"); var icon = new HtmlGenericControl("i"); anchor.Controls.Add(icon); icon.AddCssClass("fa fa-phone"); if (item.Unlisted) { var span = new HtmlGenericControl("span"); anchor.Controls.Add(span); span.AddCssClass("phone-unlisted"); span.Attributes.Add("data-value", PhoneNumber.FormattedNumber(item.Number)); span.InnerText = "Unlisted"; } else { anchor.Controls.Add(new LiteralControl(PhoneNumber.FormattedNumber(item.Number))); } anchor.Controls.Add(new LiteralControl(" ")); var small = new HtmlGenericControl("small"); anchor.Controls.Add(small); small.InnerText = item.Type; } if (!String.IsNullOrWhiteSpace(Person.Email)) { hlEmail.Text = Person.Email; hlEmail.NavigateUrl = "mailto:" + Person.Email; } }
private void ShowTab() { liPayPal.AddCssClass("active"); redirectDiv.AddCssClass("active"); // Hide the default next button ((HtmlGenericControl)RockTransactionEntry.FindControl("liCreditCard")).RemoveCssClass("active"); ((HtmlGenericControl)RockTransactionEntry.FindControl("liACH")).RemoveCssClass("active"); ((HtmlGenericControl)RockTransactionEntry.FindControl("divCCPaymentInfo")).RemoveCssClass("active"); ((HtmlGenericControl)RockTransactionEntry.FindControl("divACHPaymentInfo")).RemoveCssClass("active"); }
public void WorksForHtmlControls() { var cell = new HtmlTableCell(); cell.AddCssClass("someclass"); cell.Attributes["Class"].Should().Be("someclass"); var generic = new HtmlGenericControl(); generic.AddCssClass("a-new-class"); generic.Attributes["Class"].Should().Be("a-new-class"); }
/// <summary> /// Handles the Load event of the RockPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { pnlMessage.Visible = false; // Look for active external authentication providers foreach (var serviceEntry in ExternalAuthenticationContainer.Instance.Components) { var component = serviceEntry.Value.Value; if (component.AttributeValues.ContainsKey("Active") && bool.Parse(component.AttributeValues["Active"][0].Value)) { string loginTypeName = component.GetType().Name; // Check if returning from third-party authentication if (!IsPostBack && component.IsReturningFromAuthentication(Request)) { string userName = string.Empty; string returnUrl = string.Empty; if (component.Authenticate(Request, out userName, out returnUrl)) { LoginUser(userName, returnUrl, false); break; } } var div = new HtmlGenericControl("div"); phExternalLogins.Controls.Add(div); div.AddCssClass(loginTypeName + "-login"); LinkButton lbLogin = new LinkButton(); div.Controls.Add(lbLogin); lbLogin.ID = "lb" + loginTypeName + "Login"; lbLogin.Click += lbLogin_Click; lbLogin.CausesValidation = false; if (!String.IsNullOrWhiteSpace(component.ImageUrl())) { HtmlImage img = new HtmlImage(); lbLogin.Controls.Add(img); img.Attributes.Add("style", "border:none"); img.Src = Page.ResolveUrl(component.ImageUrl()); } else { lbLogin.Text = loginTypeName; } } } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _lbAddFamilyMember = new LinkButton(); Controls.Add(_lbAddFamilyMember); _lbAddFamilyMember.ID = this.ID + "_btnAddFamilyMember"; _lbAddFamilyMember.Click += lbAddFamilyMember_Click; _lbAddFamilyMember.AddCssClass("add btn btn-action"); _lbAddFamilyMember.CausesValidation = false; var iAddFilter = new HtmlGenericControl("i"); iAddFilter.AddCssClass("fa fa-plus-circle"); _lbAddFamilyMember.Controls.Add(iAddFilter); }
void lb_Click(object sender, EventArgs e) { if (CurrentPersonId.HasValue) { LinkButton lb = sender as LinkButton; if (lb != null) { int groupId = 0; if (Int32.TryParse(lb.Attributes["group"], out groupId)) { int roleId = 0; if (!Int32.TryParse(AttributeValue("GroupRole"), out roleId)) { roleId = 0; } var group = groupService.Get(groupId); if (group != null && group.AttributeValues.ContainsKey(_videoAttributeKey)) { hfVideoUrl.Value = group.AttributeValues[_videoAttributeKey].Value[0].Value; MemberService memberService = new MemberService(); var groupMember = memberService.GetByGroupIdAndPersonIdAndGroupRoleId( groupId, CurrentPersonId.Value, roleId); if (groupMember == null) { groupMember = new Member(); groupMember.GroupId = groupId; groupMember.PersonId = CurrentPersonId.Value; groupMember.GroupRoleId = roleId; memberService.Add(groupMember, CurrentPersonId); memberService.Save(groupMember, CurrentPersonId); } HtmlGenericControl li = lb.Parent as HtmlGenericControl; if (li != null) { li.RemoveCssClass("not-viewed"); li.AddCssClass("viewed"); } } } } } }
/// <summary> /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template. /// </summary> /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param> public void InstantiateIn(Control container) { DataControlFieldCell cell = container as DataControlFieldCell; if (cell != null) { HtmlGenericControl a = new HtmlGenericControl("a"); a.Attributes.Add("href", "#"); a.AddCssClass("minimal"); HtmlGenericControl buttonIcon = new HtmlGenericControl("i"); buttonIcon.Attributes.Add("class", "fa fa-bars"); a.Controls.Add(buttonIcon); cell.Controls.Add(a); } }
private void AddPagerNextButton(Control parentControl) { var li = new HtmlGenericControl("li"); var anchor = new HtmlAnchor { HRef = QueryStringHelper.AddUpdateQueryStringGetUrl("pageIndex", PageIndex + 1), InnerHtml = "Next", Title = "Go to next page" }; if (PageIndex == LastIndex) { li.AddCssClass("disabled"); anchor.HRef = "javascript:void(o)"; } li.Controls.Add(anchor); parentControl.Controls.Add(li); }
private void AddPagerLastPageAnchor(Control paginationUl) { var li = new HtmlGenericControl("li"); var anchor = new HtmlAnchor { HRef = QueryStringHelper.AddUpdateQueryStringGetUrl("pageIndex", LastIndex), InnerHtml = "Last", Title = "Go to last page" }; if (PageIndex == LastIndex) { li.AddCssClass("disabled"); anchor.HRef = "javascript:void(o)"; } li.Controls.Add(anchor); paginationUl.Controls.Add(li); }
private void AddPagerLi(Control parentControl) { for (var i = StartIndex; i <= EndIndex; i++) { var li = new HtmlGenericControl("li"); var anchor = new HtmlAnchor { HRef = QueryStringHelper.AddUpdateQueryStringGetUrl("pageIndex", i), InnerText = i.ToString(), Title = "Go to page " + i }; if (PageIndex == i) { li.AddCssClass("active"); } li.Controls.Add(anchor); parentControl.Controls.Add(li); } }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override System.Collections.Generic.List <System.Web.UI.Control> ConfigurationControls() { var controls = base.ConfigurationControls(); TextBox textbox = new TextBox(); controls.Add(textbox); HtmlGenericControl lbl = new HtmlGenericControl("label"); controls.Add(lbl); lbl.AddCssClass("checkbox"); CheckBox cbDisplayDiff = new CheckBox(); lbl.Controls.Add(cbDisplayDiff); return(controls); }
/// <summary> /// Handles the ItemDataBound event of the rContactInfo control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param> void rContactInfo_ItemDataBound(object sender, RepeaterItemEventArgs e) { var pnbPhone = e.Item.FindControl("pnbPhone") as PhoneNumberBox; if (pnbPhone != null) { pnbPhone.ValidationGroup = BlockValidationGroup; var phoneNumber = e.Item.DataItem as PhoneNumber; if (_IsEditRecordAdult && (phoneNumber != null)) { pnbPhone.Required = _RequiredPhoneNumberGuids.Contains(phoneNumber.NumberTypeValue.Guid); if (pnbPhone.Required) { pnbPhone.RequiredErrorMessage = string.Format("{0} phone is required", phoneNumber.NumberTypeValue.Value); HtmlGenericControl phoneNumberContainer = ( HtmlGenericControl )e.Item.FindControl("divPhoneNumberContainer"); phoneNumberContainer.AddCssClass("required"); } } } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _lbAddGroupMember = new LinkButton(); Controls.Add(_lbAddGroupMember); _lbAddGroupMember.ID = this.ID + "_btnAddGroupMember"; _lbAddGroupMember.Click += lbAddGroupMember_Click; _lbAddGroupMember.AddCssClass("add btn btn-xs btn-action pull-right"); _lbAddGroupMember.CausesValidation = false; var iAddFilter = new HtmlGenericControl("i"); iAddFilter.AddCssClass("fa fa-user"); _lbAddGroupMember.Controls.Add(iAddFilter); var spanAddFilter = new HtmlGenericControl("span"); spanAddFilter.InnerHtml = " Add Person"; _lbAddGroupMember.Controls.Add(spanAddFilter); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _lbAddChild = new LinkButton(); Controls.Add(_lbAddChild); _lbAddChild.ID = "_btnAddChild"; _lbAddChild.Click += lbAddChild_Click; _lbAddChild.AddCssClass("add btn btn-xs btn-default pull-right"); _lbAddChild.CausesValidation = false; var iAddFilter = new HtmlGenericControl("i"); iAddFilter.AddCssClass("fa fa-user"); _lbAddChild.Controls.Add(iAddFilter); var spanAddFilter = new HtmlGenericControl("span"); spanAddFilter.InnerHtml = " Add Child"; _lbAddChild.Controls.Add(spanAddFilter); }
/// <summary> /// Handles the ItemDataBound event of the rPhoneNumbers control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param> protected void rPhoneNumbers_ItemDataBound(object sender, RepeaterItemEventArgs e) { var pnbPhone = e.Item.FindControl("pnbPhone") as PhoneNumberBox; HtmlGenericControl phoneGroup = e.Item.FindControl("PhoneGroup") as HtmlGenericControl; if (pnbPhone != null) { pnbPhone.ValidationGroup = BlockValidationGroup; var phoneNumber = e.Item.DataItem as PhoneNumber; if (phoneNumber != null) { var isRequired = _requiredPhoneNumberGuids.Contains(phoneNumber.NumberTypeValue.Guid); pnbPhone.Required = isRequired; pnbPhone.RequiredErrorMessage = string.Format("{0} phone is required", phoneNumber.NumberTypeValue.Value); if (phoneGroup != null && isRequired) { phoneGroup.AddCssClass("required"); } } } }
/// <summary> /// Builds the config controls. /// </summary> /// <param name="qualifierValues">The qualifier values.</param> private void BuildConfigControls(Dictionary <string, ConfigurationValue> qualifierValues) { var fieldType = Rock.Web.Cache.FieldTypeCache.Read(int.Parse(ddlFieldType.SelectedValue)); if (fieldType != null) { phFieldTypeQualifiers.Controls.Clear(); var configControls = fieldType.Field.ConfigurationControls(); int i = 0; foreach (var configValue in fieldType.Field.ConfigurationValues(null)) { var ctrlGroup = new HtmlGenericControl("div"); phFieldTypeQualifiers.Controls.Add(ctrlGroup); ctrlGroup.AddCssClass("control-group"); var lbl = new Label(); ctrlGroup.Controls.Add(lbl); lbl.AddCssClass("control-label"); lbl.Text = configValue.Value.Name; var ctrls = new HtmlGenericControl("div"); ctrlGroup.Controls.Add(ctrls); ctrls.AddCssClass("controls"); Control control = configControls[i]; ctrls.Controls.Add(control); control.ID = "configControl_" + configValue.Key; i++; } if (qualifierValues != null) { fieldType.Field.SetConfigurationValues(configControls, qualifierValues); } } }
/// <summary> /// Adds the note HTML in the form: /// <article class="alert alert-info"> /// <i class="icon-comment"></i> /// <div class="detail"> <strong>Name/Caption</strong> <span class="muted">relative date</span><br> /// <p>text</p> /// </div> /// </article> /// </summary> /// <param name="note">The note.</param> private void AddNoteHtml(Note note) { var article = new HtmlGenericControl("article"); PlaceHolder phNotes = (useTheAfterPH) ? phNotesAfter : phNotesBefore; phNotes.Controls.Add(article); article.AddCssClass("alert alert-info"); // The comment icon or possibly a picture of the person who made the comment... article.Controls.Add(new LiteralControl("<i class='icon-comment'></i> ")); var divDetail = new HtmlGenericControl("div"); article.Controls.Add(divDetail); divDetail.AddCssClass("detail"); // Add the name/caption divDetail.Controls.Add(new LiteralControl(string.Format("<strong>{0}</strong> <span class='muted'>{1}</span>", note.Caption, note.CreationDateTime.ToRelativeDateString()))); var pText = new HtmlGenericControl("p"); divDetail.Controls.Add(pText); pText.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(note.Text))); }
/// <summary> /// Handles the Click event of the btnManager control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnManager_Click(object sender, EventArgs e) { ManagerLoggedIn = false; pnlNotActive.Visible = false; pnlNotActiveYet.Visible = false; pnlClosed.Visible = false; pnlActive.Visible = false; pnlManager.Visible = false; btnManager.Visible = false; tbPIN.Text = string.Empty; // Get room counts List <int> locations = new List <int>(); foreach (var groupType in CurrentCheckInState.Kiosk.FilteredGroupTypes(CurrentCheckInState.ConfiguredGroupTypes)) { var lUl = new HtmlGenericControl("ul"); lUl.AddCssClass("kioskmanager-count-locations"); phCounts.Controls.Add(lUl); foreach (var location in groupType.KioskGroups.SelectMany(g => g.KioskLocations).OrderBy(l => l.Location.Name).Distinct()) { if (!locations.Contains(location.Location.Id)) { locations.Add(location.Location.Id); var locationAttendance = KioskLocationAttendance.Get(location.Location.Id); if (locationAttendance != null) { var lLi = new HtmlGenericControl("li"); lUl.Controls.Add(lLi); lLi.InnerHtml = string.Format("<strong>{0}</strong>: {1}", locationAttendance.LocationName, locationAttendance.CurrentCount); var gUl = new HtmlGenericControl("ul"); gUl.AddCssClass("kioskmanager-count-groups"); lLi.Controls.Add(gUl); foreach (var groupAttendance in locationAttendance.Groups) { var gLi = new HtmlGenericControl("li"); gUl.Controls.Add(gLi); gLi.InnerHtml = string.Format("<strong>{0}</strong>: {1}", groupAttendance.GroupName, groupAttendance.CurrentCount); var sUl = new HtmlGenericControl("ul"); sUl.AddCssClass("kioskmanager-count-schedules"); gLi.Controls.Add(sUl); foreach (var scheduleAttendance in groupAttendance.Schedules.Where(s => s.IsActive)) { var sLi = new HtmlGenericControl("li"); sUl.Controls.Add(sLi); sLi.InnerHtml = string.Format("<strong>{0}</strong>: {1}", scheduleAttendance.ScheduleName, scheduleAttendance.CurrentCount); } } } } } } pnlManagerLogin.Visible = true; // set manager timer to 10 minutes hfRefreshTimerSeconds.Value = "600"; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfActionTypeGuid = new HiddenField(); Controls.Add(_hfActionTypeGuid); _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid"; _lblActionTypeName = new Label(); Controls.Add(_lblActionTypeName); _lblActionTypeName.ClientIDMode = ClientIDMode.Static; _lblActionTypeName.ID = this.ID + "_lblActionTypeName"; _lbDeleteActionType = new LinkButton(); Controls.Add(_lbDeleteActionType); _lbDeleteActionType.CausesValidation = false; _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType"; _lbDeleteActionType.CssClass = "btn btn-xs btn-square btn-danger js-action-delete"; _lbDeleteActionType.Click += lbDeleteActionType_Click; var iDelete = new HtmlGenericControl("i"); _lbDeleteActionType.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); _ddlCriteriaAttribute = new RockDropDownList(); Controls.Add(_ddlCriteriaAttribute); _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute"; _ddlCriteriaAttribute.EnableViewState = false; _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria"; _ddlCriteriaAttribute.Label = "Run If"; _ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running. If the criteria is not met, this action will be skipped when this activity is processed."; _ddlCriteriaComparisonType = new RockDropDownList(); Controls.Add(_ddlCriteriaComparisonType); _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType"; _ddlCriteriaComparisonType.EnableViewState = false; _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison"; _ddlCriteriaComparisonType.BindToEnum <ComparisonType>(); _ddlCriteriaComparisonType.Label = " "; _tbddlCriteriaValue = new RockTextOrDropDownList(); Controls.Add(_tbddlCriteriaValue); _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue"; _tbddlCriteriaValue.EnableViewState = false; _tbddlCriteriaValue.TextBox.Label = "Text Value"; _tbddlCriteriaValue.DropDownList.Label = "Attribute Value"; _tbActionTypeName = new RockTextBox(); Controls.Add(_tbActionTypeName); _tbActionTypeName.ID = this.ID + "_tbActionTypeName"; _tbActionTypeName.Label = "Name"; _tbActionTypeName.Required = true; _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID); _wfatpEntityType = new WorkflowActionTypePicker(); _wfatpEntityType.SelectItem += wfatpEntityType_SelectItem; Controls.Add(_wfatpEntityType); _wfatpEntityType.ID = this.ID + "_wfatpEntityType"; _wfatpEntityType.Label = "Action Type"; _rlEntityTypeOverview = new RockLiteral(); Controls.Add(_rlEntityTypeOverview); _rlEntityTypeOverview.ID = this.ID + ""; _rlEntityTypeOverview.Label = "Action Type Overview"; _cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" }; Controls.Add(_cbIsActionCompletedOnSuccess); _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess"; _cbIsActivityCompletedOnSuccess = new RockCheckBox { Text = "Activity is Completed on Success" }; Controls.Add(_cbIsActivityCompletedOnSuccess); _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess"; _formEditor = new WorkflowFormEditor(); Controls.Add(_formEditor); _formEditor.ID = this.ID + "_formEditor"; _phActionAttributes = new PlaceHolder(); Controls.Add(_phActionAttributes); _phActionAttributes.ID = this.ID + "_phActionAttributes"; }
/// <summary> /// Builds the controls. /// </summary> /// <param name="setData">if set to <c>true</c> [set data].</param> private void BuildControls(bool setData) { string errorMessage = string.Empty; var dataSet = GetData(out errorMessage); if (!string.IsNullOrWhiteSpace(errorMessage)) { phContent.Visible = false; nbError.Text = errorMessage; nbError.Visible = true; } else { phContent.Controls.Clear(); if (dataSet != null) { string formattedOutput = GetAttributeValue("FormattedOutput"); if (string.IsNullOrWhiteSpace(formattedOutput)) { bool personReport = GetAttributeValue("PersonReport").AsBoolean(); int tableId = 0; foreach (DataTable dataTable in dataSet.Tables) { var div = new HtmlGenericControl("div"); div.AddCssClass("grid"); phContent.Controls.Add(div); var grid = new Grid(); div.Controls.Add(grid); grid.ID = string.Format("dynamic_data_{0}", tableId++); grid.AllowSorting = true; grid.EmptyDataText = "No Results"; grid.GridRebind += gReport_GridRebind; grid.RowSelected += gReport_RowSelected; if (personReport) { grid.PersonIdField = "Id"; } else { grid.PersonIdField = null; } grid.CommunicateMergeFields = GetAttributeValue("MergeFields").SplitDelimitedValues().ToList <string>(); AddGridColumns(grid, dataTable); SetDataKeyNames(grid, dataTable); if (setData) { SortTable(grid, dataTable); grid.DataSource = dataTable; grid.DataBind(); } } } else { var mergeFields = Rock.Web.Cache.GlobalAttributesCache.GetMergeFields(CurrentPerson); if (CurrentPerson != null) { // TODO: When support for "Person" is not supported anymore (should use "CurrentPerson" instead), remove this line mergeFields.Add("Person", CurrentPerson); mergeFields.Add("CurrentPerson", CurrentPerson); } mergeFields.Add("RockVersion", Rock.VersionInfo.VersionInfo.GetRockProductVersionNumber()); mergeFields.Add("Campuses", CampusCache.All()); int i = 1; foreach (DataTable dataTable in dataSet.Tables) { var dropRows = new List <DataRowDrop>(); foreach (DataRow row in dataTable.Rows) { dropRows.Add(new DataRowDrop(row)); } if (dataSet.Tables.Count > 1) { var tableField = new Dictionary <string, object>(); tableField.Add("rows", dropRows); mergeFields.Add("table" + i.ToString(), tableField); } else { mergeFields.Add("rows", dropRows); } i++; } phContent.Controls.Add(new LiteralControl(formattedOutput.ResolveMergeFields(mergeFields))); } } phContent.Visible = true; nbError.Visible = false; } }