public void Page_Init(object sender, EventArgs e) { // When user selects item in the first dropdown (hourly, daily, weekly), display correct second drop down ddlMainFrequency.SelectedIndexChanged += (s, ea) => DisplayCorrectExtendedDropDownList(); // Bind to the event when settings page is being saved and perform a Strands setup call after page is saved SettingsGroupViewerControl settingsGroupViewer = ControlsHelper.GetParentControl <SettingsGroupViewerControl>(this); // Do nothing if this form control is not placed under SettingsGroupViewerControl control (can happen in form control preview for example) if (settingsGroupViewer != null) { settingsGroupViewer.SettingsSave.After += (s, ea) => { if (StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName)) { try { var setupCall = new StrandsSetupCall(); setupCall.DoWithDefaults(); } catch (Exception ex) { EventLogProvider.LogException("Strands Recommender", "SETUPCALL", ex); } } }; } }
protected void Page_Load(object sender, EventArgs e) { // Register custom style sheet file CssRegistration.RegisterCssLink(Page, "~/CMSModules/StrandsRecommender/StyleSheets/InsertEmailWidget.css"); List <string> emailTemplates = null; // If Strands is disabled (no API key present in settings), show common warning message if (StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName)) { emailTemplates = LoadEmailTemplateNames(); // If there is no template available, show warning message if ((emailTemplates != null) && !emailTemplates.Any()) { AddWarning(GetString("strands.notemplates")); } } else { AddWarning(GetString("strands.notoken")); } RegisterScripts(emailTemplates); SetLabelMoreInformationText(); }
protected void Page_Load(object sender, EventArgs e) { if (!StrandsSettings.IsStrandsEnabled(CurrentSite.SiteName)) { ddlTemplates.Visible = false; // Ensures OK button won't update template hdnSelectedTemplate.Value = null; lblNoToken.Visible = true; lblNoToken.Text = GetString("strands.notoken"); } else { ddlTemplates.Items.Add(new ListItem(GetString("general.loading"))); RegisterScripts(); } }
/// <summary> /// Load event handler. /// </summary> protected void Page_Load(object sender, EventArgs e) { // Contains definition for position of error label CSSHelper.RegisterCSSLink(Page, "~/CMSWebparts/StrandsRecommender/StrandsRecommendations.css"); if (!StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName)) { // If Strands is not currently available, stop processing webpart StopProcessing = true; HandleError(GetString("strands.notoken")); } else if (CookieHelper.CurrentCookieLevel < CookieLevel.Visitor) { // Do nothing, if user has decided to forbid cookie usage to under Visitor level, because Strands library uses Cookies under the hood StopProcessing = true; HandleError(); } else { SetupControl(); } }