Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (Request.Form[ASC.PhotoManager.PhotoConst.PARAM_EDIT_ITEMID + i] != null)
            {
                UpdateImage(i);
                i++;
            }

            long albumItemId = 0;

            if (!string.IsNullOrEmpty(Request.Form["album_face"]) && long.TryParse(Request.Form["album_face"], out albumItemId))
            {
                var storage = StorageFactory.GetStorage();
                var item    = storage.GetAlbumItem(albumItemId);
                albumForPublisher.FaceItem = item;
                storage.SaveAlbum(albumForPublisher);
            }

            PhotoUserActivityPublisher.EditPhoto(albumForPublisher, SecurityContext.CurrentAccount.ID);

            if (i > 1)
            {
                Response.Redirect(ASC.PhotoManager.PhotoConst.PAGE_PHOTO + "?" + ASC.PhotoManager.PhotoConst.PARAM_ALBUM + "=" + Request.QueryString[ASC.PhotoManager.PhotoConst.PARAM_ALBUM]);
            }
            else
            {
                Response.Redirect(ASC.PhotoManager.PhotoConst.PAGE_PHOTO_DETAILS + "?" + ASC.PhotoManager.PhotoConst.PARAM_PHOTO + "=" + Request.QueryString[ASC.PhotoManager.PhotoConst.PARAM_PHOTO]);
            }
        }
Example #2
0
        public string RemoveComment(string commentID, string pid)
        {
            CommunitySecurity.DemandPermissions(PhotoConst.Action_EditRemoveComment);

            long commentId;

            if (!string.IsNullOrEmpty(commentID) && long.TryParse(commentID, out commentId))
            {
                var storage = StorageFactory.GetStorage();
                var comment = storage.GetComment(commentId);
                var item    = storage.GetAlbumItem(comment.ItemID);

                storage.RemoveComment(commentId);

                PhotoUserActivityPublisher.RemoveComment(item, comment, SecurityContext.CurrentAccount.ID);
            }
            return(commentID);
        }
Example #3
0
        public AjaxResponse UpdateComment(string commentID, string text, string pid)
        {
            CommunitySecurity.DemandPermissions(PhotoConst.Action_EditRemoveComment);

            var resp = new AjaxResponse {
                rs1 = commentID
            };

            var storage = StorageFactory.GetStorage();
            var comment = storage.GetComment(Convert.ToInt64(commentID));
            var image   = storage.GetAlbumItem(comment.ItemID);

            comment.Text = text;
            storage.SaveComment(image, comment);

            resp.rs2 = text;

            PhotoUserActivityPublisher.UpdateComment(image, comment, SecurityContext.CurrentAccount.ID);

            return(resp);
        }
Example #4
0
        private void NotifyCommentAdd(AlbumItem image, Comment newComment)
        {
            var initiatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                NotifyClient.AddInterceptor(initiatorInterceptor);

                var albumUrl    = UrlHelper.GetAbsoluteAlbumUrl(image.Album.Id);
                var albumName   = DisplayUserSettings.GetFullUserName(new Guid(image.UserID));
                var eventUrl    = UrlHelper.GetAbsoluteEventUrl(image.Album.Event.Id);
                var userName    = DisplayUserSettings.GetFullUserName(new Guid(newComment.UserID));
                var userUrl     = CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(new Guid(newComment.UserID), ASC.Web.Community.Product.CommunityProduct.ID));
                var commentsUrl = UrlHelper.GetAbsolutePhotoUrl(image.Id);
                var commentText = newComment.Text;

                NotifyClient.SendNoticeAsync(
                    PhotoConst.NewEventComment,
                    image.Album.Event != null ? image.Album.Event.Id.ToString() : "0",
                    null,
                    new TagValue(PhotoConst.TagEventName, image.Album.Event.Name),
                    new TagValue(PhotoConst.TagUserName, userName),
                    new TagValue(PhotoConst.TagUserURL, userUrl),
                    new TagValue(PhotoConst.TagEventUrl, eventUrl),
                    new TagValue(PhotoConst.TagAlbumName, albumName),
                    new TagValue(PhotoConst.TagAlbumURL, albumUrl),
                    new TagValue(PhotoConst.TagPhotoName, image.Name),
                    new TagValue(PhotoConst.TagDate, string.Format("{0:d} {0:t}", newComment.Timestamp)),
                    new TagValue(PhotoConst.TagCommentBody, commentText),
                    new TagValue(PhotoConst.TagURL, commentsUrl));
            }
            finally
            {
                NotifyClient.RemoveInterceptor(initiatorInterceptor.Name);
            }

            PhotoUserActivityPublisher.AddComment(image, newComment);
        }
Example #5
0
        private void NotifyAlbumSave(Album currentAlbum, IEnumerable <AlbumItem> newItems)
        {
            var initiatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                NotifyClient.AddInterceptor(initiatorInterceptor);
                NotifyClient.BeginSingleRecipientEvent("photo uploaded");

                var albumUrl = UrlHelper.GetAbsoluteAlbumUrl(currentAlbum.Id);
                var eventUrl = UrlHelper.GetAbsoluteEventUrl(currentAlbum.Event.Id);
                var userName = DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID);
                var userUrl  = CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID, ASC.Web.Community.Product.CommunityProduct.ID));

                NotifyClient.SendNoticeAsync(
                    PhotoConst.NewPhotoUploaded,
                    null,
                    null,
                    new[] {
                    new TagValue(PhotoConst.TagEventName, currentAlbum.Event.Name),
                    new TagValue(PhotoConst.TagUserName, userName),
                    new TagValue(PhotoConst.TagUserURL, userUrl),
                    new TagValue(PhotoConst.TagPhotoCount, newItems.Count()),
                    new TagValue(PhotoConst.TagDate, string.Format("{0:d} {0:t}", TenantUtil.DateTimeNow())),
                    new TagValue(PhotoConst.TagURL, albumUrl),
                    new TagValue(PhotoConst.TagEventUrl, eventUrl),
                    new TagValue("PHOTO_UPLOAD", true)
                });
            }
            finally
            {
                NotifyClient.EndSingleRecipientEvent("photo uploaded");
                NotifyClient.RemoveInterceptor(initiatorInterceptor.Name);
            }

            PhotoUserActivityPublisher.AddPhoto(currentAlbum, SecurityContext.CurrentAccount.ID, newItems.ToList());
        }