public string getData() { TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); DataTable dt = JpColumns.GetFirstlevcolumns_online(); StringBuilder strShow = new StringBuilder(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级文章目录 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { //如果需要显示这个栏目(当前栏目有权限要显示,如果当前栏目没权限但是下级栏目有权限也要显示但是不加载链接) if (JpRoles.ifhaveEditorRoleBycidanduid_containsubcid("admin", dt.Rows[i]["cid"].ToString()) == true) { strShow.Append("<li class=\"mui-table-view-cell mui-collapse\"><a class=\"mui-navigate-right\" href=\"javascript:void(0)\">" + dt.Rows[i]["cname"].ToString() + "</a>"); strShow.Append("<ul class=\"mui-table-view mui-table-view-chevron\">"); strShow.Append(GetNextColumn(dt.Rows[i]["cid"].ToString())); strShow.Append("</ul>"); strShow.Append("</li>"); } } else { if (JpRoles.ifhaveEditorRoleBycidanduid("admin", dt.Rows[i]["cid"].ToString()) == true) { strShow.Append("<li class=\"mui-table-view-cell mui-collapse\"><a class=\"mui-navigate-right\" href=\"javascript:void(0)\">" + dt.Rows[i]["cname"].ToString() + "</a></li>"); } } } } return strShow.ToString(); }
private string GetNextColumn(string pis_cid) { string ls_return = ""; //得到下级文章目录 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); DataTable dt = JpColumns.GetSubColumnsOrderbysort_online(pis_cid); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid_containsubcid("admin", dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid("admin", dt.Rows[i]["cid"].ToString()) == true) { if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { ls_return += "<li class=\"mui-table-view-cell\">"; } else { ls_return += "<li class=\"mui-table-view-cell\" ><a class=\"mui-navigate-right\" href=\"auditSecondList.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\" ><span class=\"mui-badge mui-badge-warning\">2</span>"; } } else { ls_return += "<li class=\"mui-table-view-cell\">"; } ls_return += dt.Rows[i]["cname"].ToString() + "</a>"; ls_return += "<ul>"; ls_return += GetNextColumn(dt.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { if (JpRoles.ifhaveEditorRoleBycidanduid("admin", dt.Rows[i]["cid"].ToString()) == true) { ls_return += "<li class=\"mui-table-view-cell\" ><a class=\"mui-navigate-right\" href=\"auditSecondList.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\" >" + dt.Rows[i]["cname"].ToString() + "<span class=\"mui-badge mui-badge-warning\">2</span></a></li>"; } } } } return ls_return; }
protected void btnLogin_Click(object sender, EventArgs e) { if (Session["checkcode"].ToString().Equals(this.txt_checkcode.Value)) { String password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_password.Value, "MD5"); TPortalClass.JpUsers Users = new TPortalClass.JpUsers(); if (Users.Login(this.txt_username.Value, password)) { TPortalClass.JpUsers userinfo = new TPortalClass.JpUsers(this.txt_username.Value); Session["uid"] = userinfo.uid; Session["uname"] = userinfo.uname; TPortalClass.JpRoles roles = new TPortalClass.JpRoles(); Session["role"] = roles.GetRolesListByUID(userinfo.uid); String aa = Session["role"].ToString(); //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "登录", "后台登录", Session["uid"].ToString(), Session["uname"].ToString()); this.Response.Redirect(this.lblurl.Text); } else { Response.Write("<script>alert('输入的用户名或者密码不正确!');window.location.href = window.location.href;</script>"); return; } } else { Response.Write("<script>alert('校验码不正确!');window.location.href = window.location.href;</script>"); return; } }
private void addsubcolumn(DataTable tempTable, string pi_cid, string pi_cname) { TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); //先插入当前栏目 DataRow dr = tempTable.NewRow(); dr["cid"] = pi_cid; dr["cname"] = pi_cname; if (JpRoles.ifhaveAuthorRoleBycidanduid(Session["uid"].ToString(), pi_cid) == true && JpColumns.ifhotpublish(pi_cid) == false) { //有下一级 if (JpColumns.isHaveSubColumn_online(pi_cid) == true) { } else { tempTable.Rows.Add(dr); } } //判断是否有下级栏目 DataTable dt = new DataTable(); dt = JpColumns.GetColumns(pi_cid); if (dt.Rows.Count > 0) { //有下一级目录 for (int i = 0; i < dt.Rows.Count; i++) { addsubcolumn(tempTable, dt.Rows[i]["cid"].ToString(), pi_cname + ">>" + dt.Rows[i]["cname"].ToString()); } } }
private string GetShopNextColumn_editor(string pis_cid) { TPortalClass.DAO db = new TPortalClass.DAO(); string ls_return = ""; //得到二级部门 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); DataTable dt = JpColumns.GetSubColumnsOrderbysort_online(pis_cid); string sql_GetSubColumnsOrderbysort_online = " select * from JpColumns where online=1 and cid like '" + pis_cid + "%' and len(cid)=9 order by csort"; dt = db.GetDataTable(sql_GetSubColumnsOrderbysort_online); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { ls_return += "<li isexpand=\"false\" url=\"shop/list_shop_sh.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\">"; } else { ls_return += "<li isexpand=\"false\">"; } ls_return += "<span>" + dt.Rows[i]["cname"].ToString() + "</span>"; ls_return += "<ul>"; ls_return += GetShopNextColumn_editor(dt.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { ls_return += "<li url=\"shop/list_shop_sh.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\"><span>"; ls_return += dt.Rows[i]["cname"].ToString() + "</span></li>"; } } } } return ls_return; }
private string GetNextColumn_sh(string pis_cid) { string ls_return = ""; //得到二级部门 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); DataTable dt = JpColumns.GetSubColumnsOrderbysort_online(pis_cid); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true && JpColumns.ifhotpublish(dt.Rows[i]["cid"].ToString()) == false) { ls_return += "<li isexpand=\"false\" url=\"article/list_article_sh.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\">"; } else { ls_return += "<li isexpand=\"false\">"; } ls_return += "<span>" + dt.Rows[i]["cname"].ToString() + "</span>"; ls_return += "<ul>"; ls_return += GetNextColumn_sh(dt.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true && JpColumns.ifhotpublish(dt.Rows[i]["cid"].ToString()) == false) { ls_return += "<li url=\"article/list_article_sh.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\"><span>"; ls_return += dt.Rows[i]["cname"].ToString() + "</span></li>"; } } } } return ls_return; }
//商城管理 public string ls_scgl() { TPortalClass.DAO db = new TPortalClass.DAO(); string ls_return = ""; if (Session["uid"].ToString() == "") { } else { TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); if (JpRoles.ifshowcolumn_tg(Session["uid"].ToString(), "006")) { ls_return += "<li isexpand=\"false\"><span>商城投稿</span>"; ls_return += "<ul>"; #region DataTable dt = new DataTable(); //文章发布左侧动态产生 //得到一级部门 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); string sql_Firstlevcolumns = "Select * from JpColumns where len(cid)=6 and cid like '006%' and online=1 order by csort "; dt = db.GetDataTable(sql_Firstlevcolumns); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 string sql_isHaveSubColumn = " select * from JpColumns where cid like '" + dt.Rows[i]["cid"].ToString() + "%' and len(cid) = 9 and online = 1 order by csort "; DataTable dt_isHaveSbuColumn = db.GetDataTable(sql_isHaveSubColumn); bool b_isHaveSbuColumn; if (dt_isHaveSbuColumn.Rows.Count > 0) { b_isHaveSbuColumn = true; } else { b_isHaveSbuColumn = false; } if (b_isHaveSbuColumn == true) { string sql_ifshowcolumn = " select * from JpRoles a,JpColumns b where a.cid=b.cid and a.role='author' and a.uid='" + Session["uid"].ToString() + "' and a.cid like '" + dt.Rows[i]["cid"].ToString() + "%' "; DataTable dt_ifshowcolumn = db.GetDataTable(sql_isHaveSubColumn); bool b_ifshowcolumn; if (dt_ifshowcolumn.Rows.Count > 0) { b_ifshowcolumn = true; } else { b_ifshowcolumn = false; } if (b_ifshowcolumn == true) { string sql_ifhaveAuthorRoleBycidanduid = " select * from JpRoles where role='author' and uid='" + Session["uid"].ToString() + "' and cid='" + dt.Rows[i]["cid"].ToString() + "' "; DataTable dt_ifhaveAuthorRoleBycidanduid = db.GetDataTable(sql_isHaveSubColumn); bool b_ifhaveAuthorRoleBycidanduid; if (dt_ifhaveAuthorRoleBycidanduid.Rows.Count > 0) { b_ifhaveAuthorRoleBycidanduid = true; } else { b_ifhaveAuthorRoleBycidanduid = false; } if (b_ifhaveAuthorRoleBycidanduid == true) { ls_return += "<li isexpand=\"false\" url=\"shop/list_shop_tg.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\">"; } else { ls_return += "<li isexpand=\"false\">"; } ls_return += "<span>" + dt.Rows[i]["cname"].ToString() + "</span>"; ls_return += "<ul>"; ls_return += GetShopNextColumn_author(dt.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { DataTable dt_ifhaveAuthorRoleBycidanduid = db.GetDataTable(sql_isHaveSubColumn); bool b_ifhaveAuthorRoleBycidanduid; if (dt_ifhaveAuthorRoleBycidanduid.Rows.Count > 0) { b_ifhaveAuthorRoleBycidanduid = true; } else { b_ifhaveAuthorRoleBycidanduid = false; } if (b_ifhaveAuthorRoleBycidanduid == true) { ls_return += "<li url=\"shop/list_shop_tg.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\"><span>"; ls_return += dt.Rows[i]["cname"].ToString() + "</span></li>"; } } } } #endregion ls_return += "</ul>"; ls_return += "</li>"; } if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), "006")) { ls_return += "<li isexpand=\"false\"><span>商城审核</span>"; ls_return += "<ul>"; #region DataTable dt2 = new DataTable(); //文章发布左侧动态产生 //得到一级部门 TPortalClass.JpColumns JpColumns2 = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles2 = new TPortalClass.JpRoles(); string sql_Firstlevcolumns2 = "Select * from JpColumns where len(cid)=6 and cid like '006%' and online=1 order by csort "; dt2 = db.GetDataTable(sql_Firstlevcolumns2); if (dt2.Rows.Count > 0) { for (int i = 0; i < dt2.Rows.Count; i++) { //有下一级部门 string sql_isHaveSubColumn2 = " select * from JpColumns where cid like '" + dt2.Rows[i]["cid"].ToString() + "%' and len(cid) = 9 and online = 1 order by csort "; DataTable dt_isHaveSbuColumn2 = db.GetDataTable(sql_isHaveSubColumn2); bool b_isHaveSbuColumn2; if (dt_isHaveSbuColumn2.Rows.Count > 0) { b_isHaveSbuColumn2 = true; } else { b_isHaveSbuColumn2 = false; } if (b_isHaveSbuColumn2 == true) { string sql_ifshowcolumn2 = " select * from JpRoles a,JpColumns b where a.cid=b.cid and a.role='editor' and a.uid='" + Session["uid"].ToString() + "' and a.cid like '" + dt2.Rows[i]["cid"].ToString() + "%' "; DataTable dt_ifshowcolumn2 = db.GetDataTable(sql_isHaveSubColumn2); bool b_ifshowcolumn2; if (dt_ifshowcolumn2.Rows.Count > 0) { b_ifshowcolumn2 = true; } else { b_ifshowcolumn2 = false; } if (b_ifshowcolumn2 == true) { string sql_ifhaveAuthorRoleBycidanduid2 = " select * from JpRoles where role='editor' and uid='" + Session["uid"].ToString() + "' and cid='" + dt2.Rows[i]["cid"].ToString() + "' "; DataTable dt_ifhaveAuthorRoleBycidanduid2 = db.GetDataTable(sql_isHaveSubColumn2); bool b_ifhaveAuthorRoleBycidanduid2; if (dt_ifhaveAuthorRoleBycidanduid2.Rows.Count > 0) { b_ifhaveAuthorRoleBycidanduid2 = true; } else { b_ifhaveAuthorRoleBycidanduid2 = false; } if (b_ifhaveAuthorRoleBycidanduid2 == true) { ls_return += "<li isexpand=\"false\" url=\"shop/list_shop_sh.aspx?cid=" + dt2.Rows[i]["cid"].ToString() + "\">"; } else { ls_return += "<li isexpand=\"false\">"; } ls_return += "<span>" + dt2.Rows[i]["cname"].ToString() + "</span>"; ls_return += "<ul>"; ls_return += GetShopNextColumn_editor(dt2.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { DataTable dt_ifhaveAuthorRoleBycidanduid2 = db.GetDataTable(sql_isHaveSubColumn2); bool b_ifhaveAuthorRoleBycidanduid2; if (dt_ifhaveAuthorRoleBycidanduid2.Rows.Count > 0) { b_ifhaveAuthorRoleBycidanduid2 = true; } else { b_ifhaveAuthorRoleBycidanduid2 = false; } if (b_ifhaveAuthorRoleBycidanduid2 == true) { ls_return += "<li url=\"shop/list_shop_tg.aspx?cid=" + dt2.Rows[i]["cid"].ToString() + "\"><span>"; ls_return += dt2.Rows[i]["cname"].ToString() + "</span></li>"; } } } } #endregion ls_return += "</ul>"; ls_return += "</li>"; } } return ls_return; }
protected void Page_Load(object sender, EventArgs e) { if (Session["uid"].ToString() == "") { this.Response.Redirect("login.aspx?url=" + this.Request.RawUrl.ToString()); } else { TPortalClass.JpUsers JpUsers = new TPortalClass.JpUsers(Session["uid"].ToString()); DataTable dt = new DataTable(); lbluserinfo.Text = JpUsers.uname; if (JpUsers.deptid != "") { TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); dt = JpDepts.GetDept(JpUsers.deptid); if (dt.Rows.Count > 0) { lbluserinfo.Text += "(" + dt.Rows[0]["deptname"].ToString() + ")"; } } #region 根据权限判断导航显示情况 this.pis_wzfb.Visible = false; this.pis_wztg.Visible = false; this.pis_wzsh.Visible = false; this.pis_yhgl.Visible = false; this.pis_lmgl.Visible = false; this.pis_xtsz.Visible = false; this.pis_plgl.Visible = false; this.pis_gggl.Visible = false; this.pis_hdgl.Visible = false; this.li_adv_tg.Visible = false; this.li_adv_sh.Visible = false; li_activity_tg.Visible = false; li_activity_sh.Visible = false; li_activityusers.Visible = false; pis_wqgl.Visible = false; this.pis_xwgl.Visible = false; pis_ssyz.Visible = false; //文章发布 if (ChkRole("Role0001") == "1") { this.pis_wzfb.Visible = true; } else { if (ChkRole("Role0002") == "1") { ls_gobal1 = "global_channel_tree2"; ls_gobal2 = "global_channel_tree1"; } else { if (ChkRole("Role0003") == "1") { ls_gobal1 = "global_channel_tree3"; ls_gobal3 = "global_channel_tree1"; } } } //文章投稿 if (ChkRole("Role0002") == "1") { this.pis_wztg.Visible = true; } //文章审核 if (ChkRole("Role0003") == "1") { this.pis_wzsh.Visible = true; } //评论管理 if (ChkRole("Role0004") == "1") { this.pis_plgl.Visible = true; } //维权帮办 if (ChkRole("Role0012") == "1") { this.pis_wqgl.Visible = true; } //新闻爆料 if (ChkRole("Role0013") == "1") { this.pis_xwgl.Visible = true; } //新闻爆料 if (ChkRole("Role0014") == "1") { this.pis_ssyz.Visible = true; } //活动管理 if (ChkRole("Role0005") == "1") { this.pis_hdgl.Visible = true; TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); if (JpRoles.ifshowcolumn_tg(Session["uid"].ToString(), "008")) { li_activity_tg.Visible = true; } if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), "008")) { li_activity_sh.Visible = true; } } //广告管理 if (ChkRole("Role0006") == "1") { this.pis_gggl.Visible = true; TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); if (JpRoles.ifshowcolumn_tg(Session["uid"].ToString(), "007")) { li_adv_tg.Visible = true; } if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), "007")) { li_adv_sh.Visible = true; } } //活动报名审核 if (ChkRole("Role0010") == "1") { this.li_activityusers.Visible = true; } //用户管理 if (ChkRole("Role0007") == "1") { this.pis_yhgl.Visible = true; } //栏目管理 if (ChkRole("Role0008") == "1") { this.pis_lmgl.Visible = true; } //系统设置 if (ChkRole("Role0011") == "1") { this.pis_xtsz.Visible = true; } #endregion } }
//显示文章投稿栏目 public string ls_wztg() { string ls_return = ""; if (Session["uid"].ToString() == "") { } else { DataTable dt = new DataTable(); //文章发布左侧动态产生 //得到一级部门 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); dt = JpColumns.GetFirstlevcolumns_online(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifshowcolumn_tg(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveAuthorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true && JpColumns.ifhotpublish(dt.Rows[i]["cid"].ToString()) == false) { ls_return += "<li isexpand=\"false\" url=\"article/list_article_tg.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\">"; } else { ls_return += "<li isexpand=\"false\">"; } ls_return += "<span>" + dt.Rows[i]["cname"].ToString() + "</span>"; ls_return += "<ul>"; ls_return += GetNextColumn_author(dt.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { if (JpRoles.ifhaveAuthorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true && JpColumns.ifhotpublish(dt.Rows[i]["cid"].ToString()) == false) { ls_return += "<li url=\"article/list_article_tg.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "\"><span>"; ls_return += dt.Rows[i]["cname"].ToString() + "</span></li>"; } } } } } return ls_return; }
//得到下一级部门的信息 private void GetNextColumn(string pis_cid) { //得到二级部门 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); DataTable dt = JpColumns.GetSubColumnsOrderbysort_online(pis_cid); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid_containsubcid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { //if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) //{ //输出二级部门头部 Response.Write("<dd class=\"folderClose\">"); //Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["cid"].ToString() + "\" value=\"" + dt.Rows[i]["cid"].ToString() + "\" id=\"" + dt.Rows[i]["cname"].ToString() + "\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["cid"].ToString() + "\" value=\"\">"); Response.Write(dt.Rows[i]["cname"].ToString()); Response.Write("<dl>"); GetNextColumn(dt.Rows[i]["cid"].ToString()); //输出二级部门尾部 Response.Write("</dl>"); Response.Write("</dd>"); //} } } } else { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { //输出二级部门头部 Response.Write("<dt>"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["cid"].ToString() + "\" value=\"" + dt.Rows[i]["cid"].ToString() + "\" id=\"" + dt.Rows[i]["cname"].ToString() + "\">"); Response.Write(dt.Rows[i]["cname"].ToString()); //输出二级部门尾部 Response.Write("</dt>"); } } } } }
private void ChkRole() { //判断权限 TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); DataTable dtart; if (this.txtop.Value != "add") { dtart = JpArticle.GetArticleByaid(System.Int32.Parse(this.txtaid.Text)); } else { dtart = JpArticle.GetArticleByaid(-1); } if (this.txtop.Value != "add") { this.txtstatus.Text = dtart.Rows[0]["status"].ToString(); //旧文档 if (dtart.Rows[0]["status"].ToString() == "编辑") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 btnFBJX.Visible = true;//发布并继续按钮 btnCG.Visible = false; //撤稿按钮 btnBJ.Visible = false; //编辑按钮 } if (dtart.Rows[0]["status"].ToString() == "发布") { btnSave.Visible = false; //保存按钮 btnFB.Visible = false; //发布按钮 btnFBJX.Visible = false;//发布并继续按钮 btnCG.Visible = true; //撤稿按钮 btnBJ.Visible = true; //编辑按钮 this.Label1.Visible = true; this.Label2.Visible = true; this.Label3.Visible = true; this.Label4.Visible = true; this.Label5.Visible = true; this.Label6.Visible = true; this.Label7.Visible = true; this.Label8.Visible = true; this.Label9.Visible = true; this.Label10.Visible = true; this.Label11.Visible = true; this.txtpubtime.Visible = false; this.ddlcolname.Visible = false; this.txtasort.Visible = false; this.txtauthor.Visible = false; this.txtsource.Visible = false; this.btn_lgdw.Visible = false; this.txttitle.Visible = false; this.txttitle2.Visible = false; this.txtsummary.Visible = false; this.content1.Visible = false; this.txthits.Visible = false; this.txtgoodnum.Visible = false; } if (dtart.Rows[0]["status"].ToString() == "撤稿") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 btnFBJX.Visible = true; //发布并继续按钮 btnCG.Visible = false; //撤稿按钮 btnBJ.Visible = false; //编辑按钮 } if (dtart.Rows[0]["status"].ToString() == "审核") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 btnFBJX.Visible = true; //发布并继续按钮 btnCG.Visible = false; //撤稿按钮 btnBJ.Visible = false; //编辑按钮 } } else { btnSave.Visible = true; btnFB.Visible = true; btnCG.Visible = false; btnBJ.Visible = false; //编辑按钮 } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string uid = txtuid.Text; TPortalClass.JpRoles Roles = new TPortalClass.JpRoles(); string cidlist = this.txtcids.Text; string[] cids = cidlist.Split(','); string authlist = this.txtauths.Text; string[] auths = authlist.Split(','); string editlist = this.txtedits.Text; string[] edits = editlist.Split(','); int rowcnt = 0; foreach (string cid in cids) { //版主 if (edits[rowcnt] == "1") { Roles.role = "editor"; Roles.uid = uid; Roles.cid = cid; Roles.Delete(); Roles.Insert(); } else { Roles.role = "editor"; Roles.uid = uid; Roles.cid = cid; Roles.Delete(); } //作者 if (auths[rowcnt] == "1") { Roles.role = "author"; Roles.uid = uid; Roles.cid = cid; Roles.Delete(); Roles.Insert(); } else { Roles.role = "author"; Roles.uid = uid; Roles.cid = cid; Roles.Delete(); } rowcnt = rowcnt + 1; } TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string pageUrl = JpCommon.CombUrlTxt("main_columnrole.aspx", "page={0}&rnd={1}&cid={2}&uid={3}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", this.txtcid.Text, this.txtuid.Text); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "保存人员授权", "批量保存人员授权", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('保存人员授权成功!');window.location='" + pageUrl + "';</script>"); }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); string uid = txtuid.Text; string cid = txtcid.Text; TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); DataTable dt = new DataTable(); if (this.txtcid.Text == "") dt = JpColumns.GetFirstlevcolumns_online(); else dt = JpColumns.GetSubColumnsOrderbysort_online(this.txtcid.Text); this.totalCount = dt.Rows.Count; DataTable tempTable = dt.Clone(); tempTable.Columns.Add(new DataColumn("authorchecked", typeof(string))); tempTable.Columns.Add(new DataColumn("editorchecked", typeof(string))); for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } if (JpRoles.ifhaveAuthorRoleBycidanduid(this.txtuid.Text, dt.Rows[i]["cid"].ToString()) == true) dr["authorchecked"] = "checked"; else dr["authorchecked"] = ""; if (JpRoles.ifhaveEditorRoleBycidanduid(this.txtuid.Text, dt.Rows[i]["cid"].ToString()) == true) dr["editorchecked"] = "checked"; else dr["editorchecked"] = ""; tempTable.Rows.Add(dr); } this.rptList.DataSource = tempTable; this.rptList.DataBind(); //翻页 //string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", // this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string pageUrl = JpCommon.CombUrlTxt("main_columnrole.aspx", "page={0}&rnd={1}&cid={2}&uid={3}", "__id__", System.Guid.NewGuid().ToString(), cid, uid); PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void ChkRole() { //判断权限 TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); DataTable dtart; if (this.txtop.Value != "add") { dtart = JpArticle.GetArticleByaid(System.Int32.Parse(this.txtaid.Text)); } else { dtart = JpArticle.GetArticleByaid(-1); } //是发布者 if (this.txtop.Value != "add") { //旧文档 if (dtart.Rows[0]["status"].ToString() == "审核") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 } else { btnSave.Visible = false; //保存按钮 btnFB.Visible = false; //发布按钮 } } else { //新文档 btnSave.Visible = true; btnFB.Visible = false; } }
//显示文章发布栏目 public string ls_wzfb() { string ls_return = ""; if (Session["uid"].ToString() == "") { } else { DataTable dt = new DataTable(); //文章发布左侧动态产生 //得到一级部门 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); dt = JpColumns.GetFirstlevcolumns_online(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { //如果需要显示这个栏目(当前栏目有权限要显示,如果当前栏目没权限但是下级栏目有权限也要显示但是不加载链接) if (JpRoles.ifhaveEditorRoleBycidanduid_containsubcid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { ls_return += "<li isexpand=\"false\" >"; } else { ls_return += "<li isexpand=\"false\">"; } ls_return += "<span>" + dt.Rows[i]["cname"].ToString() + "</span>"; ls_return += "<ul>"; ls_return += GetNextColumn(dt.Rows[i]["cid"].ToString()); ls_return += "</ul>"; ls_return += "</li>"; } } else { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { ls_return += "<li url=\"article/list_article_fb.aspx?cid=" + dt.Rows[i]["cid"].ToString() + "&rnd=" + System.Guid.NewGuid().ToString() + "\"><span>"; ls_return += dt.Rows[i]["cname"].ToString() + "</span></li>"; } } } } } return ls_return; }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); //if (this.Request.QueryString["deptid"] != null) // this.deptid = this.Request.QueryString["deptid"].ToString(); if (this.Request.QueryString["keywords"] != null) this.keywords = this.Request.QueryString["keywords"].ToString(); if (this.Request.QueryString["cid"] != null) { this.cid = this.Request.QueryString["cid"].ToString(); this.txtcid.Text = this.Request.QueryString["cid"].ToString(); } this.pageSize = 10; //每页数量 if (!Page.IsPostBack) { //DeptBind(this.cid); //绑定栏目 //判断权限 TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); if (JpRoles.ifhaveAuthorRoleBycidanduid(this.Session["uid"].ToString(), this.cid) != true) { this.Response.Write("<script>alert('你没有该栏目的编辑权限,请联系管理员!');</script>"); return; } TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dtcol = JpColumns.GetColumnBycid(this.cid); if (dtcol.Rows[0]["hotpublish"].ToString() == "1") { this.tdnewdoc.Visible = false; } TPortalClass.JpRoleuser JpRoleuser = new TPortalClass.JpRoleuser(); if (JpRoleuser.isHaveRole("Role9999", this.Session["uid"].ToString()) == true) { btnDelete.Visible = true; } else { btnDelete.Visible = false; } RptBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); if (!this.IsPostBack) { TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); Response.Write("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"zh-cn\">"); Response.Write("<Head><Title>栏目列表</Title>"); Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); Response.Write("<meta name=\"generator\" content=\"editplus\" />"); Response.Write("<link type=\"text/css\" rel=\"stylesheet\" href=\"hyhtml/ltree/resources/css/lTREE.checkbox.css\" />"); Response.Write("<style type=\"text/css\">"); Response.Write("#lTREEMenuDEMO {border:1px solid #ccc;margin:3px;padding:3px;}"); Response.Write("#infoBox {position:absolute;left:450px;top:40px;border:1px solid #ccc;width:400px;padding:0 10px;font-family:\"宋体\",Geneva,Arial,sans-serif;line-height:150%;}"); Response.Write("#debugMSG strong {color:#f00;}"); Response.Write("</style>"); Response.Write("<!--[if IE 6]>"); Response.Write("<script>"); Response.Write("document.execCommand(\"BackgroundImageCache\", false, true);"); Response.Write("</script>"); Response.Write("<![endif]-->"); Response.Write("</Head>"); Response.Write("<body style=\"padding:2px;\">"); //Response.Write("<form>"); Response.Write("<div class=\"lTREEMenu lTREENormal\" id=\"lTREEMenuDEMO\">"); Response.Write("<dl>"); Response.Write("<dl>"); //Response.Write("<dd><input type=\"checkbox\" name=\"SelAll\" value=\"全选\" onclick=\"SelectAll();\" style=\"width:13;\"> <b>栏目列表</b>"); Response.Write("<dd> <b>栏目列表</b>"); Response.Write("<dl>"); //得到一级栏目 DataTable dt = JpColumns.GetFirstlevcolumns_online(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //有下一级部门 if (JpColumns.isHaveSubColumn_online(dt.Rows[i]["cid"].ToString()) == true) { //如果需要显示这个栏目(当前栏目有权限要显示,如果当前栏目没权限但是下级栏目有权限也要显示但是不加载链接) if (JpRoles.ifhaveEditorRoleBycidanduid_containsubcid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { //输出一级部门头部 Response.Write("<dd class=\"folderClose\">"); //Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["cid"].ToString() + "\" value=\"" + dt.Rows[i]["cid"].ToString() + "\" id=\"" + dt.Rows[i]["cname"].ToString() + "\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["cid"].ToString() + "\" value=\"\">"); Response.Write(dt.Rows[i]["cname"].ToString()); Response.Write("<dl>"); GetNextColumn(dt.Rows[i]["cid"].ToString()); //输出一级部门尾部 Response.Write("</dl>"); Response.Write("</dd>"); } } else { if (JpRoles.ifhaveEditorRoleBycidanduid(Session["uid"].ToString(), dt.Rows[i]["cid"].ToString()) == true) { //输出一级部门头部 Response.Write("<dt>"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["cid"].ToString() + "\" value=\"" + dt.Rows[i]["cid"].ToString() + "\" id=\"" + dt.Rows[i]["cname"].ToString() + "\">"); Response.Write(dt.Rows[i]["cname"].ToString()); //输出一级部门尾部 Response.Write("</dt>"); } } } } Response.Write("</dl>"); Response.Write("</dd>"); Response.Write("</dl>"); Response.Write("</div>"); Response.Write("<script type=\"text/javascript\" src=\"hyhtml/ltree/js/lTREE.js\"></script>"); Response.Write("<script class=\"lJSFDemo\" type=\"text/javascript\"> "); Response.Write(" var lTree = new lTREE();"); Response.Write(" lTree.config({"); Response.Write(" path : \"dl dd\""); Response.Write(" });"); Response.Write(" lTree.tagName({"); Response.Write(" folder : \"DD\","); Response.Write(" file : \"DT\""); Response.Write(" });"); Response.Write(" lTree.className({"); Response.Write(" folderClose : \"folderClose\","); Response.Write(" lastChild : \"lastChild\""); Response.Write(" });"); Response.Write("var t=new Date(),timer=[];"); Response.Write("lTree.build(\"lTREEMenuDEMO\");"); Response.Write("timer.push(new Date()-t);"); /************************************** * 给树内所有复选框添加相应事件 * * Start */ Response.Write("function chkAll(){"); Response.Write("var a=this.parentNode.getElementsByTagName(\"input\"),b=this.checked;"); Response.Write("for(var i=0,l=a.length; i<l;i++) {"); Response.Write("a[i].checked=b;"); Response.Write("}"); Response.Write("}"); Response.Write("function chkOne(){"); Response.Write("var a=this,b=this.checked,p=lDOM.$(\"lTREEMenuDEMO\"),pn=null;"); Response.Write("while(a.tagName!=\"DD\" && a!=p) a=a.parentNode;"); Response.Write("pn=a.getElementsByTagName(\"input\");"); Response.Write("if(b){"); Response.Write("for(var i=1,l=pn.length; i<l;i++) {"); Response.Write("if(!pn[i].checked){"); Response.Write("b=false;"); Response.Write("break;"); Response.Write("}"); Response.Write("}"); Response.Write("}"); Response.Write("pn[0].checked=b;"); Response.Write("}"); Response.Write("var arrCHK=lDOM.find(\"dl dd input\",lDOM.$(\"lTREEMenuDEMO\"),{type:\"checkbox\"});"); Response.Write("arrCHK.each(function(s){"); Response.Write("if(s.parentNode.tagName==\"DT\"){"); Response.Write("s.onclick=chkOne;"); Response.Write("} else {"); Response.Write("s.onclick=chkAll;"); Response.Write("}"); Response.Write("});"); Response.Write(" </script>"); //Response.Write("</form>"); Response.Write("</Body></HTML>"); } }