Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _forumManager = UserControls.Forum.Common.ForumManager.GetSettings(ForumManager.Settings.ID).ForumManager;

            ForumManager.Instance.SetCurrentPage(ForumPage.PostList);

            var idTopic = 0;
            if (!String.IsNullOrEmpty(Request["t"]))
            {
                try
                {
                    idTopic = Convert.ToInt32(Request["t"]);
                }
                catch
                {
                    idTopic = 0;
                }
            }
            if (idTopic == 0)
                Response.Redirect("default.aspx");


            var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, idTopic);
            if (topic == null)
                Response.Redirect("default.aspx");

            Topic = topic;

            var postListControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/PostListControl.ascx") as PostListControl;
            postListControl.SettingsID = ForumManager.Settings.ID;
            postListControl.Topic = topic;
            postListHolder.Controls.Add(postListControl);
            Utility.RegisterTypeForAjax(typeof (TopicControl), Page);
            Utility.RegisterTypeForAjax(typeof (Subscriber));
            var subscriber = new Subscriber();

            var isTopicSubscribe = subscriber.IsTopicSubscribe(topic.ID);
            var SubscribeTopicLink = subscriber.RenderTopicSubscription(!isTopicSubscribe, topic.ID);

            //master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, topic.ThreadID)));
            //master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderTopicSubscription(!isTopicSubscribe, topic.ID)));

            ForumPageParentTitle = topic.ThreadTitle;
            ForumPageParentIn = CommunityResource.InForParentPage;
            ForumPageParentURL = "topics.aspx?f=" + topic.ThreadID.ToString();
            ForumPageTitle = topic.Title;
            Title = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption ?? Resources.ForumResource.AddonName);
            SubscribeStatus = isTopicSubscribe ? "subscribed" : "unsubscribed";

            RenderModeratorFunctionsHeader();

            SubscribeLinkBlock.Text = SubscribeTopicLink;
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumManager.Instance.SetCurrentPage(ForumPage.TopicList);

            int idThread;
            if (!int.TryParse(Request["f"], out idThread))
                Response.Redirect("default.aspx");

            var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, idThread);

            if (thread == null)
                Response.Redirect("default.aspx");

            if (thread.TopicCount > 0)
            {
                var topicsControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/TopicListControl.ascx") as UserControls.Forum.TopicListControl;
                topicsControl.SettingsID = ForumManager.Settings.ID;
                topicsControl.ThreadID = thread.ID;
                topicsHolder.Controls.Add(topicsControl);
            }
            else
            {
                var emptyScreenControl = new EmptyScreenControl
                                             {
                                                 ImgSrc = WebImageSupplier.GetAbsoluteWebPath("forums_icon.png", ForumManager.Settings.ModuleID),
                                                 Header = Resources.ForumResource.EmptyScreenTopicCaption,
                                                 Describe = Resources.ForumResource.EmptyScreenTopicText,
                                                 ButtonHTML = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.TopicCreate, thread) ? String.Format("<a class='linkAddMediumText' href='newpost.aspx?f=" + thread.ID + "&m=0'>{0}</a>", Resources.ForumResource.EmptyScreenTopicLink) : String.Empty
                                             };

                topicsHolder.Controls.Add(emptyScreenControl);
            }

            Utility.RegisterTypeForAjax(typeof (Subscriber));
            var subscriber = new Subscriber();

            var isThreadSubscribe = subscriber.IsThreadSubscribe(thread.ID);

            var master = Master as ForumMasterPage;
            master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID)));

            //bread crumbs
            var breadCrumbs = (Master as ForumMasterPage).BreadCrumbs;
            breadCrumbs.Add(new BreadCrumb {Caption = Resources.ForumResource.ForumsBreadCrumbs, NavigationUrl = "default.aspx"});
            breadCrumbs.Add(new BreadCrumb {Caption = thread.Title});

            Title = HeaderStringHelper.GetPageTitle(Resources.ForumResource.AddonName, breadCrumbs);
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {            
            ForumManager.Instance.SetCurrentPage(ForumPage.PostList);               
           
            int idTopic = 0;            
            if (!String.IsNullOrEmpty(Request["t"]))
            {
                try
                {
                    idTopic = Convert.ToInt32(Request["t"]);
                }
                catch { idTopic = 0; }
            }
            if (idTopic == 0)
                Response.Redirect("default.aspx");
            

            var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, idTopic);
            if (topic == null)
                Response.Redirect("default.aspx");

            var postListControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/PostListControl.ascx") as PostListControl;
            postListControl.SettingsID = ForumManager.Settings.ID;
            postListControl.Topic = topic;
            this.postListHolder.Controls.Add(postListControl);
            
            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber = new Subscriber();

            var isThreadSubscribe = subscriber.IsThreadSubscribe(topic.ThreadID);

            var isTopicSubscribe = subscriber.IsTopicSubscribe(topic.ID);

            var master = this.Master as ForumMasterPage;
            master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, topic.ThreadID)));
            master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderTopicSubscription(!isTopicSubscribe, topic.ID)));
            
            var breadCrumbs = (this.Master as ForumMasterPage).BreadCrumbs;
            breadCrumbs.Add(new BreadCrumb() { Caption = Resources.ForumResource.ForumsBreadCrumbs, NavigationUrl = "default.aspx" });
            breadCrumbs.Add(new BreadCrumb() { Caption = topic.ThreadTitle, NavigationUrl = "topics.aspx?f=" + topic.ThreadID.ToString() });
            breadCrumbs.Add(new BreadCrumb() { Caption = topic.Title });

            this.Title = HeaderStringHelper.GetPageTitle(Resources.ForumResource.AddonName, breadCrumbs);
        }        
