コード例 #1
0
ファイル: JournalListControl.cs プロジェクト: biganth/Curt
 protected override void Render(HtmlTextWriter output) {
     if (Enabled) {
         if (CurrentIndex < 0) {
             CurrentIndex = 0;
         }
         JournalParser jp = new JournalParser(portalSettings, ModuleId, ProfileId, SocialGroupId, userInfo);
         output.Write(jp.GetList(CurrentIndex, PageSize));
     }
     
 }
コード例 #2
0
        public HttpResponseMessage CommentSave(CommentSaveDTO postData)
        {
            try
            {
                var ci = new CommentInfo { JournalId = postData.JournalId, Comment = HttpUtility.UrlDecode(postData.Comment) };
                if (ci.Comment.Length > 2000)
                {
                    ci.Comment = ci.Comment.Substring(0, 1999);
                    ci.Comment = Utilities.RemoveHTML(ci.Comment);
                }
                ci.UserId = UserInfo.UserID;
                JournalController.Instance.SaveComment(ci);

                var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId);
                var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo);

                return Request.CreateResponse(HttpStatusCode.OK, jp.GetCommentRow(ci), "text/html");
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
            }
        }
コード例 #3
0
 public HttpResponseMessage Like(JournalIdDTO postData)
 {
     try
     {
         JournalController.Instance.LikeJournalItem(postData.JournalId, UserInfo.UserID, UserInfo.DisplayName);
         var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId);
         var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo);
         var isLiked = false;
         var likeList = jp.GetLikeListHTML(ji, ref isLiked);
         likeList = Utilities.LocalizeControl(likeList);
         return Request.CreateResponse(HttpStatusCode.OK, new { LikeList = likeList, Liked = isLiked });
     }
     catch (Exception exc)
     {
         Logger.Error(exc);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
     }
 }
コード例 #4
0
 public HttpResponseMessage GetListForProfile(GetListForProfileDTO postData)
 {
     try
     {
         
         var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, postData.ProfileId, postData.GroupId, UserInfo);
         return Request.CreateResponse(HttpStatusCode.OK, jp.GetList(postData.RowIndex, postData.MaxRows), "text/html");
     }
     catch (Exception exc)
     {
         Logger.Error(exc);
         throw new HttpException(500, exc.Message);
     }
 }
コード例 #5
0
ファイル: ServicesController.cs プロジェクト: biganth/Curt
 public ActionResult CommentLike(int journalId, int commentId)
 {
     try
     {
         InternalJournalController.Instance.LikeComment(journalId, commentId, UserInfo.UserID, UserInfo.DisplayName);
         var ji = JournalController.Instance.GetJournalItem(PortalSettings.PortalId, UserInfo.UserID, journalId);
         var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo);
         var isLiked = false;
         var likeList = jp.GetLikeListHTML(ji, ref isLiked);
         likeList = Utilities.LocalizeControl(likeList);
         return Json(new { LikeList = likeList, Liked = isLiked }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception exc)
     {
         DnnLog.Error(exc);
         return Json(new { Result = "error" });
     }
 }
コード例 #6
0
ファイル: ServicesController.cs プロジェクト: biganth/Curt
        public string CommentSave(int journalId, string comment)
        {
            try
            {
                var ci = new CommentInfo { JournalId = journalId, Comment = HttpUtility.UrlDecode(comment) };
                if (ci.Comment.Length > 2000)
                {
                    ci.Comment = ci.Comment.Substring(0, 1999);
                    ci.Comment = Utilities.RemoveHTML(ci.Comment);
                }
                ci.UserId = UserInfo.UserID;
                InternalJournalController.Instance.SaveComment(ci);

                var ji = JournalController.Instance.GetJournalItem(PortalSettings.PortalId, UserInfo.UserID, journalId);
                var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo);
                return jp.GetCommentRow(ci);
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);
                return string.Empty;
            }
        }
コード例 #7
0
ファイル: ServicesController.cs プロジェクト: biganth/Curt
 public string GetListForProfile(int profileId, int groupId, int rowIndex, int maxRows)
 {
     try
     {
         var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, profileId, groupId, UserInfo);
         return jp.GetList(rowIndex, maxRows);
     }
     catch (Exception exc)
     {
         DnnLog.Error(exc);
         return string.Empty;
     }
 }
コード例 #8
0
        public HttpResponseMessage CommentSave(CommentSaveDTO postData)
        {
            try
            {
                var comment = HttpUtility.UrlDecode(postData.Comment);
                IDictionary<string, UserInfo> mentionedUsers = new Dictionary<string, UserInfo>();
                var originalComment = comment;
                comment = ParseMentions(comment, postData.Mentions, ref mentionedUsers);
                var ci = new CommentInfo { JournalId = postData.JournalId, Comment = comment };
                ci.UserId = UserInfo.UserID;
                ci.DisplayName = UserInfo.DisplayName;
                JournalController.Instance.SaveComment(ci);

                var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId);
                var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo);

                SendMentionNotifications(mentionedUsers, ji, originalComment, "Comment");

                return Request.CreateResponse(HttpStatusCode.OK, jp.GetCommentRow(ji, ci), "text/html");
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
            }
        }