protected void SaveButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { Topic topic = TopicManager.GetTopicByID(this.TopicID); if (topic != null) { DateTime nowDT = DateTime.Now; LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, this.LanguageID); if (localizedTopic != null) { localizedTopic = TopicManager.UpdateLocalizedTopic(localizedTopic.TopicLocalizedID, localizedTopic.TopicID, localizedTopic.LanguageID, txtTitle.Text, txtBody.Value, localizedTopic.CreatedOn, nowDT, ShowOnHomePage.Value); Response.Redirect("TopicLocalizedDetails.aspx?TopicID=" + localizedTopic.TopicID.ToString() + "&LanguageID=" + localizedTopic.LanguageID.ToString()); } else { localizedTopic = TopicManager.InsertLocalizedTopic(this.TopicID, this.LanguageID, txtTitle.Text, txtBody.Value, nowDT, nowDT, ShowOnHomePage.Value); Response.Redirect("TopicLocalizedDetails.aspx?TopicID=" + this.TopicID.ToString() + "&LanguageID=" + this.LanguageID.ToString()); } } else { Response.Redirect("Topics.aspx"); } } catch (Exception exc) { ProcessException(exc); } } }
private void BindData() { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(this.TopicID, NopContext.Current.WorkingLanguage.LanguageID); if (localizedTopic != null) { if (!string.IsNullOrEmpty(localizedTopic.Title)) { lTitle.Text = Server.HtmlEncode(localizedTopic.Title); } else { lTitle.Visible = false; } if (!string.IsNullOrEmpty(localizedTopic.Body)) { lBody.Text = localizedTopic.Body; } else { lBody.Visible = false; } } else { Response.Redirect("~/Default.aspx"); } }
private void WriteTopics(StringBuilder sb, TopicCollection topicCollection) { foreach (Topic topic in topicCollection) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.TopicId, NopContext.Current.WorkingLanguage.LanguageId); if (localizedTopic != null) { sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title), (String.IsNullOrEmpty(localizedTopic.Title) ? localizedTopic.TopicId.ToString() : Server.HtmlEncode(localizedTopic.Title))); } } }
private void WriteTopics() { TopicCollection topics = TopicManager.GetAllTopics(); foreach (Topic topic in topics) { LocalizedTopicCollection localizedTopics = TopicManager.GetAllLocalizedTopics(topic.Name); if (localizedTopics.Count > 0) { //UNDONE add topic of one language only (they have the same URL now) LocalizedTopic localizedTopic = localizedTopics[0]; string url = SEOHelper.GetTopicUrl(localizedTopic.TopicID, localizedTopic.Title); UpdateFrequency updateFrequency = UpdateFrequency.weekly; DateTime updateTime = localizedTopic.UpdatedOn; WriteUrlLocation(url, updateFrequency, updateTime); } } }
private void SetTopicName(TopicControl topic, int number, HtmlGenericControl div) { LocalizedTopic lTopic = LocalizedTopicCollection.FirstOrDefault(t => t.ShowOnHomePage == number); if (lTopic != null) { topic.TopicName = lTopic.Topic.Name; if (number == 1) { div.Attributes.Add("style", "background: url(../../images/ff_images/mainimg_logo_big_background.gif) center center no-repeat ;"); } } else { div.Attributes.Add("style", number == 1 ? "background: url(../../images/ff_images/mainimg_logo_big.gif) center center no-repeat ;" : "background: url(../../images/ff_images/mainimg_logo.gif) center center no-repeat ;"); } }
private void BindData() { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(TopicName, NopContext.Current.WorkingLanguage.LanguageID); if (localizedTopic != null) { if (!string.IsNullOrEmpty(localizedTopic.Body)) { lBody.Text = localizedTopic.Body; } else { lBody.Visible = false; } } else { Visible = false; } }
protected void DeleteButton_Click(object sender, EventArgs e) { try { Topic topic = TopicManager.GetTopicByID(this.TopicID); if (topic != null) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, this.LanguageID); if (localizedTopic != null) { TopicManager.DeleteLocalizedTopic(localizedTopic.TopicLocalizedID); } } Response.Redirect("Topics.aspx"); } catch (Exception exc) { ProcessException(exc); } }
private void BindData() { Language language = LanguageManager.GetLanguageById(this.LanguageId); Topic topic = TopicManager.GetTopicById(this.TopicId); if (language != null && topic != null) { this.lblLanguage.Text = language.Name; this.lblTopic.Text = topic.Name; LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, this.LanguageId); if (localizedTopic != null) { this.txtTitle.Text = localizedTopic.Title; string topicURL = SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title); this.hlURL.NavigateUrl = topicURL; this.hlURL.Text = topicURL; this.txtBody.Content = localizedTopic.Body; this.pnlCreatedOn.Visible = true; this.pnlUpdatedOn.Visible = true; this.lblCreatedOn.Text = DateTimeHelper.ConvertToUserTime(localizedTopic.CreatedOn).ToString(); this.lblUpdatedOn.Text = DateTimeHelper.ConvertToUserTime(localizedTopic.UpdatedOn).ToString(); this.txtMetaKeywords.Text = localizedTopic.MetaKeywords; this.txtMetaDescription.Text = localizedTopic.MetaDescription; this.txtMetaTitle.Text = localizedTopic.MetaTitle; } else { this.DeleteButton.Visible = false; this.pnlCreatedOn.Visible = false; this.pnlUpdatedOn.Visible = false; } } else { Response.Redirect("Topics.aspx"); } }
private SiteMapNode ChangeTopicMap(SiteMapResolveEventArgs e) { SiteMapNode currentNode = null; try { currentNode = e.Provider.FindSiteMapNode("~/Sitemap-Topics.aspx").Clone(true); LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(this.TopicId, NopContext.Current.WorkingLanguage.LanguageID); if (localizedTopic != null) { currentNode.Url = SEOHelper.GetTopicUrl(TopicId, localizedTopic.Title); currentNode.Description = localizedTopic.Title; currentNode.Title = localizedTopic.Title; } } catch { } return(currentNode); }
public Topic SaveInfo() { //system info Topic topic = this.TopicService.GetTopicById(this.TopicId); if (topic != null) { topic.Name = txtSystemName.Text; topic.IsPasswordProtected = cbIsPasswordProtected.Checked; topic.Password = txtPassword.Text.Trim(); topic.IncludeInSitemap = cbIncludeInSitemap.Checked; this.TopicService.UpdateTopic(topic); } else { topic = new Topic() { Name = txtSystemName.Text, IsPasswordProtected = cbIsPasswordProtected.Checked, Password = txtPassword.Text.Trim(), IncludeInSitemap = cbIncludeInSitemap.Checked }; this.TopicService.InsertTopic(topic); } //localizable info DateTime nowDT = DateTime.UtcNow; foreach (RepeaterItem item in rptrLanguageDivs.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { var txtTitle = (TextBox)item.FindControl("txtTitle"); var txtBody = (FCKeditor)item.FindControl("txtBody"); var lblLanguageId = (Label)item.FindControl("lblLanguageId"); int languageId = int.Parse(lblLanguageId.Text); string title = txtTitle.Text; string body = txtBody.Value; var content = this.TopicService.GetLocalizedTopic(topic.Name, languageId); if (content == null) { content = new LocalizedTopic() { TopicId = topic.TopicId, LanguageId = languageId, Title = title, Body = body, CreatedOn = nowDT, UpdatedOn = nowDT }; this.TopicService.InsertLocalizedTopic(content); } else { content.LanguageId = languageId; content.Title = title; content.Body = body; content.UpdatedOn = nowDT; this.TopicService.UpdateLocalizedTopic(content); } } } foreach (RepeaterItem item in rptrLanguageDivs_SEO.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { var txtMetaKeywords = (TextBox)item.FindControl("txtMetaKeywords"); var txtMetaDescription = (TextBox)item.FindControl("txtMetaDescription"); var txtMetaTitle = (TextBox)item.FindControl("txtMetaTitle"); var lblLanguageId = (Label)item.FindControl("lblLanguageId"); int languageId = int.Parse(lblLanguageId.Text); string metaKeywords = txtMetaKeywords.Text; string metaDescription = txtMetaDescription.Text; string metaTitle = txtMetaTitle.Text; var content = this.TopicService.GetLocalizedTopic(topic.Name, languageId); if (content == null) { //localized topic should be already created on the previous step } else { content.UpdatedOn = nowDT; content.MetaKeywords = metaKeywords; content.MetaDescription = metaDescription; content.MetaTitle = metaTitle; this.TopicService.UpdateLocalizedTopic(content); } } } return(topic); }
protected string GetTopicName(LocalizedTopic localizedTopic) { return(localizedTopic.Topic.Name); }
protected void BindData() { StringBuilder warningResult = new StringBuilder(); if (CurrencyManager.PrimaryExchangeRateCurrency == null) { warningResult.Append("Primary exchange rate currency is not set. <a href=\"Currencies.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } if (CurrencyManager.PrimaryStoreCurrency == null) { warningResult.Append("Primary store currency is not set. <a href=\"Currencies.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } if (MeasureManager.BaseWeightIn == null) { warningResult.Append("The weight that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } if (MeasureManager.BaseDimensionIn == null) { warningResult.Append("The dimension that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } LanguageCollection publishedLanguages = LanguageManager.GetAllLanguages(false); foreach (MessageTemplate messageTemplate in MessageManager.GetAllMessageTemplates()) { foreach (Language language in publishedLanguages) { LocalizedMessageTemplate localizedMessageTemplate = MessageManager.GetLocalizedMessageTemplate(messageTemplate.Name, language.LanguageID); if (localizedMessageTemplate == null) { warningResult.AppendFormat("You don't have localized version of message template [{0}] for {1}. <a href=\"MessageTemplates.aspx\">Create it now</a>", messageTemplate.Name, language.Name); warningResult.Append("<br />"); warningResult.Append("<br />"); } } } foreach (Topic topic in TopicManager.GetAllTopics()) { foreach (Language language in publishedLanguages) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, language.LanguageID); if (localizedTopic == null) { warningResult.AppendFormat("You don't have localized version of topic [{0}] for {1}. <a href=\"Topics.aspx\">Create it now</a>", topic.Name, language.Name); warningResult.Append("<br />"); warningResult.Append("<br />"); } } } string warnings = warningResult.ToString(); if (!String.IsNullOrEmpty(warnings)) { lblWarnings.Text = warnings; } else { this.Visible = false; } }
protected override void OnPreRender(EventArgs e) { StringBuilder warningResult = new StringBuilder(); //currencies if (CurrencyManager.PrimaryExchangeRateCurrency == null) { warningResult.Append("Primary exchange rate currency is not set. <a href=\"Currencies.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } if (CurrencyManager.PrimaryStoreCurrency == null) { warningResult.Append("Primary store currency is not set. <a href=\"Currencies.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } //measures if (MeasureManager.BaseWeightIn == null) { warningResult.Append("The weight that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } if (MeasureManager.BaseDimensionIn == null) { warningResult.Append("The dimension that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>"); warningResult.Append("<br />"); warningResult.Append("<br />"); } //languages LanguageCollection publishedLanguages = LanguageManager.GetAllLanguages(false); foreach (MessageTemplate messageTemplate in MessageManager.GetAllMessageTemplates()) { foreach (Language language in publishedLanguages) { LocalizedMessageTemplate localizedMessageTemplate = MessageManager.GetLocalizedMessageTemplate(messageTemplate.Name, language.LanguageId); if (localizedMessageTemplate == null) { warningResult.AppendFormat("You don't have localized version of message template [{0}] for {1}. <a href=\"MessageTemplates.aspx\">Create it now</a>", messageTemplate.Name, language.Name); warningResult.Append("<br />"); warningResult.Append("<br />"); } } } foreach (Topic topic in TopicManager.GetAllTopics()) { foreach (Language language in publishedLanguages) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, language.LanguageId); if (localizedTopic == null) { warningResult.AppendFormat("You don't have localized version of topic [{0}] for {1}. <a href=\"Topics.aspx\">Create it now</a>", topic.Name, language.Name); warningResult.Append("<br />"); warningResult.Append("<br />"); } } } //shipping methods var srcmList = ShippingRateComputationMethodManager.GetAllShippingRateComputationMethods(false); int offlineSrcmCount = 0; foreach (var srcm in srcmList) { if (srcm.ShippingRateComputationMethodType == ShippingRateComputationMethodTypeEnum.Offline) { offlineSrcmCount++; } } if (offlineSrcmCount > 1) { warningResult.Append("Only one offline shipping rate computation method is recommended to use"); warningResult.Append("<br />"); warningResult.Append("<br />"); } string warnings = warningResult.ToString(); if (!String.IsNullOrEmpty(warnings)) { lblWarnings.Text = warnings; } else { this.Visible = false; } base.OnPreRender(e); }
protected void BindData() { //topics var sitemapTopics = new List <SitemapTopic>(); var topics = TopicManager.GetAllTopics(); topics = topics.FindAll(t => t.IncludeInSitemap); foreach (var topic in topics) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.TopicId, NopContext.Current.WorkingLanguage.LanguageId); if (localizedTopic != null && !String.IsNullOrEmpty(localizedTopic.Title)) { string topicURL = SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title); string topicName = localizedTopic.Title; sitemapTopics.Add(new SitemapTopic() { Name = topicName, Url = topicURL }); } } //other pages string otherPages = SettingManager.GetSettingValue("Sitemap.OtherPages"); if (!String.IsNullOrEmpty(otherPages)) { string[] pages = otherPages.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string page in pages) { sitemapTopics.Add(new SitemapTopic() { Name = page, Url = string.Format("{0}{1}", CommonHelper.GetStoreLocation(), page.Trim()) }); } } if (sitemapTopics.Count > 0) { dlTopics.DataSource = sitemapTopics; dlTopics.DataBind(); } else { dlTopics.Visible = false; } //categories if (SettingManager.GetSettingValueBoolean("Sitemap.IncludeCategories", true)) { //root categories only here var categories = CategoryManager.GetAllCategoriesByParentCategoryId(0); if (categories.Count > 0) { dlCategories.DataSource = categories; dlCategories.DataBind(); } else { dlCategories.Visible = false; } } else { dlCategories.Visible = false; } //manufacturers if (SettingManager.GetSettingValueBoolean("Sitemap.IncludeManufacturers", true)) { var manufacturers = ManufacturerManager.GetAllManufacturers(); if (manufacturers.Count > 0) { dlManufacturers.DataSource = ManufacturerManager.GetAllManufacturers(); dlManufacturers.DataBind(); } else { dlManufacturers.Visible = false; } } else { dlManufacturers.Visible = false; } //products if (SettingManager.GetSettingValueBoolean("Sitemap.IncludeProducts", true)) { var products = ProductManager.GetAllProducts(); if (products.Count > 0) { dlProducts.DataSource = products; dlProducts.DataBind(); } else { dlProducts.Visible = false; } } else { dlProducts.Visible = false; } }