Example #1
0
        string DelChannel()
        {
            if (!CheckChannelPermission())
            {
                return("无法删除此栏目,没有权限!");
            }

            if (!We7Helper.IsEmptyID(ChannelID))
            {
                List <Channel> listSon = ChannelHelper.GetChannels(ChannelID);
                if (listSon != null)
                {
                    if (listSon.Count > 0)
                    {
                        return("栏目下有子栏目不能删除,请您先删除子栏目后再试。");
                    }
                }
                //删除节点
                Channel ch = ChannelHelper.GetChannel(ChannelID, new string[] { "Name", "FullUrl" });
                ChannelHelper.DeleteChannel(ChannelID);
                TemplateMap.DeleteChannelUrls(ch.FullUrl);
                TemplateMap.ResetInstance();

                //记录日志
                string content = string.Format("删除栏目:“{0}”", ch.Name);
                AddLog("栏目管理", content);
            }
            return("0");
        }
Example #2
0
        string SaveChannel(string id, string parentId, int index)
        {
            if (!CheckChannelPermission())
            {
                return("您没有操作权限。");
            }

            try
            {
                //更新子节点的父节点属性
                Channel c = new Channel();
                c = ChannelHelper.GetChannel(id, null);
                if (c.ParentID != parentId)
                {
                    if (CanMove(c, parentId))
                    {
                        string oldUrl  = c.FullUrl;
                        string oldPath = c.FullPath;
                        c.ParentID = parentId;
                        ChannelHelper.UpdateChannel(c);
                        //ChannelHelper.UpdateChannelUrlBatch(oldUrl, newUrl);
                        ChannelHelper.UpdateChannelUrlBatch2(oldUrl, c.FullUrl);
                        ChannelHelper.UpdateChannelPathBatch(c, oldPath);
                        TemplateMap.ReplaceChannelUrls(oldUrl, c.FullUrl);
                        TemplateMap.ResetInstance();
                    }
                    else
                    {
                        return("无法移动栏目,目标栏目下有标识为 " + c.ChannelName + " 的子栏目!");
                    }
                }
                if (c.Index != index)
                {
                    ResortChannelList(id, c.ParentID, index);
                }
                return("0");
            }
            catch (Exception ex)
            {
                return("无法保存数据!" + ex.Message);
            }
        }
Example #3
0
        void SaveToMapFile()
        {
            ChannelTemplateGroup cg = new ChannelTemplateGroup();

            cg.IndexTemplate  = TemplateIDTextBox.Text;
            cg.DetailTemplate = DetailTemplateIDTextBox.Text;
            cg.ListTemplate   = ListTemplateIDTextBox.Text;
            cg.SearchTemplate = SearchTemplateIDTextBox.Text;
            cg.IndexInherit   = indexCheckbox.Checked;
            cg.ListInherit    = listCheckbox.Checked;
            cg.DetailInherit  = detailCheckbox.Checked;
            cg.SearchInherit  = searchCheckbox.Checked;

            string tmpfolder = CDHelper.Config.DefaultTemplateGroupFileName;

            tmpfolder = tmpfolder.Remove(tmpfolder.IndexOf("."));
            tmpfolder = Path.Combine(HttpContext.Current.Server.MapPath("~/" + CDHelper.Config.SiteSkinsBasePath), tmpfolder + ".map");
            Channel ch = ChannelHelper.GetChannel(ChannelID, null);

            TemplateMap.SaveToTemplateMapFile(cg, ch.FullUrl, tmpfolder);
            TemplateMap.ResetInstance();
        }