Esempio n. 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl");
            _channelId = AuthRequest.GetQueryInt("channelId");
            _returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));

            CacAttributes.SiteInfo  = SiteInfo;
            CacAttributes.ChannelId = _channelId;

            if (!IsPostBack)
            {
                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }

                var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
                if (nodeInfo == null)
                {
                    return;
                }

                if (nodeInfo.ParentId == 0)
                {
                    PhLinkUrl.Visible           = false;
                    PhLinkType.Visible          = false;
                    PhChannelTemplateId.Visible = false;
                    PhFilePath.Visible          = false;
                }

                BtnSubmit.Attributes.Add("onclick", $"if (UE && UE.getEditor('Content', {UEditorUtils.ConfigValues})){{ UE.getEditor('Content', {UEditorUtils.ConfigValues}).sync(); }}");

                CacAttributes.Attributes = nodeInfo.Additional;

                if (PhLinkType.Visible)
                {
                    ELinkTypeUtils.AddListItems(DdlLinkType);
                }

                ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType);

                CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId);
                if (PhChannelTemplateId.Visible)
                {
                    DdlChannelTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate);
                }
                DdlContentTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate);

                DataBind();

                if (PhChannelTemplateId.Visible)
                {
                    DdlChannelTemplateId.Items.Insert(0, new ListItem("<未设置>", "0"));
                    ControlUtils.SelectSingleItem(DdlChannelTemplateId, nodeInfo.ChannelTemplateId.ToString());
                }

                DdlContentTemplateId.Items.Insert(0, new ListItem("<未设置>", "0"));
                ControlUtils.SelectSingleItem(DdlContentTemplateId, nodeInfo.ContentTemplateId.ToString());

                TbNodeName.Text      = nodeInfo.ChannelName;
                TbNodeIndexName.Text = nodeInfo.IndexName;
                if (PhLinkUrl.Visible)
                {
                    TbLinkUrl.Text = nodeInfo.LinkUrl;
                }

                foreach (ListItem item in CblNodeGroupNameCollection.Items)
                {
                    item.Selected = StringUtils.In(nodeInfo.GroupNameCollection, item.Value);
                }
                if (PhFilePath.Visible)
                {
                    TbFilePath.Text = nodeInfo.FilePath;
                }

                if (PhLinkType.Visible)
                {
                    ControlUtils.SelectSingleItem(DdlLinkType, nodeInfo.LinkType);
                }
                ControlUtils.SelectSingleItem(DdlTaxisType, nodeInfo.Additional.DefaultTaxisType);

                TbImageUrl.Text             = nodeInfo.ImageUrl;
                LtlImageUrlButtonGroup.Text = WebUtils.GetImageUrlButtonGroupHtml(SiteInfo, TbImageUrl.ClientID);
                TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, nodeInfo.Content);
                if (TbKeywords.Visible)
                {
                    TbKeywords.Text = nodeInfo.Keywords;
                }
                if (TbDescription.Visible)
                {
                    TbDescription.Text = nodeInfo.Description;
                }
            }
            else
            {
                CacAttributes.Attributes = new ExtendedAttributes(Request.Form);
            }
        }
