示例#1
0
        public string RemoveComment(string commentId, string pid)
        {
            var storage = FeedStorageFactory.Create();
            var comment = storage.GetFeedComment(long.Parse(commentId, CultureInfo.CurrentCulture));

            if (!CommunitySecurity.CheckPermissions(comment, NewsConst.Action_Edit))
            {
                return(null);
            }

            comment.Inactive = true;
            storage.RemoveFeedComment(comment);
            return(commentId);
        }
示例#2
0
        protected void wikiEditPage_WikiPageLoaded(bool isNew, IWikiObjectOwner owner)
        {
            if (!isNew)
            {
                _wikiObjOwner = owner;
            }

            if ((isNew && !CommunitySecurity.CheckPermissions(Common.Constants.Action_AddPage))
                ||
                (!isNew && !(CommunitySecurity.CheckPermissions(new WikiObjectsSecurityObject(owner), Common.Constants.Action_EditPage))))
            {
                Response.RedirectLC("Default.aspx", this);
            }
        }
示例#3
0
        private void ShowForEdit(BlogsEngine engine)
        {
            if (!IsPostBack)
            {
                var post = engine.GetPostById(new Guid(BlogId));

                InitPreviewTemplate(post);

                if (post != null && CommunitySecurity.CheckPermissions(post, Constants.Action_EditRemovePost))
                {
                    hdnUserID.Value = post.UserID.ToString();

                    if (Request.QueryString["action"] == "delete")
                    {
                        foreach (var comment in engine.GetPostComments(post.ID))
                        {
                            CommonControlsConfigurer.FCKUploadsRemoveForItem("blogs_comments", comment.ID.ToString());
                        }

                        engine.DeletePost(post);
                        CommonControlsConfigurer.FCKUploadsRemoveForItem("blogs", post.ID.ToString());
                        Response.Redirect(Constants.DefaultPageUrl);
                        return;
                    }
                    else
                    {
                        txtTitle.Text = Server.HtmlDecode(post.Title);

                        if (_mobileVer)
                        {
                            _text = post.Content;
                        }
                        else
                        {
                            FCKeditor.Value = post.Content;
                        }

                        hidBlogID.Value = post.ID.ToString();

                        LoadTags(post.TagList);
                    }
                }
                else
                {
                    Response.Redirect(Constants.DefaultPageUrl);
                    return;
                }
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UploadFileContainer.Options.IsPopup             = true;
            UploadFileContainer.Options.OnCancelButtonClick = "javascript:HideUploadFileBox();";

            CanUpload = CommunitySecurity.CheckPermissions(Community.Wiki.Common.Constants.Action_UploadFile) && !MobileDetector.IsMobile;

            if (IsPostBack)
            {
                return;
            }

            cmdFileUpload.Text       = WikiResource.cmdUpload;
            cmdFileUploadCancel.Text = WikiResource.cmdCancel;
            BindRepeater();
        }
示例#5
0
        private string PrepereEmptyString(string format, bool isFile, bool isSearchResultExists)
        {
            commentList.Visible = false;
            var mainOptions         = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant;
            var rxLinkCreatePlace   = new Regex(@"{0([\s\S]+?)}", mainOptions);
            var rxLinkSearchResult  = new Regex(@"{1([\s\S]+?)}", mainOptions);
            var rxSearchResultParth = new Regex(@"\[\[([\s\S]+?)\]\]", mainOptions);
            var result = format;

            foreach (Match match in rxLinkCreatePlace.Matches(format))
            {
                if (isFile)
                {
                    if (CommunitySecurity.CheckPermissions(Common.Constants.Action_UploadFile) && !MobileDetector.IsMobile)
                    {
                        result = result.Replace(match.Value, string.Format(@"<a href=""{0}"">{1}</a>", ActionHelper.GetEditFilePath(this.ResolveUrlLC("Default.aspx"), PageNameUtil.Decode(WikiPage)), match.Groups[1].Value));
                    }
                }
                else
                {
                    if (CommunitySecurity.CheckPermissions(Common.Constants.Action_AddPage))
                    {
                        result = result.Replace(match.Value, string.Format(@"<a href=""{0}"">{1}</a>", ActionHelper.GetEditPagePath(this.ResolveUrlLC("Default.aspx"), PageNameUtil.Decode(WikiPage)), match.Groups[1].Value));
                    }
                    else
                    {
                        result = result.Replace(match.Value, match.Groups[1].Value);
                    }
                }
            }

            if (isSearchResultExists && !isFile)
            {
                result = rxSearchResultParth.Replace(result, SearchResultParthMatchEvaluator);

                foreach (Match match in rxLinkSearchResult.Matches(format))
                {
                    result = result.Replace(match.Value, string.Format(@"<a href=""{0}"">{1}</a>", this.ResolveUrlLC(string.Format("Search.aspx?Search={0}&pn=", HttpUtility.UrlEncode(PageNameUtil.Decode(WikiPage)))), match.Groups[1].Value));
                }
            }
            else
            {
                result = rxSearchResultParth.Replace(result, string.Empty);
            }

            return(result);
        }
示例#6
0
 public NewsModule()
 {
     Context = new ModuleContext
     {
         ThemesFolderVirtualPath = "~/products/community/modules/news/app_themes",
         ImageFolder             = "newsimages",
         SmallIconFileName       = "newslogo.png",
         IconFileName            = "32x_news.png",
         SubscriptionManager     = new SubscriptionManager(),
         StatisticProvider       = new StatisticProvider(),
         UserActivityPublishers  = new List <IUserActivityPublisher> {
             new ActivityPublisher()
         },
         GetCreateContentPageAbsoluteUrl = () => CommunitySecurity.CheckPermissions(NewsConst.Action_Add) ? FeedUrls.EditNewsUrl : null,
         SearchHandler = new SearchHandler(),
     };
 }
示例#7
0
        private static void ConfigureComments(CommentsList commentList, string pageName)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.Simple     = false;
            commentList.BehaviorID = "_commentsWikiObj";

            commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(Common.Constants.Action_AddComment);

            commentList.JavaScriptAddCommentFunctionName        = "_Default.AddComment";
            commentList.JavaScriptPreviewCommentFunctionName    = "_Default.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName     = "_Default.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName     = "_Default.UpdateComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "_Default.LoadCommentText";
            commentList.FckDomainName = "wiki_comments";

            commentList.ObjectID = pageName.HtmlEncode();
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UploadFileContainer.Options.IsPopup             = true;
            UploadFileContainer.Options.OnCancelButtonClick = "javascript:HideUploadFileBox();";

            var currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            CanUpload = CommunitySecurity.CheckPermissions(Community.Wiki.Common.Constants.Action_UploadFile) && !currentUser.IsVisitor();

            if (IsPostBack)
            {
                return;
            }

            cmdFileUpload.Text       = WikiResource.cmdUpload;
            cmdFileUploadCancel.Text = WikiResource.cmdCancel;
            BindRepeater();
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            (Master as WikiMaster).GetNavigateActionsVisible += new WikiMaster.GetNavigateActionsVisibleHandle(ListFiles_GetNavigateActionsVisible);
            PageHeaderText = WikiResource.menu_ListFiles;

            cmdUploadFile.Text = cmdUploadFile_Top.Text = WikiResource.menu_AddNewFile;

            UploadFileContainer.Options.IsPopup             = true;
            UploadFileContainer.Options.OnCancelButtonClick = "javascript:HideUploadFileBox();";

            if (!IsPostBack)
            {
                cmdFileUpload.Text       = WikiResource.cmdUpload;
                cmdFileUploadCancel.Text = WikiResource.cmdCancel;
                cmdUploadFile.Visible    = cmdUploadFile_Top.Visible = CommunitySecurity.CheckPermissions(ASC.Web.Community.Wiki.Common.Constants.Action_UploadFile) && !ASC.Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(Context);
                BindRepeater();
            }
        }
