Exemplo n.º 1
0
 private void topics_Unload(object sender, System.EventArgs e)
 {
     if (Mession.UnreadTopics == 0)
     {
         Mession.SetForumRead(PageContext.PageForumID, DateTime.Now);
     }
 }
Exemplo n.º 2
0
        protected string GetForumIcon(object o)
        {
            DataRow  row        = ( DataRow )o;
            bool     locked     = ( bool )row ["Locked"];
            DateTime lastRead   = Mession.GetForumRead(( int )row ["ForumID"]);
            DateTime lastPosted = row ["LastPosted"] != DBNull.Value ? ( DateTime )row ["LastPosted"] : lastRead;

            string img, imgTitle;

            try
            {
                if (locked)
                {
                    img      = GetThemeContents("ICONS", "FORUM_LOCKED");
                    imgTitle = GetText("ICONLEGEND", "Forum_Locked");
                }
                else if (lastPosted > lastRead)
                {
                    img      = GetThemeContents("ICONS", "FORUM_NEW");
                    imgTitle = GetText("ICONLEGEND", "New_Posts");
                }
                else
                {
                    img      = GetThemeContents("ICONS", "FORUM");
                    imgTitle = GetText("ICONLEGEND", "No_New_Posts");
                }
            }
            catch (Exception)
            {
                img      = GetThemeContents("ICONS", "FORUM");
                imgTitle = GetText("ICONLEGEND", "No_New_Posts");
            }

            return(String.Format("<img src=\"{0}\" alt=\"{1}\" title=\"{1}\"/>", img, imgTitle));
        }
Exemplo n.º 3
0
        protected void SubforumList_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRow  row        = ( DataRow )e.Item.DataItem;
                DateTime lastRead   = Mession.GetForumRead(( int )row ["ForumID"]);
                DateTime lastPosted = row ["LastPosted"] != DBNull.Value ? ( DateTime )row ["LastPosted"] : lastRead;

                ThemeImage subForumIcon = e.Item.FindControl("ThemeSubforumIcon") as ThemeImage;

                subForumIcon.ThemeTag           = "SUBFORUM";
                subForumIcon.LocalizedTitlePage = "ICONLEGEND";
                subForumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";

                try
                {
                    if (lastPosted > lastRead)
                    {
                        subForumIcon.ThemeTag           = "SUBFORUM_NEW";
                        subForumIcon.LocalizedTitlePage = "ICONLEGEND";
                        subForumIcon.LocalizedTitleTag  = "NEW_POSTS";
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 4
0
        private void bt3_Click(object sender, EventArgs e)
        {
            SlidePanel.Height = bt3.Height;
            SlidePanel.Top    = bt3.Top;
            var ms = new Mession();

            ms.RefToHome = this;
            this.Visible = false;
            this.Hide();

            ms.Show();
        }
Exemplo n.º 5
0
        protected void ForumList1_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRow    row        = ( DataRow )e.Item.DataItem;
                ForumFlags flags      = new ForumFlags(row["Flags"]);
                DateTime   lastRead   = Mession.GetForumRead(( int )row ["ForumID"]);
                DateTime   lastPosted = row ["LastPosted"] != DBNull.Value ? ( DateTime )row ["LastPosted"] : lastRead;

                ThemeImage forumIcon = e.Item.FindControl("ThemeForumIcon") as ThemeImage;

                forumIcon.ThemeTag           = "FORUM";
                forumIcon.LocalizedTitlePage = "ICONLEGEND";
                forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";

                try
                {
                    if (flags.IsLocked)
                    {
                        forumIcon.ThemeTag           = "FORUM_LOCKED";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "FORUM_LOCKED";
                    }
                    else if (lastPosted > lastRead)
                    {
                        forumIcon.ThemeTag           = "FORUM_NEW";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "NEW_POSTS";
                    }
                    else
                    {
                        forumIcon.ThemeTag           = "FORUM";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";
                    }
                }
                catch
                {
                }

                if (!PageContext.BoardSettings.ShowModeratorList)
                {
                    // hide moderator list...
                    HtmlTableCell      moderatorColumn = e.Item.FindControl("ModeratorListTD") as HtmlTableCell;
                    ForumModeratorList modList         = e.Item.FindControl("ModeratorList") as ForumModeratorList;

                    // set them as invisible...
                    moderatorColumn.Visible = false;
                    modList.Visible         = false;
                }
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _quickReplyEditor.BaseDir    = YafForumInfo.ForumRoot + "editors";
            _quickReplyEditor.StyleSheet = YafBuildLink.ThemeFile("theme.css");

            _topic = YAF.Classes.Data.DB.topic_info(PageContext.PageTopicID);

            // in case topic is deleted or not existant
            if (_topic == null)
            {
                YafBuildLink.Redirect(ForumPages.info, "i=6");                  // invalid argument message
            }
            // get topic flags
            _topicFlags = new TopicFlags(_topic["Flags"]);

            using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID))
                _forum = dt.Rows [0];

            _forumFlags = new ForumFlags(_forum["Flags"]);

            if (!PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            #region Initial Setup
            if (!IsPostBack)
            {
                if (PageContext.Settings.LockedForum == 0)
                {
                    PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
                    PageLinks.AddLink(PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID));
                }

                QuickReply.Text         = GetText("POSTMESSAGE", "SAVE");
                DataPanel1.TitleText    = GetText("QUICKREPLY");
                DataPanel1.ExpandText   = GetText("QUICKREPLY_SHOW");
                DataPanel1.CollapseText = GetText("QUICKREPLY_HIDE");

                PageLinks.AddForumLinks(PageContext.PageForumID);
                PageLinks.AddLink(General.BadWordReplace(Server.HtmlDecode(PageContext.PageTopicName)), "");

                TopicTitle.Text = General.BadWordReplace(( string )_topic ["Topic"]);

                ViewOptions.Visible     = PageContext.BoardSettings.AllowThreaded;
                ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;

                RssTopic.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg={0}&t={1}", Request.QueryString ["g"], PageContext.PageTopicID);
                RssTopic.Visible     = PageContext.BoardSettings.ShowRSSLink;

                QuickReplyPlaceHolder.Visible = PageContext.BoardSettings.ShowQuickAnswer;

                if ((PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests) ||
                    (PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded))
                {
                    Session ["CaptchaImageText"] = General.GetCaptchaString();
                    imgCaptcha.ImageUrl          = String.Format("{0}resource.ashx?c=1", YafForumInfo.ForumRoot);
                    CaptchaDiv.Visible           = true;
                }

                if (!PageContext.ForumPostAccess || (_forumFlags.IsLocked && !PageContext.ForumModeratorAccess))
                {
                    NewTopic1.Visible = false;
                    NewTopic2.Visible = false;
                }

                // Ederon : 9/9/2007 - moderators can relpy in locked topics
                if (!PageContext.ForumReplyAccess ||
                    ((_topicFlags.IsLocked || _forumFlags.IsLocked) && !PageContext.ForumModeratorAccess))
                {
                    PostReplyLink1.Visible        = PostReplyLink2.Visible = false;
                    QuickReplyPlaceHolder.Visible = false;
                }

                if (PageContext.ForumModeratorAccess)
                {
                    MoveTopic1.Visible = true;
                    MoveTopic2.Visible = true;
                }
                else
                {
                    MoveTopic1.Visible = false;
                    MoveTopic2.Visible = false;
                }

                if (!PageContext.ForumModeratorAccess)
                {
                    LockTopic1.Visible   = false;
                    UnlockTopic1.Visible = false;
                    DeleteTopic1.Visible = false;
                    LockTopic2.Visible   = false;
                    UnlockTopic2.Visible = false;
                    DeleteTopic2.Visible = false;
                }
                else
                {
                    LockTopic1.Visible   = !_topicFlags.IsLocked;
                    UnlockTopic1.Visible = !LockTopic1.Visible;
                    LockTopic2.Visible   = LockTopic1.Visible;
                    UnlockTopic2.Visible = !LockTopic2.Visible;
                }

                // handle custom BBCode javascript or CSS...
                BBCode.RegisterCustomBBCodePageElements(Page, this.GetType());
            }
            #endregion

            // Mark topic read
            Mession.SetTopicRead(PageContext.PageTopicID, DateTime.Now);

            BindData();
        }
