Example #1
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(WikiPage) || IsFile)
                {
                    return;
                }
                var pageName = PageNameUtil.Decode(WikiPage);

                var page = Wiki.GetPage(pageName);
                CommunitySecurity.DemandPermissions(new WikiObjectsSecurityObject(page), Common.Constants.Action_RemovePage);

                foreach (var cat in Wiki.GetCategoriesRemovedWithPage(pageName))
                {
                    WikiNotifySource.Instance.GetSubscriptionProvider().UnSubscribe(Common.Constants.AddPageToCat, cat.CategoryName);
                }

                Wiki.RemoveCategories(pageName);

                WikiNotifySource.Instance.GetSubscriptionProvider().UnSubscribe(Common.Constants.EditPage, pageName);

                foreach (var comment in Wiki.GetComments(pageName))
                {
                    CommonControlsConfigurer.FCKUploadsRemoveForItem("wiki_comments", comment.Id.ToString());
                }
                Wiki.RemovePage(pageName);

                Response.RedirectLC("Default.aspx", this);
            }
            catch (Exception err)
            {
                WikiMaster.PrintInfoMessage(err.Message, InfoType.Alert);
            }
        }
        private IList<CommentInfo> GetCommentsList(string pageName, out int totalCount)
        {
            var comments = Wiki.GetComments(pageName);
            totalCount = comments.Count;

            return BuildCommentsList(comments);
        }
Example #3
0
        public AjaxResponse AddComment(string parentCommentId, string pageName, string text, string pid)
        {
            text = HtmlUtility.GetFull(text);
            var resp = new AjaxResponse();

            resp.rs1 = parentCommentId;

            var parentIdGuid = String.IsNullOrEmpty(parentCommentId) ? Guid.Empty : new Guid(parentCommentId);
            var newComment   = Wiki.CreateComment(new Comment {
                Body = text, PageName = pageName, ParentId = parentIdGuid
            });

            var info = GetCommentInfo(newComment);

            var defComment = new CommentsList();

            ConfigureComments(defComment, pageName);

            var visibleCommentsCount = Wiki.GetComments(pageName).Count;

            resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer(
                defComment,
                info,
                string.IsNullOrEmpty(parentCommentId),
                visibleCommentsCount % 2 == 1);

            return(resp);
        }
Example #4
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var pageName = ((LinkButton)sender).CommandName;

                var page = Wiki.GetPage(pageName);
                CommunitySecurity.DemandPermissions(new WikiObjectsSecurityObject(page), Common.Constants.Action_RemovePage);

                foreach (var comment in Wiki.GetComments(pageName))
                {
                    CommonControlsConfigurer.FCKUploadsRemoveForItem("wiki_comments", comment.Id.ToString());
                }
                Wiki.RemovePage(pageName);
                BindRepeater();
            }
            catch (Exception err)
            {
                WikiMaster.PrintInfoMessage(err.Message, InfoType.Warning);
            }
        }