Example #1
0
 public void AddReplyToJournal(int PortalId, int ModuleId, int TabId, int ForumId, int TopicId, int ReplyId, int UserId, string URL, string Subject, string Body)
 {
     //make sure that this is a User before trying to create a journal item, you can't post a JI without
     if (UserId > 0)
     {
         ModuleInfo  module = ModuleController.Instance.GetModule(ModuleId, TabId, false);
         string      summary;
         JournalItem ji = new JournalItem
         {
             PortalId      = PortalId,
             ProfileId     = UserId,
             UserId        = UserId,
             Title         = Subject,
             JournalTypeId = GetReplyTopicTypeId(PortalId),
             ItemData      = new ItemData {
                 Url = URL
             }
         };
         summary = TextUtilityClass.StripHTML(HttpUtility.HtmlDecode(Body));
         if (summary.Length > 150)
         {
             summary = summary.Substring(0, 150) + "...";
         }
         ji.Summary   = summary;
         ji.Body      = TextUtilityClass.StripHTML(Body);
         ji.ObjectKey = GetJournalKey(ModuleId, ForumId, TopicId, ReplyId);
         if (JournalController.Instance.GetJournalItemByKey(PortalId, ji.ObjectKey) != null)
         {
             JournalController.Instance.DeleteJournalItemByKey(PortalId, ji.ObjectKey);
         }
         ji.SecuritySet = "E,";
         JournalController.Instance.SaveJournalItem(ji, module);
     }
 }
Example #2
0
        public void AddThreadToJournal(int PortalId, int ModuleId, int TabId, int ForumId, int TopicId, int PostId, int UserId, string URL, string Subject, string Body)
        {
            ModuleInfo  module = ModuleController.Instance.GetModule(ModuleId, TabId, false);
            string      summary;
            JournalItem ji = new JournalItem
            {
                PortalId      = PortalId,
                ProfileId     = UserId,
                UserId        = UserId,
                Title         = Subject,
                JournalTypeId = GetAddTopicTypeId(PortalId),
                ItemData      = new ItemData {
                    Url = URL
                }
            };

            summary = TextUtilityClass.StripHTML(HttpUtility.HtmlDecode(Body));
            if (summary.Length > 150)
            {
                summary = summary.Substring(0, 150) + "...";
            }

            ji.Summary   = summary;
            ji.Body      = TextUtilityClass.StripHTML(Body);
            ji.ObjectKey = GetJournalKey(ModuleId, ForumId, TopicId, PostId);
            if (JournalController.Instance.GetJournalItemByKey(PortalId, ji.ObjectKey) != null)
            {
                JournalController.Instance.DeleteJournalItemByKey(PortalId, ji.ObjectKey);
            }
            ji.SecuritySet = "E,";
            JournalController.Instance.SaveJournalItem(ji, module);
        }