`<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.XML" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="Kesion.Weixin" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script runat="server" type="text/C#">
	dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
	private static dynamic __info = new System.Dynamic.ExpandoObject();   //初始化当前页信息
	bool isLoadPage = true;  //定义页面是否加载
	DataRow dr = null;

	public int ParentID = 0;
	public int MenuID = 0;
	public int Count = 0;
	public int ModifyNum = 0;
	public string AlbumPhoto = string.Empty;
	public DataRow TuDr = null;
	public DataRow CourseDr = null;
	public string TypeName = string.Empty;
	private string menustatus = "1";
	public int sendtype = 0;
	public DataRow suCaiDr = null;
	protected void Page_Load(object sender, EventArgs e)
	{
		string action = KSCMS.S("do");
		if (string.IsNullOrEmpty(action))
		{
			action = KSCMS.S("action");
		}
	
		ParentID = Utils.StrToInt(KSCMS.S("parentID"));
		MenuID = Utils.StrToInt(KSCMS.S("menuID"));
		menustatus = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 menuStatus from KS_WeixinEpConfig where userid="+new TemporaryVar().UserID+"")).ToString();
		ModifyNum = Utils.StrToInt(DataFactory.GetOnlyValue("select modifynum from KS_WeixinMenu where id=" + MenuID + " and TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  order by id "));
		__info.TxtClassName = "";
		__info.TxtContent = "";
		__info.TxtUrl = "";
		__info.DrClassID = "0";
		if (!IsPostBack)
		{
			__info.Panel11 = true;
			__info.Panel2 = false;
			__info.Panel3 = true;
			__info.Panel4 = false;
			__info.Panel5 = false;
			__info.Panel7 = false;
			__info.Panel8 = false;
			__info.Panel9 = false;
			__info.Panel12 = false;
			__info.Panel13 = false;
			#region action
		
			switch (action)
			{
				case "visible":
					__info.Panel11 = true;
					__info.Panel2 = true;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel5 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel9 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "add":
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = true;
					__info.Panel5 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel9 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "modify":
					modify();
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = true;
					__info.Panel5 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel9 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "delete":
					delete();
					break;
				case "url":
					__info.Panel5 = true;
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel9 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "send":
					__info.Panel5 = false;
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel9 = true;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "class":
					__info.Panel5 = false;
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel9 = false;
					__info.Panel12 = true;
					__info.Panel13 = false;
					break;
				case "course":
					__info.Panel9 = true;
					__info.Panel5 = false;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;

				case "tuwen":
					__info.Panel9 = false;
					__info.Panel5 = false;
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "wenzi":
					__info.Panel9 = true;
					__info.Panel5 = false;
					__info.Panel11 = true;
					__info.Panel2 = false;
					__info.Panel3 = false;
					__info.Panel4 = false;
					__info.Panel7 = false;
					__info.Panel8 = false;
					__info.Panel12 = false;
					__info.Panel13 = false;
					break;
				case "btn1save":
					Button1_Click();
					break;
				case "btn2save":
					Button2_Click();
					break;
				case "btn4save":
					Button4_Click();
					break;
				case "btn6save":
					Button6_Click();
					break;
			}
			#endregion

			#region 修改
			using (DataTable dt = DataFactory.GetDataTable("select Top 1 * from KS_WeixinMenu where id=" + MenuID + " and TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+" order by id "))
			{
				if (dt.Rows.Count > 0)
				{
					DataRow dr = dt.Rows[0];
					ModifyNum = Utils.StrToInt(dr["ModifyNum"].ToString());
					TypeName = dr["TypeName"].ToString();
					if (ModifyNum == 1)
					{
						#region typename
						if (dr["TypeName"].ToString() == "Url")
						{
							modify();
							__info.Panel5 = true;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel9 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
						}
						else if (dr["TypeName"].ToString() == "Course")
						{
							GetCourse(Utils.StrToInt(dr["courseid"].ToString()), Utils.StrToInt(dr["costype"].ToString()));
							__info.Panel7 = true;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel8 = false;
							__info.Panel9 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
							sendtype = 2;
						}
						else if (dr["TypeName"].ToString() == "TuWen")
						{
							if (dr["infoid"].ToString() != "")
							{
								GetTuWen(Utils.StrToInt(dr["infoid"].ToString()));
							}
							__info.Panel8 = true;
							__info.Panel7 = false;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel9 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
							sendtype = 0;
						}
						else if (dr["TypeName"].ToString() == "WenZi")
						{
							__info.Panel9 = true;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = false;
							__info.TxtContent = dr["KeyWord"].ToString();
							__info.Panel13 = false;
							sendtype = 1;
						}
						else if (dr["TypeName"].ToString() == "SuCai")
						{
							if (Utils.StrToInt(dr["SuCaiID"].ToString()) != 0)
							{
								GetSuCai(Utils.StrToInt(dr["SuCaiID"].ToString()));
							}
							__info.Panel9 = false;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = false;
							sendtype = 3;
							__info.Panel13 = true;
						}
						else if (dr["TypeName"].ToString() == "Class")
						{
							__info.Panel9 = false;
							__info.Panel5 = false;
							__info.Panel11 = false;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = true;
							__info.Panel11 = true;
							__info.DrClassID = dr["classid"].ToString();
							__info.Panel13 = false;
						}
						#endregion

						#region action
						if (KSCMS.S("action") == "course")
						{
							__info.Panel9 = true;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = false;
							sendtype = 2;
							__info.Panel13 = false;
						}
						else if (KSCMS.S("action") == "tuwen")
						{
							__info.Panel9 = true;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
							sendtype = 0;
						}

						else if (KSCMS.S("action") == "wenzi")
						{
							__info.Panel9 = true;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
							sendtype = 1;
						}
						else if (KSCMS.S("action") == "sucai")
						{
							__info.Panel9 = true;
							__info.Panel5 = false;
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
						}
						else if (KSCMS.S("action") == "modify")
						{
							modify();
							__info.Panel11 = true;
							__info.Panel2 = false;
							__info.Panel3 = false;
							__info.Panel4 = true;
							__info.Panel5 = false;
							__info.Panel7 = false;
							__info.Panel8 = false;
							__info.Panel9 = false;
							__info.Panel12 = false;
							__info.Panel13 = false;
						}
						#endregion
					}
				}
			}
			#endregion
		}
	}
	public string GetVal(string field, int type=0)
	{
		#region 获取dr的值
		if (type == 0)//图文
		{
			if (TuDr != null)
			{
				return TuDr[field].ToString();
			}
			else
			{
				return "";
			}
		}
		else if (type == 1)
		{
			if (CourseDr != null)
			{
				return CourseDr[field].ToString();
			}
			else
			{
				return "";
			}
		}
		else
		{
			if (suCaiDr != null)
			{
				return suCaiDr[field].ToString();
			}
			else
			{
				return "";
			}
		}

		#endregion

	}
	public string GetMenuOrderButton()
	{
		#region 得到菜单排序
		string str = string.Empty;
		if (menustatus != "0")
		{
			str = " <a  class=\"ct-btn blue\"  href=\"javascript:void(0)\" onclick=\"openWin('菜单排序','" + BasicField.GetUserUrl("wx/wx_MenuList","frame-no") + "',true,800,400)\" title=\"菜单排序\" style=\"padding:0 20px;\" >菜单排序</a>";
		}
		return str;
		#endregion
	}
	public string GetMenuStatus()
	{
		string str = string.Empty;
		if (menustatus == "0")
		{
			// str = "您当前的菜单状态是禁用，如果要开启，请按同步到微信按钮！";
			// this.Button5.Visible = false;
		__info.Button5= "启用自定义菜单";
		}
		else
		{
			__info.Button5 = "禁用自定义菜单";
		}
		return str;
	}
	
	private void GetSuCai(int sucaiId)
	{
			#region 得到素材

		using (DataTable dt = DataFactory.GetDataTable("select top 1 * from KS_WeixinPigmsg where id=" + sucaiId))
		{
			if (dt.Rows.Count > 0)
			{
				suCaiDr = dt.Rows[0];
			}
		}
		#endregion
	}
	private void GetCourse(int id,int cosType)
	{
		#region 根据相册类型得到相册的图片
		if (id != 0)
		{
			string tableName = "KS_Course";
			if (cosType == 0)
			{
				tableName = "KS_CourseFace";
			}
			using (DataTable dt2 = DataFactory.GetDataTable("select Top 1 * from " + tableName + " where courseid=" + id + " "))
			{
				if (dt2.Rows.Count > 0)
				{
					CourseDr = dt2.Rows[0];
				}
			}
		}
		#endregion
	}
	private void GetTuWen(int id)
	{
		#region 根据图文类型得到图文的信息

	
			using (DataTable dt2 = DataFactory.GetDataTable("select Top 1 * from KS_EnterpriseNews where id=" + id + " "))
			{
				if (dt2.Rows.Count > 0)
				{
					TuDr = dt2.Rows[0];
				}
			}
		
		#endregion
	}
	private void modify()
	{
		#region 修改
		using (DataTable dt = DataFactory.GetDataTable("select top 1 * from  KS_WeixinMenu where id=" + MenuID + " and ParentID=" + ParentID + " and TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+" "))
		{
			if (dt.Rows.Count > 0)
			{
				DataRow dr = dt.Rows[0];
				__info.TxtClassName = dr["classname"].ToString();
				__info.TxtUrl = dr["KeyWord"].ToString();
			}
		}
		#endregion
	}

	public string GetyijiAnniu(int count)
	{
		#region 一级菜单按钮
		string str = string.Empty;

		if (count == 3)
		{
			str = "";
		}
		else
		{
			if (menustatus != "0")
			{
				str = "<a href=\""+BasicField.GetUserUrl("wx/wx_menu","action-Add")+"\" class=\"add_button\" style=\"font-size:16px\">添加一级菜单</a>";
			}
		}
		return str;
		#endregion
	}
	public string GetTitle(int parentid, int menuid)
	{
		#region 头部操作按钮
		string str = string.Empty;
		if (parentid == 0)
		{
			
			str = string.Format(@"<span class=""chongming""><a href=""{0}"">重命名</a></span>",GetUrl("modify",menuid,parentid) );
			str += string.Format(@"<span class=""chongming""><a href=""{0}"" onclick=""return(confirm('删除确认，同时删除该菜单的子菜单，此操作不可逆，确定删除该菜单吗?'));"" >删除</a></span>", GetUrl("delete", menuid, parentid));
			str += string.Format(@"<span>一级菜单：{0}</span>", DataFactory.GetOnlyValue("select top 1 ClassName from KS_WeixinMenu where TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and id=" + menuid + " and ParentID=" + parentid));
		}
		else
		{
			str = string.Format(@"<span class=""chongming""><a href=""{0}"">重命名</a></span>", GetUrl("modify", menuid, parentid));
			str += string.Format(@"<span class=""chongming""><a href=""{0}"" onclick=""return(confirm('删除确认，此操作不可逆，确定删除该菜单吗?'));"" >删除</a></span>", GetUrl("delete", menuid, parentid));
			str += string.Format(@"<span>二级菜单：{0}</span>", DataFactory.GetOnlyValue("select top 1 ClassName from KS_WeixinMenu where TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and id=" + menuid + " and ParentID=" + parentid));
		}
		return str;
		#endregion
	}
	public string GetCaozuo(int parentid, int menuid)
	{
		#region 操作按钮
		string str = string.Empty;
		if (parentid == 0)
		{
			using (DataTable dt = DataFactory.GetDataTable("select classname,id from  KS_WeixinMenu where ParentID=" + menuid + " and TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"   order by id"))
			{
				if (dt.Rows.Count > 0)
				{
					DataRow dr = dt.Rows[0];
					if (dt.Rows.Count == 5)
					{
						str = "<span class=\"content\">你已添加满5个二级菜单</span>";
					}
					else
					{
						str = string.Format("<span class=\"content\">已为“{0}”添加了二级菜单，无法设置其他内容。你还可以添加{1}个二级菜单</span>", dr["classname"].ToString(), (5 - (dt.Rows.Count)));
						str += string.Format(@"<ul class=""menu_list"">  <li class=""o1 ol""><a href=""{0}""><i class=""fa fa-reorder""></i><span>添加二级菜单</span></a></li>", GetUrl("Add", menuid, parentid));
					}
				}
				else
				{
					str = string.Format(@"<span class=""content"">请设置“{0}”菜单的内容</span>", DataFactory.GetOnlyValue("select top 1 ClassName from KS_WeixinMenu where TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and id=" + menuid + " and ParentID=" + parentid));
					str += string.Format(@"<ul class=""menu_list"">  <li class=""o1 ol""><a href=""{0}""><i class=""fa fa-reorder""></i><span>添加二级菜单</span></a></li>", GetUrl("Add", menuid, parentid));
					str += string.Format(@"<li class=""o2 ol""><a href=""{0}""><i class=""fa fa-envelope""></i></a><span>发送信息</span></li>", GetUrl("send", menuid, parentid));
					str += string.Format(@"<li class=""o3 ol""><a href=""{0}""><i class=""fa fa-globe""></i></a><span>跳转到网页</span></li>", GetUrl("url", menuid, parentid));
					str += string.Format(@"<li class=""o4 ol""><a href=""{0}""><i class=""fa fa-paper-plane""></i></a><span>指定系统栏目</span></li>", GetUrl("class", menuid, parentid));
					str += string.Format(@"</ul>");
				}
			}
		}
		else
		{
			using (DataTable dt = DataFactory.GetDataTable("select classname,id,modifynum from  KS_WeixinMenu where TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and id=" + menuid))
			{
				if (dt.Rows.Count > 0)
				{
					DataRow dr = dt.Rows[0];
					if (Utils.StrToInt(dr["modifynum"].ToString()) == 0)
					{
						str = string.Format(@"<span class=""content"">请设置“{0}”菜单的内容</span>", dr["classname"].ToString());
						str += string.Format(@"<ul class=""menu_list""><li class=""o2 ol""><a href=""{0}""><i class=""fa fa-envelope""></i></a><span>发送信息</span></li>", GetUrl("send", menuid, parentid));
						str += string.Format(@"<li class=""o3 ol""><a href=""{0}""><i class=""fa fa-globe""></i></a><span>跳转到网页</span></li>", GetUrl("url", menuid, parentid));
						str += string.Format(@"<li class=""o4 ol""><a href=""{0}""><i class=""fa fa-paper-plane""></i></a><span>指定系统栏目</span></li>", GetUrl("class", menuid, parentid));
						str += string.Format(@"</ul>");
					}
					else
					{
					}
				}
			}
		}
		return str;
		#endregion
	}
	public string GetUrl(string doFun, int menuID, int parentID)
	{
		string rUrl = BasicField.GetUserUrl("wx/wx_menu", "action-" + doFun + ",menuID-" + menuID + ",parentID-" + parentID + "");

		return rUrl;
	}

	public string GetAddTitle(int menuid, int count)
	{
		#region 得到添加的标题
		string str = string.Empty;
		if (menuid != 0)
		{
			if (KSCMS.S("action") == "modify")
			{
				if (ParentID == 0)
				{
					str = string.Format(@"<span class='content'>不多于4个汉字或8个字母</span>");
				}
				else
				{
					str = string.Format("<span class='content'>不多于8个汉字或16个字母以内</span>");
				}
			}
			else
			{
				str = string.Format("<span class='content'>还能添加{0}个二级菜单，请输入名称（8个汉字或16个字母以内）</span>", 5 - (Utils.StrToInt(DataFactory.GetOnlyValue("select count(*) from KS_WeixinMenu where ParentID=" + menuid + " and username='" + KSCMS.GetCookie("Admin", "AdminUser") + "'"))));
			}
		}
		else
		{
			str = string.Format(@"<span>还能添加{0}个一级菜单，请输入名称（4个汉字或8个字母以内）</span>", 3 - count);
		}
		return str;
		#endregion
	}
	protected void Button1_Click()
	{
		#region 菜单的保存按钮
		Hashtable ht = new Hashtable();
		ht.Add("classname",KSCMS.S("TxtClassName"));
		ht.Add("TypeFlag", new TemporaryVar().GroupID);
		if (MenuID != 0)
		{
			if (KSCMS.S("action") == "modify")
			{
				CommonData.Update("KS_WeixinMenu", ht, "where id=" + MenuID);
				Msg.Alert("恭喜，修改成功", BasicField.GetUserUrl("wx/wx_menu"));
				isLoadPage = false;
				return;
			}
			else
			{
				ht.Add("ParentID", MenuID);
				ht.Add("userid", new TemporaryVar().UserID);
				ht.Add("username",new TemporaryVar().UserName);
				ht.Add("ModifyNum", 0);
				ht.Add("OrderID", 0);
				ht.Add("KeyWord", "子菜单");
				ht.Add("Type", "click");
				CommonData.Insert("KS_WeixinMenu", ht);
				int orderid = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 max(orderid) from KS_WeixinMenu where  TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and ParentID=" + MenuID));
				DataFactory.ExecuteNonQuery("update KS_WeixinMenu set OrderID=1+" + orderid + " where TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and id=" + CommonData.GetMaxId("KS_WeixinMenu", "id") + " and ParentID=" + MenuID);
				Hashtable ht2 = new Hashtable();
				ht2.Add("Type", "click");
				ht2.Add("KeyWord", "有子菜单");
				CommonData.Update("KS_WeixinMenu", ht2, "where id=" + MenuID);
				Msg.Alert("恭喜，修改成功", BasicField.GetUserUrl("wx/wx_menu"));
				isLoadPage = false;
				return;
			}
		}
		else
		{
			ht.Add("ParentID", 0);
			ht.Add("userid", new TemporaryVar().UserID);
			ht.Add("username", new TemporaryVar().UserName);
			ht.Add("OrderID", 0);
			ht.Add("Type", "click");
			ht.Add("KeyWord", "父级菜单");
			CommonData.Insert("KS_WeixinMenu", ht);
			int orderid = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 max(orderid) from KS_WeixinMenu where  TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and ParentID=0 "));
			DataFactory.ExecuteNonQuery("update KS_WeixinMenu set OrderID=1+" + orderid + " where  TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and id=" + CommonData.GetMaxId("KS_WeixinMenu", "id") + " and ParentID=0");
			Msg.Alert("恭喜，修改成功", BasicField.GetUserUrl("wx/wx_menu"));
			isLoadPage = false;
			return;
		}
		#endregion
	}
	private void delete()
	{
		#region 删除
		using (DataTable dt = DataFactory.GetDataTable("select * from  KS_WeixinMenu where ParentID in(" + MenuID + ") and TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  order by id"))
		{
			if (dt.Rows.Count > 0)
			{
				foreach (DataRow dr in dt.Rows)
				{
					Hashtable ht = new Hashtable();
					ht.Add("id", dr["id"].ToString());
					ht.Add("userid", new TemporaryVar().UserID);
					CommonData.Delete("KS_WeixinMenu", ht);
				}
			}
			else
			{
				Hashtable ht = new Hashtable();
				ht.Add("id", MenuID);
				ht.Add("userid", new TemporaryVar().UserID);
				CommonData.Delete("KS_WeixinMenu", ht);
			}
		}
		Hashtable ht2 = new Hashtable();
		ht2.Add("id", MenuID);
		ht2.Add("userid", new TemporaryVar().UserID);
		CommonData.Delete("KS_WeixinMenu", ht2);
		Msg.Alert("恭喜，删除成功", BasicField.GetUserUrl("wx/wx_menu"));
		isLoadPage = false;
		return;
		#endregion
	}

	protected void Button2_Click()
	{
		#region 跳转url
		Hashtable ht = new Hashtable();
		if (ModifyNum == 0)
		{
			ht.Add("ModifyNum", 1);
			ht.Add("type", "view");
			ht.Add("TypeName", "Url");
			ht.Add("keyword", KSCMS.S("TxtUrl"));
			CommonData.Update("KS_WeixinMenu", ht, "where id=" + MenuID);
		}
		else
		{
			ht.Add("keyword",KSCMS.S("TxtUrl"));
			CommonData.Update("KS_WeixinMenu", ht, "where id=" + MenuID);
		}
		Msg.Alert("恭喜，设置成功", BasicField.GetUserUrl("wx/wx_menu"));
		isLoadPage = false;
		return;
		#endregion
	}

	protected void Button4_Click()
	{
		Hashtable ht = new Hashtable();
		ht.Add("ModifyNum", 1);
		ht.Add("type", "click");
		ht.Add("TypeName", "WenZi");
		ht.Add("keyword", Utils.ClearHtml( KSCMS.S("TxtContent")));
		CommonData.Update("KS_WeixinMenu", ht, "where id=" + MenuID);
		Msg.Alert("恭喜，保存成功", BasicField.GetUserUrl("wx/wx_menu"));
		isLoadPage = false;
		return;
	}
	protected void Button6_Click()
	{
		Hashtable ht = new Hashtable();
		ht.Add("ModifyNum", 1);
		ht.Add("type", "view");
		ht.Add("TypeName", "Class");
		ht.Add("keyword", "指定栏目");
		ht.Add("ClassID",KSCMS.S("DrClassID"));
		CommonData.Update("KS_WeixinMenu", ht, "where id=" + MenuID);
		Msg.Alert("恭喜，保存成功", BasicField.GetUserUrl("wx/wx_menu"));
		isLoadPage = false;
		return;
	}
	


</script>
<%
	if (!isLoadPage) return;
%>
    <link href="/SysImg/teacher/css/newswx.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/admin/weixin/images/font/css/font-awesome.min.css">
    <div class="t_tybox">
        <div class="tytitle"><h4>微信自定义菜单</h4></div>
        <div class="console_body" style="overflow:hidden">     
            <script>
                $(function () {
                    $(".phone_muen .f_nav").hover(function () {
                        $(this).toggleClass("show");
                    })
                });
                var box = null;
                var isreload = false;
                function openWin(title, url, reload, width, height) {
                    if (width == null) width = 760;
                    if (height == null) height = 450;
                    isreload = reload;
                    box = $.dialog.open(url, {
                        id: 'topbox', lock: true, title: title, width: width, height: height, close: function () {
                            if (isreload) {
                                top.frames.location.reload();
                            }
                        }
                    });
                }
            </script>
            <script>
                $(function () {
                    var w = 250;
                    var h = 50;
                    $(".prompt_box").css("position", "fixed");
                    $(".prompt_box").css("width", w).css("height", h);
                    var x = ($(window).width() - w) / 2;
                    var y = ($(window).height() - h) / 3;
                    $(".prompt_box").css("top", y).css("left", x);
                });
             </script>
            <script>
                function TongBu() {
                    $("#Loading").show();
                    $.ajax({
                        url: "/plus/course/wxajax.aspx?action=menutb&rnd=" + Math.random(),
                        context: document.body,
                        type: "get",
                        success: function (data) {
                            if (data == 'ok') {
                                KesionJS.Alert("恭喜,同步成功", "location.reload();");
                            } else {
                                KesionJS.Alert("对不起,同步失败!原因：" + data, "location.reload();");
                            }
                            $("#Loading").hide();
                        }
                    });
                    return false;
                }
            </script>
    
              <script>
                function JinYong() {
                    $("#jinyong").show();
                    $.ajax({
                        url: "/plus/course/wxajax.aspx?action=menuforbid&rnd=" + Math.random(),
                        context: document.body,
                        type: "get",
                        success: function (data) {
                            if (data == 'ok') {
                                KesionJS.Alert("恭喜,禁用自定义菜单成功", "location.reload();");
                            } else if (data = 'openok') {
                                KesionJS.Alert(" 恭喜，自定义菜单开启成功,设置完成菜单请点“同步到微信”按钮", "location.reload();");
                            }
                            else {
                                KesionJS.Alert("对不起,禁用自定义菜单失败", "location.reload();");
                            }
                            $("#jinyong").hide();
                        }
                    });
                    return false;
                }
            </script>
            <div class="prompt_bg" style="display:none" id="Loading">
               <div class="prompt_box">
                 <p><img src="/admin/weixin/images/loading.gif" />正在同步，请耐心等待...</p>
               </div>
               </div>
            <div class="prompt_bg" style="display:none" id="jinyong">
               <div class="prompt_box">
                 <p><img src="/admin/weixin/images/loading.gif" />正在禁用，请耐心等待...</p>
               </div>
            </div>
            <form name="myform" action="<%=BasicField.GetUserUrl("wx/wx_Menu") %>" method="post" id="myform" >   
              <input type="hidden" name="do" value="" id="domethod" />
              <input type="hidden" name="action" value="" id="action" />
              <input type="hidden" value="<%=MenuID %>" name="menuID" />
              <input type="hidden" value="<%=ParentID %>" name="parentID" />
    
            <%if(__info.Panel11){ %>
            <div ID="Panel11">
                <div class="phone_left">
                    <div class="phone_left_bottom">
                        <div class="right_img">
                            <img src="/admin/weixin/images/key.png" />
                        </div>
                        <%
      using (DataTable dt = DataFactory.GetDataTable("select * from KS_WeixinMenu where TypeFlag="+new TemporaryVar().GroupID+" and userid="+new TemporaryVar().UserID+"  and parentid=0 order by orderid "))
      {
            Count=dt.Rows.Count;
            if (Count > 0)
          {
              KSCMS.W("<ul class=\"phone_muen\">");
              foreach (DataRow dr in dt.Rows)
              {
                  KSCMS.W("<li class=\"f_nav\"><a href=\"" + BasicField.GetUserUrl("wx/wx_menu", "action-visible,menuID-" + dr["id"].ToString() + ",parentID-" + dr["ParentID"].ToString() + "") + "\">" + dr["ClassName"].ToString() + "</a>");
                  using (DataTable dts = DataFactory.GetDataTable("select * from KS_weixinmenu where ParentID=" + dr["id"].ToString() + " order by orderid desc"))
                  {
                      KSCMS.W(" <ul class=\"s_nav\">");
                    
                      if (dts.Rows.Count > 0)
                      {
                          foreach (DataRow drs in dts.Rows)
                          {
                              KSCMS.W(" <li> <a href=\"" + BasicField.GetUserUrl("wx/wx_menu", "action-visible,menuID-" + drs["id"].ToString() + ",parentID-" + drs["ParentID"].ToString() + "") + "\">" + drs["ClassName"] + "</a></li>");
                          }
                      }
                      KSCMS.W("</ul>");
                  }
    
                  KSCMS.W("</li>");
              }
              KSCMS.W(" <div class=\"clear\"></div> </ul>");
          }
          else
          {
              KSCMS.W("  <div class=\"norecord1\"><span style=\"text-align:center\"> </span></div>");
          }
      }
       
        %>
                        <div class="clear">
                        </div>
                    </div>
                </div>
                <div style="padding-left:340px; margin-right:10px;">
                    <div class="ct-tips --large">
                        <div class="__left">
                            <img src="/SysImg/teacher/zhusi.png" style="vertical-align: middle;" />
                            <span>
                                由于微信缓存，如同步微信菜单后无变化，请取消关注公众号后重新关注。
                            </span>
                            <br />
                            <span>
                                <%=GetMenuStatus() %>
                            </span>
                        </div>
                        <div class="__right">
                            <%=GetMenuOrderButton() %>
                                <input type="button" value="同步菜单到微信" class="ct-btn blue" onclick="return (TongBu());" />
                                    <input type="submit" value="<%=__info.Button5 %>" class="ct-btn red" onclick="$('#domethod').val('btn5save'); return (JinYong());" />
                                <%=GetyijiAnniu(Count) %>
                                    <div class="clear">
                                    </div>
                        </div>
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel2){ %>
            <div ID="Panel2">
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="cz_list">
                        <%=GetCaozuo(ParentID, MenuID)%>
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel3){ %>
            <div ID="Panel3">
                <div class="phone_right">
                    <div class="title_phone">
                    </div>
                    <div class="cz_list">
                        <span class="content">你可以点击左侧菜单，然后设置菜单内容</span>
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel4){ %>
            <div ID="Panel4">
                <script>
                    function check() {
                        var action = '<%=KSCMS.S("action")%>';
    
                        var menuid = '<%=MenuID %>';
                        var parentid = '<%=ParentID %>';
                        var classname = jQuery("#TxtClassName").val();
                        if (classname == '') {
                            TipsDoFun("请输入菜单名!", '$("#TxtClassName").focus();');
                            return false;
                        }
    
                        else {
    
                            var hanzi = JHshStrLen(classname);
                            if (menuid != '0') {
    
                                if (parentid == '0') {
    
                                    if (action == 'modify') {
    
                                        if (hanzi > 8) {
                                            TipsDoFun("一级栏目菜单名称名字不多于4个汉字或8个字母!", '$("#TxtClassName").focus();');
                                            return false;
                                        }
                                    }
                                    else {
                                        if (hanzi > 16) {
                                            TipsDoFun("二级栏目菜单名称名字不多于8个汉字或16个字母!", '$("#TxtClassName").focus();');
                                            return false;
                                        }
                                    }
                                } else if (parentid != '0') {
                                    if (hanzi > 16) {
                                        TipsDoFun("二级栏目菜单名称名字不多于8个汉字或16个字母!", '$("#TxtClassName").focus();');
                                        return false;
                                    }
                                }
    
                        } else {
    
                            if (hanzi > 8) {
                                TipsDoFun("一级栏目菜单名称名字不多于4个汉字或8个字母!", '$("#TxtClassName").focus();');
                                return false;
                            }
                        }
                    }
                }
                </script>
                <script>
                    function JHshStrLen(sString) {
                        var sStr, iCount, i, strTemp;
                        iCount = 0;
                        sStr = sString.split("");
                        for (i = 0; i < sStr.length; i++) {
                            strTemp = escape(sStr[i]);
                            if (strTemp.indexOf("%u", 0) == -1) // 表示是汉字  
                            {
                                iCount = iCount + 1;
                            } else {
                                iCount = iCount + 2;
                            }
                        }
                        return iCount;
                    }
                </script>
                
                <div class="phone_right">
                    <div class="title_phone">
                        <%=MenuID !=0 ? GetTitle(ParentID, MenuID) : ""%>
                    </div>
                    <div class="cz_list">
                        <%=GetAddTitle(MenuID,Count)%>
                            <ul class="catalog mtm">
                                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <tr>
                                        <td>
                                            <input type="text" style="width:60%" id="TxtClassName" name="TxtClassName" value="<%= __info.TxtClassName %>" />
                                            <span class="xmark">
                                                *
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input type="submit" value="保  存" class="btn btn-blue subtn" onclick="$('#domethod').val('btn1save');$('#action').val('<%=KSCMS.S("action")%>'); return (check())" />
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                </table>
                            </ul>
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel5){ %>
            <div ID="Panel5">
    
                <script>
                    function check2() {
                        var url = jQuery("#TxtUrl").val();
                        if (url == '') {
                            TipsDoFun("请输入页面地址!", '$("#TxtUrl").focus();');
                            return false;
                        }
                    }
                </script>
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="cz_list">
                        <span class="content">点击该菜单会跳到以下链接</span>
                        <ul class="catalog mtm">
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td width="100">
                                        页面地址：
                                    </td>
                                    <td>
                                    <input type="text" style="width:60%" id="TxtUrl" name="TxtUrl" value="<%= __info.TxtUrl %>" />
                                        <span class="xmark"> * </span>
                                        <%if (System.IO.Directory.Exists(Utils.GetMapPath("~/admin/agent/"))){ %>
                                        <div class="tips">提示：分销系统如果公众号菜单点击进去要到主站，请加上?from=home。如：http://wfx.kesion.com/3g/index.aspx?from=home</div>
                                        <%} %>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                            <input type="submit" value="保  存" class="btn btn-blue subtn" onclick="$('#domethod').val('btn2save');$('#action').val('<%=KSCMS.S("action")%>'); return (check2())" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </ul>
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel9){ %>
            <div ID="Panel9">
                <script>
                    function check9() {
    
                        var url = jQuery("#TxtContent").val();
                        if (url == '') {
                            TipsDoFun("请输入指定关键词!", '$("#TxtContent").focus();');
                            return false;
                        }
                    }
                </script>
                      <script>
                        $(function () {
                            aa(<%=sendtype%>);
                            $(".menu1box ul li").click(function () {
                                var k = $(this).index();
                                aa(k);
                            });
                          });
                        function aa(k) {
    
                            $(".menu1box ul li").each(function (index, domEle) {
                                $(this).attr("class", "");
                            });
                            $(".menu1box ul li").each(function (index, domEle) {
                                if (k == index) {
                                    $("#sendtype").val(k);
                                    if (k == 0) {
                                        $('#iframemain0').attr('src', '<%=BasicField.GetUserUrl("wx/wx_TuWenList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %>');
    
                                    } else if (k == 1) {
                                        $('#mybox2').show();
                                        $('#mybox1').hide();
                                    } else if (k == 2) {
                                        $('#iframemain0').attr('src', '<%=BasicField.GetUserUrl("wx/wx_CourseList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %>');
                                    }
                                    else if (k == 3) {
                                        $('#iframemain0').attr('src', '<%=BasicField.GetUserUrl("wx/wx_SuCaiList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %>');
                                    }
                                    $(this).attr("class", "hit");
                                }
                            });
                        }
    </script>
                 <input type="hidden" id="sendtype" name="sendtype" value="<%=sendtype %>" />
    
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="cz_list">
                        <div class="tabs1">
                            <div class="menu1box clearfix">
                                <ul class="menu1">
                                    <li class="hit">
                                        <a href="<%=BasicField.GetUserUrl("wx/wx_TuWenList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %> " onclick="$('#mybox1').show();$('#mybox2').hide();" target="iframemain0">
                                            <i class="sm_tab tw2"></i>图文
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" onclick="$('#mybox2').show();$('#mybox1').hide();"  id="key"  >
                                         <i class="sm_tab wz"></i>    关键词回复
                                        </a>
                                    </li>
                                    
                                    <li>
                                        <a href="<%=BasicField.GetUserUrl("wx/wx_CourseList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %>" onclick="$('#mybox2').hide();$('#mybox1').show();" target="iframemain0">
                                            <i class="sm_tab sp"></i>课程
                                        </a>
                                    </li>
                                    <li>
                                        <a href="<%=BasicField.GetUserUrl("wx/wx_SuCaiList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %>" onclick="$('#mybox1').show();$('#mybox2').hide();" target="iframemain0">
                                            <i class="sm_tab tw2"></i>素材
                                        </a>
                                    </li>
                                    <div class="clear"> </div>
                                </ul>
                                    
                            </div>
                            <div class="main1box">
                                <div class="main">
                                    <dt class="mbimg" style="display:block;">
                                        <div id="main">
                                            <div class="comment">
                                                <div class="com_form msgBox" id="mybox1">
                                                   <iframe class="editArea-ifrm" frameborder="no" border="0" src="<%=BasicField.GetUserUrl("wx/wx_TuWenList","frame-no,action-menu,menuID-"+MenuID+",parentID-"+ParentID+"") %>" style="width:100%; height:300px" name="iframemain0" id="iframemain0"> </iframe>
                                                    </div>
                                                    
                                                <div class="com_form msgBox" id="mybox2" style="display:none">
                                                    <div class="">指定关键词：</div>
                                                    <div><textarea name="TxtContent" rows="2" cols="20" id="TxtContent" style="height: 200px; width: 98%; background: #fff; background-color: #fff; border: 1px solid #ddd;"><%=__info.TxtContent %>  </textarea></div>
                                                     <p>  <input type="submit" name="ButtonAdd" value="保存" id="ButtonAdd" class="ct-btn blue"  onclick="$('#domethod').val('btn4save');$('#action').val('<%=KSCMS.S("action")%>');"/></p>
                                                </div>
                                            
                                            </div>
                                        </div>
                                    </dt>
                                </div>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel7){ %>
            <div ID="Panel7">
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="action_content sended jsMain" style="display: block;">
                        <p class="action_tips">
                            订阅者点击该子菜单会收到以下消息
                        </p>
                        <div class="msg_wrp">
                            <div class="appmsg ">
                                <div class="appmsg_content">
                                    <div class="appmsg_thumb_wrp" >
                                        <img src="<%=GetVal("photourl",1)%>" alt="" class="appmsg_thumb">
                                    </div>
                                    <div class="article_info">
                                    <h4 class="appmsg_title js_title">
                                        <a href="javascript:(0)">
                                            <%=GetVal("name",1)%>
                                        </a>
                                    </h4>
                                    <div class="appmsg_info">
                                        <em class="appmsg_date">
                                            <%=GetVal("addtime",1)%>
                                        </em>
                                    </div>
                                   
                                    <p class="appmsg_desc">
                                        <%=BaseFun.GetCoursePriceInfo(Utils.StrToInt(GetVal("promotion",1)), Utils.StrToDecimal(GetVal("price_member",1)), Utils.StrToInt(GetVal("jifen",1)), Utils.StrToDecimal(GetVal("panicmoney",1)))%>
                                    </p>
                                    </div>
                                    
                                        <a href="<%=BasicField.GetUserUrl("wx/wx_Menu","action-Course,menuID-"+MenuID+",parentID-"+ParentID+"") %>" class="huifu_deletebutton" id="A1" style="display: inline-block;" >
                                            <img src="/admin/weixin/images/updata.png">
                                        </a>
                                    
                                    <div class="clear"></div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel8){ %>
            <div ID="Panel8" >
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="action_content sended jsMain" style="display: block;">
                        <p class="action_tips">
                            订阅者点击该子菜单会收到以下消息
                        </p>
                        <div class="msg_wrp">
                            <div class="appmsg ">
                                <div class="appmsg_content">
                                    <div class="appmsg_thumb_wrp">
                                      <img src="<%=GetVal("photo")==""?"/SysImg/nopic.gif":GetVal("photo")%>" alt="" class="appmsg_thumb">
                                    </div>
                                    <div class="article_info">
                                        <h4 class="appmsg_title js_title">
                                            <a href="javascript:(0)">
                                                <%=GetVal("title")%>
                                            </a>
                                        </h4>
                                        <div class="appmsg_info">
                                            <em class="appmsg_date">
                                                <%=GetVal("adddate")%>
                                            </em>
                                        </div>
                                        
                                        <p class="appmsg_inforin">
                                            <%=GetVal("intro")%>
                                        </p>
                                    </div>
                                        <a href="<%=BasicField.GetUserUrl("wx/wx_Menu","action-TuWen,menuID-"+MenuID+",parentID-"+ParentID+"") %>" class="huifu_deletebutton" id="changeBt" style="display: inline-block;">
                                            <img src="/admin/weixin/images/updata.png">
                                        </a>
                                    
                                    <div style="clear:both;"></div>
                                    
                                </div>
                            </div>
                            
                        </div>
                        
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel13){ %>
            <div ID="Panel13">
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="action_content sended jsMain" style="display: block;">
                        <p class="action_tips">
                            订阅者点击该子菜单会收到以下消息
                        </p>
                        <div class="msg_wrp">
                            <div class="appmsg ">
                                <div class="appmsg_content">
                                    <div class="appmsg_thumb_wrp">
                                      <img src="<%=Convert.ToString(GetVal("picurl",2))==""?"/SysImg/nopic.gif":GetVal("picurl",2)%>" alt="" class="appmsg_thumb">
                                    </div>
                                    <div class="article_info">
                                        <h4 class="appmsg_title js_title">
                                            <a href="javascript:(0)">
                                                <%=GetVal("title",2)%>
                                            </a>
                                        </h4>
                                        <div class="appmsg_info">
                                            <em class="appmsg_date">
                                                <%=GetVal("AddTime",2)%>
                                            </em>
                                        </div>
                                        
                                        <p class="appmsg_inforin">
                                            <%=GetVal("Info",2)==""?Utils.CutStr(GetVal("content",2),10):GetVal("Info",2)%>
                                        </p>
                                    </div>
                                        <a href="<%=BasicField.GetUserUrl("wx/wx_Menu","action-SuCai,menuID-"+MenuID+",parentID-"+ParentID+"") %>"	class="huifu_deletebutton" id="A2" style="display: inline-block;">
                                            <img src="/admin/weixin/images/updata.png">
                                        </a>
                                    <div style="clear:both;"></div>
                                    
                                </div>
                            </div>
                            
                        </div>
                        
                    </div>
                </div>
            </div>
            <%} %>
            <%if(__info.Panel12){ %>
            <div ID="Panel12" >
                <script>
                    function check12() {
    
                        var classid = jQuery("#DrClassID").val();
                        if (classid == '0') {
                            TipsDoFun("请选择栏目!", '$("#DrClassID").focus();');
                            return false;
                        }
                    }
                </script>
                <div class="phone_right">
                    <div class="title_phone">
                        <%=GetTitle(ParentID,MenuID)%>
                    </div>
                    <div class="cz_list">
                        <span class="content">点击该菜单会跳到以下链接</span>
                        <ul class="catalog mtm">
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td width="100" style="text-align:right; font-size:14px;">
                                        指定栏目：
                                    </td>
                                    <td>
                                        <select onchange="DoClasstype(this.value,'change')" name="costype" id="costype">
                                        <option value="6">新闻分类</option>
                                        </select>
                                        <select name="DrClassID" id="DrClassID">
                                        <option value="0">选择栏目</option>
                                        <%
										  string selected = string.Empty;
										  StringBuilder sb = new StringBuilder();
										  string sqlStr = "select ClassID,ClassName from KS_EnterPriseNewsClass where userid=" + new TemporaryVar().UserID + " and IsShow=1 order by classid";
										  using (DataTable dt = DataFactory.GetDataTable(sqlStr))
										  {
											  if (dt.Rows.Count > 0)
											  {
												  foreach (DataRow dr in dt.Rows)
												  {
													  if (__info.DrClassID == dr[0].ToString())
													  {
														  selected = "selected";
													  }
													  sb.Append("<option value='" + dr["classID"].ToString() + "' selected>" + dr["ClassName"].ToString() + "</option>");
												  }
											  }
										  }
										  
										  KSCMS.W(sb.ToString());
										%>
										</select>
                                        <span class="xmark">*</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input type="submit" value="保  存" class="btn btn-blue subtn" onclick="$('#domethod').val('btn6save');$('#action').val('<%=KSCMS.S("action")%>'); return (check12());" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </ul>
                    </div>
                </div>
            </div>
            <%} %>
    
            </form>
        </div> 
    </div>      