示例#10
0
        private Post AddNewBlog(BlogsEngine engine)
        {
            var authorId = SecurityContext.CurrentAccount.ID;

            if (CommunitySecurity.CheckPermissions(
                    new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(authorId)),
                    Constants.Action_AddPost))
            {
                var newPost = new Post
                {
                    Content = (Request["blog_text"] ?? "")
                };

                var dateNow = ASC.Core.Tenants.TenantUtil.DateTimeNow();

                newPost.Datetime = dateNow;
                newPost.Title    = GetLimitedText(txtTitle.Text);
                newPost.UserID   = authorId;

                newPost.TagList = new List <Tag>();
                foreach (var tagName in txtTags.Text.Split(','))
                {
                    if (tagName == string.Empty || IsExistsTagName(newPost, tagName))
                    {
                        continue;
                    }

                    var tag = new Tag
                    {
                        Content = GetLimitedText(tagName.Trim())
                    };
                    newPost.TagList.Add(tag);
                }
                engine.SavePost(newPost, true, Request.Form["notify_comments"] == "on");

                CommonControlsConfigurer.FCKEditingComplete("blogs", newPost.ID.ToString(), newPost.Content, false);

                return(newPost);
            }

            Response.Redirect("AddBlog.aspx");
            return(null);
        }
示例#11
0
        private static void ConfigureComments(CommentsList commentList, int totalCount, Post postToUpdate)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(postToUpdate, Constants.Action_AddComment);
            commentList.CommentsCountTitle  = totalCount > 0 ? totalCount.ToString() : "";
            commentList.FckDomainName       = commentList.ObjectID = postToUpdate != null?postToUpdate.ID.ToString() : "";

            commentList.Simple     = false;
            commentList.BehaviorID = "commentsObj";
            commentList.JavaScriptAddCommentFunctionName        = "ViewBlog.AddComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "ViewBlog.LoadCommentBBCode";
            commentList.JavaScriptPreviewCommentFunctionName    = "ViewBlog.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName     = "ViewBlog.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName     = "ViewBlog.UpdateComment";
            commentList.FckDomainName = "blogs_comments";

            commentList.TotalCount = totalCount;
        }
示例#12
0
        private string RenderLastUpdateContent()
        {
            var widgetSettings = SettingsManager.Instance.LoadSettingsFor <PhotoManagerWidgetSettings>(SecurityContext.CurrentAccount.ID);
            var sb             = new StringBuilder();

            var           storage = StorageFactory.GetStorage();
            IList <Album> list    = storage.GetLastAlbums(widgetSettings.MaxCountLastAlbums);

            sb.Append("<div class='clearFix'>");

            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    sb.Append(GetAlbumInfo(item));
                }

                sb.Append("<div style=\"padding-top:10px;\">");
                sb.Append("<a href=\"" + VirtualPathUtility.ToAbsolute(PhotoConst.AddonPath + PhotoConst.PAGE_DEFAULT) + "\">" + PhotoManagerResource.SeeAllAlbumsLink + "</a>");
                sb.Append("</div>");
            }
            else
            {
                if (CommunitySecurity.CheckPermissions(PhotoConst.Action_AddPhoto))
                {
                    sb.Append("<div class=\"empty-widget\" style=\"padding:40px; text-align: center;\">" +
                              String.Format(PhotoManagerResource.EmptyWidgetMessage,
                                            string.Format("<div style=\"padding-top:3px;\"><a class=\"promoAction\" href=\"{0}\">", VirtualPathUtility.ToAbsolute(PhotoConst.AddonPath + PhotoConst.PAGE_ADD_PHOTO)),
                                            "</a></div>") + "</div>");
                }
                else
                {
                    sb.Append("<div class=\"empty-widget\" style=\"padding:40px; text-align: center;\">" + PhotoManagerResource.YouHaveNoPhotosTitle + "</div>");
                }
            }


            sb.Append("</div>");


            return(sb.ToString());
        }