Exemplo n.º 7
0
 private void MarkRead_Click(object sender, System.EventArgs e)
 {
     Mession.SetForumRead(PageContext.PageForumID, DateTime.Now);
     BindData();
 }
Exemplo n.º 8
0
        void ForumLastPost_PreRender(object sender, EventArgs e)
        {
            if (DataRow != null)
            {
                if (int.Parse(DataRow ["ReadAccess"].ToString()) == 0)
                {
                    TopicInPlaceHolder.Visible = false;
                }

                if (DataRow ["LastPosted"] != DBNull.Value)
                {
                    LastPosted.Text          = YafDateTime.FormatDateTimeTopic(DataRow ["LastPosted"]);
                    topicLink.NavigateUrl    = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "t={0}", DataRow ["LastTopicID"]);
                    topicLink.Text           = General.Truncate(General.BadWordReplace(DataRow ["LastTopicName"].ToString()), 50);
                    ProfileUserLink.UserID   = Convert.ToInt32(DataRow ["LastUserID"]);
                    ProfileUserLink.UserName = DataRow ["LastUser"].ToString();

                    LastTopicImgLink.ToolTip     = PageContext.Localization.GetText("GO_LAST_POST");
                    LastTopicImgLink.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "m={0}#post{0}", DataRow ["LastMessageID"]);
                    Icon.ThemeTag = (DateTime.Parse(Convert.ToString(DataRow ["LastPosted"])) > Mession.GetTopicRead(( int )DataRow ["LastTopicID"])) ? "ICON_NEWEST" : "ICON_LATEST";

                    LastPostedHolder.Visible = true;
                    NoPostsLabel.Visible     = false;
                }
                else
                {
                    // show "no posts"
                    LastPostedHolder.Visible = false;
                    NoPostsLabel.Visible     = true;
                }
            }
        }