protected void Page_Load(object sender, EventArgs e)
        {
            if (!KickPage.KickUserProfile.IsVetted)
            {
                Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.UserTest, KickPage.KickUserProfile.Username));
            }

            if (!Page.IsPostBack)
            {
                // In case a url is passed on the querystring check if the story
                // already exists and in that case redirect the user to the story page
                string url = Request.QueryString["url"];

                if (!string.IsNullOrEmpty(url))
                {
                    Dal.Story story = Incremental.Kick.Dal.Story.FetchStoryByUrl(url.Trim());

                    if (story != null)
                    {
                        Response.Redirect(
                            UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, story.StoryIdentifier,
                                                 story.Category.CategoryIdentifier), true);
                    }
                }

                // Bind list of categories
                Category.DataSource = CategoryCache.GetCategories(KickPage.HostProfile.HostID);
                Category.DataBind();

                // Retrieve story information if story was submitted with the bookmarklet
                Url.Text   = Request.QueryString["url"];
                Title.Text = Request.QueryString["title"];

                if (Title.Text.Length > 70)
                {
                    Title.Text = Title.Text.Substring(0, 70);
                }

                if (Title.Text.Length > 0)
                {
                    TitleNoteLabel.Text    = "NOTE: Is this title correct?<br/>";
                    TitleNoteLabel.Visible = true;
                }

                Description.Text = Request.QueryString["description"];

                if (Url.Text.Length == 0)
                {
                    Url.Focus();
                }
                else if (Title.Text.Length == 0)
                {
                    Title.Focus();
                }
                else
                {
                    Description.Focus();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.hypSiteTitle.NavigateUrl  = UrlFactory.CreateUrl(UrlFactory.PageName.Home);
            this.hypSiteTitle.Text         = this.KickPage.HostProfile.SiteTitle;
            this.litSiteTagLine.Text       = this.KickPage.HostProfile.TagLine;
            this.litFeedBurnerCounter.Text = this.KickPage.HostProfile.FeedBurnerMainRssFeedCountHtml;

            this.pnlSideAds.Visible = this.KickPage.DisplaySideAds;

            this.googleTop.AdSenseId  = this.KickPage.AdSenseID;
            this.googleSide.AdSenseId = this.KickPage.AdSenseID;

            if (this.KickPage.DisplayAnnouncement && !String.IsNullOrEmpty(this.KickPage.HostProfile.AnnouncementHtml))
            {
                this.pnlSiteAnnouncement.Visible = true;
                this.litSiteAnnouncement.Text    = this.KickPage.HostProfile.AnnouncementHtml;
            }

            if (this.KickPage.Caption.Length > 0)
            {
                this.pnlPageCaption.Visible = true;
                this.litPageCaption.Text    = this.KickPage.Caption;
                this.RssFeedIcon.Visible    = this.KickPage.HasRssFeed;
            }
        }
