Пример #1
0
        public ForumModule(ISessionManager sessionManager)
        {
            _sessionManager = sessionManager;

            this._currentAction = ForumModuleAction.ForumList;

            _categorySortBy			= CategorySortBy.Name;
            _forumSortBy			= ForumSortBy.Name;
            _forumPostSortBy		= ForumPostSortBy.DateCreated;
            _categorySortASC = true;
            _forumSortASC = true;
            _forumPostSortASC = true;

            this._forumthemepath = UrlHelper.GetApplicationPath() + "Modules/Forum/Images/Standard/";
        }
Пример #2
0
        /// <summary>
        /// Override ParsePathInfo to determine action and optional parameters.
        /// </summary>
        protected override void ParsePathInfo()
        {
            base.ParsePathInfo();
            if (base.ModuleParams.Length > 0)
            {
                // First pathinfo parameter is the module action.
                try
                {
                    this._currentAction = (ForumModuleAction)Enum.Parse(typeof(ForumModuleAction), base.ModuleParams[0], true);

                    switch(this._currentAction)
                    {
                        case ForumModuleAction.ForumCategoryList:
                            this.CurrentForumCategoryId = Int32.Parse(base.ModuleParams[1]);
                            break;

                        case ForumModuleAction.ForumView:
                            this.CurrentForumId = Int32.Parse(base.ModuleParams[1]);
                            break;

                        case ForumModuleAction.ForumNewPost:
                            this.CurrentForumId = Int32.Parse(base.ModuleParams[1]);
                            break;

                        case ForumModuleAction.ForumViewPost:
                            this.CurrentForumId		= Int32.Parse(base.ModuleParams[1]);
                            this.CurrentForumPostId	= Int32.Parse(base.ModuleParams[3]);

                            if(base.ModuleParams.Length > 5 && base.ModuleParams[4] == "Download")
                            {
                                this.DownloadId	= Int32.Parse(base.ModuleParams[5]);
                            }

                            break;

                        case ForumModuleAction.ForumReplyPost:
                            this.CurrentForumId		= Int32.Parse(base.ModuleParams[1]);
                            this.CurrentForumPostId	= Int32.Parse(base.ModuleParams[3]);
                            this.OrigForumPostId	= Int32.Parse(base.ModuleParams[3]);
                            this.QuotePost = 0;
                            break;

                        case ForumModuleAction.ForumReplyPostQuote:
                            this.CurrentForumId		= Int32.Parse(base.ModuleParams[1]);
                            this.CurrentForumPostId	= Int32.Parse(base.ModuleParams[3]);
                            this.OrigForumPostId	= Int32.Parse(base.ModuleParams[5]);
                            this.QuotePost = 1;
                            this._currentAction = ForumModuleAction.ForumReplyPost;
                            break;

                        case ForumModuleAction.ForumProfile:
                        case ForumModuleAction.ForumViewProfile:
                            this.CurrentUserId	= Int32.Parse(base.ModuleParams[1]);
                            break;
                    }
                }
                catch (ArgumentException ex)
                {
                    throw new Exception("Error when parsing module action: " + base.ModuleParams[0], ex);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error when parsing module parameters: " + base.ModulePathInfo, ex);
                }
            }
        }