protected override void OnInit(EventArgs e) { base.OnInit(e); if (WebSiteId == Guid.Empty) { Response.Redirect(ResolveUrl("~/SiteNotFound.aspx")); } if (Page.Master != null) { var head = Page.Master.FindControl("head"); var lrlCounteCode = new Literal() { Text = ScriptTemplates.Counter(SiteId) }; head.Controls.Add(lrlCounteCode); var analytics = Page.Master.FindControl("analytics"); var lrlScriptCode = new Literal() { Text = ScriptTemplates.Script(true) }; analytics.Controls.Add(lrlScriptCode); } }
/// <summary> /// Binds the data. /// </summary> private void BindData() { ucPortal.SiteId = SiteId; ucPortal.Module = "Settings"; ucSiteDomains.SiteId = SiteId; ucSiteDomains.Module = "Settings"; EnumHelper.EnumToDropDownList <HtmlEditorMode>(ref ddlHtmlEditorMode, false); var site = DataManager.Sites.SelectById(SiteId); if (site.AccessProfileID.HasValue) { var accessProfile = DataManager.AccessProfile.SelectById(site.AccessProfileID.Value); if (accessProfile != null && accessProfile.DomainsCount > 0) { chxIsBlockAccessFromDomainsOutsideOfList.Checked = true; plAccessBlock.Visible = false; } } else { chxIsBlockAccessFromDomainsOutsideOfList.Checked = site.IsBlockAccessFromDomainsOutsideOfList; } txtName.Text = site.Name; txtLinkProcessingURL.Text = site.LinkProcessingURL; lrlCounterCode.Text = HttpUtility.HtmlEncode(ScriptTemplates.Counter(SiteId)); lrlScriptCode.Text = HttpUtility.HtmlEncode(ScriptTemplates.Script(true)); chxShowHiddenMessages.Checked = site.ShowHiddenMessages; ddlHtmlEditorMode.SelectedIndex = ddlHtmlEditorMode.FindItemIndexByValue(site.HtmlEditorModeID.ToString()); List <tbl_Sites> fakeList = new List <tbl_Sites>(); fakeList.Add(site); fvSmtp.DataSource = fakeList; fvSmtp.DataBind(); }
/// <summary> /// Generates the counter result. /// </summary> /// <param name="counter">The counter.</param> /// <param name="siteDomain">The site domain.</param> private void GenerateCounterResult(ref CheckSiteStatus counter, tbl_SiteDomain siteDomain, bool isNotFound = false) { if (!counter.ErrorLinks.Any()) { counter.Score = 50; counter.ErrorTypeClass = "success"; try { Uri siteUrl = GetDomainUrl(siteDomain.Domain); if (IsLeadForceDomain(siteUrl)) { siteDomain.StatusID = (int)SiteDomainStatus.LeadForceDomain; if (isNotFound) { counter.Message = "Домен найден, но не привязан к мини сайту"; } else { counter.Message = string.Format("Счетчик найден. Проверено {0} страниц сайта.", counter.SuccessLinks.Count); } } else { siteDomain.StatusID = (int)SiteDomainStatus.Checking; counter.Message = string.Format("Счетчик найден. Проверено {0} страниц сайта.", counter.SuccessLinks.Count); } } catch (Exception ex) { Log.Error("Ошибка проверки домена LeadForce", ex); siteDomain.StatusID = (int)SiteDomainStatus.Checking; } Update(siteDomain); } else { siteDomain.StatusID = (int)SiteDomainStatus.CheckingFailed; Update(siteDomain); counter.ErrorTypeClass = "error"; counter.Message = string.Format( @"Счетчик не найден на {0} страницах из {1} проверенных. <a href=""javascript:;"" onclick=""$('.checkedLinks').show();"">Подробнее...</a><div style=""display:none"" class=""checkedLinks""><br/>{2}<br/></div><br/>Для установки счетчика Вам необходимо подключить к Вашему сайту код: <div class=""row""> <label>Код счетчика (часть 1):</label><br /> <span class=""note"">(размещать в <head> или в начале документа)</span> <table class=""tbl-counter-code""> <tr> <td><pre><code>{3}</code></pre></td> </tr> </table> </div> <div class=""row""> <label>Код счетчика (часть 2):</label><br /> <span class=""note"">(размещать в конце файла перед </body>)</span> <table class=""tbl-counter-code""> <tr> <td><pre><code>{4}</code></pre></td> </tr> </table> </div>", counter.ErrorLinks.Count, counter.ErrorLinks.Count + counter.SuccessLinks.Count, string.Join("<br/> ", counter.ErrorLinks.Select(o => string.Format("<a href=\"{0}\" target=\"_blank\">{0}</a>", o))), HttpUtility.HtmlEncode(ScriptTemplates.Counter(siteDomain.SiteID)), HttpUtility.HtmlEncode(ScriptTemplates.Script(true))); } }
/// <summary> /// Binds the data. /// </summary> private void BindData() { BindStats(); ucSiteDomains.SiteId = ucPortal.SiteId = _siteId; ucSiteDomains.Module = ucPortal.Module = "Sites"; ucPayerCompany.SiteID = SiteId; ucPriceList.SiteID = SiteId; var site = DataManager.Sites.SelectById(_siteId); var emailActions = DataManager.EmailActions.SelectAll(); BindEmailActions(rblUnsubscribeActions, emailActions); BindEmailActions(rblServiceAdvertisingActions, emailActions); rcbAccessProfile.DataSource = DataManager.AccessProfile.SelectAll(null); rcbAccessProfile.DataTextField = "Title"; rcbAccessProfile.DataValueField = "ID"; rcbAccessProfile.DataBind(); rcbAccessProfile.Items.Insert(0, new RadComboBoxItem("Выберите профиль", Guid.Empty.ToString()) { Selected = true }); if (site != null) { txtName.Text = site.Name; txtLinkProcessingURL.Text = site.LinkProcessingURL; lrlCounterCode.Text = HttpUtility.HtmlEncode(ScriptTemplates.Counter(_siteId)); lrlScriptCode.Text = HttpUtility.HtmlEncode(ScriptTemplates.Script(true)); chxIsActive.Checked = site.IsActive; chxIsTemplate.Checked = site.IsTemplate; txtSmtpHost.Text = site.SmtpHost; txtSmtpUsername.Text = site.SmtpUsername; txtSmtpPassword.Attributes["value"] = site.SmtpPassword; txtSmtpPort.Text = site.SmtpPort.ToString(); txtSystemEmail.Text = site.SystemEmail; chxIsAllowUseSystemEmail.Checked = site.IsAllowUseSystemEmail; chxIsSendEmailToSubscribedUser.Checked = site.IsSendEmailToSubscribedUser; chxIsSendFromLeadForce.Checked = site.IsSendFromLeadForce; txtSessionTimeout.Text = site.SessionTimeout.ToString(); txtUserSessionTimeout.Text = site.UserSessionTimeout.ToString(); if (site.MainUserID.HasValue) { var user = DataManager.User.SelectById(site.MainUserID.Value); ucMainUser.SelectedIdNullable = user.ID; ucMainUser.SelectedText = user.Login; } rdpActiveUntilDate.SelectedDate = site.ActiveUntilDate; if (site.PriceListID.HasValue) { var priceList = DataManager.PriceList.SelectById(site.PriceListID.Value); ucPriceList.SelectedIdNullable = priceList.ID; ucPriceList.SelectedText = priceList.Title; } if (site.PayerCompanyID.HasValue) { var company = DataManager.Company.SelectById(CurrentUser.Instance.SiteID, site.PayerCompanyID.Value); ucPayerCompany.SelectedIdNullable = company.ID; ucPayerCompany.SelectedText = company.Name; } if (site.UnsubscribeActionID != null) { rblUnsubscribeActions.SelectedIndex = rblUnsubscribeActions.Items.IndexOf(rblUnsubscribeActions.Items.FindByValue(site.UnsubscribeActionID.ToString())); } if (site.ServiceAdvertisingActionID != null) { rblServiceAdvertisingActions.SelectedIndex = rblServiceAdvertisingActions.Items.IndexOf(rblServiceAdvertisingActions.Items.FindByValue(site.ServiceAdvertisingActionID.ToString())); } txtMaxFileSize.Text = site.MaxFileSize.ToString(); txtFileQuota.Text = site.FileQuota.ToString(); lrlClientCount.Text = DataManager.Contact.SelectCount(_siteId).ToString(); if (site.AccessProfileID != null) { rcbAccessProfile.SelectedIndex = rcbAccessProfile.Items.FindItemIndexByValue(site.AccessProfileID.ToString()); var accessProfile = DataManager.AccessProfile.SelectById(site.AccessProfileID.Value); if (accessProfile != null && accessProfile.DomainsCount > 0) { chxIsBlockAccessFromDomainsOutsideOfList.Checked = true; plAccessBlock.Visible = false; } } plCounterCode.Visible = true; } else { plMainUser.Visible = false; txtSessionTimeout.Text = "30"; txtUserSessionTimeout.Text = "30"; pUser.Visible = true; rblUnsubscribeActions.SelectedIndex = rblUnsubscribeActions.Items.IndexOf(rblUnsubscribeActions.Items.FindByValue("3")); } }