Beispiel #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (relatedStory == null)
            {
                return;
            }

            if (!String.IsNullOrEmpty(this.Title))
            {
                writer.WriteLine(@"<div class=""PageSmallCaption"">{0}</div>", this.Title);
            }

            writer.WriteLine("<ul id=\"relatedStoriesList\">");

            foreach (Story s in relatedStory)
            {
                Category category     = CategoryCache.GetCategory(s.CategoryID, KickPage.HostProfile.HostID);
                string   kickStoryUrl =
                    UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, s.StoryIdentifier, category.CategoryIdentifier);

                writer.WriteLine("<li><a href=\"{0}\">{1}</a></li>", kickStoryUrl, s.Title);
            }

            writer.WriteLine("</ul>");
        }
        protected void SubmitStory_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (!KickPage.KickUserProfile.IsVetted)
                {
                    throw new SecurityException("This user can't submit stories");
                }

                short  categoryID      = short.Parse(Category.SelectedValue);
                string storyIdentifier =
                    StoryBR.AddStory(KickPage.HostProfile.HostID, Title.Text, Description.Text, Url.Text, categoryID,
                                     KickPage.KickUserProfile, KickPage.IPAddress);

                NewStoryPanel.Visible = false;
                SuccessPanel.Visible  = true;

                string categoryName = CategoryCache.GetCategory(categoryID, KickPage.HostProfile.HostID).CategoryIdentifier;
                UpcomingStoryQueue.NavigateUrl = UrlFactory.CreateUrl(UrlFactory.PageName.NewStories);
                UpcomingStoryQueue.Text        = "upcoming queue";
                StoryLink.NavigateUrl          = UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, storyIdentifier, categoryName);

                // Bind the story original url to the image customization user control
                KickItImagePersonalization.StoryUrl = Url.Text;
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            if (this._tags.Count == 0)
            {
                writer.WriteLine("");
            }
            else
            {
                string tagClass; bool isEven = false;
                foreach (WeightedTag tag in this._tags)
                {
                    string spanID = this._storyID + "_" + tag.TagID + "_EditableTag";
                    if (isEven)
                    {
                        tagClass = "evenTag";
                    }
                    else
                    {
                        tagClass = "oddTag";
                    }

                    writer.WriteLine(@"<span class=""EditableTag {3}"" id=""{0}""><a href=""{1}"" class=""tag {3}"">{2}</a>",
                                     spanID, UrlFactory.CreateUrl(UrlFactory.PageName.UserTag, _username, tag.TagIdentifier), tag.TagName, tagClass);

                    writer.WriteLine(@" [<a href=""javascript:RemoveUserStoryTag({0}, {1});"">x</a>]<br /></span>",
                                     this._storyID, tag.TagID);
                    isEven = !isEven;
                }
            }
        }
 //NOTE: GJ: this page will be depreciated in favour of tagging
 protected void Page_Init(object sender, EventArgs e)
 {
     this.Caption    = "Latest " + CategoryCache.GetCategory(this.UrlParameters.CategoryID, this.HostProfile.HostID).Name + " stories";
     this.Title      = this.HostProfile.SiteTitle + " - " + this.Caption;
     this.PageName   = UrlFactory.PageName.ViewCategory;
     this.RssFeedUrl = UrlFactory.CreateUrl(UrlFactory.PageName.ViewCategoryRss, this.UrlParameters.CategoryIdentifier);
 }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //TODO: GJ: decode url

            string url   = Request["url"].Trim();
            string title = Request["title"];

            if (String.IsNullOrEmpty(title))
            {
                title = "";
            }

            title = title.Trim();

            //TODO: GJ: we could improve performance here (better story cache)
            Incremental.Kick.Dal.Story story = Incremental.Kick.Dal.Story.FetchStoryByUrl(url);

            if (story == null)
            {
                this.Response.Redirect("~/submit/?url=" + HttpUtility.UrlEncode(url) + "&title=" + HttpUtility.UrlEncode(title));
            }
            else
            {
                //TODO: GJ: should we auto kick???
                this.Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, story.StoryIdentifier, CategoryCache.GetCategory(story.CategoryID, this.HostProfile.HostID).CategoryIdentifier));
            }
        }