Esempio n. 2
0
        private static async Task CreateChannelAsync(int siteId, int channelId)
        {
            var siteInfo = SiteManager.GetSiteInfo(siteId);
            var nodeInfo = ChannelManager.GetChannelInfo(siteId, channelId);

            if (nodeInfo == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(nodeInfo.LinkUrl))
            {
                return;
            }
            if (!ELinkTypeUtils.IsCreatable(nodeInfo))
            {
                return;
            }

            var templateInfo = channelId == siteId
                ? TemplateManager.GetIndexPageTemplateInfo(siteId)
                : TemplateManager.GetChannelTemplateInfo(siteId, channelId);

            var filePath    = PathUtility.GetChannelPageFilePath(siteInfo, channelId, 0);
            var pageInfo    = new PageInfo(channelId, 0, siteInfo, templateInfo, new Dictionary <string, object>());
            var contextInfo = new ContextInfo(pageInfo)
            {
                ContextType = EContextType.Channel
            };
            var contentBuilder = new StringBuilder(TemplateManager.GetTemplateContent(siteInfo, templateInfo));

            var stlLabelList          = StlParserUtility.GetStlLabelList(contentBuilder.ToString());
            var stlPageContentElement = string.Empty;

            foreach (var label in stlLabelList)
            {
                if (!StlParserUtility.IsStlChannelElement(label, ChannelAttribute.PageContent))
                {
                    continue;
                }
                stlPageContentElement = label;
                break;
            }

            //如果标签中存在<stl:channel type="PageContent"></stl:channel>
            if (!string.IsNullOrEmpty(stlPageContentElement))//内容存在
            {
                var innerBuilder = new StringBuilder(stlPageContentElement);
                StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                var contentAttributeHtml = innerBuilder.ToString();
                var pageCount            = StringUtils.GetCount(ContentUtility.PagePlaceHolder, contentAttributeHtml) + 1;//一共需要的页数

                Parser.Parse(siteInfo, pageInfo, contextInfo, contentBuilder, filePath, false);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    var thePageInfo = pageInfo.Clone();
                    var index       = contentAttributeHtml.IndexOf(ContentUtility.PagePlaceHolder, StringComparison.Ordinal);
                    var length      = index == -1 ? contentAttributeHtml.Length : index;
                    var pagedContentAttributeHtml = contentAttributeHtml.Substring(0, length);
                    var pagedBuilder = new StringBuilder(contentBuilder.ToString().Replace(stlPageContentElement, pagedContentAttributeHtml));
                    StlParserManager.ReplacePageElementsInChannelPage(pagedBuilder, thePageInfo, stlLabelList, thePageInfo.PageChannelId, currentPageIndex, pageCount, 0);

                    filePath = PathUtility.GetChannelPageFilePath(siteInfo, thePageInfo.PageChannelId, currentPageIndex);

                    await GenerateFileAsync(filePath, pageInfo.TemplateInfo.Charset, pagedBuilder);

                    if (index != -1)
                    {
                        contentAttributeHtml = contentAttributeHtml.Substring(length + ContentUtility.PagePlaceHolder.Length);
                    }
                }
            }
            //如果标签中存在<stl:pageContents>
            else if (StlParserUtility.IsStlElementExists(StlPageContents.ElementName, stlLabelList))
            {
                var stlElement           = StlParserUtility.GetStlElement(StlPageContents.ElementName, stlLabelList);
                var stlElementTranslated = StlParserManager.StlEncrypt(stlElement);

                var pageContentsElementParser = new StlPageContents(stlElement, pageInfo, contextInfo, false);
                int totalNum;
                var pageCount = pageContentsElementParser.GetPageCount(out totalNum);

                Parser.Parse(siteInfo, pageInfo, contextInfo, contentBuilder, filePath, false);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    var thePageInfo  = pageInfo.Clone();
                    var pageHtml     = pageContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, true);
                    var pagedBuilder =
                        new StringBuilder(contentBuilder.ToString().Replace(stlElementTranslated, pageHtml));

                    StlParserManager.ReplacePageElementsInChannelPage(pagedBuilder, thePageInfo, stlLabelList,
                                                                      thePageInfo.PageChannelId, currentPageIndex, pageCount, totalNum);

                    filePath = PathUtility.GetChannelPageFilePath(siteInfo, thePageInfo.PageChannelId,
                                                                  currentPageIndex);
                    thePageInfo.AddLastPageScript(pageInfo);

                    await GenerateFileAsync(filePath, pageInfo.TemplateInfo.Charset, pagedBuilder);

                    thePageInfo.ClearLastPageScript(pageInfo);
                    pageInfo.ClearLastPageScript();
                }
            }
            //如果标签中存在<stl:pageChannels>
            else if (StlParserUtility.IsStlElementExists(StlPageChannels.ElementName, stlLabelList))
            {
                var stlElement           = StlParserUtility.GetStlElement(StlPageChannels.ElementName, stlLabelList);
                var stlElementTranslated = StlParserManager.StlEncrypt(stlElement);

                var pageChannelsElementParser = new StlPageChannels(stlElement, pageInfo, contextInfo, false);
                int totalNum;
                var pageCount = pageChannelsElementParser.GetPageCount(out totalNum);

                Parser.Parse(siteInfo, pageInfo, contextInfo, contentBuilder, filePath, false);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    var thePageInfo  = pageInfo.Clone();
                    var pageHtml     = pageChannelsElementParser.Parse(currentPageIndex, pageCount);
                    var pagedBuilder = new StringBuilder(contentBuilder.ToString().Replace(stlElementTranslated, pageHtml));

                    StlParserManager.ReplacePageElementsInChannelPage(pagedBuilder, thePageInfo, stlLabelList, thePageInfo.PageChannelId, currentPageIndex, pageCount, totalNum);

                    filePath = PathUtility.GetChannelPageFilePath(siteInfo, thePageInfo.PageChannelId, currentPageIndex);
                    await GenerateFileAsync(filePath, pageInfo.TemplateInfo.Charset, pagedBuilder);
                }
            }
            //如果标签中存在<stl:pageSqlContents>
            else if (StlParserUtility.IsStlElementExists(StlPageSqlContents.ElementName, stlLabelList))
            {
                var stlElement           = StlParserUtility.GetStlElement(StlPageSqlContents.ElementName, stlLabelList);
                var stlElementTranslated = StlParserManager.StlEncrypt(stlElement);

                var pageSqlContentsElementParser = new StlPageSqlContents(stlElement, pageInfo, contextInfo, false);
                int totalNum;
                var pageCount = pageSqlContentsElementParser.GetPageCount(out totalNum);

                Parser.Parse(siteInfo, pageInfo, contextInfo, contentBuilder, filePath, false);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    var thePageInfo  = pageInfo.Clone();
                    var pageHtml     = pageSqlContentsElementParser.Parse(currentPageIndex, pageCount);
                    var pagedBuilder = new StringBuilder(contentBuilder.ToString().Replace(stlElementTranslated, pageHtml));

                    StlParserManager.ReplacePageElementsInChannelPage(pagedBuilder, thePageInfo, stlLabelList, thePageInfo.PageChannelId, currentPageIndex, pageCount, totalNum);

                    filePath = PathUtility.GetChannelPageFilePath(siteInfo, thePageInfo.PageChannelId, currentPageIndex);
                    await GenerateFileAsync(filePath, pageInfo.TemplateInfo.Charset, pagedBuilder);
                }
            }
            //如果标签中存在<stl:StlPageInputContents>
            //else if (StlParserUtility.IsStlElementExists(StlPageInputContents.ElementName, stlLabelList))
            //{
            //    var stlElement = StlParserUtility.GetStlElement(StlPageInputContents.ElementName, stlLabelList);
            //    var stlElementTranslated = StlParserManager.StlEncrypt(stlElement);

            //    var pageInputContentsElementParser = new StlPageInputContents(stlElement, pageInfo, contextInfo, true);
            //    int totalNum;
            //    var pageCount = pageInputContentsElementParser.GetPageCount(out totalNum);

            //    Parser.Parse(siteInfo, pageInfo, contextInfo, contentBuilder, filePath, false);

            //    for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
            //    {
            //        var thePageInfo = new PageInfo(pageInfo.PageChannelId, pageInfo.PageContentId, pageInfo.SiteInfo, pageInfo.TemplateInfo, null);
            //        var pageHtml = pageInputContentsElementParser.Parse(currentPageIndex, pageCount);
            //        var pagedBuilder = new StringBuilder(contentBuilder.ToString().Replace(stlElementTranslated, pageHtml));

            //        StlParserManager.ReplacePageElementsInChannelPage(pagedBuilder, thePageInfo, stlLabelList, thePageInfo.PageChannelId, currentPageIndex, pageCount, totalNum);

            //        filePath = PathUtility.GetChannelPageFilePath(siteInfo, thePageInfo.PageChannelId, currentPageIndex);
            //        GenerateFile(filePath, pageInfo.TemplateInfo.Charset, pagedBuilder);
            //    }
            //}
            else
            {
                Parser.Parse(siteInfo, pageInfo, contextInfo, contentBuilder, filePath, false);
                await GenerateFileAsync(filePath, pageInfo.TemplateInfo.Charset, contentBuilder);
            }
        }
Esempio n. 3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl");

            _channelId = AuthRequest.GetQueryInt("channelId");
            ReturnUrl  = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));

            if (AuthRequest.GetQueryString("CanNotEdit") == null && AuthRequest.GetQueryString("UncheckedChannel") == null)
            {
                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }
            }
            if (AuthRequest.IsQueryExists("CanNotEdit"))
            {
                BtnSubmit.Visible = false;
            }

            var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);

            if (nodeInfo == null)
            {
                return;
            }

            CacAttributes.SiteInfo  = SiteInfo;
            CacAttributes.ChannelId = _channelId;

            if (!IsPostBack)
            {
                DdlContentModelPluginId.Items.Add(new ListItem("<默认>", string.Empty));
                var contentTables = PluginContentManager.GetContentModelPlugins();
                foreach (var contentTable in contentTables)
                {
                    DdlContentModelPluginId.Items.Add(new ListItem(contentTable.Title, contentTable.Id));
                }
                ControlUtils.SelectSingleItem(DdlContentModelPluginId, nodeInfo.ContentModelPluginId);

                var plugins = PluginContentManager.GetAllContentRelatedPlugins(false);
                if (plugins.Count > 0)
                {
                    var relatedPluginIds =
                        TranslateUtils.StringCollectionToStringList(nodeInfo.ContentRelatedPluginIds);
                    foreach (var pluginMetadata in plugins)
                    {
                        CblContentRelatedPluginIds.Items.Add(new ListItem(pluginMetadata.Title, pluginMetadata.Id)
                        {
                            Selected = relatedPluginIds.Contains(pluginMetadata.Id)
                        });
                    }
                }
                else
                {
                    PhContentRelatedPluginIds.Visible = false;
                }

                CacAttributes.Attributes = nodeInfo.Additional;

                TbImageUrl.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", SiteInfo.Additional.WebUrl));

                var showPopWinString = ModalFilePathRule.GetOpenWindowString(SiteId, _channelId, true, TbChannelFilePathRule.ClientID);
                BtnCreateChannelRule.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalFilePathRule.GetOpenWindowString(SiteId, _channelId, false, TbContentFilePathRule.ClientID);
                BtnCreateContentRule.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectImage.GetOpenWindowString(SiteInfo, TbImageUrl.ClientID);
                BtnSelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImage.GetOpenWindowString(SiteId, TbImageUrl.ClientID);
                BtnUploadImage.Attributes.Add("onclick", showPopWinString);

                ELinkTypeUtils.AddListItems(DdlLinkType);
                ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType);

                CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId);

                DdlChannelTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate);

                DdlContentTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate);

                DataBind();

                DdlChannelTemplateId.Items.Insert(0, new ListItem("<未设置>", "0"));
                ControlUtils.SelectSingleItem(DdlChannelTemplateId, nodeInfo.ChannelTemplateId.ToString());

                DdlContentTemplateId.Items.Insert(0, new ListItem("<未设置>", "0"));
                ControlUtils.SelectSingleItem(DdlContentTemplateId, nodeInfo.ContentTemplateId.ToString());

                TbNodeName.Text      = nodeInfo.ChannelName;
                TbNodeIndexName.Text = nodeInfo.IndexName;
                TbLinkUrl.Text       = nodeInfo.LinkUrl;

                foreach (ListItem item in CblNodeGroupNameCollection.Items)
                {
                    item.Selected = StringUtils.In(nodeInfo.GroupNameCollection, item.Value);
                }
                TbFilePath.Text            = nodeInfo.FilePath;
                TbChannelFilePathRule.Text = nodeInfo.ChannelFilePathRule;
                TbContentFilePathRule.Text = nodeInfo.ContentFilePathRule;

                ControlUtils.SelectSingleItem(DdlLinkType, nodeInfo.LinkType);
                ControlUtils.SelectSingleItem(DdlTaxisType, nodeInfo.Additional.DefaultTaxisType);
                ControlUtils.SelectSingleItem(RblIsChannelAddable, nodeInfo.Additional.IsChannelAddable.ToString());
                ControlUtils.SelectSingleItem(RblIsContentAddable, nodeInfo.Additional.IsContentAddable.ToString());

                TbImageUrl.Text = nodeInfo.ImageUrl;

                TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, nodeInfo.Content);

                TbKeywords.Text    = nodeInfo.Keywords;
                TbDescription.Text = nodeInfo.Description;

                //this.Content.SiteId = base.SiteId;
                //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.SiteInfo.SiteUrl);
            }
            else
            {
                CacAttributes.Attributes = new ExtendedAttributes(Request.Form);
            }
        }
Esempio n. 4
0
        //得到栏目经过计算后的连接地址
        public static string GetChannelUrl(SiteInfo siteInfo, ChannelInfo channelInfo, bool isLocal)
        {
            if (channelInfo == null)
            {
                return(string.Empty);
            }

            var url = string.Empty;

            if (channelInfo.ParentId == 0)
            {
                url = GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
            }
            else
            {
                var linkType = ELinkTypeUtils.GetEnumType(channelInfo.LinkType);
                if (linkType == ELinkType.None)
                {
                    url = GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                }
                else if (linkType == ELinkType.NoLink)
                {
                    url = PageUtils.UnclickedUrl;
                }
                else
                {
                    if (linkType == ELinkType.NoLinkIfContentNotExists)
                    {
                        var count = ContentManager.GetCount(siteInfo, channelInfo, true);
                        url = count == 0 ? PageUtils.UnclickedUrl : GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                    }
                    else if (linkType == ELinkType.LinkToOnlyOneContent)
                    {
                        var count = ContentManager.GetCount(siteInfo, channelInfo, true);
                        if (count == 1)
                        {
                            var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
                            var contentId = StlContentCache.GetContentId(tableName, channelInfo.Id, ETaxisTypeUtils.GetContentOrderByString(ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType)));
                            url = GetContentUrl(siteInfo, channelInfo, contentId, isLocal);
                        }
                        else
                        {
                            url = GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                        }
                    }
                    else if (linkType == ELinkType.NoLinkIfContentNotExistsAndLinkToOnlyOneContent)
                    {
                        var count = ContentManager.GetCount(siteInfo, channelInfo, true);
                        if (count == 0)
                        {
                            url = PageUtils.UnclickedUrl;
                        }
                        else if (count == 1)
                        {
                            var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
                            var contentId = StlContentCache.GetContentId(tableName, channelInfo.Id, ETaxisTypeUtils.GetContentOrderByString(ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType)));
                            url = GetContentUrl(siteInfo, channelInfo, contentId, isLocal);
                        }
                        else
                        {
                            url = GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                        }
                    }
                    else if (linkType == ELinkType.LinkToFirstContent)
                    {
                        var count = ContentManager.GetCount(siteInfo, channelInfo, true);
                        if (count >= 1)
                        {
                            var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
                            var contentId = StlContentCache.GetContentId(tableName, channelInfo.Id, ETaxisTypeUtils.GetContentOrderByString(ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType)));
                            //var contentId = StlCacheManager.FirstContentId.GetValue(siteInfo, nodeInfo);
                            url = GetContentUrl(siteInfo, channelInfo, contentId, isLocal);
                        }
                        else
                        {
                            url = GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                        }
                    }
                    else if (linkType == ELinkType.NoLinkIfContentNotExistsAndLinkToFirstContent)
                    {
                        var count = ContentManager.GetCount(siteInfo, channelInfo, true);
                        if (count >= 1)
                        {
                            var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
                            var contentId = StlContentCache.GetContentId(tableName, channelInfo.Id, ETaxisTypeUtils.GetContentOrderByString(ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType)));
                            //var contentId = StlCacheManager.FirstContentId.GetValue(siteInfo, nodeInfo);
                            url = GetContentUrl(siteInfo, channelInfo, contentId, isLocal);
                        }
                        else
                        {
                            url = PageUtils.UnclickedUrl;
                        }
                    }
                    else if (linkType == ELinkType.NoLinkIfChannelNotExists)
                    {
                        url = channelInfo.ChildrenCount == 0 ? PageUtils.UnclickedUrl : GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                    }
                    else if (linkType == ELinkType.LinkToLastAddChannel)
                    {
                        var lastAddChannelInfo = StlChannelCache.GetChannelInfoByLastAddDate(channelInfo.Id);
                        url = lastAddChannelInfo != null?GetChannelUrl(siteInfo, lastAddChannelInfo, isLocal) : GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                    }
                    else if (linkType == ELinkType.LinkToFirstChannel)
                    {
                        var firstChannelInfo = StlChannelCache.GetChannelInfoByTaxis(channelInfo.Id);
                        url = firstChannelInfo != null?GetChannelUrl(siteInfo, firstChannelInfo, isLocal) : GetChannelUrlNotComputed(siteInfo, channelInfo.Id, isLocal);
                    }
                    else if (linkType == ELinkType.NoLinkIfChannelNotExistsAndLinkToLastAddChannel)
                    {
                        var lastAddChannelInfo = StlChannelCache.GetChannelInfoByLastAddDate(channelInfo.Id);
                        url = lastAddChannelInfo != null?GetChannelUrl(siteInfo, lastAddChannelInfo, isLocal) : PageUtils.UnclickedUrl;
                    }
                    else if (linkType == ELinkType.NoLinkIfChannelNotExistsAndLinkToFirstChannel)
                    {
                        var firstChannelInfo = StlChannelCache.GetChannelInfoByTaxis(channelInfo.Id);
                        url = firstChannelInfo != null?GetChannelUrl(siteInfo, firstChannelInfo, isLocal) : PageUtils.UnclickedUrl;
                    }
                }
            }

            return(RemoveDefaultFileName(siteInfo, url));
        }
Esempio n. 5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl");
            _channelId = AuthRequest.GetQueryInt("channelId");
            ReturnUrl  = StringUtils.ValueFromUrl(AttackUtils.FilterSqlAndXss(AuthRequest.GetQueryString("ReturnUrl")));
            //if (!base.HasChannelPermissions(this.channelId, AppManager.CMS.Permission.Channel.ChannelAdd))
            //{
            //    PageUtils.RedirectToErrorPage("您没有添加栏目的权限!");
            //    return;
            //}

            var parentNodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);

            if (parentNodeInfo.Additional.IsChannelAddable == false)
            {
                PageUtils.RedirectToErrorPage("此栏目不能添加子栏目!");
                return;
            }

            CacAttributes.SiteInfo  = SiteInfo;
            CacAttributes.ChannelId = _channelId;

            if (!IsPostBack)
            {
                ChannelManager.AddListItems(DdlParentChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions);
                ControlUtils.SelectSingleItem(DdlParentChannelId, _channelId.ToString());

                DdlContentModelPluginId.Items.Add(new ListItem("<默认>", string.Empty));
                var contentTables = PluginContentManager.GetContentModelPlugins();
                foreach (var contentTable in contentTables)
                {
                    DdlContentModelPluginId.Items.Add(new ListItem(contentTable.Title, contentTable.Id));
                }
                ControlUtils.SelectSingleItem(DdlContentModelPluginId, parentNodeInfo.ContentModelPluginId);

                var plugins = PluginContentManager.GetAllContentRelatedPlugins(false);
                if (plugins.Count > 0)
                {
                    foreach (var pluginMetadata in plugins)
                    {
                        CblContentRelatedPluginIds.Items.Add(new ListItem(pluginMetadata.Title, pluginMetadata.Id));
                    }
                }
                else
                {
                    PhContentRelatedPluginIds.Visible = false;
                }

                CacAttributes.Attributes = new ExtendedAttributes();

                TbImageUrl.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", SiteInfo.Additional.WebUrl));

                var showPopWinString = ModalFilePathRule.GetOpenWindowString(SiteId, _channelId, true, TbChannelFilePathRule.ClientID);
                BtnCreateChannelRule.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalFilePathRule.GetOpenWindowString(SiteId, _channelId, false, TbContentFilePathRule.ClientID);
                BtnCreateContentRule.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectImage.GetOpenWindowString(SiteInfo, TbImageUrl.ClientID);
                BtnSelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImage.GetOpenWindowString(SiteId, TbImageUrl.ClientID);
                BtnUploadImage.Attributes.Add("onclick", showPopWinString);

                ELinkTypeUtils.AddListItems(DdlLinkType);

                ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType);
                ControlUtils.SelectSingleItem(DdlTaxisType, ETaxisTypeUtils.GetValue(ETaxisType.OrderByTaxisDesc));

                CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId);
                DdlChannelTemplateId.DataSource       = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate);
                DdlContentTemplateId.DataSource       = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate);

                DataBind();

                DdlChannelTemplateId.Items.Insert(0, new ListItem("<默认>", "0"));
                DdlChannelTemplateId.Items[0].Selected = true;

                DdlContentTemplateId.Items.Insert(0, new ListItem("<默认>", "0"));
                DdlContentTemplateId.Items[0].Selected = true;
                TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, string.Empty);
            }
            else
            {
                CacAttributes.Attributes = new ExtendedAttributes(Request.Form);
            }
        }
Esempio n. 6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl");
            _channelId = Body.GetQueryInt("channelId");
            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            CacAttributes.SiteInfo  = SiteInfo;
            CacAttributes.ChannelId = _channelId;

            if (!IsPostBack)
            {
                if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }

                var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
                if (nodeInfo == null)
                {
                    return;
                }

                if (nodeInfo.ParentId == 0)
                {
                    PhLinkUrl.Visible           = false;
                    PhLinkType.Visible          = false;
                    PhChannelTemplateId.Visible = false;
                    PhFilePath.Visible          = false;
                }

                BtnSubmit.Attributes.Add("onclick", "if (UE && UE.getEditor('Content', {{allowDivTransToP: false}})){ UE.getEditor('Content', {{allowDivTransToP: false}}).sync(); }");

                if (!string.IsNullOrEmpty(SiteInfo.Additional.ChannelEditAttributes))
                {
                    var channelEditAttributes = TranslateUtils.StringCollectionToStringList(SiteInfo.Additional.ChannelEditAttributes);
                    if (channelEditAttributes.Count > 0)
                    {
                        PhNodeName.Visible = PhNodeIndexName.Visible = PhLinkUrl.Visible = PhNodeGroupNameCollection.Visible = PhLinkType.Visible = PhTaxisType.Visible = PhChannelTemplateId.Visible = PhContentTemplateId.Visible = PhImageUrl.Visible = PhFilePath.Visible = PhContent.Visible = PhKeywords.Visible = PhDescription.Visible = false;
                        foreach (var attribute in channelEditAttributes)
                        {
                            if (attribute == ChannelAttribute.ChannelName)
                            {
                                PhNodeName.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.ChannelIndex)
                            {
                                PhNodeIndexName.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.LinkUrl)
                            {
                                PhLinkUrl.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.ChannelGroupNameCollection)
                            {
                                PhNodeGroupNameCollection.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.LinkType)
                            {
                                PhLinkType.Visible = true;
                            }
                            else if (attribute == nameof(ChannelInfoExtend.DefaultTaxisType))
                            {
                                PhTaxisType.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.ChannelTemplateId)
                            {
                                PhChannelTemplateId.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.ContentTemplateId)
                            {
                                PhContentTemplateId.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.ImageUrl)
                            {
                                PhImageUrl.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.FilePath)
                            {
                                PhFilePath.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.Content)
                            {
                                PhContent.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.Keywords)
                            {
                                PhKeywords.Visible = true;
                            }
                            else if (attribute == ChannelAttribute.Description)
                            {
                                PhDescription.Visible = true;
                            }
                        }
                    }
                }

                CacAttributes.Attributes = nodeInfo.Additional;

                if (PhLinkType.Visible)
                {
                    ELinkTypeUtils.AddListItems(DdlLinkType);
                }

                if (PhTaxisType.Visible)
                {
                    ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType);
                }

                if (PhNodeGroupNameCollection.Visible)
                {
                    CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId);
                }
                if (PhChannelTemplateId.Visible)
                {
                    DdlChannelTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate);
                }
                if (PhContentTemplateId.Visible)
                {
                    DdlContentTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate);
                }

                DataBind();

                if (PhChannelTemplateId.Visible)
                {
                    DdlChannelTemplateId.Items.Insert(0, new ListItem("<未设置>", "0"));
                    ControlUtils.SelectSingleItem(DdlChannelTemplateId, nodeInfo.ChannelTemplateId.ToString());
                }

                if (PhContentTemplateId.Visible)
                {
                    DdlContentTemplateId.Items.Insert(0, new ListItem("<未设置>", "0"));
                    ControlUtils.SelectSingleItem(DdlContentTemplateId, nodeInfo.ContentTemplateId.ToString());
                }

                if (PhNodeName.Visible)
                {
                    TbNodeName.Text = nodeInfo.ChannelName;
                }
                if (PhNodeIndexName.Visible)
                {
                    TbNodeIndexName.Text = nodeInfo.IndexName;
                }
                if (PhLinkUrl.Visible)
                {
                    TbLinkUrl.Text = nodeInfo.LinkUrl;
                }

                if (PhNodeGroupNameCollection.Visible)
                {
                    foreach (ListItem item in CblNodeGroupNameCollection.Items)
                    {
                        item.Selected = CompareUtils.Contains(nodeInfo.GroupNameCollection, item.Value);
                    }
                }
                if (PhFilePath.Visible)
                {
                    TbFilePath.Text = nodeInfo.FilePath;
                }

                if (PhLinkType.Visible)
                {
                    ControlUtils.SelectSingleItem(DdlLinkType, nodeInfo.LinkType);
                }
                if (PhTaxisType.Visible)
                {
                    ControlUtils.SelectSingleItem(DdlTaxisType, nodeInfo.Additional.DefaultTaxisType);
                }

                if (PhImageUrl.Visible)
                {
                    TbImageUrl.Text             = nodeInfo.ImageUrl;
                    LtlImageUrlButtonGroup.Text = WebUtils.GetImageUrlButtonGroupHtml(SiteInfo, TbImageUrl.ClientID);
                }
                if (PhContent.Visible)
                {
                    TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, nodeInfo.Content);

                    //this.Content.SiteId = base.SiteId;
                    //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.SiteInfo.SiteUrl);
                }
                if (TbKeywords.Visible)
                {
                    TbKeywords.Text = nodeInfo.Keywords;
                }
                if (TbDescription.Visible)
                {
                    TbDescription.Text = nodeInfo.Description;
                }
            }
            else
            {
                CacAttributes.Attributes = new ExtendedAttributes(Request.Form);
            }
        }