示例#13
0
        private Post AddNewBlog(BlogsEngine engine)
        {
            Guid authorId = SecurityContext.CurrentAccount.ID;

            if (CommunitySecurity.CheckPermissions(
                    new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(authorId)),
                    ASC.Blogs.Core.Constants.Action_AddPost))
            {
                Post newPost = new Post();
                newPost.Content = _mobileVer? (Request["mobiletext"] ?? "") : FCKeditor.Value;

                DateTime dateNow = ASC.Core.Tenants.TenantUtil.DateTimeNow();

                newPost.Datetime = dateNow;
                newPost.Title    = GetLimitedText(txtTitle.Text);
                newPost.UserID   = authorId;

                newPost.TagList = new List <ASC.Blogs.Core.Domain.Tag>();
                foreach (string tagName in txtTags.Text.Split(','))
                {
                    if (tagName != string.Empty && !IsExistsTagName(newPost, tagName))
                    {
                        ASC.Blogs.Core.Domain.Tag tag = new ASC.Blogs.Core.Domain.Tag();
                        tag.Content = GetLimitedText(tagName.Trim());
                        newPost.TagList.Add(tag);
                    }
                }


                var blog = engine.EnsurePersonalBlog(authorId);
                engine.SavePost(newPost, true, Request.Form["notify_comments"] == "on");

                CommonControlsConfigurer.FCKEditingComplete("blogs", newPost.ID.ToString(), newPost.Content, false);

                return(newPost);
            }
            else
            {
                Response.Redirect("addblog.aspx");
                return(null);
            }
        }
示例#14
0
        public string UpdateComment(string commentid, string content)
        {
            if (string.IsNullOrEmpty(content))
            {
                throw new ArgumentException();
            }

            var storage = FeedStorageFactory.Create();
            var comment = storage.GetFeedComment(long.Parse(commentid, CultureInfo.CurrentCulture));

            if (!CommunitySecurity.CheckPermissions(comment, NewsConst.Action_Edit))
            {
                throw new ArgumentException();
            }

            comment.Comment = content;
            storage.UpdateFeedComment(comment);

            return(HtmlUtility.GetFull(content));
        }
示例#15
0
        public CommentInfo GetCommentInfo(Comment comment)
        {
            var info = new CommentInfo
            {
                CommentID             = comment.Id.ToString(),
                UserID                = comment.UserId,
                TimeStamp             = comment.Date,
                TimeStampStr          = comment.Date.Ago(),
                IsRead                = true,
                Inactive              = comment.Inactive,
                CommentBody           = comment.Body,
                UserFullName          = DisplayUserSettings.GetFullUserName(comment.UserId),
                UserAvatar            = GetHtmlImgUserAvatar(comment.UserId),
                IsEditPermissions     = CommunitySecurity.CheckPermissions(new WikiObjectsSecurityObject(comment), Common.Constants.Action_EditRemoveComment),
                IsResponsePermissions = true,
                UserPost              = CoreContext.UserManager.GetUsers(comment.UserId).Title
            };

            return(info);
        }
示例#16
0
        private static CommentInfo GetCommentInfo(FeedComment comment)
        {
            var info = new CommentInfo
            {
                CommentID             = comment.Id.ToString(CultureInfo.CurrentCulture),
                UserID                = new Guid(comment.Creator),
                TimeStamp             = comment.Date,
                TimeStampStr          = comment.Date.Ago(),
                IsRead                = true,
                Inactive              = comment.Inactive,
                CommentBody           = comment.Comment,
                UserFullName          = DisplayUserSettings.GetFullUserName(new Guid(comment.Creator)),
                UserAvatar            = GetHtmlImgUserAvatar(new Guid(comment.Creator)),
                IsEditPermissions     = CommunitySecurity.CheckPermissions(comment, NewsConst.Action_Edit),
                IsResponsePermissions = CommunitySecurity.CheckPermissions(NewsConst.Action_Comment),
                UserPost              = CoreContext.UserManager.GetUsers((new Guid(comment.Creator))).Title
            };

            return(info);
        }
示例#17
0
        private static CommentInfo GetCommentInfo(Comment comment)
        {
            var info = new CommentInfo
            {
                CommentID             = comment.Id.ToString(),
                UserID                = comment.UserId,
                TimeStamp             = comment.Date,
                TimeStampStr          = comment.Date.Ago(),
                IsRead                = true,
                Inactive              = comment.Inactive,
                CommentBody           = HtmlUtility.GetFull(comment.Body),
                UserFullName          = DisplayUserSettings.GetFullUserName(comment.UserId),
                UserProfileLink       = CommonLinkUtility.GetUserProfile(comment.UserId),
                UserAvatarPath        = UserPhotoManager.GetBigPhotoURL(comment.UserId),
                IsEditPermissions     = CommunitySecurity.CheckPermissions(new WikiObjectsSecurityObject(comment), ASC.Web.Community.Wiki.Common.Constants.Action_EditRemoveComment),
                IsResponsePermissions = CommunitySecurity.CheckPermissions(ASC.Web.Community.Wiki.Common.Constants.Action_AddComment),
                UserPost              = CoreContext.UserManager.GetUsers(comment.UserId).Title
            };

            return(info);
        }
示例#18
0
        private void UpdateEditDeleteVisible(IWikiObjectOwner obj)
        {
            var canDelete = false;
            var editVisible = Action.Equals(ActionOnPage.View) || Action.Equals(ActionOnPage.CategoryView);
            if (obj != null)
            {
                var secObj = new WikiObjectsSecurityObject(obj);
                canDelete = CommunitySecurity.CheckPermissions(secObj, Common.Constants.Action_RemovePage) &&
                            !string.IsNullOrEmpty(obj.GetObjectId().ToString());
            }

            pEditButtons.Visible = !editVisible;
            //hlEditPage.Visible = editVisible && canEdit;

            if (Version > 0 && (Action.Equals(ActionOnPage.View) || Action.Equals(ActionOnPage.CategoryView)))
            {
                //hlEditPage.Visible = pEditButtons.Visible = false;
            }

            cmdDelete.Visible = editVisible && canDelete;
            litVersionSeparatorDel.Visible = cmdDelete.Visible;
        }