Beispiel #8
0
 protected void Page_Init(object sender, EventArgs e)
 {
     this.Title      = this.HostProfile.SiteTitle + " - " + this.HostProfile.TagLine + ".";
     this.Caption    = "Upcoming stories";
     this.PageName   = UrlFactory.PageName.NewStories;
     this.RssFeedUrl = UrlFactory.CreateUrl(UrlFactory.PageName.NewStoriesRss);
 }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Paging.PageNumber = UrlParameters.PageNumber;
            this.Paging.PageSize   = UrlParameters.PageSize;

            if (!this.UrlParameters.CategoryIdentifierSpecified)
            {
                this.StoryList.DataBind(StoryCache.GetPopularStories(this.HostProfile.HostID, false, this.UrlParameters.StoryListSortBy, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
                this.Paging.RecordCount = StoryCache.GetPopularStoriesCount(this.HostProfile.HostID, false, this.UrlParameters.StoryListSortBy);
                this.Paging.BaseUrl     = UrlFactory.CreateUrl(UrlFactory.PageName.Home) + "/upcoming/popular/" + this.UrlParameters.StoryListSortBy.ToString().ToLower();
            }
            else
            {
                this.StoryList.DataBind(StoryCache.GetCategoryStories(this.UrlParameters.CategoryID, false, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
                this.Paging.RecordCount = StoryCache.GetCategoryStoryCount(this.UrlParameters.CategoryID, false, this.HostProfile.HostID);
                this.Paging.BaseUrl     = UrlFactory.CreateUrl(UrlFactory.PageName.ViewCategoryNewStories, this.UrlParameters.CategoryIdentifier);
            }

            switch (this.UrlParameters.StoryListSortBy)
            {
            case StoryListSortBy.Today:
                this.PageName = UrlFactory.PageName.UpcomingToday;
                break;

            case StoryListSortBy.PastWeek:
                this.PageName = UrlFactory.PageName.UpcomingWeek;
                break;

            default:
                this.PageName = UrlFactory.PageName.NewStories;
                break;
            }
        }
        protected void UrlCheck_ServerValidate(object source, ServerValidateEventArgs args)
        {
            // Retrieve the story given the url
            Dal.Story story = Incremental.Kick.Dal.Story.FetchStoryByUrl(args.Value);

            // If the story already exists in the database
            if (story != null)
            {
                // Make page invalid
                args.IsValid = false;

                // Let user kick the existing story by providing a link to it
                UrlCheck.ErrorMessage =
                    string.Format("The story already exists. You might want to <a href=\"{0}\">kick it</a> instead.<br/>",
                                  UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, story.StoryIdentifier,
                                                       story.Category.CategoryIdentifier));
                return;
            }

            // check to see its bannination status
            bool banninated = BannedUrlHelper.IsUrlBanninated(args.Value, HostCache.GetHost(HostHelper.GetHostAndPort(Request.Url)).HostID);

            // If the url matches
            if (banninated)
            {
                // Make page invalid
                args.IsValid = false;

                // Let user kick the existing story by providing a link to it
                UrlCheck.ErrorMessage = "This URL cannot be submitted.<br/>";
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.StoryList.DataBind(StoryCache.GetCategoryStories(this.UrlParameters.CategoryID, true, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
     this.Paging.RecordCount = StoryCache.GetCategoryStoryCount(this.UrlParameters.CategoryID, true, this.HostProfile.HostID);
     this.Paging.PageNumber  = UrlParameters.PageNumber;
     this.Paging.PageSize    = UrlParameters.PageSize;
     this.Paging.BaseUrl     = UrlFactory.CreateUrl(UrlFactory.PageName.ViewCategory, this.UrlParameters.CategoryIdentifier);
 }
Beispiel #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.StoryList.DataBind(StoryCache.GetTaggedStories(this.UrlParameters.TagIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
     this.Paging.RecordCount = StoryCache.GetTaggedStoryCount(this.UrlParameters.TagIdentifier, this.HostProfile.HostID);
     this.Paging.PageNumber  = UrlParameters.PageNumber;
     this.Paging.PageSize    = UrlParameters.PageSize;
     this.Paging.BaseUrl     = UrlFactory.CreateUrl(UrlFactory.PageName.ViewTag, HttpUtility.UrlEncode(this.UrlParameters.TagIdentifier));
 }
Beispiel #13
0
        public ApiStory ToApi()
        {
            Host host = HostCache.GetHost(this.HostID);

            return(new ApiStory(
                       this.Title, host.RootUrl + UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, this.StoryIdentifier, CategoryCache.GetCategory(this.CategoryID, this.HostID).CategoryIdentifier), this.Description,
                       this.CreatedOn, this.PublishedOn, this.IsPublishedToHomepage, this.KickCount, this.CommentCount, UserCache.GetUser(this.UserID).ToApi(host)));
        }
Beispiel #14
0
 protected void Page_Init(object sender, EventArgs e)
 {
     this.Caption    = "Stories recently tagged with '" + this.UrlParameters.TagIdentifier + "'";
     this.Title      = this.HostProfile.SiteTitle + " : " + this.Caption;
     this.PageName   = UrlFactory.PageName.ViewTag;
     this.DisplayAds = true;
     this.RssFeedUrl = UrlFactory.CreateUrl(UrlFactory.PageName.ViewTagRss, this.UrlParameters.TagIdentifier);
 }
Beispiel #15
0
        protected override void OnInit(EventArgs e)
        {
            this.Caption    = this.UrlParameters.UserIdentifier;
            this.Title      = this.HostProfile.SiteTitle + " : " + this.Caption;
            this.RssFeedUrl = UrlFactory.CreateUrl(UrlFactory.PageName.UserKickedStoriesRss, this.UrlParameters.UserIdentifier);
            this.DisplayAds = false;

            base.OnInit(e);
        }
Beispiel #16
0
        /// <summary>
        /// Writes content to render on a client to the specified <see cref="T:System.Web.UI.HtmlTextWriter"></see> object.
        /// </summary>
        /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter"></see> that contains the output stream to render on the client.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteLine(@"<div class=""TagCloud"">");


            if (this._tags.Count == 0)
            {
                writer.WriteLine("<h2>No tags</h2>");
            }
            else
            {
                string tagClass;
                bool   isOdd = true;
                foreach (WeightedTag tag in this._tags)
                {
                    if (isOdd)
                    {
                        tagClass = "oddTag";
                    }
                    else
                    {
                        tagClass = "evenTag";
                    }

                    decimal fontSize = this._tags.GetTagWeight(tag.UsageCount);

                    string tagUrl;
                    if (this.KickPage.UrlParameters.UserIdentifierSpecified)
                    {
                        tagUrl = UrlFactory.CreateUrl(UrlFactory.PageName.UserTag, this.KickPage.UrlParameters.UserIdentifier, HttpUtility.UrlEncode(tag.TagIdentifier));
                    }
                    else
                    {
                        tagUrl = UrlFactory.CreateUrl(UrlFactory.PageName.ViewTag, HttpUtility.UrlEncode(tag.TagIdentifier));
                    }

                    string tagIcons = "";
                    if (tag.IsInNamespace)
                    {
                        tagClass += " namespaceTag";

                        foreach (string tagNamespace in tag.Namespaces)
                        {
                            //tagIcons += String.Format(@"<img src=""{0}/{1}_{2}.png"" width=""16"" height=""16"" border=""0""/> ", this.KickPage.StaticIconRootUrl, tagNamespace, tag.TagName);
                            tagClass += " " + tagNamespace + "_NamespaceTag";
                        }
                    }

                    writer.WriteLine(@"<span style=""font-size:{0}em;""><a href=""{1}"" class=""tag {3}"" rel=""tag"">{4}{2}</a></span>",
                                     fontSize.ToString(), tagUrl, tag.TagName, tagClass, tagIcons);
                    //writer.WriteLine("FontSize:" + fontSize.ToString());
                    isOdd = !isOdd;
                }
            }
            writer.WriteLine("</div>");
        }
Beispiel #17
0
        /// <summary>
        /// Renders the short story summary.
        /// </summary>
        /// <param name="writer">The writer.</param>
        protected void RenderShortSummary(HtmlTextWriter writer)
        {
            string kickStoryUrl =
                UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, _story.StoryIdentifier, _story.Category.CategoryIdentifier);
            string kickCountClass = GetKickCountClass();

            //

            //TODO: make this CSS
            writer.WriteLine(
                @"
                <div style=""padding-bottom:5px;margin-bottom:10px;border-bottom: solid 1px silver;display:block"" class=""smallText"">
                    <div style=""float:left;padding-right:15px;margin:0;width:60px;overflow:hidden;"">
                        <div class=""storyKickCount {2}""><a href=""{0}""><span id=""{3}_KickCount"">{1}</span></a><br/><span class=""smallText"">kicks</span></div>                       
                    </div>
            ",
                kickStoryUrl, _story.KickCount, kickCountClass, _story.StoryID);

            string publishedHtml = "";

            if (_story.IsPublishedToHomepage)
            {
                publishedHtml = "published " + Dates.ReadableDiff(_story.PublishedOn, DateTime.Now) + ", ";
            }

            //TODO: remove inline style from table
            writer.WriteLine(
                @"<div class=""storySummaryMainTD xfolkentry"">
                        <div class=""storyTitle""><a href=""{0}"" class=""taggedlink"">{1}</a> <a href=""{0}""></a></div>
                        <div class=""storySubmitted"">{2} submitted by 
            ",
                _story.Url, _story.Title, publishedHtml);

            UserLink userLink = new UserLink();

            userLink.DataBind(UserCache.GetUser(_story.UserID));
            userLink.RenderControl(writer);

            writer.WriteLine(@" {0}</div><div class=""storyActions"">", Dates.ReadableDiff(_story.CreatedOn, DateTime.Now));

            if (_story.CommentCount == 0)
            {
                writer.WriteLine("0 comments");
            }
            else if (_story.CommentCount == 1)
            {
                writer.WriteLine(@"1 comment");
            }
            else
            {
                writer.WriteLine(@"{0} comments", _story.CommentCount);
            }

            writer.WriteLine("</div></div>");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.UserProfileHeader.User            = this.UserProfile;
     this.StoryListControl.NoStoriesCaption = string.Format("{0} has not kicked any stories.", this.UrlParameters.UserIdentifier);
     this.StoryListControl.Title            = "Stories kicked by " + this.UrlParameters.UserIdentifier;
     this.StoryListControl.DataBind(StoryCache.GetUserKickedStories(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
     this.Paging.RecordCount = StoryCache.GetUserKickedStoriesCount(this.UrlParameters.UserIdentifier, this.HostProfile.HostID);
     this.Paging.PageNumber  = UrlParameters.PageNumber;
     this.Paging.PageSize    = UrlParameters.PageSize;
     this.Paging.BaseUrl     = UrlFactory.CreateUrl(this.PageName, this.UrlParameters.UserIdentifier);
 }
Beispiel #19
0
 protected void LogIn_Click(object sender, EventArgs e)
 {
     if (SecurityManager.Login(Username.Text, Password.Text, RememberMe.Checked))
     {
         Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.LoginSwitch, FormsAuthentication.GetRedirectUrl(Username.Text, RememberMe.Checked)));
     }
     else
     {
         InvalidLogin.Visible = true;
     }
 }
Beispiel #20
0
        //  Private Methods

        /// <summary>
        /// Performs the security checks.
        /// </summary>
        private void PerformSecurityChecks()
        {
            if (IsMemberPage && !IsAuthenticated)
            {
                Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.Login, Request.Url.ToString()));
            }

            if (!KickUserProfile.HasRoles(RequiredRoles))
            {
                NotAuthorisedRedirect();
            }
        }
