📄 nodepermissions.cs
字号:
RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.ChildNodesManage, builder2.ToString());
}
private void InitData()
{
IList<RoleNodePermissionsInfo> roleNodePermissionsList = new List<RoleNodePermissionsInfo>();
string permissionsType = this.m_PermissionsType;
if (permissionsType != null)
{
if (!(permissionsType == "Role"))
{
if (permissionsType == "User")
{
string str3;
roleNodePermissionsList = UserPermissions.GetNodePermissionsById(this.m_RoleId, -2, this.m_IdType);
if (((str3 = this.m_Type) != null) && (str3 == "Content"))
{
this.EgvNodes.Columns[2].Visible = true;
this.EgvNodes.Columns[3].Visible = true;
this.EgvNodes.Columns[4].Visible = true;
this.SetUserContentNodeAll(roleNodePermissionsList);
this.SetUserContentNode(roleNodePermissionsList);
}
}
}
else
{
roleNodePermissionsList = RolePermissions.GetNodePermissionsById(this.m_RoleId, -2);
string type = this.m_Type;
if (type != null)
{
if (!(type == "Content"))
{
if (!(type == "Node"))
{
if (type == "Comment")
{
this.EgvNodes.Columns[9].Visible = true;
this.EgvNodes.Columns[10].Visible = true;
this.EgvNodes.Columns[11].Visible = true;
this.SetNodeCommentAll(roleNodePermissionsList);
this.SetNodeComment(roleNodePermissionsList);
}
return;
}
}
else
{
this.EgvNodes.Columns[3].Visible = true;
this.EgvNodes.Columns[4].Visible = true;
this.EgvNodes.Columns[5].Visible = true;
this.EgvNodes.Columns[6].Visible = true;
this.SetContentNodeAll(roleNodePermissionsList);
this.SetContentNode(roleNodePermissionsList);
return;
}
this.EgvNodes.Columns[7].Visible = true;
this.EgvNodes.Columns[8].Visible = true;
this.SetNodeAll(roleNodePermissionsList);
this.SetNode(roleNodePermissionsList);
}
}
}
}
private void NodeCommentSelectPermission(GridViewRowEventArgs e, NodeInfo nodeInfo)
{
CheckBox box = (CheckBox) e.Row.FindControl("ChkNodeCommentReply");
CheckBox box2 = (CheckBox) e.Row.FindControl("ChkNodeCommentCheck");
CheckBox box3 = (CheckBox) e.Row.FindControl("ChkNodeCommentManage");
if (nodeInfo.NodeId == -1)
{
this.m_ChkNodeCommentReplyId = box.ClientID;
this.m_ChkNodeCommentCheckId = box2.ClientID;
this.m_ChkNodeCommentManageId = box3.ClientID;
box.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box.ID + "'," + this.m_ChkNodeCommentReplyId + ")");
box2.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box2.ID + "'," + this.m_ChkNodeCommentCheckId + ")");
box3.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box3.ID + "'," + this.m_ChkNodeCommentManageId + ")");
}
else
{
box.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_ChkNodeCommentReplyId + ")");
box2.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_ChkNodeCommentCheckId + ")");
box3.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_ChkNodeCommentManageId + ")");
}
}
private void NodeContentSelectPermission(GridViewRowEventArgs e, NodeInfo nodeInfo)
{
CheckBox box = (CheckBox) e.Row.FindControl("ChkNodePreview");
CheckBox box2 = (CheckBox) e.Row.FindControl("ChkNodeInput");
CheckBox box3 = (CheckBox) e.Row.FindControl("ChkNodeCheck");
CheckBox box4 = (CheckBox) e.Row.FindControl("ChkContentManage");
if (nodeInfo.NodeId == -1)
{
this.m_NodePreviewId = box.ClientID;
this.m_NodeInputId = box2.ClientID;
this.m_NodeCheckId = box3.ClientID;
this.m_ContentManageId = box4.ClientID;
box.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box.ID + "'," + this.m_NodePreviewId + ")");
box2.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box2.ID + "'," + this.m_NodeInputId + ")");
box3.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box3.ID + "'," + this.m_NodeCheckId + ")");
box4.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box4.ID + "'," + this.m_ContentManageId + ")");
}
else
{
box.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_NodePreviewId + ")");
box2.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_NodeInputId + ")");
box3.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_NodeCheckId + ")");
box4.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_ContentManageId + ")");
}
}
private void NodeSelectPermission(GridViewRowEventArgs e, NodeInfo nodeInfo)
{
CheckBox box = (CheckBox) e.Row.FindControl("ChkCurrentNodesManage");
CheckBox box2 = (CheckBox) e.Row.FindControl("ChkChildNodeManage");
if (nodeInfo.NodeId == -1)
{
this.m_CurrentNodesManageId = box.ClientID;
this.m_ChildNodeManageId = box2.ClientID;
box.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box.ID + "'," + this.m_CurrentNodesManageId + ")");
box2.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box2.ID + "'," + this.m_ChildNodeManageId + ")");
}
else
{
box.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_CurrentNodesManageId + ")");
box2.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.m_ChildNodeManageId + ")");
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_PermissionsType = BasePage.RequestString("PermissionsType");
this.m_RoleId = BasePage.RequestInt32("RoleId");
this.m_Type = BasePage.RequestString("Type");
this.m_IdType = BasePage.RequestInt32("IdType");
if ((this.m_RoleId <= 0) && (this.m_RoleId != -2))
{
AdminPage.WriteErrMsg("当前ID不存在!");
}
if (!this.Page.IsPostBack)
{
this.InitData();
}
}
private void SaveRoleFieldPermissions()
{
string type = this.m_Type;
if (type != null)
{
if (!(type == "Content"))
{
if (!(type == "Comment"))
{
if (type == "Node")
{
this.GetNodeSelectPermission();
}
return;
}
}
else
{
this.GetContentNodeSelectPermission();
return;
}
this.GetNodeCommentSelectPermission();
}
}
private void SaveUserFieldPermissions()
{
string selectId = "";
StringBuilder roleIdList = new StringBuilder();
StringBuilder builder2 = new StringBuilder();
StringBuilder builder3 = new StringBuilder();
this.m_NodeSkimAll = ((CheckBox) this.EgvNodes.Rows[0].FindControl("ChkNodeSkim")).Checked;
this.m_NodePreviewAll = ((CheckBox) this.EgvNodes.Rows[0].FindControl("ChkNodePreview")).Checked;
this.m_NodeInputAll = ((CheckBox) this.EgvNodes.Rows[0].FindControl("ChkNodeInput")).Checked;
for (int i = 0; i < this.EgvNodes.Rows.Count; i++)
{
this.m_ChkNodeSkim = (CheckBox) this.EgvNodes.Rows[i].Cells[2].FindControl("ChkNodeSkim");
this.m_ChkNodePreview = (CheckBox) this.EgvNodes.Rows[i].Cells[3].FindControl("ChkNodePreview");
this.m_ChkNodeInput = (CheckBox) this.EgvNodes.Rows[i].Cells[4].FindControl("ChkNodeInput");
selectId = this.EgvNodes.DataKeys[i].Value.ToString();
AppendSelectId(this.m_ChkNodeSkim.Checked || this.m_NodeSkimAll, selectId, ref roleIdList);
AppendSelectId(this.m_ChkNodePreview.Checked || this.m_NodePreviewAll, selectId, ref builder2);
AppendSelectId(this.m_ChkNodeInput.Checked || this.m_NodeInputAll, selectId, ref builder3);
}
AppendAllId(roleIdList, this.EgvNodes.Rows.Count - 1);
AppendAllId(builder2, this.EgvNodes.Rows.Count - 1);
AppendAllId(builder3, this.EgvNodes.Rows.Count - 1);
UserPermissions.DeleteNodePermissions(this.m_RoleId, this.m_IdType);
UserPermissions.AddNodePermissions(this.m_RoleId, OperateCode.NodeContentSkim, roleIdList.ToString(), this.m_IdType);
UserPermissions.AddNodePermissions(this.m_RoleId, OperateCode.NodeContentPreview, builder2.ToString(), this.m_IdType);
UserPermissions.AddNodePermissions(this.m_RoleId, OperateCode.NodeContentInput, builder3.ToString(), this.m_IdType);
}
private void SetContentNode(IList<RoleNodePermissionsInfo> roleNodePermissionsList)
{
for (int i = 0; i < this.EgvNodes.Rows.Count; i++)
{
this.m_ChkNodePreview = (CheckBox) this.EgvNodes.Rows[i].Cells[2].FindControl("ChkNodePreview");
this.m_ChkNodeInput = (CheckBox) this.EgvNodes.Rows[i].Cells[3].FindControl("ChkNodeInput");
this.m_ChkNodeCheck = (CheckBox) this.EgvNodes.Rows[i].Cells[4].FindControl("ChkNodeCheck");
this.m_ChkContentManage = (CheckBox) this.EgvNodes.Rows[i].Cells[5].FindControl("ChkContentManage");
int num2 = DataConverter.CLng(this.EgvNodes.Rows[i].Cells[0].Text);
for (int j = 0; j < roleNodePermissionsList.Count; j++)
{
if (roleNodePermissionsList[j].NodeId == num2)
{
if ((roleNodePermissionsList[j].OperateCode == OperateCode.NodeContentPreview) && !this.m_NodePreviewAll)
{
this.m_ChkNodePreview.Checked = true;
}
if ((roleNodePermissionsList[j].OperateCode == OperateCode.NodeContentInput) && !this.m_NodeInputAll)
{
this.m_ChkNodeInput.Checked = true;
}
if ((roleNodePermissionsList[j].OperateCode == OperateCode.NodeContentCheck) && !this.m_NodeCheckAll)
{
this.m_ChkNodeCheck.Checked = true;
}
if ((roleNodePermissionsList[j].OperateCode == OperateCode.NodeContentManage) && !this.m_ContentManageAll)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -