/// <summary> /// 更新文本框 /// </summary> protected void Flush() { CMS_Column bCol = new CMS_Column(); Model.CMS_Column col = new Model.CMS_Column(); DataTable dt; if (CurrentId > 0) { col = bCol.GetModel(CurrentId); tbTitle.Text = col.Title; if (col.GotoUrl != "") { cbLink.Checked = true; Panel1.Visible = true; } cbIsNavi.Checked = col.IsNavigator == 1 ? true : false; if (col.GotoUrl != "" && col.GotoUrl != null) { ClientScript.RegisterStartupScript(this.GetType(), "jsGotoUrl", "<script>$(\"#ckIsLink\").trigger(\"click\");$(\"#trLink\").css(\"display\",\"block\");</script>"); tbLink.Text = col.GotoUrl; } //只列出满足以下条件的栏目作为父栏目:不能是自己的下级栏目,不能是跳转到某网站的栏目,不能是已包含文章的栏目 dt = bCol.GetList("Code not like '" + col.Code + "%' and (Len(GotoUrl)=0 or GotoUrl is NULL) " + "and Id not in (select distinct ColumnId from CMS_Article)").Tables[0]; } else { //只列出满足以下条件的栏目作为父栏目:不能是跳转到某网站的栏目,不能是已包含文章的栏目 dt = bCol.GetList("(Len(GotoUrl)=0 or " + "GotoUrl is NULL) and Id not in " + "(select distinct ColumnId from CMS_Article)").Tables[0]; } ddlParentId.Items.Add(new ListItem("作为一级", "0")); foreach (DataRow dr in dt.Rows) { ListItem li = new ListItem(); li.Text = GetColumnName(dr["Title"].ToString(), dr["Code"].ToString()); li.Value = dr["Id"].ToString(); if (col.ParentId.ToString() == li.Value) { li.Selected = true; } ddlParentId.Items.Add(li); } }
//更新列表 public void Flush() { CMS_Column bCol = new CMS_Column(); GVinfo.DataSource = bCol.GetList(""); GVinfo.DataBind(); }
/// <summary> /// 加载栏目权限和系统权限 /// </summary> protected void LoadSetting() { CMS_AdminRole bar = new CMS_AdminRole(); CMS_Column bcol = new CMS_Column(); Model.CMS_AdminRole role = CurrentId > 0 ? bar.GetModel(CurrentId) : new Model.CMS_AdminRole(); hfSetting.Value = role.AdminSetting + "," + role.Setting; //收藏哪些勾选 // 加载系统权限 List <LeftMenu> menus = LeftMenu.Load(); StringBuilder sb = new StringBuilder(); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" class=\"setTable\"> "); foreach (LeftMenu menu in menus) { sb.AppendFormat("<tr><td class=\"forumRowHighlight\">{0}</td></tr>", menu.Title); sb.Append("<tr><td class=\"listRow\">"); foreach (MenuLink link in menu.Links) { sb.AppendFormat("<span><input type=\"checkbox\" name=\"admin_setting\" value=\"{0}\" id=\"{1}\">{2}</span> ", link.Code, link.Code, link.Title); } sb.Append("</td></tr>"); } sb.Append("</table>"); ltAdminSetting.Text = sb.ToString(); // 加载栏目权限 DataTable dt = bcol.GetList("").Tables[0]; sb = new StringBuilder(); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" class=\"setTable\"> "); sb.Append("<tr class='listRow'><td style='width:100px'><input type=\"checkbox\" name=\"setting\" value=\"deleteBatch\">批量删除文章</td>"); sb.Append("<td style='width:100px'><input type=\"checkbox\" name=\"setting\" value=\"moveBatch\">批量移动文章</td>"); sb.Append("<td style='width:100px'><input type=\"checkbox\" name=\"setting\" value=\"addBatch\">批量加入专题</td>"); sb.Append("</tr></table>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" class=\"setTable\"> "); foreach (DataRow dr in dt.Rows) { sb.AppendFormat("<tr class='listRow'><td>{0}</td>", GetColumnName(dr["Title"].ToString(), dr["Code"].ToString())); sb.AppendFormat("<td style='width:220px'><input type=\"checkbox\" name=\"setting\" value=\"{0}_0\">编辑文章", dr["Id"]); sb.AppendFormat("<input type=\"checkbox\" name=\"setting\" value=\"{0}_1\">删除文章", dr["Id"]); sb.AppendFormat("<input type=\"checkbox\" name=\"setting\" value=\"{0}_2\">新增文章", dr["Id"]); sb.Append("</td></tr>"); } sb.Append("</table>"); ltSetting.Text = sb.ToString(); tbTitle.Text = role.Name; }