/// <summary> /// The BindData method is used to obtain details of a message /// from the Articles table, and update the page with /// the message content. /// </summary> private void BindData(int ItemID) { if (IsEditable) { editLinkDetail.NavigateUrl = HttpUrlBuilder.BuildUrl("~/DesktopModules/CommunityModules/Articles/ArticlesEdit.aspx", "ItemID=" + ItemID + "&mid=" + ModuleID); editLinkDetail.Visible = true; } else { editLinkDetail.Visible = false; } // Obtain the selected item from the Articles table ArticlesDB Article = new ArticlesDB(); SqlDataReader dr = Article.GetSingleArticle(ItemID, Version); try { // Load first row from database if (dr.Read()) { // Update labels with message contents TitleDetail.Text = dr["Title"].ToString(); //[email protected] 5/24/04 added subtitle to ArticlesView. if (dr["Subtitle"].ToString().Length > 0) { SubtitleDetail.Text = dr["Subtitle"].ToString(); } StartDateDetail.Text = ((DateTime)dr["StartDate"]).ToShortDateString(); StartDateDetail.Visible = bool.Parse(Settings["ShowDate"].ToString()); Description.Text = Server.HtmlDecode(dr["Description"].ToString()); CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToShortDateString(); CreatedBy.Text = dr["CreatedByUser"].ToString(); // 15/7/2004 added localization by Mario Endara [email protected] if (CreatedBy.Text == "unknown") { CreatedBy.Text = General.GetString("UNKNOWN", "unknown"); } //Chris Farrell, [email protected], 5/24/2004 if (!bool.Parse(Settings["MODULESETTINGS_SHOW_MODIFIED_BY"].ToString())) { CreatedLabel.Visible = false; CreatedDate.Visible = false; OnLabel.Visible = false; CreatedBy.Visible = false; } } } finally { // close the datareader dr.Close(); } }
/// <summary> /// The BindData method is used to obtain details of a message /// from the Articles table, and update the page with /// the message content. /// </summary> private void BindData() { WorkFlowVersion Version = Request.QueryString["wversion"] == "Staging" ? WorkFlowVersion.Staging : WorkFlowVersion.Production; // Obtain the selected item from the Articles table ArticlesDB Article = new ArticlesDB(); SqlDataReader dr = Article.GetSingleArticle(ItemID, Version); try { // Load first row from database if (dr.Read()) { // Update labels with message contents Title.Text = dr["Title"].ToString(); //[email protected] 5/24/04 added subtitle to ArticlesView. if (dr["Subtitle"].ToString().Length > 0) { Subtitle.Text = "(" + dr["Subtitle"].ToString() + ")"; } StartDate.Text = ((DateTime)dr["StartDate"]).ToShortDateString(); Description.Text = Server.HtmlDecode(dr["Description"].ToString()); CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToShortDateString(); CreatedBy.Text = dr["CreatedByUser"].ToString(); // 15/7/2004 added localization by Mario Endara [email protected] if (CreatedBy.Text == "unknown") { CreatedBy.Text = General.GetString("UNKNOWN", "unknown"); } //Chris Farrell, [email protected], 5/24/2004 if (!bool.Parse(moduleSettings["MODULESETTINGS_SHOW_MODIFIED_BY"].ToString())) { CreatedLabel.Visible = false; CreatedDate.Visible = false; OnLabel.Visible = false; CreatedBy.Visible = false; } } } finally { // close the datareader dr.Close(); } }
/// <summary> /// The Page_Load event on this Page is used to obtain the ModuleID /// and ItemID of the Article to edit. /// It then uses the Rainbow.ArticlesDB() data component /// to populate the page's edit controls with the Article details. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { // Add the setting HtmlEditorDataType editor = new HtmlEditorDataType(); editor.Value = moduleSettings["Editor"].ToString(); DesktopText = editor.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()), portalSettings); DesktopText.Width = new Unit(moduleSettings["Width"].ToString()); DesktopText.Height = new Unit(moduleSettings["Height"].ToString()); HtmlEditorDataType abstractEditor = new HtmlEditorDataType(); if (moduleSettings["ARTICLES_RICHABSTRACT"] != null && bool.Parse(moduleSettings["ARTICLES_RICHABSTRACT"].ToString())) { abstractEditor.Value = moduleSettings["Editor"].ToString(); AbstractText = abstractEditor.GetEditor(PlaceHolderAbstractHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()), portalSettings); } else { abstractEditor.Value = "Plain Text"; AbstractText = abstractEditor.GetEditor(PlaceHolderAbstractHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()), portalSettings); } AbstractText.Width = new Unit(moduleSettings["Width"].ToString()); AbstractText.Height = new Unit("130px"); // Construct the page // Added css Styles by Mario Endara <*****@*****.**> (2004/10/26) updateButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(updateButton); PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); cancelButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(cancelButton); PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); deleteButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(deleteButton); // If the page is being requested the first time, determine if an // Article itemID value is specified, and if so populate page // contents with the Article details if (Page.IsPostBack == false) { if (ItemID != 0) { // Obtain a single row of Article information ArticlesDB Articles = new ArticlesDB(); SqlDataReader dr = Articles.GetSingleArticle(ItemID, WorkFlowVersion.Staging); try { // Load first row into Datareader if (dr.Read()) { StartField.Text = ((DateTime)dr["StartDate"]).ToShortDateString(); ExpireField.Text = ((DateTime)dr["ExpireDate"]).ToShortDateString(); TitleField.Text = (string)dr["Title"].ToString(); SubtitleField.Text = (string)dr["Subtitle"].ToString(); AbstractText.Text = (string)dr["Abstract"].ToString(); DesktopText.Text = Server.HtmlDecode(dr["Description"].ToString()); CreatedBy.Text = (string)dr["CreatedByUser"].ToString(); CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToString(); // 15/7/2004 added localization by Mario Endara [email protected] if (CreatedBy.Text == "unknown") { CreatedBy.Text = General.GetString("UNKNOWN", "unknown"); } } } finally { dr.Close(); } } else { //New article - set defaults StartField.Text = DateTime.Now.ToShortDateString(); ExpireField.Text = DateTime.Now.AddDays(int.Parse(moduleSettings["DefaultVisibleDays"].ToString())). ToShortDateString(); CreatedBy.Text = PortalSettings.CurrentUser.Identity.Email; CreatedDate.Text = DateTime.Now.ToString(); } } }