Beispiel #1
0
        public async Task <ModuleAction> GetAction_DownloadNewsSiteMapAsync()
        {
            if (!IsAuthorized("NewsSiteMap"))
            {
                return(null);
            }
            NewsSiteMap sm       = new NewsSiteMap();
            string      filename = sm.GetNewsSiteMapFileName();

            if (!await FileSystem.FileSystemProvider.FileExistsAsync(filename))
            {
                return(null);
            }
            return(new ModuleAction(this)
            {
                Url = Utility.UrlFor(typeof(CategoriesBrowseModuleController), nameof(CategoriesBrowseModuleController.DownloadNewsSiteMap)),
                NeedsModuleContext = true,
                CookieAsDoneSignal = true,
                Image = await CustomIconAsync("Download.png"),
                LinkText = this.__ResStr("downloadLink", "Download News Site Map"),
                MenuText = this.__ResStr("downloadMenu", "Download News Site Map"),
                Tooltip = this.__ResStr("downloadTT", "Download the news site map file"),
                Legend = this.__ResStr("downloadLegend", "Downloads the news site map file"),
                Style = ModuleAction.ActionStyleEnum.Normal,
                Category = ModuleAction.ActionCategoryEnum.Read,
                Mode = ModuleAction.ActionModeEnum.Any,
                Location = ModuleAction.ActionLocationEnum.ModuleLinks,
            });
        }
        public async Task <ActionResult> DownloadNewsSiteMap(long cookieToReturn)
        {
            NewsSiteMap sm       = new NewsSiteMap();
            string      filename = sm.GetNewsSiteMapFileName();

            if (!await FileSystem.FileSystemProvider.FileExistsAsync(filename))
            {
                throw new Error(this.__ResStr("sitemapNotFound", "News site map not found - File '{0}' cannot be located", filename));
            }
#if MVC6
            Response.Headers.Remove("Cookie");
            Response.Cookies.Append(Basics.CookieDone, cookieToReturn.ToString(), new Microsoft.AspNetCore.Http.CookieOptions {
                HttpOnly = false, Path = "/"
            });
#else
            HttpCookie cookie = new HttpCookie(Basics.CookieDone, cookieToReturn.ToString());
            Response.Cookies.Remove(Basics.CookieDone);
            Response.SetCookie(cookie);
#endif

            string contentType = "application/octet-stream";
#if MVC6
            return(new PhysicalFileResult(filename, contentType)
            {
                FileDownloadName = Path.GetFileName(filename)
            });
#else
            FilePathResult result = new FilePathResult(filename, contentType);
            result.FileDownloadName = Path.GetFileName(filename);
            return(result);
#endif
        }
        public async Task <ActionResult> RemoveNewsSiteMap()
        {
            NewsSiteMap sm = new NewsSiteMap();
            await sm.RemoveAsync();

            return(Reload(null, Reload: ReloadEnum.ModuleParts, PopupText: this.__ResStr("sremDone", "The news site map has been removed")));
        }
        public async Task <ActionResult> CreateNewsSiteMap()
        {
            NewsSiteMap sm = new NewsSiteMap();
            await sm.CreateAsync();

            return(Reload(null, Reload: ReloadEnum.ModuleParts, PopupText: this.__ResStr("screDone", "The news site map has been successfully created")));
        }
 public void Create(string loc, string prioity, string language, string name, string genres, string publicationDate, string title)
 {
     NewsSiteMap news = new NewsSiteMap();
     news.Loc = loc;
     news.Priority = prioity;
     news.NewsSiteMapNews.Publication.Language = language;
     news.NewsSiteMapNews.Publication.Name = name;
     news.NewsSiteMapNews.Genres = genres;
     news.NewsSiteMapNews.PublicationDate = publicationDate;
     news.NewsSiteMapNews.Title = title;
     List.Add(news);
 }
Beispiel #6
0
    public void Create(string loc, string prioity, string language, string name, string genres, string publicationDate, string title)
    {
        NewsSiteMap news = new NewsSiteMap();

        news.Loc      = loc;
        news.Priority = prioity;
        news.NewsSiteMapNews.Publication.Language = language;
        news.NewsSiteMapNews.Publication.Name     = name;
        news.NewsSiteMapNews.Genres          = genres;
        news.NewsSiteMapNews.PublicationDate = publicationDate;
        news.NewsSiteMapNews.Title           = title;
        List.Add(news);
    }