Esempio n. 1
0
        public static void NotifyBlogComment(Core core, Job job)
        {
            Comment comment = new Comment(core, job.ItemId);
            BlogEntry ev = new BlogEntry(core, comment.CommentedItemKey.Id);

            if (ev.Owner is User && (!comment.OwnerKey.Equals(ev.OwnerKey)))
            {
                core.CallingApplication.SendNotification(core, comment.User, (User)ev.Owner, ev.OwnerKey, ev.ItemKey, "_COMMENTED_BLOG_POST", comment.BuildUri(ev));
            }

            core.CallingApplication.SendNotification(core, comment.OwnerKey, comment.User, ev.OwnerKey, ev.ItemKey, "_COMMENTED_BLOG_POST", comment.BuildUri(ev));
        }
Esempio n. 2
0
        public static void NotifyUserComment(Core core, Job job)
        {
            Comment comment = new Comment(core, job.ItemId);
            core.LoadUserProfile(comment.CommentedItemKey.Id);
            User ev = core.PrimitiveCache[comment.CommentedItemKey.Id];

            if (ev.Owner is User && (!comment.OwnerKey.Equals(ev.ItemKey)))
            {
                core.CallingApplication.SendNotification(core, comment.User, (User)ev.Owner, ev.ItemKey, ev.ItemKey, "_COMMENTED_GUEST_BOOK", comment.BuildUri(ev));
            }

            //core.CallingApplication.SendNotification(core, comment.OwnerKey, ev.ItemKey, string.Format("[user]{0}[/user] commented on [user]{2}[/user] [iurl=\"{1}\"]blog post[/iurl]", comment.OwnerKey.Id, comment.BuildUri(ev), ev.OwnerKey.Id), string.Empty, emailTemplate);
        }
Esempio n. 3
0
        public static bool Delete(Core core)
        {
            long commentId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0));
            Comment comment;

            bool canDelete = false;
            comment = new Comment(core, commentId);

            ICommentableItem item = comment.CommentedItem;

            if (comment.PermissiveParent.Access.Can("DELETE_COMMENTS"))
            {
                canDelete = true;
            }
            else
            {
                throw new PermissionDeniedException("UNAUTHORISED_TO_DELETE_COMMENT");
            }

            if (comment.OwnerKey == core.LoggedInMemberItemKey)
            {
                canDelete = true;
            }

            if (canDelete)
            {
                comment.Delete();
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 4
0
 public CommentPostedEventArgs(Comment comment, User poster, ItemKey itemKey)
 {
     this.comment = comment;
     this.poster = poster;
     this.itemKey = itemKey;
 }
Esempio n. 5
0
        public static void NotifyGalleryItemComment(Core core, Job job)
        {
            try {
                Comment comment = new Comment(core, job.ItemId);
                GalleryItem ev = new GalleryItem(core, comment.CommentedItemKey.Id);

                if (ev.Owner is User && (!comment.OwnerKey.Equals(ev.OwnerKey)))
                {
                    core.CallingApplication.SendNotification(core, comment.User, (User)ev.Owner, ev.OwnerKey, ev.ItemKey, "_COMMENTED_GALLERY_ITEM", comment.BuildUri(ev));
                }

                core.CallingApplication.SendNotification(core, comment.OwnerKey, comment.User, ev.OwnerKey, ev.ItemKey, "_COMMENTED_GALLERY_ITEM", comment.BuildUri(ev));
            }
            catch (InvalidCommentException)
            {
            }
            catch (GalleryItemNotFoundException)
            {

            }
        }