示例#19
0
        private void LoadUserAllPhoto(string userID, Data.Storage.IDataStore store)
        {
            mainContainer.BreadCrumbs.Add(new Web.Controls.BreadCrumb {
                Caption = PhotoManagerResource.PhotoTitle, NavigationUrl = PhotoConst.PAGE_DEFAULT
            });
            mainContainer.BreadCrumbs.Add(new Web.Controls.BreadCrumb {
                Caption = DisplayUserSettings.GetFullUserName(new Guid(userID), false)
            });

            var list = StorageFactory.GetStorage().GetAlbums(0, userID);

            if (list == null || list.Count == 0)
            {
                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("150x_photo_icon.png", PhotoConst.ModuleID),
                    Describe = PhotoManagerResource.EmptyScreenText
                };

                if (userID == SecurityContext.CurrentAccount.ID.ToString())
                {
                    emptyScreenControl.Header     = PhotoManagerResource.YouHaveNoPhotosTitle;
                    emptyScreenControl.ButtonHTML = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddPhoto) ? String.Format("<a class='linkAddMediumText' href='" + PhotoConst.PAGE_ADD_PHOTO + "'>{0}</a>", PhotoManagerResource.EmptyScreenLink) : String.Empty;
                }
                else
                {
                    emptyScreenControl.Header = PhotoManagerResource.UserHaveNoPhotosTitle;
                }

                _contentHolder.Controls.Add(emptyScreenControl);
            }
            else
            {
                _contentHolder.Controls.Add(new Literal {
                    Text = ImageHTMLHelper.DrawAlbumsAlone(list, store)
                });
            }
        }
示例#20
0
        private static void ConfigureCommentsList(CommentsList commentList, AlbumItem image)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddComment);
            commentList.Simple = Core.Mobile.MobileDetector.IsRequestMatchesMobile(HttpContext.Current);

            var count = image != null ? image.CommentsCount : 0;

            commentList.CommentsCountTitle = count.ToString();

            commentList.ObjectID = image != null?image.Id.ToString() : "";

            commentList.BehaviorID = "commentsObj";
            commentList.TotalCount = count;

            commentList.JavaScriptAddCommentFunctionName        = "PhotoDetails.AddComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "PhotoDetails.LoadCommentText";
            commentList.JavaScriptPreviewCommentFunctionName    = "PhotoDetails.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName     = "PhotoDetails.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName     = "PhotoDetails.UpdateComment";
            commentList.FckDomainName = "photomanager_comments";
        }
示例#21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WikiPageName = PrintPageName;
            (Master as WikiMaster).GetDelUniqId += new WikiMaster.GetDelUniqIdHandle(_Default_GetDelUniqId);

            Utility.RegisterTypeForAjax(typeof(_Default), Page);
            RegisterInlineScript();
            LoadViews();

            if (IsPostBack)
            {
                return;
            }

            if (IsFile)
            {
                Response.RedirectLC(string.Format(WikiSection.Section.ImageHangler.UrlFormat, WikiPage, TenantId), this);
            }

            pCredits.Visible = Action.Equals(ActionOnPage.View) || Action.Equals(ActionOnPage.CategoryView);

            CheckSpetialSymbols();

            wikiEditPage.mainPath = this.ResolveUrlLC("Default.aspx");
            InitEditsLink();

            var mainStudioCss = WebSkin.BaseCSSFileAbsoluteWebPath;

            wikiEditPage.CanUploadFiles = CommunitySecurity.CheckPermissions(Common.Constants.Action_UploadFile);
            wikiEditPage.MainCssFile    = mainStudioCss;

            if (Action == ActionOnPage.CategoryView)
            {
                BindPagesByCategory();
            }
        }
示例#22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WikiPageName = PrintPageName;
            (Master as WikiMaster).GetDelUniqId += new WikiMaster.GetDelUniqIdHandle(_Default_GetDelUniqId);

            Utility.RegisterTypeForAjax(typeof(_Default), Page);
            LoadViews();

            if (IsPostBack)
            {
                return;
            }

            if (IsFile)
            {
                Response.RedirectLC(string.Format(WikiSection.Section.ImageHangler.UrlFormat, WikiPage, TenantId), this);
            }

            pCredits.Visible = Action.Equals(ActionOnPage.View) || Action.Equals(ActionOnPage.CategoryView);

            commentList.FCKBasePath = CommonControlsConfigurer.FCKEditorBasePath;

            CheckSpetialSymbols();

            wikiEditPage.mainPath = this.ResolveUrlLC("Default.aspx");
            InitEditsLink();

            var mainStudioCss = WebSkin.BaseCSSFileAbsoluteWebPath;

            wikiEditPage.CanUploadFiles = CommunitySecurity.CheckPermissions(Common.Constants.Action_UploadFile) && !MobileDetector.IsMobile;
            wikiEditPage.MainCssFile    = mainStudioCss;

            if (Action == ActionOnPage.CategoryView)
            {
                BindPagesByCategory();
            }


            var script = @"
                    window.scrollPreview = function() {
                        jq.scrollTo(jq('#_PrevContainer').position().top, { speed: 500 });
                    }
                    window.HidePreview = function() {
                        jq('#_PrevContainer').hide();
                        jq.scrollTo(jq('#edit_container').position().top, { speed: 500 });
                    }
                    window.WikiEditBtns = function() {
                        LoadingBanner.showLoaderBtn('#actionWikiPage');
                    }

                    window.panelEditBtnsID = '" + pEditButtons.ClientID + @"';
                    jq.dropdownToggle({
                        dropdownID: 'WikiActionsMenuPanel',
                        switcherSelector: '.WikiHeaderBlock .menu-small',
                        addTop: -4,
                        addLeft: -11,
                        showFunction: function (switcherObj, dropdownItem) {
                            jq('.WikiHeaderBlock .menu-small.active').removeClass('active');
                            if (dropdownItem.is(':hidden')) {
                                switcherObj.addClass('active');
                            }
                        },
                        hideFunction: function () {
                            jq('.WikiHeaderBlock .menu-small.active').removeClass('active');
                        }
                    });
                    if (jq('#WikiActionsMenuPanel .dropdown-content a').length == 0) {
                        jq('span.menu-small').hide();
                    }";

            Page.RegisterInlineScript(script);
        }
示例#23
0
 protected bool CanDeleteTheFile(IWikiObjectOwner owner)
 {
     return(CommunitySecurity.CheckPermissions(new WikiObjectsSecurityObject(owner), Community.Wiki.Common.Constants.Action_RemoveFile));
 }
示例#24
0
        private void BindRepeater()
        {
            phListResult.Visible = phTableResult.Visible = false;
            if (isByUser || isShowNew || isShowFresh)
            {
                phListResult.Visible = true;
                List <Page> dataSource;
                var         emptyScreenCaption = string.Empty;
                var         emptyScreenText    = string.Empty;

                if (isByUser)
                {
                    dataSource = Wiki.GetPages(byUserID);
                }
                else if (isShowNew)
                {
                    dataSource         = Wiki.GetNewPages(MaxNewResults);
                    emptyScreenCaption = WikiResource.EmptyScreenWikiNewPagesCaption;
                    emptyScreenText    = WikiResource.EmptyScreenWikiNewPagesText;
                }
                else
                {
                    dataSource         = Wiki.GetRecentEditedPages(MaxNewResults);
                    emptyScreenCaption = WikiResource.EmptyScreenWikiRecentlyEditedCaption;
                    emptyScreenText    = WikiResource.EmptyScreenWikiRecentlyEditedText;
                }

                //foreach (Pages p in dataSource)
                //{
                //    p.PageName = HttpUtility.HtmlEncode(p.PageName);
                //}

                if (dataSource.Count > 0)
                {
                    rptPageList.DataSource = dataSource;
                    rptPageList.DataBind();
                }
                else
                {
                    var emptyScreenControl = new EmptyScreenControl
                    {
                        ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("WikiLogo150.png", WikiManager.ModuleId),
                        Header   = emptyScreenCaption,
                        Describe = emptyScreenText
                    };

                    if (CommunitySecurity.CheckPermissions(Community.Wiki.Common.Constants.Action_AddPage))
                    {
                        emptyScreenControl.ButtonHTML = String.Format("<a class='link underline blue plus' href='default.aspx?action=New'>{0}</a>", WikiResource.menu_AddNewPage);
                    }

                    phListResult.Controls.Add(emptyScreenControl);
                }
            }
            else
            {
                phTableResult.Visible = true;
                List <Page> result;
                result = isShowCat ? Wiki.GetPages(categoryName) : Wiki.GetPages();

                result.RemoveAll(pemp => string.IsNullOrEmpty(pemp.PageName));

                var letters = new List <string>(WikiResource.wikiCategoryAlfaList.Split(','));

                var otherSymbol = string.Empty;
                if (letters.Count > 0)
                {
                    otherSymbol = letters[0];
                    letters.Remove(otherSymbol);
                }

                var dictList = new List <PageDictionary>();
                foreach (var page in result)
                {
                    page.PageName = HttpUtility.HtmlEncode(page.PageName);

                    var firstLetter = new string(page.PageName[0], 1);

                    if (!letters.Exists(lt => lt.Equals(firstLetter, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        firstLetter = otherSymbol;
                    }

                    PageDictionary pageDic;
                    if (!dictList.Exists(dl => dl.HeadName.Equals(firstLetter, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        pageDic = new PageDictionary {
                            HeadName = firstLetter
                        };
                        pageDic.Pages.Add(page);
                        dictList.Add(pageDic);
                    }
                    else
                    {
                        pageDic = dictList.Find(dl => dl.HeadName.Equals(firstLetter, StringComparison.InvariantCultureIgnoreCase));
                        pageDic.Pages.Add(page);
                    }
                }

                dictList.Sort(SortPageDict);

                var countAll  = dictList.Count * 3 + result.Count; //1 letter is like 2 links to category
                var perColumn = (int)(Math.Round((decimal)countAll / 3));

                var mainDictList = new List <List <PageDictionary> >();

                int index = 0, lastIndex = 0, count = 0;

                for (int i = 0; i < dictList.Count; i++)
                {
                    var p = dictList[i];

                    count += 3;
                    count += p.Pages.Count;
                    index++;
                    if (count >= perColumn || i == dictList.Count - 1)
                    {
                        count = count - perColumn;
                        mainDictList.Add(dictList.GetRange(lastIndex, index - lastIndex));
                        lastIndex = index;
                    }
                }

                if (mainDictList.Count > 0)
                {
                    rptMainPageList.DataSource = mainDictList;
                    rptMainPageList.DataBind();
                }
                else
                {
                    var emptyScreenControl = new EmptyScreenControl
                    {
                        ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("WikiLogo150.png", WikiManager.ModuleId),
                        Header   = WikiResource.EmptyScreenWikiIndexCaption,
                        Describe = WikiResource.EmptyScreenWikiIndexText
                    };

                    if (CommunitySecurity.CheckPermissions(Community.Wiki.Common.Constants.Action_AddPage))
                    {
                        emptyScreenControl.ButtonHTML = String.Format("<a class='link underline blue plus' href='default.aspx?action=New'>{0}</a>", WikiResource.menu_AddNewPage);
                    }

                    phTableResult.Controls.Add(emptyScreenControl);
                }
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(Default), Page);
            commentList.Visible = CommunitySecurity.CheckPermissions(NewsConst.Action_Comment);

            pgNavigator.EntryCount       = 1;
            pgNavigator.EntryCountOnPage = 1;

            if (IsPostBack)
            {
                return;
            }

            var storage = FeedStorageFactory.Create();

            if (!string.IsNullOrEmpty(Request["docID"]))
            {
                long docID;
                if (long.TryParse(Request["docID"], out docID))
                {
                    //Show panel
                    ContentView.Visible = false;
                    FeedView.Visible    = true;

                    var feed = storage.GetFeed(docID);
                    if (feed != null)
                    {
                        if (!feed.Readed)
                        {
                            storage.ReadFeed(feed.Id, SecurityContext.CurrentAccount.ID.ToString());
                        }
                        FeedViewCtrl.Feed = feed;
                        hdnField.Value    = feed.Id.ToString(CultureInfo.CurrentCulture);
                        InitCommentsView(storage, feed);
                        FeedView.DataBind();
                        EventTitle = feed.Caption;
                        var subscriptionProvider  = NewsNotifySource.Instance.GetSubscriptionProvider();
                        var amAsRecipient         = (IDirectRecipient)NewsNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString());
                        var isSubsribedOnComments = subscriptionProvider.IsSubscribed(NewsConst.NewComment, amAsRecipient, feed.Id.ToString());

                        var SubscribeTopicLink = string.Format(CultureInfo.CurrentCulture,
                                                               string.Format(CultureInfo.CurrentCulture,
                                                                             "<a id=\"statusSubscribe\" class=\"follow-status " +
                                                                             (isSubsribedOnComments ? "subscribed" : "unsubscribed") +
                                                                             "\" title=\"{0}\" href=\"#\" onclick=\"SubscribeOnComments('{1}');\"></a>",
                                                                             (isSubsribedOnComments ? NewsResource.UnsubscribeFromNewComments : NewsResource.SubscribeOnNewComments), feed.Id));

                        SubscribeLinkBlock.Text = SubscribeTopicLink;

                        Title = HeaderStringHelper.GetPageTitle((Master as NewsMaster).CurrentPageCaption ?? feed.Caption);
                    }
                    else
                    {
                        Response.Redirect(VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"));
                        ContentView.Visible  = true;
                        FeedView.Visible     = false;
                        FeedRepeater.Visible = true;
                    }
                }
            }
            else
            {
                PageNumber = string.IsNullOrEmpty(Request["page"]) ? 1 : Convert.ToInt32(Request["page"]);
                PageSize   = string.IsNullOrEmpty(Request["size"]) ? 20 : Convert.ToInt32(Request["size"]);
                LoadData();
            }
            InitScripts();
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SetupInfo.WorkMode == WorkMode.Promo)
            {
                Response.Redirect(FeedUrls.MainPageUrl, true);
            }

            if (!CommunitySecurity.CheckPermissions(NewsConst.Action_Add))
            {
                Response.Redirect(FeedUrls.MainPageUrl, true);
            }

            Breadcrumb.Add(new BreadCrumb()
            {
                Caption = NewsResource.NewsBreadCrumbs, NavigationUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/")
            });
            if (Info.HasUser)
            {
                Breadcrumb.Add(new BreadCrumb()
                {
                    Caption = Info.User.DisplayUserName(false), NavigationUrl = string.Format(CultureInfo.CurrentCulture, "{0}?uid={1}", VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"), Info.UserId)
                });
            }

            var  storage = FeedStorageFactory.Create();
            Feed feed    = null;
            long docID   = 0;

            if (!string.IsNullOrEmpty(Request["docID"]) && long.TryParse(Request["docID"], out docID))
            {
                feed = storage.GetFeed(docID);
            }
            if (!IsPostBack)
            {
                _errorMessage.Text = "";
                if (feed != null)
                {
                    if (!CommunitySecurity.CheckPermissions(feed, NewsConst.Action_Edit))
                    {
                        Response.Redirect(FeedUrls.MainPageUrl, true);
                    }

                    FeedId = docID;
                    FeedPoll pollFeed = feed as FeedPoll;
                    if (pollFeed != null)
                    {
                        _pollMaster.QuestionFieldID = "feedName";
                        var question = pollFeed;
                        _pollMaster.Singleton = (question.PollType == FeedPollType.SimpleAnswer);
                        _pollMaster.Name      = feed.Caption;
                        _pollMaster.ID        = question.Id.ToString(CultureInfo.CurrentCulture);

                        foreach (var variant in question.Variants)
                        {
                            _pollMaster.AnswerVariants.Add(new ASC.Web.Controls.PollFormMaster.AnswerViarint()
                            {
                                ID   = variant.ID.ToString(CultureInfo.CurrentCulture),
                                Name = variant.Name
                            });
                        }
                    }
                }
                else
                {
                    _pollMaster.QuestionFieldID = "feedName";
                }
            }
            else
            {
                SaveFeed();
            }

            if (feed != null)
            {
                Breadcrumb.Add(new BreadCrumb()
                {
                    Caption = feed.Caption, NavigationUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/") + "?docid=" + docID + Info.UserIdAttribute
                });
                Breadcrumb.Add(new BreadCrumb()
                {
                    Caption = NewsResource.NewsEditBreadCrumbsPoll, NavigationUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/editpoll.aspx") + "?docid=" + docID + Info.UserIdAttribute
                });
                lbCancel.NavigateUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/") + "?docid=" + docID + Info.UserIdAttribute;
            }
            else
            {
                Breadcrumb.Add(new BreadCrumb()
                {
                    Caption = NewsResource.NewsAddBreadCrumbsPoll, NavigationUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/editpoll.aspx") + (string.IsNullOrEmpty(Info.UserIdAttribute) ? string.Empty : "?" + Info.UserIdAttribute.Substring(1))
                });
                lbCancel.NavigateUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/") + (string.IsNullOrEmpty(Info.UserIdAttribute) ? string.Empty : "?" + Info.UserIdAttribute.Substring(1));
            }

            this.Title = HeaderStringHelper.GetPageTitle(Resources.NewsResource.AddonName, Breadcrumb);
        }
示例#27
0
        protected void InitPageActionPanel()
        {
            var sb         = new StringBuilder();
            var canEdit    = false;
            var canDelete  = false;
            var subscribed = false;

            if (_wikiObjOwner != null)
            {
                var secObj = new WikiObjectsSecurityObject(_wikiObjOwner);
                canEdit   = CommunitySecurity.CheckPermissions(secObj, Common.Constants.Action_EditPage);
                canDelete = CommunitySecurity.CheckPermissions(secObj, Common.Constants.Action_RemovePage) &&
                            !string.IsNullOrEmpty(_wikiObjOwner.GetObjectId().ToString());
            }

            if (SecurityContext.IsAuthenticated && (Action.Equals(ActionOnPage.CategoryView) || Action.Equals(ActionOnPage.View)))
            {
                var subscriptionProvider = WikiNotifySource.Instance.GetSubscriptionProvider();
                var userList             = new List <string>();
                var IAmAsRecipient       = (IDirectRecipient)WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString());

                if (IAmAsRecipient != null)
                {
                    userList = new List <string>(
                        subscriptionProvider.GetSubscriptions(
                            Community.Wiki.Common.Constants.EditPage,
                            IAmAsRecipient)
                        );
                }

                var pageName = WikiPage ?? string.Empty;
                subscribed = userList.Exists(s => string.Compare(s, pageName, StringComparison.InvariantCultureIgnoreCase) == 0 || (s == null && string.Empty.Equals(pageName)));
                var SubscribeTopicLink = string.Format(CultureInfo.CurrentCulture, string.Format(CultureInfo.CurrentCulture,
                                                                                                 "<a id=\"statusSubscribe\" class=\"follow-status " +
                                                                                                 (subscribed ? "subscribed" : "unsubscribed") +
                                                                                                 "\" title=\"{0}\" href=\"#\"></a>",
                                                                                                 !subscribed ? WikiResource.NotifyOnEditPage : WikiResource.UnNotifyOnEditPage));

                SubscribeLinkBlock.Text = SubscribeTopicLink;
            }

            var delURL = string.Format(@"javascript:if(confirm('{0}')) __doPostBack('{1}', '');", WikiResource.cfmDeletePage, _Default_GetDelUniqId());

            sb.Append("<div id=\"WikiActionsMenuPanel\" class=\"studio-action-panel\">");
            sb.Append("<div class=\"corner-top left\"></div>");
            sb.Append("<ul class=\"dropdown-content\">");
            sb.AppendFormat("<li><a class=\"dropdown-item\" href=\"{0}\">{1}</a></li>",
                            ActionHelper.GetViewPagePath(this.ResolveUrlLC("pagehistorylist.aspx"), WikiPage),
                            WikiResource.menu_ShowVersions);

            sb.AppendFormat("<li><a class=\"dropdown-item\" href=\"javascript:window.print();\">{0}</a></li>", WikiResource.menu_PrintThePage);

            if (canEdit)
            {
                sb.AppendFormat("<li><a class=\"dropdown-item\" href=\"{0}\">{1}</a></li>",
                                ActionHelper.GetEditPagePath(this.ResolveUrlLC("default.aspx"), WikiPage),
                                WikiResource.menu_EditThePage);
            }

            if (canDelete)
            {
                sb.AppendFormat("<li><a class=\"dropdown-item\" href=\"{0}\">{1}</a></li>", delURL, WikiResource.menu_DeleteThePage);
            }

            sb.Append("</ul>");
            sb.Append("</div>");

            ActionPanel.Text = sb.ToString();

            sb = new StringBuilder();

            sb.AppendLine("var notyfy = " + subscribed.ToString().ToLower(CultureInfo.CurrentCulture) + ";");
            sb.AppendLine("var pageId = \"" + HttpUtility.HtmlEncode((Page as WikiBasePage).WikiPage).EscapeString() + "\";");
            sb.AppendLine("jq(\"#statusSubscribe\").on(\"click\", function(){");
            sb.AppendLine("AjaxPro.onLoading = function(b) {");
            sb.AppendLine("if(b) jq(\".WikiHeaderBlock\").block();");
            sb.AppendLine("else jq(\".WikiHeaderBlock\").unblock();");
            sb.AppendLine("}");
            sb.AppendLine("MainWikiAjaxMaster.SubscribeOnEditPage(notyfy, pageId, callbackNotifyWikiPage);");
            sb.AppendLine("});");
            sb.AppendLine("function callbackNotifyWikiPage(result){notyfy = result.value;");
            sb.AppendLine("if(!notyfy){");
            sb.AppendLine("jq(\"#statusSubscribe\").removeClass(\"subscribed\").addClass(\"unsubscribed\");");
            sb.AppendFormat("jq(\"#statusSubscribe\").attr(\"title\", \"{0}\");", WikiResource.NotifyOnEditPage);
            sb.AppendLine("} else {");
            sb.AppendLine("jq(\"#statusSubscribe\").removeClass(\"unsubscribed\").addClass(\"subscribed\");");
            sb.AppendFormat("jq(\"#statusSubscribe\").attr(\"title\", \"{0}\");", WikiResource.UnNotifyOnEditPage);
            sb.AppendLine("}};");

            Page.RegisterInlineScript(sb.ToString());
        }
示例#28
0
 private static bool CanEdit()
 {
     return(CommunitySecurity.CheckPermissions(new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID)), ASC.Blogs.Core.Constants.Action_AddPost));
 }
示例#29
0
        private void LoadData()
        {
            var storage  = FeedStorageFactory.Create();
            var feedType = FeedType.All;

            if (!string.IsNullOrEmpty(Request["type"]))
            {
                feedType = (FeedType)Enum.Parse(typeof(FeedType), Request["type"], true);
                var feedTypeInfo = FeedTypeInfo.FromFeedType(feedType);
                Title = HeaderStringHelper.GetPageTitle((Master as NewsMaster).CurrentPageCaption ?? feedTypeInfo.TypeName);
            }
            else
            {
                Title = HeaderStringHelper.GetPageTitle((Master as NewsMaster).CurrentPageCaption ?? NewsResource.NewsBreadCrumbs);
            }

            var feedsCount = !string.IsNullOrEmpty(Request["search"]) ? storage.SearchFeedsCount(Request["search"], feedType, Info.UserId) : storage.GetFeedsCount(feedType, Info.UserId);

            FeedsCount = feedsCount;

            if (feedsCount == 0)
            {
                FeedRepeater.Visible = false;
                MessageShow.Visible  = true;

                string buttonLink;
                string buttonName;
                var    emptyScreenControl = new EmptyScreenControl {
                    Describe = NewsResource.EmptyScreenText
                };

                switch (feedType)
                {
                case FeedType.News:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_news.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenNewsCaption;
                    buttonLink = FeedUrls.EditNewsUrl;
                    buttonName = NewsResource.EmptyScreenNewsLink;
                    break;

                case FeedType.Order:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_order.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenOrdersCaption;
                    buttonLink = FeedUrls.EditOrderUrl;
                    buttonName = NewsResource.EmptyScreenOrderLink;
                    break;

                case FeedType.Advert:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_advert.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenAdvertsCaption;
                    buttonLink = FeedUrls.EditAdvertUrl;
                    buttonName = NewsResource.EmptyScreenAdvertLink;
                    break;

                case FeedType.Poll:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_poll.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenPollsCaption;
                    buttonLink = FeedUrls.EditPollUrl;
                    buttonName = NewsResource.EmptyScreenPollLink;
                    break;

                default:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_newslogo.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenEventsCaption;
                    buttonLink = FeedUrls.EditNewsUrl;
                    buttonName = NewsResource.EmptyScreenEventLink;
                    break;
                }

                if (CommunitySecurity.CheckPermissions(NewsConst.Action_Add) && String.IsNullOrEmpty(Request["uid"]) && String.IsNullOrEmpty(Request["search"]))
                {
                    emptyScreenControl.ButtonHTML = String.Format("<a class='link underline blue plus' href='{0}'>{1}</a>", buttonLink, buttonName);
                }


                MessageShow.Controls.Add(emptyScreenControl);
            }
            else
            {
                var pageSize  = PageSize;
                var pageCount = (int)(feedsCount / pageSize + 1);
                if (pageCount < PageNumber)
                {
                    PageNumber = pageCount;
                }

                var feeds = !string.IsNullOrEmpty(Request["search"]) ?
                            storage.SearchFeeds(Request["search"], feedType, Info.UserId, pageSize, (PageNumber - 1) * pageSize) :
                            storage.GetFeeds(feedType, Info.UserId, pageSize, (PageNumber - 1) * pageSize);

                pgNavigator.EntryCountOnPage  = pageSize;
                pgNavigator.EntryCount        = 0 < pageCount ? (int)feedsCount : pageSize;
                pgNavigator.CurrentPageNumber = PageNumber;

                pgNavigator.ParamName = "page";
                if (!string.IsNullOrEmpty(Request["search"]))
                {
                    pgNavigator.PageUrl = string.Format(
                        CultureInfo.CurrentCulture,
                        "{0}?search={1}&size={2}",
                        VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"),
                        Request["search"],
                        pageSize
                        );
                }
                else
                {
                    pgNavigator.PageUrl = string.IsNullOrEmpty(Request["type"]) ?
                                          string.Format(
                        CultureInfo.CurrentCulture,
                        "{0}?{1}&size={2}",
                        VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"),
                        (string.IsNullOrEmpty(Info.UserIdAttribute) ? string.Empty : "?" + Info.UserIdAttribute.Substring(1)),
                        pageSize
                        ) :
                                          string.Format(
                        CultureInfo.CurrentCulture,
                        "{0}?type={1}{2}&size={3}",
                        VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"),
                        Request["type"],
                        Info.UserIdAttribute,
                        pageSize);
                }
                FeedRepeater.DataSource = feeds;
                FeedRepeater.DataBind();
            }
        }
示例#30
0
        private void ValidateAccessHandler(object sender, SecurityAccessEventArgs e)
        {
            ISecurityObject securityObject = null;

            if (e.TargetObject is ISecurityObject)
            {
                securityObject = (ISecurityObject)e.TargetObject;
            }

            switch (e.Action)
            {
            case ForumAction.ReadPosts:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.ReadPostsAction);
                break;

            case ForumAction.PostCreate:

                Topic topic = (Topic)e.TargetObject;
                if (CommunitySecurity.CheckPermissions(topic, Constants.PostCreateAction))
                {
                    if (!topic.Closed)
                    {
                        _view.IsAccessible = true;
                    }

                    else if (topic.Closed && CommunitySecurity.CheckPermissions(topic, Constants.TopicCloseAction))
                    {
                        _view.IsAccessible = true;
                    }

                    else
                    {
                        _view.IsAccessible = false;
                    }
                }
                else
                {
                    _view.IsAccessible = false;
                }

                break;

            case ForumAction.ApprovePost:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.PostApproveAction);
                break;

            case ForumAction.PostEdit:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.PostEditAction);
                break;

            case ForumAction.PostDelete:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.PostDeleteAction);
                break;

            case ForumAction.TopicCreate:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TopicCreateAction);
                break;

            case ForumAction.PollCreate:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.PollCreateAction);
                break;

            case ForumAction.TopicClose:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TopicCloseAction);
                break;

            case ForumAction.TopicSticky:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TopicStickyAction);
                break;

            case ForumAction.TopicEdit:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TopicEditAction);
                break;

            case ForumAction.TopicDelete:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TopicDeleteAction);
                break;

            case ForumAction.PollVote:

                Question question = (Question)e.TargetObject;
                _view.IsAccessible = CommunitySecurity.CheckPermissions(new Topic()
                {
                    ID = question.TopicID
                }, Constants.PollVoteAction);
                break;


            case ForumAction.TagCreate:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TagCreateAction);
                break;

            case ForumAction.AttachmentCreate:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.AttachmentCreateAction);
                break;

            case ForumAction.AttachmentDelete:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.AttachmentDeleteAction);
                break;

            case ForumAction.GetAccessForumEditor:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.ForumManagementAction);
                break;

            case ForumAction.GetAccessTagEditor:
                _view.IsAccessible = CommunitySecurity.CheckPermissions(securityObject, Constants.TagManagementAction);
                break;
            }
        }