Пример #1
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isIncludeChildren = TranslateUtils.ToBool(DdlIsIncludeChildren.SelectedValue);
            var isCreateContents  = TranslateUtils.ToBool(DdlIsCreateContents.SelectedValue);

            foreach (var channelId in TranslateUtils.StringCollectionToIntList(_channelIdCollection))
            {
                CreateManager.CreateChannel(SiteId, channelId);
                if (isCreateContents)
                {
                    CreateManager.CreateAllContent(SiteId, channelId);
                }
                if (isIncludeChildren)
                {
                    foreach (var childChannelId in DataProvider.ChannelDao.GetIdListForDescendant(channelId))
                    {
                        CreateManager.CreateChannel(SiteId, childChannelId);
                        if (isCreateContents)
                        {
                            CreateManager.CreateAllContent(SiteId, channelId);
                        }
                    }
                }
            }

            LayerUtils.CloseAndOpenPageCreateStatus(Page);
        }
Пример #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (AuthRequest.IsQueryExists("CreateChannelsOneByOne") && AuthRequest.IsQueryExists("ChannelIDCollection"))
            {
                foreach (var channelId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection")))
                {
                    CreateManager.CreateChannel(SiteId, channelId);
                }

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将栏目放入生成队列"));
            }
            else if (AuthRequest.IsQueryExists("CreateContentsOneByOne") && AuthRequest.IsQueryExists("channelId") &&
                     AuthRequest.IsQueryExists("contentIdCollection"))
            {
                foreach (var contentId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection")))
                {
                    CreateManager.CreateContent(SiteId, AuthRequest.GetQueryInt("channelId"),
                                                contentId);
                }

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将内容放入生成队列"));
            }
            else if (AuthRequest.IsQueryExists("CreateByTemplate") && AuthRequest.IsQueryExists("templateID"))
            {
                CreateManager.CreateFile(SiteId, AuthRequest.GetQueryInt("templateID"));

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列"));
            }
            else if (AuthRequest.IsQueryExists("CreateByIDsCollection") && AuthRequest.IsQueryExists("IDsCollection"))
            {
                foreach (var channelIdContentId in
                         TranslateUtils.StringCollectionToStringCollection(AuthRequest.GetQueryString("IDsCollection")))
                {
                    var pair = channelIdContentId.Split('_');
                    CreateManager.CreateContent(SiteId, TranslateUtils.ToInt(pair[0]),
                                                TranslateUtils.ToInt(pair[1]));
                }

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列"));
            }
            //---------------------------------------------------------------------------------------//
            else if (AuthRequest.IsQueryExists("SiteTemplateDownload"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var downloadUrl   = TranslateUtils.DecryptStringBySecretKey(AuthRequest.GetQueryString("DownloadUrl"));
                var directoryName = PathUtils.GetFileNameWithoutExtension(downloadUrl);

                var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(downloadUrl, directoryName, userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
            else if (AuthRequest.IsQueryExists("SiteTemplateZip"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var parameters = AjaxOtherService.GetSiteTemplateZipParameters(AuthRequest.GetQueryString("DirectoryName"), userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
            else if (AuthRequest.IsQueryExists("SiteTemplateUnZip"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var parameters = AjaxOtherService.GetSiteTemplateUnZipParameters(AuthRequest.GetQueryString("FileName"), userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateUnZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
            //---------------------------------------------------------------------------------------//
            else if (AuthRequest.IsQueryExists("PluginDownload"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var parameters = AjaxOtherService.GetPluginDownloadParameters(AuthRequest.GetQueryString("DownloadUrl"), userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetPluginDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
        }