protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); // Show or hide messages this.lblError.Visible = !string.IsNullOrEmpty(this.lblError.Text); this.lblInfo.Visible = !string.IsNullOrEmpty(this.lblInfo.Text); string status = string.Empty; // Set status if (AbTestObj != null) { if (!AbTestObj.ABTestEnabled) { status = "<span class=\"StatusDisabled\">" + GetString("general.disabled") + "</span>"; } else { if (ABTestInfoProvider.ABTestIsRunning(AbTestObj)) { // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(CMSContext.CurrentSiteName) || !AnalyticsHelper.TrackConversionsEnabled(CMSContext.CurrentSiteName)) { status = GetString("abtesting.statusNone"); } else { if (!ABTestInfoProvider.ContainsVariants(AbTestObj)) { // Display warning when the test does not contain any variant status = "<img src=\"" + GetImageUrl("Design/Controls/UniGrid/Actions/Warning.png") + "\" alt=\"" + GetString("abtest.novariants") + "\" title=\"" + GetString("abtest.novariants") + "\" /> " + GetString("abtesting.statusNone"); } else { status = "<span class=\"StatusEnabled\">" + GetString("abtesting.status" + ABTestInfoProvider.GetABTestStatus(AbTestObj)) + "</span>"; } } } else { status = GetString("abtesting.status" + ABTestInfoProvider.GetABTestStatus(AbTestObj)); } } } else { status = GetString("general.none"); } ltrStatusValue.Text = status; }
/// <summary> /// Handles Unigrid's OnExternalDataBound event. /// </summary> protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLower()) { case "abteststatus": int testID = ValidationHelper.GetInteger(parameter, 0); ABTestInfo testInfo = ABTestInfoProvider.GetABTestInfo(testID); if (testInfo != null) { if (!testInfo.ABTestEnabled) { return("<span class=\"StatusDisabled\">" + GetString("general.disabled") + "</span>"); } else { string status = string.Empty; if (ABTestInfoProvider.ABTestIsRunning(testInfo)) { // Display disabled information if (!webAnalyticsEnabled) { return(GetString("abtesting.statusNone")); } if (!ABTestInfoProvider.ContainsVariants(testInfo)) { // Display warning when the test does not contain any variant return("<img src=\"" + GetImageUrl("Design/Controls/UniGrid/Actions/Warning.png") + "\" alt=\"" + GetString("abtest.novariants") + "\" title=\"" + GetString("abtest.novariants") + "\" /> " + GetString("abtesting.status" + ABTestStatusEnum.None)); } status += "<span class=\"StatusEnabled\">" + GetString("abtesting.status" + ABTestInfoProvider.GetABTestStatus(testInfo)) + "</span>"; } else { status += GetString("abtesting.status" + ABTestInfoProvider.GetABTestStatus(testInfo)); } return(status); } } return(string.Empty); } return(parameter); }