📄 content.cs
字号:
namespace PowerEasy.WebSite.Controls.WebPart
{
using PowerEasy.AccessManage;
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.Contents;
using PowerEasy.ModelControls;
using PowerEasy.Web.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public class Content : BaseWebPart, IWebEditable, IWebPartPermissibility
{
protected ExtendedGridView EgvContent;
private bool m_Administrator;
private string m_arrNodeIdManage = "";
protected ContentSortType m_ListType;
protected int m_NodeId;
protected Dictionary<int, NodeInfo> m_NodeInfoDictionary = new Dictionary<int, NodeInfo>();
protected PowerEasy.Enumerations.OperateCode m_OperateCode;
protected int m_PageSize = 10;
protected int m_Status;
public EditorPartCollection CreateEditorParts()
{
ArrayList editorParts = new ArrayList();
ContentEditorPart part = new ContentEditorPart();
part.ID = this.ID + "_editorPart1";
editorParts.Add(part);
return new EditorPartCollection(editorParts);
}
protected void EgvContent_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CommonModelInfo dataItem = (CommonModelInfo) e.Row.DataItem;
int nodeId = dataItem.NodeId;
string s = "";
if (this.m_NodeInfoDictionary.ContainsKey(dataItem.NodeId))
{
s = this.m_NodeInfoDictionary[dataItem.NodeId].NodeName;
}
else
{
NodeInfo cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId);
if (!cacheNodeById.IsNull)
{
s = cacheNodeById.NodeName;
this.m_NodeInfoDictionary.Add(dataItem.NodeId, cacheNodeById);
}
}
Label label = e.Row.FindControl("LblNodeLink") as Label;
label.Text = "<strong>[<a href=\"" + base.BasePath + SiteConfig.SiteOption.ManageDir + "/Contents/ContentManage.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(s) + "\">" + s + "</a>]</strong>";
HyperLink link = (HyperLink) e.Row.FindControl("HypTitle");
link.ToolTip = dataItem.Title;
link.Text = StringHelper.SubString(dataItem.Title, 0x19, "...");
string str2 = "javascript:OpenLink(\"Contents/NodeTree.aspx\",\"Contents/ContentView.aspx?";
if (dataItem.IsEshop)
{
link.NavigateUrl = str2 + "IsEschop=true&GeneralID=" + dataItem.GeneralId.ToString() + "\")";
}
else
{
link.NavigateUrl = str2 + "GeneralID=" + dataItem.GeneralId.ToString() + "\")";
}
HyperLink link2 = (HyperLink) e.Row.FindControl("ContentModify");
link2.Text = "修改";
link2.NavigateUrl = string.Concat(new object[] { base.BasePath, SiteConfig.SiteOption.ManageDir, "/Contents/Content.aspx?Action=Modify&NodeID=", nodeId.ToString(), "&GeneralID=", dataItem.GeneralId, "&ModelID=", dataItem.ModelId.ToString(), "&LinkType=", dataItem.LinkType.ToString() });
if (!this.m_Administrator)
{
string str3 = nodeId.ToString();
NodeInfo info3 = new NodeInfo();
if (this.m_NodeInfoDictionary.ContainsKey(dataItem.NodeId))
{
info3 = this.m_NodeInfoDictionary[dataItem.NodeId];
}
else
{
info3 = Nodes.GetCacheNodeById(nodeId);
}
if (info3.ParentId > 0)
{
str3 = str3 + "," + info3.ParentPath;
}
if (!RolePermissions.CheckNodePurview(str3, this.m_arrNodeIdManage))
{
link2.Enabled = false;
}
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_Administrator = PEContext.Current.Admin.IsSuperAdmin;
if (!this.m_Administrator)
{
this.m_arrNodeIdManage = RolePermissions.GetRoleNodeId(PEContext.Current.Admin.Roles, PowerEasy.Enumerations.OperateCode.NodeContentManage);
}
if (string.IsNullOrEmpty(base.Title))
{
base.Title = "待审核内容";
}
this.EgvContent.DataSource = ContentManage.GetCommonModelInfoList(0, this.PageSize, this.NodeId, this.ListType, this.Status);
this.EgvContent.DataBind();
base.Subtitle = "共" + ContentManage.GetTotalOfCommonModelInfo(this.NodeId, this.ListType, this.Status).ToString() + "条";
base.TitleUrl = base.BasePath + SiteConfig.SiteOption.ManageDir + "/Contents/ContentManage.aspx?Status=0";
}
[Personalizable(PersonalizationScope.User)]
public ContentSortType ListType
{
get
{
return this.m_ListType;
}
set
{
this.m_ListType = value;
}
}
[Personalizable(PersonalizationScope.User)]
public int NodeId
{
get
{
return this.m_NodeId;
}
set
{
this.m_NodeId = value;
}
}
[Personalizable(PersonalizationScope.User)]
public PowerEasy.Enumerations.OperateCode OperateCode
{
get
{
return this.m_OperateCode;
}
set
{
this.m_OperateCode = value;
}
}
[WebDescription("显示项目数"), WebDisplayName("显示项目数"), Personalizable(PersonalizationScope.User), WebBrowsable]
public int PageSize
{
get
{
return this.m_PageSize;
}
set
{
this.m_PageSize = value;
}
}
[Personalizable(PersonalizationScope.User)]
public int Status
{
get
{
return this.m_Status;
}
set
{
this.m_Status = value;
}
}
public object WebBrowsableObject
{
get
{
return this;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -