📄 contentmanageui.cs
字号:
namespace PowerEasy.WebSite.User.Contents
{
using PowerEasy.AccessManage;
using PowerEasy.Common;
using PowerEasy.CommonModel;
using PowerEasy.Components;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.Contents;
using PowerEasy.Model.UserManage;
using PowerEasy.ModelControls;
using PowerEasy.UserManage;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class ContentManageUI : DynamicPage
{
protected Button BtnSearch;
protected Button EBtnBatchDelete;
protected ExtendedGridView EgvContent;
protected HtmlForm form1;
protected HiddenField HdnListType;
protected HiddenField HdnStatus;
protected Label LblNavigation;
private string m_arrNodeIdInput = "";
private bool m_IsInput;
private bool m_IsManageStatusPassContent;
private int m_NodeId;
protected Dictionary<int, NodeInfo> m_NodeInfoDictionary = new Dictionary<int, NodeInfo>();
protected ObjectDataSource OdsContents;
protected string Path = "";
protected HtmlTableRow Tab;
protected TextBox TxtSearchTitle;
protected void EBtnBatchDelete_Click(object sender, EventArgs e)
{
if (ContentManage.UpdateStatusByUserName(this.EgvContent.SelectList.ToString(), -3))
{
DynamicPage.WriteUserSuccessMsg("<li>批量删除成功!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
}
else
{
DynamicPage.WriteUserErrMsg("<li>批量删除项目失败!</li>");
}
}
protected void EgvContent_RowCommand(object sender, CommandEventArgs e)
{
if (e.CommandName == "DeleteContent")
{
int generalId = DataConverter.CLng(e.CommandArgument.ToString());
if (ContentManage.UpdateStatusByUserName(e.CommandArgument.ToString(), -3))
{
PermissionContent.Delete(generalId);
ContentCharge.Delete(generalId);
DynamicPage.WriteUserSuccessMsg("<li>删除成功!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
}
else
{
DynamicPage.WriteUserErrMsg("<li>删除失败!</li>");
}
}
}
protected void EgvContent_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CommonModelInfo dataItem = (CommonModelInfo) e.Row.DataItem;
int length = 0;
NodeInfo cacheNodeById = null;
if (this.m_NodeInfoDictionary.ContainsKey(dataItem.NodeId))
{
cacheNodeById = this.m_NodeInfoDictionary[dataItem.NodeId];
}
else
{
cacheNodeById = Nodes.GetCacheNodeById(dataItem.NodeId);
if (!cacheNodeById.IsNull)
{
this.m_NodeInfoDictionary.Add(dataItem.NodeId, cacheNodeById);
}
}
if (dataItem.NodeId != this.m_NodeId)
{
Label label = e.Row.FindControl("LblNodeLink") as Label;
label.Text = "<strong>[<a href=\"ContentManage.aspx?NodeID=" + dataItem.NodeId.ToString() + "&NodeName=" + base.Server.UrlEncode(cacheNodeById.NodeName) + "\">" + cacheNodeById.NodeName + "</a>]</strong>";
length = StringHelper.SubStringLength(DataSecurity.HtmlDecode(cacheNodeById.NodeName)) + 2;
}
Label label2 = e.Row.FindControl("LblIsCreateHtml") as Label;
if (!dataItem.CreateTime.HasValue || (dataItem.CreateTime.Value <= dataItem.UpdateTime))
{
label2.Text = "<span style=\"color:Red\"><b>\x00d7</b></span>";
}
else
{
label2.Text = "<b>√</b>";
}
LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage;
string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon;
if (string.IsNullOrEmpty(itemIcon))
{
itemIcon = "Default.gif";
}
image.Icon = itemIcon;
if (dataItem.LinkType != 0)
{
image.IsShowLink = true;
}
HyperLink link = (HyperLink) e.Row.FindControl("ContentModify");
LinkButton button = (LinkButton) e.Row.FindControl("LtnDelete");
string str2 = dataItem.NodeId.ToString();
if (cacheNodeById.ParentId > 0)
{
str2 = str2 + "," + cacheNodeById.ParentPath;
}
if (!StringHelper.CheckNodePurview(this.m_arrNodeIdInput, dataItem.NodeId.ToString()))
{
link.Enabled = false;
button.Enabled = false;
}
else if (!this.m_IsManageStatusPassContent && (dataItem.Status == 0x63))
{
CheckBox box = (CheckBox) e.Row.FindControl("CheckBoxButton");
link.Enabled = false;
button.Enabled = false;
box.Enabled = false;
}
if (dataItem.IsEshop)
{
link.NavigateUrl = string.Concat(new object[] { "../Shop/Product.aspx?Action=Modify&NodeID=", dataItem.NodeId.ToString(), "&GeneralID=", dataItem.GeneralId, "&ModelID=", dataItem.ModelId.ToString() });
}
else
{
link.NavigateUrl = string.Concat(new object[] { "Content.aspx?Action=Modify&NodeID=", dataItem.NodeId.ToString(), "&GeneralID=", dataItem.GeneralId, "&ModelID=", dataItem.ModelId.ToString() });
}
HyperLink link2 = e.Row.FindControl("LnkItem") as HyperLink;
length = 0x25 - length;
link2.Text = DataSecurity.HtmlEncode(StringHelper.SubString(DataSecurity.HtmlDecode(dataItem.Title), length, "..."));
link2.ToolTip = dataItem.Title;
link2.Target = "_blank";
link2.NavigateUrl = base.FullBasePath + "Item/" + dataItem.GeneralId.ToString() + ".aspx";
if (dataItem.Status != 0x63)
{
link2.Target = "";
link2.NavigateUrl = link.NavigateUrl;
}
}
}
protected string GetStatusShow(string status)
{
int num = DataConverter.CLng(status);
switch (num)
{
case -3:
return "回收站中";
case -2:
return "退稿";
case -1:
return "草稿";
case 0:
return "待审核";
case 0x63:
return "终审通过";
}
return "审核中";
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_NodeId = BasePage.RequestInt32("NodeID");
this.OdsContents.SelectParameters["userName"].DefaultValue = PEContext.Current.User.UserName;
this.Path = this.Page.Request.ApplicationPath.Equals("/") ? string.Empty : this.Page.Request.ApplicationPath;
this.Path = this.Page.Request.Url.Scheme + "://" + this.Page.Request.Url.Authority + this.Path;
int num = BasePage.RequestInt32("Status");
if (((num != 0) && (num < 0x66)) && (num > -3))
{
this.HdnStatus.Value = BasePage.RequestInt32("Status").ToString();
}
UserPurviewInfo userPurview = Users.GetUsersByUserName(PEContext.Current.User.UserName).UserPurview;
if (!userPurview.IsNull)
{
this.m_IsManageStatusPassContent = userPurview.ManageSelfPublicInfo;
if (this.m_IsManageStatusPassContent)
{
this.EBtnBatchDelete.Visible = true;
}
}
this.m_arrNodeIdInput = UserPermissions.GetRoleNodeId(PEContext.Current.User.RoleId, OperateCode.NodeContentInput, PEContext.Current.User.UserInfo.IsInheritGroupRole ? 1 : 0);
if (this.m_NodeId > 0)
{
string str = this.m_NodeId.ToString();
NodeInfo cacheNodeById = Nodes.GetCacheNodeById(this.m_NodeId);
if (cacheNodeById.IsNull)
{
DynamicPage.WriteErrMsg("当前栏目不存在,可能被删除了请返回!");
}
if (cacheNodeById.ParentId > 0)
{
str = str + "," + cacheNodeById.ParentPath;
}
this.m_IsInput = StringHelper.CheckNodePurview(this.m_arrNodeIdInput, str);
}
else
{
this.m_IsInput = UserPermissions.AccessCheck(OperateCode.NodeContentInput, -1);
}
if (!this.m_IsInput)
{
this.EBtnBatchDelete.Enabled = false;
}
string str2 = BasePage.RequestString("NodeName");
if (string.IsNullOrEmpty(str2))
{
str2 = "根目录";
}
this.LblNavigation.Text = str2;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -