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

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var groupName = AuthRequest.GetQueryString("GroupName");

                try
                {
                    DataProvider.ContentGroupDao.Delete(groupName, SiteId);
                    AuthRequest.AddSiteLog(SiteId, "删除内容组", $"内容组:{groupName}");
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            if (AuthRequest.IsQueryExists("SetTaxis"))
            {
                var groupName = AuthRequest.GetQueryString("GroupName");
                var direction = AuthRequest.GetQueryString("Direction");

                switch (direction.ToUpper())
                {
                case "UP":
                    DataProvider.ContentGroupDao.UpdateTaxisToUp(SiteId, groupName);
                    break;

                case "DOWN":
                    DataProvider.ContentGroupDao.UpdateTaxisToDown(SiteId, groupName);
                    break;
                }
                SuccessMessage("排序成功!");
                AddWaitAndRedirectScript(GetRedirectUrl(SiteId));
            }

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.WebSitePermissions.Configration);

            RptContents.DataSource     = ContentGroupManager.GetContentGroupInfoList(SiteId);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(SiteId);

            BtnAddGroup.Attributes.Add("onclick", showPopWinString);
        }
Esempio n. 2
0
        public void Export()
        {
            var siteInfo = SiteManager.GetSiteInfo(_siteId);

            var feed = AtomUtility.GetEmptyFeed();

            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                SiteAttribute.Id, "PublishmentSystemId"
            }, siteInfo.Id.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                SiteAttribute.SiteName, "PublishmentSystemName"
            }, siteInfo.SiteName);
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                SiteAttribute.SiteDir, "PublishmentSystemDir"
            }, siteInfo.SiteDir);
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                SiteAttribute.TableName, "AuxiliaryTableForContent"
            }, siteInfo.TableName);
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                SiteAttribute.IsRoot, "IsHeadquarters"
            }, siteInfo.IsRoot.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                SiteAttribute.ParentId, "ParentPublishmentSystemId"
            }, siteInfo.ParentId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, SiteAttribute.Taxis, siteInfo.Taxis.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, SiteAttribute.SettingsXml, siteInfo.Additional.ToString());

            var indexTemplateId = TemplateManager.GetDefaultTemplateId(siteInfo.Id, TemplateType.IndexPageTemplate);

            if (indexTemplateId != 0)
            {
                var indexTemplateName = TemplateManager.GetTemplateName(_siteId, indexTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, DefaultIndexTemplateName, indexTemplateName);
            }

            var channelTemplateId = TemplateManager.GetDefaultTemplateId(siteInfo.Id, TemplateType.ChannelTemplate);

            if (channelTemplateId != 0)
            {
                var channelTemplateName = TemplateManager.GetTemplateName(_siteId, channelTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, DefaultChannelTemplateName, channelTemplateName);
            }

            var contentTemplateId = TemplateManager.GetDefaultTemplateId(siteInfo.Id, TemplateType.ContentTemplate);

            if (contentTemplateId != 0)
            {
                var contentTemplateName = TemplateManager.GetTemplateName(_siteId, contentTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, DefaultContentTemplateName, contentTemplateName);
            }

            var fileTemplateId = TemplateManager.GetDefaultTemplateId(siteInfo.Id, TemplateType.FileTemplate);

            if (fileTemplateId != 0)
            {
                var fileTemplateName = TemplateManager.GetTemplateName(siteInfo.Id, fileTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, DefaultFileTemplateName, fileTemplateName);
            }

            var channelGroupInfoList = ChannelGroupManager.GetChannelGroupInfoList(siteInfo.Id);

            channelGroupInfoList.Reverse();

            foreach (var channelGroupInfo in channelGroupInfoList)
            {
                var entry = ChannelGroupIe.Export(channelGroupInfo);
                feed.Entries.Add(entry);
            }

            var contentGroupInfoList = ContentGroupManager.GetContentGroupInfoList(siteInfo.Id);

            contentGroupInfoList.Reverse();

            foreach (var contentGroupInfo in contentGroupInfoList)
            {
                var entry = ContentGroupIe.Export(contentGroupInfo);
                feed.Entries.Add(entry);
            }

            feed.Save(_filePath);
        }