Beispiel #21
0
        private void RenderLink(UrlFactory.PageName pageName, string caption, HtmlTextWriter writer)
        {
            string url      = UrlFactory.CreateUrl(pageName, this.KickPage.UrlParameters.UserIdentifier);
            string cssClass = "PopularStoryHeaderLink";

            if (pageName == this.KickPage.PageName)
            {
                cssClass += " PopularStoryHeaderLinkSelected";
            }

            writer.WriteLine(@"<a href=""{0}"" class=""{1}"">{2}</a>", url, cssClass, caption);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     //TODO Will need to modify the Comment & CommentList web controls to show related story
     this.UserProfileHeader.User = this.UserProfile;
     Incremental.Kick.Dal.CommentCollection commentTable = StoryCache.GetUserComments(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize);
     this.CommentList.DisplayStoryTitle = true;
     this.CommentList.DataBind(commentTable);
     this.Paging.RecordCount = StoryCache.GetUserCommentsCount(this.UrlParameters.UserIdentifier, this.HostProfile.HostID);
     this.Paging.PageNumber  = UrlParameters.PageNumber;
     this.Paging.PageSize    = UrlParameters.PageSize;
     this.Paging.BaseUrl     = UrlFactory.CreateUrl(this.PageName, this.UrlParameters.UserIdentifier);
 }
Beispiel #23
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (this.KickUserProfile.IsGeneratedPassword)
     {
         Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.ChangePassword));
     }
     else
     {
         // No need to check if the querystring parameter is null or empty
         // because if it is the root url is returned
         Response.Redirect(Request.QueryString["url"]);
     }
 }
Beispiel #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.UserProfileHeader.User            = this.UserProfile;
     this.StoryListControl.NoStoriesCaption = string.Format("Friends of {0} have not submitted any stories.", this.UrlParameters.UserIdentifier);
     this.StoryListControl.Title            = "Stories submitted by friends of " + this.UrlParameters.UserIdentifier;
     if (!this.UserProfile.Friends.Count.Equals(0))
     {
         this.StoryListControl.DataBind(StoryCache.GetFriendsSubmittedStories(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
         this.Paging.RecordCount = StoryCache.GetFriendsSubmittedStoriesCount(this.UrlParameters.UserIdentifier, this.HostProfile.HostID);
     }
     this.Paging.PageNumber = UrlParameters.PageNumber;
     this.Paging.PageSize   = UrlParameters.PageSize;
     this.Paging.BaseUrl    = UrlFactory.CreateUrl(this.PageName, this.UrlParameters.UserIdentifier);
 }
Beispiel #25
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (this._tags.Count > 0)
            {
                if (_showTagIt)
                {
                    writer.WriteLine("tags: ");
                }

                string tagClass;
                //TODO: GJ: refactor the Tag rendering as the code is duplicated
                for (int i = 0; i < this._tags.Count; i++)
                {
                    if (i % 2 == 0)
                    {
                        tagClass = "evenTag";
                    }
                    else
                    {
                        tagClass = "oddTag";
                    }

                    string tagIcons = "";
                    if (this._tags[i].IsInNamespace)
                    {
                        tagClass += " namespaceTag";

                        foreach (string tagNamespace in this._tags[i].Namespaces)
                        {
                            //tagIcons += String.Format(@"<img src=""{0}/{1}_{2}.png"" width=""16"" height=""16"" border=""0""/> ", this.KickPage.StaticIconRootUrl, tagNamespace, this._tags[i].TagName);
                            tagClass += " " + tagNamespace + "_NamespaceTag";
                        }
                    }

                    writer.Write(@"<a href=""{0}"" class=""tag {2}"" rel=""tag"">{3}{1}</a>",
                                 UrlFactory.CreateUrl(UrlFactory.PageName.ViewTag, HttpUtility.UrlEncode(this._tags[i].TagIdentifier)), this._tags[i].TagName, tagClass, tagIcons);

                    if (i < this._tags.Count - 1)
                    {
                        writer.Write(", ");
                    }
                }
            }

            if (_showTagIt)
            {
                writer.WriteLine(@" | <a href=""javascript:ToggleStoryTags({0});""><strong>tag it</strong></a>", this._storyID);
            }
        }
Beispiel #26
0
        protected void Page_Init(object sender, EventArgs e)
        {
            this.Title    = this.HostProfile.SiteTitle + " - " + this.HostProfile.TagLine + ".";
            this.Caption  = "Latest popular stories";
            this.PageName = UrlFactory.PageName.Home;

            if (string.IsNullOrEmpty(this.HostProfile.FeedBurnerMainRssFeedUrl))
            {
                this.RssFeedUrl = UrlFactory.CreateUrl(UrlFactory.PageName.HomeRss);
            }
            else
            {
                this.RssFeedUrl = this.HostProfile.FeedBurnerMainRssFeedUrl;
            }
        }
Beispiel #27
0
        protected void TestMe_Click(object sender, EventArgs e)
        {
            Message.Text = "";

            List <string> answers = new List <string>();

            foreach (ListItem item in checkboxList.Items)
            {
                if (item.Selected)
                {
                    answers.Add(item.Value);
                }
            }

            bool isCorrect = true;

            if (answers.Count != 5)
            {
                Message.Text = "Please select 5 answers";
                isCorrect    = false;
            }
            else
            {
                List <string> correctAnswers = new List <string>();
                correctAnswers.Add("enum");
                correctAnswers.Add("private");
                correctAnswers.Add("namespace");
                correctAnswers.Add("class");
                correctAnswers.Add("decimal");

                foreach (string correctAnswer in correctAnswers)
                {
                    if (!answers.Contains(correctAnswer))
                    {
                        Message.Text = "Incorrect Answers";
                        isCorrect    = false;
                    }
                }

                if (isCorrect)
                {
                    UserBR.UserPassedTest(this.KickUserProfile, this.HostProfile);

                    Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.SubmitStory));
                }
            }
        }
        public static RssChannel ConvertToRssChannel(StoryCollection stories, string title, string description, string link, Host host)
        {
            RssChannel channel = new RssChannel();

            channel.Title       = title;
            channel.Description = description;
            channel.Link        = new System.Uri(link);
            channel.Language    = "en-us";
            channel.Generator   = host.SiteTitle + " - " + host.TagLine;
            channel.Docs        = "";
            channel.TimeToLive  = 30;
            channel.Copyright   = "Atweb Publishing Ltd.";

            if (stories.Count == 0)
            {
                RssItem item = new RssItem();
                item.Title       = " ";
                item.Description = " ";
                item.PubDate     = DateTime.Now.ToUniversalTime();

                channel.Items.Add(item);
            }
            else
            {
                foreach (Story story in stories)
                {
                    string storyUrl = host.RootUrl + UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, story.StoryIdentifier, CategoryCache.GetCategory(story.CategoryID, host.HostID).CategoryIdentifier);

                    //TODO: GJ: add category info

                    RssItem item = new RssItem();
                    item.Title       = story.Title;
                    item.Description = story.Description + " <br /><br /><br />" + Incremental.Common.Web.Helpers.ControlHelper.RenderControl(new Incremental.Kick.Web.Controls.StoryDynamicImage(story.Url, host));
                    item.PubDate     = story.PublishedOn.ToUniversalTime();
                    RssGuid guid = new RssGuid();
                    guid.Name      = storyUrl;
                    guid.PermaLink = true;
                    item.Guid      = guid;
                    item.Link      = new Uri(storyUrl);

                    channel.Items.Add(item);
                }
            }

            return(channel);
        }
Beispiel #29
0
 /// <summary>
 /// Renders the list of years.
 /// </summary>
 /// <param name="writer">The writer.</param>
 private void RenderListOfYears(HtmlTextWriter writer)
 {
     writer.RenderBeginTag(HtmlTextWriterTag.Ul);
     //each month of that year
     for (int y = this.MinimumDate.Year; y <= DateTime.Now.Year; y++)
     {
         writer.RenderBeginTag(HtmlTextWriterTag.Li);
         string yearUrl = UrlFactory.CreateUrl(UrlFactory.PageName.Zeitgeist, y.ToString());
         writer.WriteBeginTag("a");
         writer.WriteAttribute("href", yearUrl);
         writer.Write(HtmlTextWriter.TagRightChar);
         writer.Write(y);
         writer.WriteEndTag("a");
         writer.RenderEndTag(); //li year
     }
     writer.RenderEndTag();     //ul year
 }
Beispiel #30
0
        /// <summary>
        /// Renders the user list items.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="users">The users.</param>
        /// <param name="title">The title.</param>
        /// <param name="itemType">Type of the item.</param>
        private void RenderUserListItems(HtmlTextWriter writer, Dictionary <string, int> users, string title, string itemType)
        {
            //render top 10 lists
            writer.RenderBeginTag(HtmlTextWriterTag.H3);
            writer.Write(title);
            writer.Write(" for ");

            if (Month == null)
            {
                writer.Write(Year);
            }
            else if (Day == null)
            {
                writer.Write(new DateTime(Year.Value, Month.Value, 1).ToString("MMMM yyyy"));
            }
            else
            {
                writer.Write(new DateTime(Year.Value, Month.Value, Day.Value).ToString("MMMM d, yyyy"));
            }
            writer.RenderEndTag();

            //just plain OL with tag links
            writer.RenderBeginTag(HtmlTextWriterTag.Ol);
            foreach (KeyValuePair <string, int> kvp in users)
            {
                string userUrl = UrlFactory.CreateUrl(UrlFactory.PageName.UserHome,
                                                      kvp.Key);
                writer.RenderBeginTag(HtmlTextWriterTag.Li);
                writer.WriteBeginTag("a");
                writer.WriteAttribute("href", userUrl);
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Write(kvp.Key);
                writer.WriteEndTag("a");
                writer.Write(" (" + SubSonic.Sugar.Strings.Pluralize(kvp.Value, itemType) + ")");
                writer.RenderEndTag();
            }
            writer.RenderEndTag();

            if (users.Count.Equals(0))
            {
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(this.NoDataCaption);
                writer.RenderEndTag();
            }
        }