当前位置: 首页>>代码示例>>C#>>正文


C# Primitive.CanModerateComments方法代码示例

本文整理汇总了C#中BoxSocial.Internals.Primitive.CanModerateComments方法的典型用法代码示例。如果您正苦于以下问题:C# Primitive.CanModerateComments方法的具体用法?C# Primitive.CanModerateComments怎么用?C# Primitive.CanModerateComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoxSocial.Internals.Primitive的用法示例。


在下文中一共展示了Primitive.CanModerateComments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplayComments


//.........这里部分代码省略.........

            foreach (Comment comment in comments)
            {
                core.PrimitiveCache.LoadUserProfile(comment.UserId);
            }

            long lastId = 0;

            foreach (Comment comment in comments)
            {
                VariableCollection commentsVariableCollection = template.CreateChild("comment-list");

                //commentsVariableCollection.ParseRaw("COMMENT", Bbcode.Parse(HttpUtility.HtmlEncode(comment.Body), core.session.LoggedInMember));
                /*if ((!core.IsMobile) && (!string.IsNullOrEmpty(comment.BodyCache)))
                {
                    core.Display.ParseBbcodeCache(commentsVariableCollection, "COMMENT", comment.BodyCache);
                }
                else*/
                {
                    core.Display.ParseBbcode(commentsVariableCollection, "COMMENT", comment.Body, true, null, null);
                }

                try
                {
                    User commentPoster = core.PrimitiveCache[comment.UserId];

                    lastId = comment.Id;

                    commentsVariableCollection.Parse("ID", comment.Id.ToString());
                    commentsVariableCollection.Parse("TYPE_ID", ItemKey.GetTypeId(core, typeof(Comment)));
                    commentsVariableCollection.Parse("USERNAME", commentPoster.DisplayName);
                    commentsVariableCollection.Parse("USER_ID", commentPoster.Id.ToString());
                    commentsVariableCollection.Parse("USER_DISPLAY_NAME", commentPoster.DisplayName);
                    commentsVariableCollection.Parse("U_PROFILE", commentPoster.ProfileUri);
                    commentsVariableCollection.Parse("U_QUOTE", core.Hyperlink.BuildCommentQuoteUri(comment.Id));
                    commentsVariableCollection.Parse("U_REPORT", core.Hyperlink.BuildCommentReportUri(comment.Id));
                    commentsVariableCollection.Parse("U_DELETE", core.Hyperlink.BuildCommentDeleteUri(comment.Id));
                    commentsVariableCollection.Parse("U_LIKE", core.Hyperlink.BuildLikeItemUri(comment.ItemTypeId, comment.Id));
                    commentsVariableCollection.Parse("TIME", core.Tz.DateTimeToString(comment.GetTime(core.Tz)));
                    commentsVariableCollection.Parse("USER_ICON", commentPoster.Icon);
                    commentsVariableCollection.Parse("USER_TILE", commentPoster.Tile);
                    commentsVariableCollection.Parse("USER_SQUARE", commentPoster.Square);

                    if (comment.Info.Likes > 0)
                    {
                        commentsVariableCollection.Parse("LIKES", string.Format("{0:d} ", comment.Info.Likes));
                    }

                    if (comment.Info.Dislikes > 0)
                    {
                        commentsVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", comment.Info.Dislikes));
                    }

                    if (comment.Info.SharedTimes > 0)
                    {
                        commentsVariableCollection.Parse("SHARES", string.Format(" ({0:d})", comment.Info.SharedTimes));
                    }

                    if (hook != null)
                    {
                        hook(new DisplayCommentHookEventArgs(core, owner, commentPoster, commentsVariableCollection));
                    }

                    if (core.Session.IsLoggedIn)
                    {
                        if (owner.CanModerateComments(core.Session.LoggedInMember))
                        {
                            commentsVariableCollection.Parse("MODERATE", "TRUE");
                        }
                    }

                    if (owner.IsItemOwner(commentPoster))
                    {
                        commentsVariableCollection.Parse("OWNER", "TRUE");
                        commentsVariableCollection.Parse("NORMAL", "FALSE");
                    }
                    else
                    {
                        commentsVariableCollection.Parse("OWNER", "FALSE");
                        commentsVariableCollection.Parse("NORMAL", "TRUE");
                    }

                    if (comment.SpamScore >= 10)
                    {
                        commentsVariableCollection.Parse("IS_SPAM", "TRUE");
                    }
                }
                catch
                {
                    // if userid is 0, anonymous
                    commentsVariableCollection.Parse("USERNAME", "Anonymous");
                    commentsVariableCollection.Parse("TIME", core.Tz.DateTimeToString(comment.GetTime(core.Tz)));

                    commentsVariableCollection.Parse("OWNER", "FALSE");
                    commentsVariableCollection.Parse("NORMAL", "TRUE");
                }
            }

            template.Parse("LAST_ID", "lastId");
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:101,代码来源:Display.cs


注:本文中的BoxSocial.Internals.Primitive.CanModerateComments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。