예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InitControls();
            if (!IsPostBack)
            {
                if (ChannelID == null)
                {
                    if (!We7Helper.IsEmptyID(ParentID))
                    {
                        Channel ch = ChannelHelper.GetChannel(ParentID, new string[] { "FullPath", "Name" });
                        string  pn = ch.FullPath;
                        channelUrlLabel.InnerHtml = ch.FullUrl;
                    }
                    SaveButton2.Value   = "创建栏目";
                    CreatedLabel.Text   = "即将创建……";
                    ReturnUrlRowDisplay = "none";
                }
                else
                {
                    if (We7Helper.IsEmptyID(ChannelID))
                    {
                        throw new CDException(TextCannotModifyColumn);
                    }

                    ShowInfomation();

                    if (Request["saved"] != null && Request["saved"].ToString() == "1")
                    {
                        Messages.ShowMessage("栏目已成功创建。");
                        Response.Write(string.Format("<script language=javascript>window.parent.freshNodeTree('{0}','{1}');</script>", We7Helper.RemoveBrarket(ChannelID), NameTextBox.Text));
                    }
                }
                CheckChannelPermission();
            }
        }
예제 #2
0
        string getChannelTree(string ChannelID)
        {
            string id = ChannelID;

            Channel c = new Channel();

            if (We7Helper.IsEmptyID(id))
            {
                if (id == We7Helper.EmptyWapGUID)
                {
                    c.ID       = We7Helper.EmptyWapGUID;
                    c.ParentID = We7Helper.EmptyWapGUID;
                }
                else
                {
                    c.ID       = We7Helper.EmptyGUID;
                    c.ParentID = We7Helper.EmptyGUID;
                }
                c.Name        = TopTitle;
                c.Description = TopSummary;
            }
            else
            {
                c.ID = id;
                c    = ChannelHelper.GetChannel(id, null);
            }

            List <Channel> channelList = ChannelHelper.GetChannels(c.ID, true);
            List <Channel> list        = new List <Channel>();

            foreach (Channel ch in channelList)
            {
                if (We7Helper.IsEmptyID(AccountID) || HavePermission(ch.ID))
                {
                    list.Add(ch);
                }
            }

            string TopStr    = @"[";
            string BottomStr = "]";
            string MiddleStr = "";

            foreach (Channel ch in list)
            {
                List <Channel> listSon = ChannelHelper.GetChannels(ch.ID, true);

                string name = ch.Name;
                if (ch.Type == ((int)TypeOfChannel.QuoteChannel).ToString())
                {
                    name = "[专题]" + name;
                }
                //name = "<a href='" + ch.FullUrl + "' target='_blank'>" + name + "<a>";
                if (listSon != null && listSon.Count > 0)   //有子菜单
                {
                    string strHaveSubMenu = @"text:'{0}',id:'{1}',href:'{2}',hrefTarget:'_blank'";
                    MiddleStr = MiddleStr + "{" + string.Format(strHaveSubMenu, name, We7Helper.RemoveBrarket(ch.ID), ch.FullUrl) + "},";
                }
                else
                {
                    string strNotHaveSubMenu = @"text:'{0}',id:'{1}',leaf:true,href:'{2}',hrefTarget:'_blank'";
                    MiddleStr = MiddleStr + "{" + string.Format(strNotHaveSubMenu, name, We7Helper.RemoveBrarket(ch.ID), ch.FullUrl) + "},";
                }
            }

            if (MiddleStr.EndsWith(","))
            {
                MiddleStr = MiddleStr.Remove(MiddleStr.Length - 1);
            }

            return(TopStr + MiddleStr + BottomStr);
        }