/// <summary> /// 投稿文章到专题 /// </summary> /// <param name="TopicId"></param> /// <param name="ArticleId"></param> /// <returns></returns> public ActionResult PostArticle(string TopicId, string ArticleId) { if (Session[ConstHelper.Session_USERID] == null) { return(Redirect("/Home/Index")); } string accountid = Session[ConstHelper.Session_USERID].ToString(); var article = Article.GetArticleBySn(ArticleId); if (article.OwnerId != accountid) { return(Redirect("/")); } var topic = Topic.GetTopicBySn(TopicId); if (topic == null || (!topic.IsPostable)) { return(Redirect("/")); } if (topic.IsNeedApproval) { TopicArticle.InsertTopicArticle(new TopicArticle() { ArticleID = ArticleId, TopicID = TopicId, PublishStatus = ApproveStatus.Pending }); var parm = "TopicId=" + topic.Sn + "&ArticleId=" + ArticleId; var articleurl = "<a href = '/Article/Index?ArticleId=" + article.Sn + "'>" + article.Title + "</a>"; var topicurl = "<a href = '/Author/TopicPage?accountid=" + topic.OwnerId + "'>" + topic.Title + "</a>"; SiteMessage.CreateYesNo(topic.OwnerId, articleurl + "请求投稿到专题" + topicurl, "/Author/AcceptActicle?" + parm, "/Author/RefuseActicle?" + parm, accountid); } else { TopicArticle.InsertTopicArticle(new TopicArticle() { ArticleID = ArticleId, TopicID = TopicId, PublishStatus = ApproveStatus.Accept }); } return(Redirect("/Author/PostToTopic?TopicId=" + TopicId)); }
/// <summary> /// 接受文章首页申请 /// </summary> /// <param name="ArticleId"></param> /// <returns></returns> public ActionResult Accept(string ArticleId) { if (string.IsNullOrEmpty(ArticleId)) { return(Redirect("/")); } if (Session[ConstHelper.Session_USERID] == null) { return(Redirect("/")); } if ((UserType)Session[ConstHelper.Session_PRIVILEGE] != UserType.Admin && (UserType)Session[ConstHelper.Session_PRIVILEGE] != UserType.Editor) { return(Redirect("/")); } if (Article.GetArticleBySn(ArticleId) == null) { return(Redirect("/")); } Article.Accept(ArticleId); Article article = Article.GetArticleBySn(ArticleId); var articleurl = "<a href = '/Article/Index?ArticleId=" + article.Sn + "'>" + article.Title + "</a>"; SiteMessage.CreateNotify(article.OwnerId, "您的文章[" + articleurl + "]通过审核"); if (article.IsPutToMyTopic) { //发布后则加入到自己专题 var topic = Topic.GetTopicByAccountId(article.OwnerId); if (topic != null) { TopicArticle.InsertTopicArticle(new TopicArticle() { ArticleID = article.Sn, TopicID = topic.Sn, PublishStatus = ApproveStatus.NotNeed }); } } return(Redirect("/Admin")); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string json = string.Empty; if (context.Session[ConstHelper.Session_USERID] == null) { var SessionTimeout = new { success = ConstHelper.Fail, message = "系统超时,请重新登陆", }; json = JsonConvert.SerializeObject(SessionTimeout); context.Response.Write(json); return; } string strArticleID = context.Request.Unvalidated.Form["ArticleID"]; string strMarkDown = context.Request.Unvalidated.Form["Content"]; string strHTML = context.Request.Unvalidated.Form["HTML"]; Article article = Article.GetArticleBySn(strArticleID); if (!article.OwnerId.Equals(context.Session[ConstHelper.Session_USERID].ToString())) { var NotTheOwner = new { success = ConstHelper.Fail, message = "你所编辑的文章的所有者和您的登陆用户不匹配", }; json = JsonConvert.SerializeObject(NotTheOwner); context.Response.Write(json); return; } ArticleContent.SaveMarkDownVersion(strArticleID, strMarkDown, article.Sn, RevisionType.Draft); ArticleContent.SaveHTMLVersion(strArticleID, strHTML, article.Sn); if (article.IsFirstPage) { //首页发布处理 Article.Publish(strArticleID, strMarkDown, strHTML); } else { //非首页处理 ArticleContent.SaveMarkDownVersion(strArticleID, strMarkDown, article.Sn, RevisionType.Current); } if (!article.IsPrivate && !article.IsFirstPage) { //公开非首页,变成发布状态 article.PublishStatus = ApproveStatus.Accept; article.PublishDateTime = System.DateTime.Now; if (article.IsPutToMyTopic) { //发布后则加入到自己专题 var topic = Topic.GetTopicByAccountId(context.Session[ConstHelper.Session_USERID].ToString()); if (topic != null) { TopicArticle.InsertTopicArticle(new TopicArticle() { ArticleID = article.Sn, TopicID = topic.Sn, PublishStatus = ApproveStatus.NotNeed }); } } Article.UpdateArticle(article); ArticleListManager.RemoveArticleItemBody(article.Sn); } var Success = new { success = ConstHelper.Success, message = "保存成功", }; json = JsonConvert.SerializeObject(Success); context.Response.Write(json); }