Example #4
0
        protected void SetNavigation()
        {
            var currentModule = UserOnlineManager.Instance.GetCurrentModule() as Module;
            if (currentModule == null) return;

            var actionsControl = new SideActions();

            if (ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null))
            {
                _forumMakerHolder.Controls.Add(LoadControl(ForumMaker.Location));
                string actionURL = "";
                if (this.Page is ASC.Web.Community.Forum.Default)
                    actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog(false,'window.location.reload(true)');";

                else if (this.Page is ManagementCenter)
                {
                    if (String.IsNullOrEmpty(Request["type"]) || Request["type"] == "0")
                        actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog(true);";

                    else
                        actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog();";
                }

                else
                    actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog();";


                actionsControl.Controls.Add(new NavigationItem()
                {
                    Name = Resources.ForumResource.AddThreadCategoryButton,
                    Description = "",
                    URL = actionURL,
                    IsPromo = (SetupInfo.WorkMode == WorkMode.Promo)
                });

            }

            if (currentModule.Actions.Any() || ActionsPlaceHolder.Controls.Count > 0)
            {
                foreach (var shortcut in currentModule.Actions)
                {
                    actionsControl.Controls.Add(new NavigationItem()
                    {
                        Name = shortcut.Name,
                        Description = shortcut.Description,
                        URL = shortcut.StartURL,
                        IsPromo = (SetupInfo.WorkMode == WorkMode.Promo)
                    });
                }

            }

            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber = new Subscriber();
            var isNewTopicSubscribe = subscriber.IsNewTopicSubscribe();
            this.ActionsPlaceHolder.Controls.AddAt(0, new HtmlMenuItem(subscriber.RenderNewTopicSubscription(!isNewTopicSubscribe)));

            if (ActionsPlaceHolder.Controls.Count > 0)
                actionsControl.Controls.Add(ActionsPlaceHolder);

            if (actionsControl.Controls.Count > 0)
                _actionHolder.Controls.Add(actionsControl);

            if (currentModule.Navigations.Any())
            {
                var navigationControl = new SideNavigator();
                foreach (var shortcut in currentModule.Navigations)
                {
                    navigationControl.Controls.Add(new NavigationItem()
                    {
                        Name = shortcut.Name,
                        Description = shortcut.Description,
                        URL = shortcut.StartURL
                    });
                }

                _actionHolder.Controls.Add(navigationControl);
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumManager.Instance.SetCurrentPage(ForumPage.TopicList);
            Utility.RegisterTypeForAjax(typeof(ForumEditor), this.Page);
            int idThread;
            if (!int.TryParse(Request["f"], out idThread))
                Response.Redirect("default.aspx");

            var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, idThread);

            if (thread == null)
                Response.Redirect("default.aspx");

            if (thread.TopicCount > 0)
            {
                var topicsControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/TopicListControl.ascx") as UserControls.Forum.TopicListControl;
                topicsControl.SettingsID = ForumManager.Settings.ID;
                topicsControl.ThreadID = thread.ID;
                topicsHolder.Controls.Add(topicsControl);
            }
            else
            {
                var emptyScreenControl = new EmptyScreenControl
                    {
                        ImgSrc = WebImageSupplier.GetAbsoluteWebPath("forums_icon.png", ForumManager.Settings.ModuleID),
                        Header = Resources.ForumResource.EmptyScreenTopicCaption,
                        Describe = Resources.ForumResource.EmptyScreenTopicText,
                        ButtonHTML = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.TopicCreate, thread) ? String.Format("<a class='link underline blue plus' href='newpost.aspx?f=" + thread.ID + "&m=0'>{0}</a>", Resources.ForumResource.EmptyScreenTopicLink) : String.Empty
                    };

                topicsHolder.Controls.Add(emptyScreenControl);
            }

            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber = new Subscriber();

            var isThreadSubscribe = subscriber.IsThreadSubscribe(thread.ID);
            var subscribeThreadLink = subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID);
            SubscribeLinkBlock.Text = subscribeThreadLink;

            //var master = Master as ForumMasterPage;
            //     master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID)));

            ForumTitle = thread.Title;
            ForumParentTitle = Resources.ForumResource.ForumsBreadCrumbs;
            ForumParentURL = "default.aspx";

            Title = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption ?? Resources.ForumResource.AddonName);
            EnableDelete = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null);
            var sb = new StringBuilder();
            sb.Append("<div id=\"forumsActionsMenuPanel\" class=\"studio-action-panel topics\">");
            sb.Append("<div class=\"corner-top left\"></div>");
            sb.Append("<ul class=\"dropdown-content\">");
            if (EnableDelete)
            {
                sb.Append("<li><a class=\"dropdown-item\" href=\"javascript:ForumMakerProvider.DeleteThreadTopic('" + thread.ID + "','" + thread.CategoryID + "');\">" + Resources.ForumResource.DeleteButton + "</a></li>");
            }
            sb.Append("</ul>");
            sb.Append("</div>");
            topicsHolder.Controls.Add(new Literal { Text = sb.ToString() });

            SubscribeStatus = isThreadSubscribe ? "subscribed" : "unsubscribed";
        }
Example #6
0
        protected void SetNavigation()
        {
            var currentModule = UserOnlineManager.Instance.GetCurrentModule() as Module;

            if (currentModule == null)
            {
                return;
            }

            var actionsControl = new SideActions();

            if (ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null))
            {
                _forumMakerHolder.Controls.Add(LoadControl(ForumMaker.Location));
                string actionURL = "";
                if (this.Page is ASC.Web.Community.Forum.Default)
                {
                    actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog(false,'window.location.reload(true)');";
                }

                else if (this.Page is ManagementCenter)
                {
                    if (String.IsNullOrEmpty(Request["type"]) || Request["type"] == "0")
                    {
                        actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog(true);";
                    }

                    else
                    {
                        actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog();";
                    }
                }

                else
                {
                    actionURL = "javascript:ForumMakerProvider.ShowForumMakerDialog();";
                }


                actionsControl.Controls.Add(new NavigationItem()
                {
                    Name        = Resources.ForumResource.AddThreadCategoryButton,
                    Description = "",
                    URL         = actionURL,
                    IsPromo     = (SetupInfo.WorkMode == WorkMode.Promo)
                });
            }

            if (currentModule.Actions.Any() || ActionsPlaceHolder.Controls.Count > 0)
            {
                foreach (var shortcut in currentModule.Actions)
                {
                    actionsControl.Controls.Add(new NavigationItem()
                    {
                        Name        = shortcut.Name,
                        Description = shortcut.Description,
                        URL         = shortcut.StartURL,
                        IsPromo     = (SetupInfo.WorkMode == WorkMode.Promo)
                    });
                }
            }

            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber          = new Subscriber();
            var isNewTopicSubscribe = subscriber.IsNewTopicSubscribe();

            this.ActionsPlaceHolder.Controls.AddAt(0, new HtmlMenuItem(subscriber.RenderNewTopicSubscription(!isNewTopicSubscribe)));

            if (ActionsPlaceHolder.Controls.Count > 0)
            {
                actionsControl.Controls.Add(ActionsPlaceHolder);
            }

            if (actionsControl.Controls.Count > 0)
            {
                _actionHolder.Controls.Add(actionsControl);
            }

            if (currentModule.Navigations.Any())
            {
                var navigationControl = new SideNavigator();
                foreach (var shortcut in currentModule.Navigations)
                {
                    navigationControl.Controls.Add(new NavigationItem()
                    {
                        Name        = shortcut.Name,
                        Description = shortcut.Description,
                        URL         = shortcut.StartURL
                    });
                }

                _actionHolder.Controls.Add(navigationControl);
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _forumManager = ForumManager.Settings.ForumManager;

            ForumManager.Instance.SetCurrentPage(ForumPage.PostList);

            var idTopic = 0;

            if (!String.IsNullOrEmpty(Request["t"]))
            {
                try
                {
                    idTopic = Convert.ToInt32(Request["t"]);
                }
                catch
                {
                    idTopic = 0;
                }
            }
            if (idTopic == 0)
            {
                Response.Redirect("Default.aspx");
            }


            var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, idTopic);

            if (topic == null)
            {
                Response.Redirect("Default.aspx");
            }

            Topic = topic;

            var postListControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/PostListControl.ascx") as PostListControl;

            postListControl.SettingsID    = ForumManager.Settings.ID;
            postListControl.Topic         = topic;
            postListControl.PaggingHolder = PagingHolder;
            postListHolder.Controls.Add(postListControl);
            Utility.RegisterTypeForAjax(typeof(TopicControl), Page);
            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber = new Subscriber();

            var isTopicSubscribe   = subscriber.IsTopicSubscribe(topic.ID);
            var SubscribeTopicLink = subscriber.RenderTopicSubscription(!isTopicSubscribe, topic.ID);

            //master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, topic.ThreadID)));
            //master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderTopicSubscription(!isTopicSubscribe, topic.ID)));

            ForumPageParentTitle = topic.ThreadTitle;
            ForumPageParentIn    = CommunityResource.InForParentPage;
            ForumPageParentURL   = "topics.aspx?f=" + topic.ThreadID.ToString();
            ForumPageTitle       = topic.Title;
            Title           = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption ?? Resources.ForumResource.AddonName);
            SubscribeStatus = isTopicSubscribe ? "subscribed" : "unsubscribed";

            RenderModeratorFunctionsHeader();

            SubscribeLinkBlock.Text = SubscribeTopicLink;
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumManager.Instance.SetCurrentPage(ForumPage.TopicList);
            Utility.RegisterTypeForAjax(typeof(ForumEditor), this.Page);
            int idThread;

            if (!int.TryParse(Request["f"], out idThread))
            {
                Response.Redirect("default.aspx");
            }

            var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, idThread);

            if (thread == null)
            {
                Response.Redirect("default.aspx");
            }

            if (thread.TopicCount > 0)
            {
                var topicsControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/TopicListControl.ascx") as UserControls.Forum.TopicListControl;
                topicsControl.SettingsID = ForumManager.Settings.ID;
                topicsControl.ThreadID   = thread.ID;
                topicsHolder.Controls.Add(topicsControl);
            }
            else
            {
                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("forums_icon.png", ForumManager.Settings.ModuleID),
                    Header     = Resources.ForumResource.EmptyScreenTopicCaption,
                    Describe   = Resources.ForumResource.EmptyScreenTopicText,
                    ButtonHTML = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.TopicCreate, thread) ? String.Format("<a class='link underline blue plus' href='newpost.aspx?f=" + thread.ID + "&m=0'>{0}</a>", Resources.ForumResource.EmptyScreenTopicLink) : String.Empty
                };

                topicsHolder.Controls.Add(emptyScreenControl);
            }

            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber = new Subscriber();

            var isThreadSubscribe   = subscriber.IsThreadSubscribe(thread.ID);
            var subscribeThreadLink = subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID);

            SubscribeLinkBlock.Text = subscribeThreadLink;

            //var master = Master as ForumMasterPage;
            //     master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID)));

            ForumTitle       = thread.Title;
            ForumParentTitle = Resources.ForumResource.ForumsBreadCrumbs;
            ForumParentURL   = "default.aspx";

            Title        = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption ?? Resources.ForumResource.AddonName);
            EnableDelete = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null);
            var sb = new StringBuilder();

            sb.Append("<div id=\"forumsActionsMenuPanel\" class=\"studio-action-panel topics\">");
            sb.Append("<ul class=\"dropdown-content\">");
            if (EnableDelete)
            {
                sb.Append("<li><a class=\"dropdown-item\" href=\"javascript:ForumMakerProvider.DeleteThreadTopic('" + thread.ID + "','" + thread.CategoryID + "');\">" + Resources.ForumResource.DeleteButton + "</a></li>");
            }
            sb.Append("</ul>");
            sb.Append("</div>");
            topicsHolder.Controls.Add(new Literal {
                Text = sb.ToString()
            });

            SubscribeStatus = isThreadSubscribe ? "subscribed" : "unsubscribed";
        }