public void LoadTopic(int topicId) { pnlTopicEditor.Visible = true; this.EditingTopicId = topicId; TopicMapping tm = pnlMapTopic.FindControl <TopicMapping>("ctrlMapTopic"); tm.ThisTopicID = EditingTopicId.ToString(); tm.BindData(); trMapTopics.Visible = Editing; btnDelete.Visible = btnNuke.Visible = Editing; Literal28.Visible = !Editing && Store.StoreCount > 1; ssOne.Visible = !Editing; trCopyToStore.Visible = Editing && Store.StoreCount > 1 && AppLogic.GlobalConfigBool("AllowTopicFiltering"); if (!Editing) { BindNewTopic(); } else { BindTopic(); } }
protected void UpdateTopic() { Topic originalTopic = new Topic(EditingTopicId); StringBuilder sql = new StringBuilder(2500); int StoreID = 0; bool bTopicNameExist = IsTopicNameExist(out StoreID); int ExistingTopicId = Topic.GetTopicID(TopicName, LocaleSetting, originalTopic.StoreID); if (TopicName != originalTopic.TopicName && ExistingTopicId != originalTopic.TopicID && ExistingTopicId > 0) { resetError("The topic name entered already exists. Please choose a unique topic name.", true); return; } sql.Append("update Topic set "); sql.Append("Name=" + DB.SQuote(AppLogic.FormLocaleXml("Name", TopicName, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ","); sql.Append("SkinID=" + Localization.ParseUSInt(txtSkin.Text) + ","); sql.Append("DisplayOrder=" + Localization.ParseUSInt(txtDspOrdr.Text) + ","); sql.Append("ContentsBGColor=" + DB.SQuote(txtContentsBG.Text) + ","); sql.Append("PageBGColor=" + DB.SQuote(txtPageBG.Text) + ","); sql.Append("GraphicsColor=" + DB.SQuote(txtSkinColor.Text) + ","); sql.Append("Title=" + DB.SQuote(AppLogic.FormLocaleXml("Title", ltTitle.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ","); String desc = String.Empty; if (bUseHtmlEditor) { desc = AppLogic.FormLocaleXml("Description", radDescription.Content, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)); } else { desc = AppLogic.FormLocaleXmlEditor("Description", "Description", LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)); } if (desc.Length != 0) { sql.Append("Description=" + DB.SQuote(desc) + ","); } else { sql.Append("Description=NULL,"); } if (txtPassword.Text.Trim().Length != 0) { sql.Append("Password="******","); } else { sql.Append("Password=NULL,"); } sql.Append("RequiresSubscription=" + rbSubscription.SelectedValue.ToString() + ","); sql.Append("HTMLOk=" + rbHTML.SelectedValue.ToString() + ","); sql.Append("RequiresDisclaimer=" + rbDisclaimer.SelectedValue.ToString() + ","); sql.Append("ShowInSiteMap=" + rbPublish.SelectedValue.ToString() + ","); if (AppLogic.FormLocaleXml("SEKeywords", ltSEKeywords.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)).Length != 0) { sql.Append("SEKeywords=" + DB.SQuote(AppLogic.FormLocaleXml("SEKeywords", ltSEKeywords.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ","); } else { sql.Append("SEKeywords=NULL,"); } if (AppLogic.FormLocaleXml("SEDescription", ltSEDescription.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)).Length != 0) { sql.Append("SEDescription=" + DB.SQuote(AppLogic.FormLocaleXml("SEDescription", ltSEDescription.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ","); } else { sql.Append("SEDescription=NULL,"); } if (AppLogic.FormLocaleXml("SETitle", ltSETitle.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)).Length != 0) { sql.Append("SETitle=" + DB.SQuote(AppLogic.FormLocaleXml("SETitle", ltSETitle.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)))); } else { sql.Append("SETitle=NULL"); } sql.Append(" where TopicID=" + EditingTopicId.ToString()); DB.ExecuteSQL(sql.ToString()); resetError("Topic updated.", false); int EditedTopic = EditingTopicId; UnloadTopic(); if (TopicSaved != null) { TopicSaved(this, new TopicEditEventArgs(EditedTopic, originalTopic.TopicName != TopicName)); } }