Esempio n. 7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");
            _nodeId    = Body.GetQueryInt("NodeID");
            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary");
            if (!IsPostBack)
            {
                if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }

                var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
                if (nodeInfo != null)
                {
                    if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode)
                    {
                        LinkUrlRow.Visible           = false;
                        LinkTypeRow.Visible          = false;
                        ChannelTemplateIDRow.Visible = false;
                        FilePathRow.Visible          = false;
                    }

                    btnSubmit.Attributes.Add("onclick", "if (UE && UE.getEditor('Content', {{allowDivTransToP: false}})){ UE.getEditor('Content', {{allowDivTransToP: false}}).sync(); }");

                    if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ChannelEditAttributes))
                    {
                        var channelEditAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ChannelEditAttributes);
                        if (channelEditAttributes.Count > 0)
                        {
                            NodeNameRow.Visible = NodeIndexNameRow.Visible = LinkUrlRow.Visible = NodeGroupNameCollectionRow.Visible = LinkTypeRow.Visible = ChannelTemplateIDRow.Visible = ContentTemplateIDRow.Visible = ImageUrlRow.Visible = FilePathRow.Visible = ContentRow.Visible = KeywordsRow.Visible = DescriptionRow.Visible = false;
                            foreach (string attribute in channelEditAttributes)
                            {
                                if (attribute == NodeAttribute.ChannelName)
                                {
                                    NodeNameRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelIndex)
                                {
                                    NodeIndexNameRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.LinkUrl)
                                {
                                    LinkUrlRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelGroupNameCollection)
                                {
                                    NodeGroupNameCollectionRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.LinkType)
                                {
                                    LinkTypeRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelTemplateId)
                                {
                                    ChannelTemplateIDRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ContentTemplateId)
                                {
                                    ContentTemplateIDRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ImageUrl)
                                {
                                    ImageUrlRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.FilePath)
                                {
                                    FilePathRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Content)
                                {
                                    ContentRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Keywords)
                                {
                                    KeywordsRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Description)
                                {
                                    DescriptionRow.Visible = true;
                                }
                            }
                        }
                    }

                    if (channelControl.Visible)
                    {
                        //List<string> displayAttributes = null;
                        //if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ChannelEditAttributes))
                        //{
                        //    displayAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ChannelEditAttributes);
                        //}
                        channelControl.SetParameters(nodeInfo.Additional.Attributes, true, IsPostBack);
                    }

                    if (LinkTypeRow.Visible)
                    {
                        ELinkTypeUtils.AddListItems(LinkType);
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId);
                    }
                    if (ChannelTemplateIDRow.Visible)
                    {
                        ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate);
                    }
                    if (ContentTemplateIDRow.Visible)
                    {
                        ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate);
                    }

                    DataBind();

                    if (ChannelTemplateIDRow.Visible)
                    {
                        ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                        ControlUtils.SelectListItems(ChannelTemplateID, nodeInfo.ChannelTemplateId.ToString());
                    }

                    if (ContentTemplateIDRow.Visible)
                    {
                        ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                        ControlUtils.SelectListItems(ContentTemplateID, nodeInfo.ContentTemplateId.ToString());
                    }

                    if (NodeNameRow.Visible)
                    {
                        NodeName.Text = nodeInfo.NodeName;
                    }
                    if (NodeIndexNameRow.Visible)
                    {
                        NodeIndexName.Text = nodeInfo.NodeIndexName;
                    }
                    if (LinkUrlRow.Visible)
                    {
                        LinkUrl.Text = nodeInfo.LinkUrl;
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        foreach (ListItem item in NodeGroupNameCollection.Items)
                        {
                            if (CompareUtils.Contains(nodeInfo.NodeGroupNameCollection, item.Value))
                            {
                                item.Selected = true;
                            }
                            else
                            {
                                item.Selected = false;
                            }
                        }
                    }
                    if (FilePathRow.Visible)
                    {
                        FilePath.Text = nodeInfo.FilePath;
                    }

                    if (LinkTypeRow.Visible)
                    {
                        ControlUtils.SelectListItems(LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
                    }

                    if (ImageUrlRow.Visible)
                    {
                        tbImageUrl.Text             = nodeInfo.ImageUrl;
                        ltlImageUrlButtonGroup.Text = ControlUtility.GetImageUrlButtonGroupHtml(PublishmentSystemInfo, tbImageUrl.ClientID);
                    }
                    if (ContentRow.Visible)
                    {
                        var formCollection = new NameValueCollection();
                        formCollection[NodeAttribute.Content] = nodeInfo.Content;
                        Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollection, true, IsPostBack);

                        //this.Content.PublishmentSystemID = base.PublishmentSystemID;
                        //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.PublishmentSystemInfo.PublishmentSystemUrl);
                    }
                    if (Keywords.Visible)
                    {
                        Keywords.Text = nodeInfo.Keywords;
                    }
                    if (Description.Visible)
                    {
                        Description.Text = nodeInfo.Description;
                    }
                }
            }
            else
            {
                if (channelControl.Visible)
                {
                    channelControl.SetParameters(Request.Form, true, IsPostBack);
                }
            }
        }
Esempio n. 8
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var isChanged = false;

                try
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);

                    if (NodeIndexNameRow.Visible)
                    {
                        if (!nodeInfo.NodeIndexName.Equals(NodeIndexName.Text) && NodeIndexName.Text.Length != 0)
                        {
                            var nodeIndexNameList = DataProvider.NodeDao.GetNodeIndexNameList(PublishmentSystemId);
                            if (nodeIndexNameList.IndexOf(NodeIndexName.Text) != -1)
                            {
                                FailMessage("栏目修改失败,栏目索引已存在!");
                                return;
                            }
                        }
                    }

                    if (FilePathRow.Visible)
                    {
                        FilePath.Text = FilePath.Text.Trim();
                        if (!nodeInfo.FilePath.Equals(FilePath.Text) && FilePath.Text.Length != 0)
                        {
                            if (!DirectoryUtils.IsDirectoryNameCompliant(FilePath.Text))
                            {
                                FailMessage("栏目页面路径不符合系统要求!");
                                return;
                            }

                            if (PathUtils.IsDirectoryPath(FilePath.Text))
                            {
                                FilePath.Text = PageUtils.Combine(FilePath.Text, "index.html");
                            }

                            var filePathArrayList = DataProvider.NodeDao.GetAllFilePathByPublishmentSystemId(PublishmentSystemId);
                            if (filePathArrayList.IndexOf(FilePath.Text) != -1)
                            {
                                FailMessage("栏目修改失败,栏目页面路径已存在!");
                                return;
                            }
                        }
                    }

                    if (channelControl.Visible)
                    {
                        var extendedAttributes = new ExtendedAttributes();
                        var relatedIdentities  = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
                        BackgroundInputTypeParser.AddValuesToAttributes(ETableStyle.Channel, DataProvider.NodeDao.TableName, PublishmentSystemInfo, relatedIdentities, Request.Form, extendedAttributes.Attributes);
                        if (extendedAttributes.Attributes.Count > 0)
                        {
                            nodeInfo.Additional.SetExtendedAttribute(extendedAttributes.Attributes);
                        }
                    }

                    if (NodeNameRow.Visible)
                    {
                        nodeInfo.NodeName = NodeName.Text;
                    }
                    if (NodeIndexNameRow.Visible)
                    {
                        nodeInfo.NodeIndexName = NodeIndexName.Text;
                    }
                    if (FilePathRow.Visible)
                    {
                        nodeInfo.FilePath = FilePath.Text;
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        var list = new ArrayList();
                        foreach (ListItem item in NodeGroupNameCollection.Items)
                        {
                            if (item.Selected)
                            {
                                list.Add(item.Value);
                            }
                        }
                        nodeInfo.NodeGroupNameCollection = TranslateUtils.ObjectCollectionToString(list);
                    }
                    if (ImageUrlRow.Visible)
                    {
                        nodeInfo.ImageUrl = tbImageUrl.Text;
                    }
                    if (ContentRow.Visible)
                    {
                        nodeInfo.Content = StringUtility.TextEditorContentEncode(Request.Form[NodeAttribute.Content], PublishmentSystemInfo, PublishmentSystemInfo.Additional.IsSaveImageInTextEditor);
                    }
                    if (Keywords.Visible)
                    {
                        nodeInfo.Keywords = Keywords.Text;
                    }
                    if (Description.Visible)
                    {
                        nodeInfo.Description = Description.Text;
                    }



                    if (LinkUrlRow.Visible)
                    {
                        nodeInfo.LinkUrl = LinkUrl.Text;
                    }
                    if (LinkTypeRow.Visible)
                    {
                        nodeInfo.LinkType = ELinkTypeUtils.GetEnumType(LinkType.SelectedValue);
                    }
                    if (ChannelTemplateIDRow.Visible)
                    {
                        nodeInfo.ChannelTemplateId = (ChannelTemplateID.Items.Count > 0) ? int.Parse(ChannelTemplateID.SelectedValue) : 0;
                    }
                    if (ContentTemplateIDRow.Visible)
                    {
                        nodeInfo.ContentTemplateId = (ContentTemplateID.Items.Count > 0) ? int.Parse(ContentTemplateID.SelectedValue) : 0;
                    }

                    DataProvider.NodeDao.UpdateNodeInfo(nodeInfo);

                    Body.AddSiteLog(PublishmentSystemId, _nodeId, 0, "修改栏目", $"栏目:{nodeInfo.NodeName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"栏目修改失败:{ex.Message}");
                    LogUtils.AddErrorLog(ex);
                }

                if (isChanged)
                {
                    CreateManager.CreateChannel(PublishmentSystemId, _nodeId);

                    if (string.IsNullOrEmpty(_returnUrl))
                    {
                        PageUtils.CloseModalPage(Page);
                    }
                    else
                    {
                        PageUtils.CloseModalPageAndRedirect(Page, _returnUrl);
                    }
                }
            }
        }
Esempio n. 9
0
        private AtomFeed ExportNodeInfo(NodeInfo nodeInfo)
        {
            var feed = AtomUtility.GetEmptyFeed();

            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeId, nodeInfo.NodeId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeName, nodeInfo.NodeName);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeType, ENodeTypeUtils.GetValue(nodeInfo.NodeType));
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.PublishmentSystemId, nodeInfo.PublishmentSystemId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentModelId, nodeInfo.ContentModelId);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ParentId, nodeInfo.ParentId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ParentsPath, nodeInfo.ParentsPath);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ParentsCount, nodeInfo.ParentsCount.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ChildrenCount, nodeInfo.ChildrenCount.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.IsLastNode, nodeInfo.IsLastNode.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeIndexName, nodeInfo.NodeIndexName);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeGroupNameCollection, nodeInfo.NodeGroupNameCollection);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Taxis, nodeInfo.Taxis.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.AddDate, nodeInfo.AddDate.ToLongDateString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ImageUrl, nodeInfo.ImageUrl);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Content, AtomUtility.Encrypt(nodeInfo.Content));
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentNum, nodeInfo.ContentNum.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.FilePath, nodeInfo.FilePath);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ChannelFilePathRule, nodeInfo.ChannelFilePathRule);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentFilePathRule, nodeInfo.ContentFilePathRule);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.LinkUrl, nodeInfo.LinkUrl);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ChannelTemplateId, nodeInfo.ChannelTemplateId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentTemplateId, nodeInfo.ContentTemplateId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Keywords, nodeInfo.Keywords);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Description, nodeInfo.Description);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ExtendValues, nodeInfo.Additional.ToString());

            if (nodeInfo.ChannelTemplateId != 0)
            {
                var channelTemplateName = TemplateManager.GetTemplateName(nodeInfo.PublishmentSystemId, nodeInfo.ChannelTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, ChannelTemplateName, channelTemplateName);
            }

            if (nodeInfo.ContentTemplateId != 0)
            {
                var contentTemplateName = TemplateManager.GetTemplateName(nodeInfo.PublishmentSystemId, nodeInfo.ContentTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, ContentTemplateName, contentTemplateName);
            }

            return(feed);
        }