示例#1
0
        private void AddUpcomingPagesInRegularSiteMap(HttpContextBase context, bool forMobile, XContainer target, IFormattable currentDate)
        {
            string rootUrl = Settings.RootUrl;

            int upcomingPageCount   = PageCalculator.TotalPage(StoryRepository.CountByUpcoming(), Settings.HtmlStoryPerPage);
            int upcomingPageCounter = 1;

            while (upcomingPageCounter <= upcomingPageCount)
            {
                target.Add(CreateEntry(context, rootUrl, "Upcoming", new { page = upcomingPageCounter }, currentDate, SiteMapChangeFrequency.Hourly, ((upcomingPageCounter <= CriticalPriorityPageLimit) ? SiteMapUpdatePriority.High : SiteMapUpdatePriority.Normal), forMobile));
                upcomingPageCounter += 1;
            }
        }
示例#2
0
        private void AddPublishedPagesInRegularSiteMap(HttpContextBase context, bool forMobile, XContainer target, IFormattable currentDate)
        {
            string rootUrl = Settings.RootUrl;

            int publishPageCount   = PageCalculator.TotalPage(StoryRepository.CountByPublished(), Settings.HtmlStoryPerPage);
            int publishPageCounter = 1;

            while (publishPageCounter <= publishPageCount)
            {
                target.Add(CreateEntry(context, rootUrl, "Published", new { page = publishPageCounter }, currentDate, SiteMapChangeFrequency.Daily, ((publishPageCounter <= CriticalPriorityPageLimit) ? SiteMapUpdatePriority.Critical : SiteMapUpdatePriority.Normal), forMobile));
                publishPageCounter += 1;
            }
        }
示例#3
0
        public ActionResult Published(int?page)
        {
            StoryListViewData    viewData    = CreateStoryListViewData <StoryListViewData>(page);
            PagedResult <IStory> pagedResult = _storyRepository.FindPublished(PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

            viewData.Stories         = pagedResult.Result;
            viewData.TotalStoryCount = pagedResult.Total;

            viewData.Title               = "{0} - Najnowsze artyku³y o .NET".FormatWith(Settings.SiteTitle);
            viewData.RssUrl              = string.IsNullOrEmpty(Settings.PublishedStoriesFeedBurnerUrl) ? Url.RouteUrl("FeedPublished") : Settings.PublishedStoriesFeedBurnerUrl;
            viewData.AtomUrl             = Url.RouteUrl("FeedPublished", new { format = "Atom" });
            viewData.Subtitle            = "Wszystkie";
            viewData.NoStoryExistMessage = "Brak opublikowanych artyku³ów.";

            return(View("List", viewData));
        }
        public ActionResult List(int?page)
        {
            var viewData = CreateViewData <UserListViewData>();

            PagedResult <IUser> pagedResult = UserRepository.FindAll(PageCalculator.StartIndex(page, Settings.HtmlUserPerPage), Settings.HtmlUserPerPage);

            viewData.CurrentPage    = page ?? 1;
            viewData.UserPerPage    = Settings.HtmlUserPerPage;
            viewData.Users          = pagedResult.Result;
            viewData.TotalUserCount = pagedResult.Total;

            viewData.Title              = "{0} - Użytkownicy".FormatWith(Settings.SiteTitle);
            viewData.Subtitle           = "Użytkownicy";
            viewData.NoUserExistMessage = "Brak użytkowników";

            return(View(viewData));
        }
示例#5
0
        private void AddTagPagesInRegularSiteMap(HttpContextBase context, bool forMobile, XContainer target, IFormattable currentDate)
        {
            int    rowPerPage = Settings.HtmlStoryPerPage;
            string rootUrl    = Settings.RootUrl;

            foreach (ITag tag in TagRepository.FindByUsage(Settings.TopTags))
            {
                int tagPageCount   = PageCalculator.TotalPage(StoryRepository.CountByTag(tag.Id), rowPerPage);
                int tagPageCounter = 1;

                while (tagPageCounter <= tagPageCount)
                {
                    target.Add(CreateEntry(context, rootUrl, "Story", "Tags", new { name = tag.UniqueName, page = tagPageCounter }, currentDate, SiteMapChangeFrequency.Daily, ((tagPageCounter <= CriticalPriorityPageLimit) ? SiteMapUpdatePriority.High : SiteMapUpdatePriority.Normal), forMobile));
                    tagPageCounter += 1;
                }
            }
        }
示例#6
0
        public ActionResult Upcoming(int?page)
        {
            StoryListViewData    viewData    = CreateStoryListViewData <StoryListViewData>(page);
            PagedResult <IStory> pagedResult = _storyRepository.FindUpcoming(PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

            viewData.Stories         = pagedResult.Result;
            viewData.TotalStoryCount = pagedResult.Total;

            viewData.Title               = "{0} - Upcoming stories".FormatWith(Settings.SiteTitle);
            viewData.MetaDescription     = "Upcoming stories";
            viewData.RssUrl              = string.IsNullOrEmpty(Settings.UpcomingStoriesFeedBurnerUrl) ? Url.RouteUrl("FeedUpcoming") : Settings.UpcomingStoriesFeedBurnerUrl;
            viewData.AtomUrl             = Url.RouteUrl("FeedUpcoming", new { format = "Atom" });
            viewData.Subtitle            = "Upcoming";
            viewData.NoStoryExistMessage = "No upcoming story exists.";

            return(View("List", viewData));
        }
示例#7
0
        public ActionResult Search(string q, int?page)
        {
            if (string.IsNullOrEmpty(q))
            {
                return(RedirectToRoute("Published"));
            }

            StoryListSearchViewData viewData    = CreateStoryListViewData <StoryListSearchViewData>(page);
            PagedResult <IStory>    pagedResult = _storyRepository.Search(q, PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

            viewData.Stories         = pagedResult.Result;
            viewData.TotalStoryCount = pagedResult.Total;
            viewData.Query           = q;

            viewData.Title               = "{0} - Wyniki wyszukiwania dla \"{1}\"".FormatWith(Settings.SiteTitle, q);
            viewData.MetaDescription     = "Wyniki wyszukiwania dla {0}".FormatWith(q);
            viewData.RssUrl              = Url.Action("Search", "Feed", new { q });
            viewData.AtomUrl             = Url.Action("Search", "Feed", new { q, format = "Atom" });
            viewData.Subtitle            = "Wyniki wyszukiwania : {0}".FormatWith(q.HtmlEncode());
            viewData.NoStoryExistMessage = "Brak artyku³ów dla \"{0}\".".FormatWith(q.HtmlEncode());

            return(View("List", viewData));
        }
示例#8
0
        public ActionResult Unapproved(int?page)
        {
            StoryListViewData viewData = CreateStoryListViewData <StoryListViewData>(page);

            viewData.Title           = "{0} - Niezatwierdzone artyku³y".FormatWith(Settings.SiteTitle);
            viewData.MetaDescription = "Niezatwierdzone artyku³y";
            viewData.Subtitle        = "Niezatwierdzone";

            if (!IsCurrentUserAuthenticated || !CurrentUser.CanModerate())
            {
                viewData.NoStoryExistMessage = "Nie masz uprawnieñ do przegl¹dania niezatwierdzonych artyku³ów.";
            }
            else
            {
                PagedResult <IStory> pagedResult = _storyRepository.FindUnapproved(PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

                viewData.Stories         = pagedResult.Result;
                viewData.TotalStoryCount = pagedResult.Total;

                viewData.NoStoryExistMessage = "Brak niezatwierdzonych artyku³ów.";
            }

            return(View("List", viewData));
        }
示例#9
0
        public ActionResult Unapproved(int?page)
        {
            StoryListViewData viewData = CreateStoryListViewData <StoryListViewData>(page);

            viewData.Title           = "{0} - Unapproved stories".FormatWith(Settings.SiteTitle);
            viewData.MetaDescription = "Unapproved stories";
            viewData.Subtitle        = "Unapproved";

            if (!IsCurrentUserAuthenticated || !CurrentUser.CanModerate())
            {
                viewData.NoStoryExistMessage = "You do not have the privilege to view unapproved stories.";
            }
            else
            {
                PagedResult <IStory> pagedResult = _storyRepository.FindUnapproved(PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

                viewData.Stories         = pagedResult.Result;
                viewData.TotalStoryCount = pagedResult.Total;

                viewData.NoStoryExistMessage = "No unapproved story exists.";
            }

            return(View("List", viewData));
        }
示例#10
0
        public ActionResult Category(string name, int?page)
        {
            name = name.NullSafe();

            if (string.IsNullOrEmpty(name))
            {
                return(RedirectToRoute("Published"));
            }

            ICategory category = _categoryRepository.FindByUniqueName(name);

            if (category == null)
            {
                ThrowNotFound("Kategoria nie istnieje.");
            }

            StoryListViewData viewData   = CreateStoryListViewData <StoryListViewData>(page);
            string            uniqueName = name;

            if (category != null)
            {
                PagedResult <IStory> pagedResult = _storyRepository.FindPublishedByCategory(category.Id, PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);
                viewData.Stories         = pagedResult.Result;
                viewData.TotalStoryCount = pagedResult.Total;

                name       = category.Name;
                uniqueName = category.UniqueName;
            }

            viewData.Title               = "{0} - Najnowsze artyku³y o .NET w dziale {1}".FormatWith(Settings.SiteTitle, name);
            viewData.MetaDescription     = "Najnowsze artyku³y o .NET w dziale {0}".FormatWith(name);
            viewData.RssUrl              = Url.Action("Category", "Feed", new { name = uniqueName });
            viewData.AtomUrl             = Url.Action("Category", "Feed", new { name = uniqueName, format = "Atom" });
            viewData.Subtitle            = name.HtmlEncode();
            viewData.NoStoryExistMessage = "Brak opublikowanych artyku³ów w \"{0}\".".FormatWith(name.HtmlEncode());

            return(View("List", viewData));
        }
示例#11
0
        public ActionResult Tags(string name, int?page)
        {
            name = name.NullSafe();

            if (string.IsNullOrEmpty(name))
            {
                return(RedirectToRoute("Published"));
            }

            ITag tag = _tagRepository.FindByUniqueName(name);

            if (tag == null)
            {
                ThrowNotFound("Tag nie istnieje.");
            }

            StoryListViewData viewData   = CreateStoryListViewData <StoryListViewData>(page);
            string            uniqueName = name;

            if (tag != null)
            {
                PagedResult <IStory> pagedResult = _storyRepository.FindByTag(tag.Id, PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

                viewData.Stories         = pagedResult.Result;
                viewData.TotalStoryCount = pagedResult.Total;

                name       = tag.Name;
                uniqueName = tag.UniqueName;
            }

            viewData.Title               = "{0} - Artyku³y z tagiem {1}".FormatWith(Settings.SiteTitle, name);
            viewData.MetaDescription     = "Artyku³y z tagiem {0}".FormatWith(name);
            viewData.RssUrl              = Url.Action("Tags", "Feed", new { name = uniqueName });
            viewData.AtomUrl             = Url.Action("Tags", "Feed", new { name = uniqueName, format = "Atom" });
            viewData.Subtitle            = name.HtmlEncode();
            viewData.NoStoryExistMessage = "Brak artyku³ów z \"{0}\".".FormatWith(name.HtmlEncode());

            return(View("List", viewData));
        }
示例#12
0
        public ActionResult Publishable(int?page)
        {
            StoryListViewData viewData = CreateStoryListViewData <StoryListViewData>(page);

            viewData.Title           = "{0} - Do opublikowania".FormatWith(Settings.SiteTitle);
            viewData.MetaDescription = "Do opublikowania";
            viewData.Subtitle        = "Do opublikowania";

            if (!IsCurrentUserAuthenticated || !CurrentUser.CanModerate())
            {
                viewData.NoStoryExistMessage = "Nie masz uprawnieñ do przegl¹dania artyku³ów do opublikowania.";
            }
            else
            {
                DateTime currentTime = SystemTime.Now();
                DateTime minimumDate = currentTime.AddHours(-Settings.MaximumAgeOfStoryInHoursToPublish);
                DateTime maximumDate = currentTime.AddHours(-Settings.MinimumAgeOfStoryInHoursToPublish);

                PagedResult <IStory> pagedResult = _storyRepository.FindPublishable(minimumDate, maximumDate, PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

                viewData.Stories         = pagedResult.Result;
                viewData.TotalStoryCount = pagedResult.Total;

                viewData.NoStoryExistMessage = "Brak artyku³ów do apublikowania.";
            }

            return(View("List", viewData));
        }
示例#13
0
        public ActionResult CommentedBy(string name, int?page)
        {
            IUser user = UserRepository.FindById(name.ToGuid());
            PagedResult <IStory> pagedResult = _storyRepository.FindCommentedByUser(user.Id, PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

            StoryListUserViewData viewData = CreateStoryListViewData <StoryListUserViewData>(page);

            viewData.Stories             = pagedResult.Result;
            viewData.TotalStoryCount     = pagedResult.Total;
            viewData.RssUrl              = Url.Action("CommentedBy", "Feed", new { name });
            viewData.AtomUrl             = Url.Action("CommentedBy", "Feed", new { name, format = "Atom" });
            viewData.NoStoryExistMessage = "Brak artyku³ów skomentowanych przez \"{0}\".".FormatWith(user.UserName.HtmlEncode());
            viewData.SelectedTab         = UserDetailTab.Commented;
            viewData.TheUser             = user;

            return(View("UserStoryList", viewData));
        }
示例#14
0
        public ActionResult Publishable(int?page)
        {
            StoryListViewData viewData = CreateStoryListViewData <StoryListViewData>(page);

            viewData.Title           = "{0} - Publishable stories".FormatWith(Settings.SiteTitle);
            viewData.MetaDescription = "Publishable stories";
            viewData.Subtitle        = "Publishable";

            if (!IsCurrentUserAuthenticated || !CurrentUser.CanModerate())
            {
                viewData.NoStoryExistMessage = "You do not have the privilege to view publishable stories.";
            }
            else
            {
                DateTime currentTime = SystemTime.Now();
                DateTime minimumDate = currentTime.AddHours(-Settings.MaximumAgeOfStoryInHoursToPublish);
                DateTime maximumDate = currentTime.AddHours(-Settings.MinimumAgeOfStoryInHoursToPublish);

                PagedResult <IStory> pagedResult = _storyRepository.FindPublishable(minimumDate, maximumDate, PageCalculator.StartIndex(page, Settings.HtmlStoryPerPage), Settings.HtmlStoryPerPage);

                viewData.Stories         = pagedResult.Result;
                viewData.TotalStoryCount = pagedResult.Total;

                viewData.NoStoryExistMessage = "No publishable story exists.";
            }

            return(View("List", viewData));
        }