⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 managearticles.aspx.cs

📁 community server 源码
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using ResourceControl = CommunityServer.ControlPanel.Controls.ResourceControl;
using ResourceManager = CommunityServer.ControlPanel.Components.ResourceManager;
using StatusMessage = CommunityServer.ControlPanel.Controls.StatusMessage;
using Content = CommunityServer.Components.Content;

namespace CommunityServer.ControlPanel.Tools
{
	/// <summary>
	/// Summary description for ManageArticles.
	/// </summary>
	public class ManageArticles : BaseToolsPage
	{
		#region Members
		protected StatusMessage Status;
		protected ControlPanelSelectedNavigation SelectedNavigation1;
		protected ResourceControl RegionTitle;
		protected MPContent DescriptionRegion;
		protected ResourceControl Resourcecontrol1;
		protected MPContent TaskRegion;
		protected MPContainer MPContainer;
		protected Repeater articleslist;
		#endregion

		override protected void OnInit(EventArgs e)
		{
			this.Load += new EventHandler(this.Page_Load);
            articleslist.ItemDataBound +=new RepeaterItemEventHandler(articleslist_ItemDataBound);
			base.OnInit(e);
		}

		private void Page_Load(object sender, EventArgs e)
		{
			if ( !Page.IsPostBack ) 
				BindArticles();
		}

		private void BindArticles() 
		{
			articleslist.DataSource = Contents.GetAllContent();
			articleslist.DataBind();
        }

		private void InitializeComponent()
		{
		
		}

        private void articleslist_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Content c = e.Item.DataItem as Content;
                if(c != null)
                {
                    Literal lastMod = e.Item.FindControl("LastModified") as Literal;
                    if(lastMod != null)
                    {
                        lastMod.Text = c.LastModified.ToString();
                    }

                    Literal contentName = e.Item.FindControl("ContentName") as Literal;
                    if(contentName != null)
                    {
                        contentName.Text = c.Name;
                    }

                	HyperLink viewLink = e.Item.FindControl("ViewLink") as HyperLink;
                    if(viewLink != null)
                    {
                        viewLink.NavigateUrl = Contents.ArticleUrl(c.Name);
						viewLink.ToolTip = ResourceManager.GetString("CP_Tools_ManageArticle_View_Tip"); 
                        
                    }

                	HyperLink editLink = e.Item.FindControl("EditLink") as HyperLink;
                    if(editLink != null)
                    {
                        editLink.NavigateUrl = Contents.EditArticleUrl(c.ID);
						editLink.ToolTip = ResourceManager.GetString("CP_Tools_ManageArticle_Edit_Tip"); 
					}

                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -