예제 #1
0
 /// <summary>
 /// 为资讯添加标签时触发
 /// </summary>
 private void AddTagsToCms_BatchAfter(IEnumerable <string> senders, TagEventArgs eventArgs)
 {
     if (eventArgs.TenantTypeId == TenantTypeIds.Instance().ContentItem())
     {
         long cmsThreadId = eventArgs.ItemId;
         if (cmsSearcher == null)
         {
             cmsSearcher = (CmsSearcher)SearcherFactory.GetSearcher(CmsSearcher.CODE);
         }
         cmsSearcher.Update(contentItemService.Get(cmsThreadId));
     }
 }
예제 #2
0
        public ActionResult _DeleteContribute(long contentItemId)
        {
            var         contentItemService = new ContentItemService();
            ContentItem contentItem        = contentItemService.Get(contentItemId);

            if (contentItem == null)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "没有找到准备删除的投稿")));
            }
            if (authorizer.CMS_DeleteContentItem(contentItem))
            {
                contentItemService.Delete(contentItem);
            }
            else
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "您没有删除此投稿的权限")));
            }
            return(Json(new StatusMessageData(StatusMessageType.Success, "成功删除了投稿")));
        }
예제 #3
0
        /// <summary>
        /// 评论资讯动态处理程序
        /// </summary>
        /// <param name="comment"></param>
        /// <param name="eventArgs"></param>
        private void CmsCommentActivityEventModule_After(Comment comment, AuditEventArgs eventArgs)
        {
            NoticeService noticeService = new NoticeService();
            ContentItem   contentItem   = null;

            if (comment.TenantTypeId == TenantTypeIds.Instance().ContentItem())
            {
                //生成动态
                ActivityService activityService = new ActivityService();
                AuditService    auditService    = new AuditService();
                bool?           auditDirection  = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);
                if (auditDirection == true)
                {
                    //创建评论的动态[关注评论者的粉丝可以看到该评论]
                    Activity activity = Activity.New();
                    activity.ActivityItemKey = ActivityItemKeys.Instance().CreateCmsComment();
                    activity.ApplicationId   = CmsConfig.Instance().ApplicationId;

                    ContentItemService contentItemService = new ContentItemService();
                    contentItem = contentItemService.Get(comment.CommentedObjectId);
                    if (contentItem == null || contentItem.UserId == comment.UserId)
                    {
                        return;
                    }
                    activity.IsOriginalThread      = true;
                    activity.IsPrivate             = false;
                    activity.OwnerId               = comment.UserId;
                    activity.OwnerName             = comment.Author;
                    activity.OwnerType             = ActivityOwnerTypes.Instance().User();
                    activity.ReferenceId           = contentItem.ContentItemId;
                    activity.ReferenceTenantTypeId = TenantTypeIds.Instance().ContentItem();
                    activity.SourceId              = comment.Id;
                    activity.TenantTypeId          = TenantTypeIds.Instance().Comment();
                    activity.UserId = comment.UserId;

                    activityService.Generate(activity, false);
                }
                else if (auditDirection == false)
                {
                    activityService.DeleteSource(TenantTypeIds.Instance().Comment(), comment.Id);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 资讯详细显示页
        /// </summary>
        public static string ContentItemDetail(this SiteUrls siteUrls, long contentItemId)
        {
            var contentItemService = new ContentItemService();
            var item = contentItemService.Get(contentItemId);
            if (item == null)
                return string.Empty;
            if (item.ContentType != null && item.ContentType.ContentTypeKey == ContentTypeKeys.Instance().NewsLink())
                return item.AdditionalProperties.Get<string>("LinkUrl", string.Empty);

            RouteValueDictionary routeValueDictionary = new RouteValueDictionary();
            routeValueDictionary.Add("contentItemId", contentItemId);

            return CachedUrlHelper.Action("ContentItemDetail", "ChannelCms", CmsAreaName, routeValueDictionary);
        }
예제 #5
0
 public ActionResult _DeleteContribute(long contentItemId)
 {
     var contentItemService = new ContentItemService();
     ContentItem contentItem = contentItemService.Get(contentItemId);
     if (contentItem == null)
         return Json(new StatusMessageData(StatusMessageType.Error, "没有找到准备删除的投稿"));
     if (authorizer.CMS_DeleteContentItem(contentItem))
         contentItemService.Delete(contentItem);
     else
         return Json(new StatusMessageData(StatusMessageType.Error, "您没有删除此投稿的权限"));
     return Json(new StatusMessageData(StatusMessageType.Success, "成功删除了投稿"));
 }