internal static UserActivity ComposeActivityByPhoto(AlbumItem item)
        {
            UserActivity ua = new UserActivity();
            ua.TenantID = CurrentTenantID;
            ua.ContentID = GetPhotoContentID(item);
            ua.Date = ASC.Core.Tenants.TenantUtil.DateTimeNow();
            ua.ModuleID = PhotoConst.ModuleID;
            ua.ProductID = ASC.Web.Community.Product.CommunityProduct.ID;
            ua.Title = item.Name;
            ua.URL = String.Format("{0}?photo={1}", PhotoConst.ViewPhotoPageUrl, item.Id);

            return ua;
        }
        public PhotoAlbumItemWrapper(AlbumItem faceItem)
        {
            Id = faceItem.Id;
            Title = faceItem.Name;
            Updated = Created = (ApiDateTime)faceItem.Timestamp;

            Description = faceItem.Description;
            var storage =
                Data.Storage.StorageFactory.GetStorage(
                    CoreContext.TenantManager.GetCurrentTenant().TenantId.ToString(), "photo");
            Thumbnail = ImageHTMLHelper.GetImageUrl(faceItem.ExpandedStorePreview, storage);
            Location = ImageHTMLHelper.GetImageUrl(faceItem.ExpandedStoreThumb, storage);
            Comments = faceItem.CommentsCount;
        }
Пример #3
0
        private void LoadData()
        {
            if (!string.IsNullOrEmpty(Request.QueryString[PhotoConst.PARAM_PHOTO]))
            {
                var storage = StorageFactory.GetStorage();

                image = storage.GetAlbumItem(Convert.ToInt64(Request.QueryString[PhotoConst.PARAM_PHOTO]));

                if (image != null)
                {
                    if (storage.GetAlbumItems(image.Album).Count == 0)
                        Response.Redirect(PhotoConst.PAGE_DEFAULT);

                    SlideShowButton.Visible = storage.GetAlbumItems(image.Album).Count > 1;

                    var CommentsList = new CommentsList();
                    ConfigureCommentsList(CommentsList, image);
                    var scripts = CommentsList.GetClientScripts(Page.Request.GetUrlRewriter().Scheme + Uri.SchemeDelimiter + Page.Request.GetUrlRewriter().Host + ":" + Page.Request.GetUrlRewriter().Port, Page);
                    Page.Header.Controls.Add(new Literal() {Text = scripts});

                    LoadHeaderForImage(image);

                    LoadAlbumsLinks(image.Album.Event);

                    LoadThumbnails(image.Album);

                    // LoadComments(image);

                    hdnPhotoName.Value = HttpUtility.HtmlEncode(image.Name);
                    hdnImageID.Value = image.Id.ToString();
                    hdnAlbumID.Value = image.Album.Id.ToString();
                    hdnDefaultImageID.Value = image.Id.ToString();

                }
                else
                {
                    mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = PhotoManagerResource.PhotoTitle, NavigationUrl = PhotoConst.PAGE_DEFAULT});
                    pnlContent.Visible = false;
                    albumsContainer.Visible = false;
                    ltrMessage.Text = string.Format("<div class=\"noContentBlock\">{0}</div>", PhotoManagerResource.NoFoundMessage);
                }
            }
        }
Пример #4
0
 protected string RenderSlideShowLink(AlbumItem img)
 {
     return PhotoConst.PAGE_SLIDER + "?" + PhotoConst.PARAM_ALBUM + "=" + img.Album.Id + "&" + PhotoConst.PARAM_PHOTO + "=" + img.Id.ToString();
 }
Пример #5
0
 protected string RenderEditPhotoLink(AlbumItem img)
 {
     return PhotoConst.PAGE_EDIT_PHOTO + "?" + PhotoConst.PARAM_PHOTO + "=" + img.Id;
 }
Пример #6
0
        private void DeletePhoto(AlbumItem image)
        {
            CommunitySecurity.DemandPermissions(image, PhotoConst.Action_EditRemovePhoto);

            var storage = StorageFactory.GetStorage();
            var store = Data.Storage.StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(), "photo");
            var tempAlbum = image.Album;

            if (image.Album.FaceItem.Equals(image))
            {
                var items = storage.GetAlbumItems(tempAlbum);
                tempAlbum.FaceItem = items[items[0].Equals(image) && 1 < tempAlbum.ImagesCount ? 1 : 0];
                storage.SaveAlbum(tempAlbum);
            }

            RemoveCommentsFCKUploads(storage.GetComments(image.Id));
            storage.RemoveAlbumItem(image.Id);

            store.Delete(PhotoConst.ImagesPath + image.ExpandedStoreThumb);
            store.Delete(PhotoConst.ImagesPath + image.ExpandedStorePreview);
        }
Пример #7
0
        private static void ConfigureCommentsList(CommentsList commentList, AlbumItem image)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddComment);
            commentList.Simple = Core.Mobile.MobileDetector.IsRequestMatchesMobile(HttpContext.Current);

            var count = image != null ? image.CommentsCount : 0;
            commentList.CommentsCountTitle = count.ToString();

            commentList.ObjectID = image != null ? image.Id.ToString() : "";
            commentList.BehaviorID = "commentsObj";
            commentList.TotalCount = count;

            commentList.JavaScriptAddCommentFunctionName = "PhotoDetails.AddComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "PhotoDetails.LoadCommentText";
            commentList.JavaScriptPreviewCommentFunctionName = "PhotoDetails.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName = "PhotoDetails.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName = "PhotoDetails.UpdateComment";
            commentList.FckDomainName = "photomanager_comments";

        }
Пример #8
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);
        }
Пример #9
0
        public void SaveAlbumItem(AlbumItem i)
        {
            if (i == null) throw new ArgumentNullException("image");

            if (i.Id != 0)
            {
                DbManager
                    .ExecuteList(Query("photo_image").Select("ViewsCount", "CommentsCount").Where("Id", i.Id))
                    .ForEach(r => { i.ViewsCount = (int)Convert.ToInt64(r[0]); i.CommentsCount = (int)Convert.ToInt64(r[1]); });
            }

            using (var tx = DbManager.BeginTransaction())
            {
                i.Id = DbManager.ExecuteScalar<long>(
                    Insert("photo_image")
                    .InColumns(Mappers.ImageColumns)
                    .Values(i.Id, i.Album.Id, i.Name, i.Description, i.Location, DateTime.UtcNow, i.UserID, i.ThumbnailSize.Width, i.ThumbnailSize.Height, /*i.OriginalSize.Width, i.OriginalSize.Height,*/ i.PreviewSize.Width, i.PreviewSize.Height, i.ViewsCount, i.CommentsCount)
                    .Identity(1, 0L, true)
                );
                UpdateAlbumImagesCount(i.Album.Id);

                tx.Commit();
            }
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {            
            try
            {
                // Get the data
                HttpPostedFile jpeg_image_upload = Request.Files["Filedata"];
                IDataStore store = StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(), "photo");
                var storage = ASC.PhotoManager.Model.StorageFactory.GetStorage();
                   
                string uid = Request["uid"];
                string eventID = Request["eventID"];
                
                bool clearSession = false;

                Album currentAlbum = null;
                
                var albums = storage.GetAlbums(Convert.ToInt64(eventID), uid);
                    clearSession = true;

                    currentAlbum = 0 < albums.Count ? albums[0] : null;

                    if (currentAlbum == null)
                    {
                        Event Event = storage.GetEvent(Convert.ToInt64(eventID));

                        currentAlbum = new Album();
                        currentAlbum.Event = Event;
                        currentAlbum.UserID = uid;

                        storage.SaveAlbum(currentAlbum);
                    }

                    if (Session["photo_albumid"] != null)
                    {
                        if (currentAlbum.Id != (long)Session["photo_albumid"])
                            clearSession = true;
                        Session["photo_albumid"] = currentAlbum.Id;
                    }
                    else
                        clearSession = true;

                string fileNamePath = Resources.PhotoManagerResource.ImagesPath + uid + "/" + currentAlbum.Id + "/";

                ImageInfo currentImageInfo = new ImageInfo();
                string[] listFiles;

                if (Session["photo_listFiles"] != null && !clearSession)
                    listFiles = (string[])Session["photo_listFiles"];
                else
                {
                    listFiles = store.ListFilesRelative("", fileNamePath, "*.*", false);
                    Session["photo_listFiles"] = listFiles;
                }

                string fileExtension = GetFileExtension(jpeg_image_upload.FileName);
                string fileNameWithOutExtension = GetFileName(jpeg_image_upload.FileName);
                string addSuffix = string.Empty;

                
                //if file already exists
                int i = 1;

                while (CheckFile(listFiles, fileNameWithOutExtension + addSuffix + Constants.THUMB_SUFFIX + fileExtension))
                {
                    addSuffix = "(" + i.ToString() + ")";
                    i++;
                }

                string fileNameThumb = fileNamePath + fileNameWithOutExtension + addSuffix + Constants.THUMB_SUFFIX + "." + Constants.jpeg_extension;
                string fileNamePreview = fileNamePath + fileNameWithOutExtension + addSuffix + Constants.PREVIEW_SUFFIX + "." + Constants.jpeg_extension;
                                

                currentImageInfo.Name = fileNameWithOutExtension;
                currentImageInfo.PreviewPath = fileNamePreview;
                currentImageInfo.ThumbnailPath = fileNameThumb;


                Stream fs = jpeg_image_upload.InputStream;
                
                try
                {
                    EXIFReader reader = new EXIFReader(fs);
                    currentImageInfo.ActionDate = (string)reader[PropertyTagId.DateTime];
                }
                catch { }

                ImageHelper.GenerateThumbnail(fs, fileNameThumb, ref currentImageInfo, store);
                ImageHelper.GeneratePreview(fs, fileNamePreview, ref currentImageInfo, store);

                fs.Dispose();

                AlbumItem image = new AlbumItem(currentAlbum);
                image.Name = currentImageInfo.Name;
                image.Timestamp = ASC.Core.Tenants.TenantUtil.DateTimeNow();
                image.UserID = uid;

                image.Location = currentImageInfo.Name;
                

                image.PreviewSize = new Size(currentImageInfo.PreviewWidth, currentImageInfo.PreviewHeight);
                image.ThumbnailSize = new Size(currentImageInfo.ThumbnailWidth, currentImageInfo.ThumbnailHeight);

                storage.SaveAlbumItem(image);

                currentAlbum.FaceItem = image;
                storage.SaveAlbum(currentAlbum);

                string response = image.Id.ToString();

                byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(response);
                string encodingResponse = Convert.ToBase64String(byteArray);

                
                Response.StatusCode = 200;
                Response.Write(encodingResponse);
            }
            catch
            {
                // If any kind of error occurs return a 500 Internal Server error
                Response.StatusCode = 500;
                Response.Write("An error occured");
                Response.End();
            }
            finally
            {
                Response.End();
            }
        }
 internal static string GetPhotoContentID(AlbumItem item)
 {
     return String.Format("photo#{0}", item.Id);
 }
		public static void UpdateComment(AlbumItem item, Comment comment, Guid authorID)
        {
            var ua =
                ApplyCustomeActivityParams(
                    ComposeActivityByPhoto(item),
                    Resources.PhotoManagerResource.UserActivity_EditComment,
                    authorID,
                    UserActivityConstants.ActivityActionType,
                    PhotoConst.EditCommentBusinessValue);
            PublishInternal(ua);
        }
 public static void AddComment(AlbumItem item, Comment newComment)
 {
     var ua =
         ApplyCustomeActivityParams(
             ComposeActivityByPhoto(item),
             Resources.PhotoManagerResource.UserActivity_AddComment,
             new Guid (newComment.UserID),
             UserActivityConstants.ActivityActionType,
             PhotoConst.AddCommentBusinessValue);
     ua.HtmlPreview = newComment.Text;
     PublishInternal(ua);
 }
        public static void Evaluate(AlbumItem image, Guid authorID)
        {
            var ua =
                ApplyCustomeActivityParams(
                    ComposeActivityByPhoto(image),
                    Resources.PhotoManagerResource.UserActivity_Evaluate,
                    authorID,
                    UserActivityConstants.ActivityActionType,
                    PhotoConst.EvaluateBusinessValue);

            PublishInternal(ua);
        }
Пример #15
0
        public AjaxResponse AddComment(string parrentCommentID, string photoID, string text, string pid)
        {
            var resp = new AjaxResponse {rs1 = parrentCommentID};

            CommunitySecurity.DemandPermissions(PhotoConst.Action_AddComment);

            var storage = StorageFactory.GetStorage();
            image = storage.GetAlbumItem(Convert.ToInt64(photoID));

            var newComment = new Comment(image.Id)
                                 {
                                     Text = text,
                                     Timestamp = ASC.Core.Tenants.TenantUtil.DateTimeNow(),
                                     UserID = SecurityContext.CurrentAccount.ID.ToString()
                                 };

            if (!string.IsNullOrEmpty(parrentCommentID))
            {
                newComment.ParentId = Convert.ToInt64(parrentCommentID);
            }

            var count = storage.SaveComment(image, newComment);
            storage.ReadAlbumItem(newComment.ItemID, SecurityContext.CurrentAccount.ID.ToString());

            var odd = count%2 == 1;

            var comment = newComment;

            var info = new CommentInfo
                           {
                               CommentID = comment.Id.ToString(),
                               UserID = new Guid(comment.UserID),
                               TimeStampStr = comment.Timestamp.Ago(),
                               IsRead = true,
                               Inactive = comment.Inactive,
                               CommentBody = comment.Text,
                               UserFullName = DisplayUserSettings.GetFullUserName(new Guid(comment.UserID)),
                               UserAvatar = ImageHTMLHelper.GetHTMLImgUserAvatar(new Guid(comment.UserID)),
                               UserPost = CoreContext.UserManager.GetUsers(new Guid(comment.UserID)).Title,
                               IsEditPermissions = CommunitySecurity.CheckPermissions(image, PhotoConst.Action_EditRemoveComment),
                               IsResponsePermissions = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddComment)
                           };

            //postParser.Parse(comment.Text);

            var defComment = new CommentsList();
            ConfigureCommentsList(defComment, image);

            resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer(defComment, info, newComment.ParentId == 0, odd);


            return resp;
        }
Пример #16
0
        private List<string> CreateImagesInfoBySimple()
        {
            var info = new List<string>();
            var store = Data.Storage.StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(), "photo");
            var storage = StorageFactory.GetStorage();

            var uid = SecurityContext.CurrentAccount.ID.ToString();
            var eventID = Request["events_selector"];

            var albums = storage.GetAlbums(Convert.ToInt64(eventID), uid);

            var currentAlbum = 0 < albums.Count ? albums[0] : null;

            if (currentAlbum == null)
            {
                var Event = storage.GetEvent(Convert.ToInt64(eventID));

                currentAlbum = new Album {Event = Event, UserID = uid};

                storage.SaveAlbum(currentAlbum);
            }
            var fileNamePath = PhotoConst.ImagesPath + uid + "/" + currentAlbum.Id + "/";

            var listFiles = store.ListFilesRelative("", fileNamePath, "*.*", false);

            for (var j = 0; j < Request.Files.Count; j++)
            {
                var file = Request.Files[j];

                if (file.ContentLength > SetupInfo.MaxUploadSize)
                    continue;

                if (string.IsNullOrEmpty(file.FileName))
                    continue;

                var currentImageInfo = new ImageInfo();

                var fileExtension = FileUtility.GetFileExtension(file.FileName);
                var fileNameWithOutExtension = FileUtility.GetFileName(file.FileName);
                var addSuffix = string.Empty;

                var i = 1;

                while (CheckFile(listFiles, fileNameWithOutExtension + addSuffix + PhotoConst.THUMB_SUFFIX + fileExtension))
                {
                    addSuffix = "(" + i.ToString() + ")";
                    i++;
                }

                var fileNameThumb = fileNamePath + fileNameWithOutExtension + addSuffix + PhotoConst.THUMB_SUFFIX + "." + PhotoConst.jpeg_extension;
                var fileNamePreview = fileNamePath + fileNameWithOutExtension + addSuffix + PhotoConst.PREVIEW_SUFFIX + "." + PhotoConst.jpeg_extension;


                currentImageInfo.Name = fileNameWithOutExtension;
                currentImageInfo.PreviewPath = fileNamePreview;
                currentImageInfo.ThumbnailPath = fileNameThumb;
                var fs = file.InputStream;

                try
                {
                    var reader = new EXIFReader(fs);
                    currentImageInfo.ActionDate = (string) reader[PropertyTagId.DateTime];
                }
                catch
                {
                }

                ImageHelper.GenerateThumbnail(fs, fileNameThumb, ref currentImageInfo, store);
                ImageHelper.GeneratePreview(fs, fileNamePreview, ref currentImageInfo, store);

                fs.Dispose();

                var image = new AlbumItem(currentAlbum)
                                {
                                    Name = currentImageInfo.Name,
                                    Timestamp = ASC.Core.Tenants.TenantUtil.DateTimeNow(),
                                    UserID = uid,
                                    Location = currentImageInfo.Name,
                                    PreviewSize = new Size(currentImageInfo.PreviewWidth, currentImageInfo.PreviewHeight),
                                    ThumbnailSize = new Size(currentImageInfo.ThumbnailWidth, currentImageInfo.ThumbnailHeight)
                                };

                storage.SaveAlbumItem(image);

                currentAlbum.FaceItem = image;

                storage.SaveAlbum(currentAlbum);

                info.Add(image.Id.ToString());
            }

            return info;
        }
Пример #17
0
        public override FileUploadResult ProcessUpload(HttpContext context)
        {
            if (!ASC.Core.SecurityContext.AuthenticateMe(CookiesManager.GetCookies(CookiesType.AuthKey)))
            {
                return new FileUploadResult
                           {
                               Success = false,
                               Message = "Permission denied"
                           };
            }

            var result = "";

            try
            {
                if (ProgressFileUploader.HasFilesToUpload(context))
                {
                    var postedFile = new ProgressFileUploader.FileToUpload(context);
                    var fileName = postedFile.FileName;
                    var inputStream = postedFile.InputStream;


                    var store = Data.Storage.StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(), "photo");
                    var storage = StorageFactory.GetStorage();

                    var uid = context.Request["uid"];
                    var eventID = context.Request["eventID"];

                    var albums = storage.GetAlbums(Convert.ToInt64(eventID), uid);

                    var currentAlbum = 0 < albums.Count ? albums[0] : null;

                    if (currentAlbum == null)
                    {
                        var Event = storage.GetEvent(Convert.ToInt64(eventID));

                        currentAlbum = new Album
                                           {
                                               Event = Event,
                                               UserID = uid
                                           };

                        storage.SaveAlbum(currentAlbum);
                    }

                    if (context.Session["photo_albumid"] != null)
                    {
                        context.Session["photo_albumid"] = currentAlbum.Id;
                    }

                    var fileNamePath = PhotoConst.ImagesPath + uid + "/" + currentAlbum.Id + "/";

                    var currentImageInfo = new ImageInfo();

                    var listFiles = store.ListFilesRelative("", fileNamePath, "*.*", false);
                    context.Session["photo_listFiles"] = listFiles;

                    var fileExtension = FileUtility.GetFileExtension(fileName);
                    var fileNameWithOutExtension = GetFileName(fileName);
                    var addSuffix = string.Empty;

                    //if file already exists
                    var i = 1;

                    while (CheckFile(listFiles, fileNameWithOutExtension + addSuffix + PhotoConst.THUMB_SUFFIX + fileExtension))
                    {
                        addSuffix = "(" + i.ToString() + ")";
                        i++;
                    }

                    var fileNameThumb = fileNamePath + fileNameWithOutExtension + addSuffix + PhotoConst.THUMB_SUFFIX + "." + PhotoConst.jpeg_extension;
                    var fileNamePreview = fileNamePath + fileNameWithOutExtension + addSuffix + PhotoConst.PREVIEW_SUFFIX + "." + PhotoConst.jpeg_extension;

                    currentImageInfo.Name = fileNameWithOutExtension;
                    currentImageInfo.PreviewPath = fileNamePreview;
                    currentImageInfo.ThumbnailPath = fileNameThumb;

                    var fs = inputStream;

                    try
                    {
                        var reader = new EXIFReader(fs);
                        currentImageInfo.ActionDate = (string) reader[PropertyTagId.DateTime];
                    }
                    catch
                    {
                    }

                    ImageHelper.GenerateThumbnail(fs, fileNameThumb, ref currentImageInfo, store);
                    ImageHelper.GeneratePreview(fs, fileNamePreview, ref currentImageInfo, store);

                    fs.Dispose();

                    var image = new AlbumItem(currentAlbum)
                                    {
                                        Name = currentImageInfo.Name,
                                        Timestamp = ASC.Core.Tenants.TenantUtil.DateTimeNow(),
                                        UserID = uid,
                                        Location = currentImageInfo.Name,
                                        PreviewSize = new Size(currentImageInfo.PreviewWidth, currentImageInfo.PreviewHeight),
                                        ThumbnailSize = new Size(currentImageInfo.ThumbnailWidth, currentImageInfo.ThumbnailHeight)
                                    };

                    storage.SaveAlbumItem(image);

                    currentAlbum.FaceItem = image;
                    storage.SaveAlbum(currentAlbum);

                    var response = image.Id.ToString();

                    var byteArray = System.Text.Encoding.UTF8.GetBytes(response);
                    result = Convert.ToBase64String(byteArray);
                }

            }
            catch (Exception ex)
            {
                return new FileUploadResult
                           {
                               Success = false,
                               Message = ex.Message,
                           };
            }

            return new FileUploadResult
                       {
                           Success = true,
                           Data = "",
                           Message = result
                       };
        }
Пример #18
0
        public long SaveComment(AlbumItem image, Comment comment)
        {
            using (var tx = DbManager.BeginTransaction())
            {
                comment.Id = DbManager.ExecuteScalar<long>(
                    Insert("photo_comment")
                    .InColumns(Mappers.CommentColumns)
                    .Values(comment.Id, comment.Text, comment.UserID, PrepareTimestamp(comment.Timestamp), comment.ItemID, comment.ParentId, comment.Inactive)
                    .Identity(1, 0L, true)
                );
                var count = UpdateImageCommentsCount(comment.ItemID);

                tx.Commit();

                NotifyCommentAdd(image, comment);
                return count;
            }
        }
Пример #19
0
        private void LoadHeaderForImage(AlbumItem image)
        {
            var caption = string.IsNullOrEmpty(image.Album.Caption) ? DisplayUserSettings.GetFullUserName(new Guid(image.Album.UserID), false) : image.Album.Caption;

            mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = PhotoManagerResource.PhotoTitle, NavigationUrl = PhotoConst.PAGE_DEFAULT});
            mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = image.Album.Event.Name, NavigationUrl = PhotoConst.PAGE_DEFAULT + "?" + PhotoConst.PARAM_EVENT + "=" + image.Album.Event.Id});
            mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = caption, NavigationUrl = PhotoConst.PAGE_PHOTO + "?" + PhotoConst.PARAM_ALBUM + "=" + image.Album.Id});
            mainContainer.BreadCrumbs.Add(new BreadCrumb {Caption = PhotoManagerResource.PhotoTitle});
        }
Пример #20
0
		private string AddAlbumItem(AlbumItem albumItem, bool isFace)
		{
			StringBuilder sb = new StringBuilder();

			if (countItems != 0 && countItems % 3 == 0)
				sb.Append("</div>");

			if (countItems % 3 == 0)
				sb.Append("<div class=\"borderLight tintMediumLight clearFix\" style=\"padding:20px; border-left:none;border-right:none;margin-bottom:8px;\">");


			sb.Append("<div style='float:left;margin-bottom:5px;" + (countItems % 3 == 0 ? "" : "margin-left:22px; ") + "'>");

			sb.Append("<span>");
			sb.Append("<input name=\"" + ASC.PhotoManager.PhotoConst.PARAM_EDIT_ITEMID + countItems + "\" name=\"" + ASC.PhotoManager.PhotoConst.PARAM_EDIT_ITEMID + countItems + "\" type=\"hidden\" value=\"" + albumItem.Id + "\" />");
			sb.Append("<div style=\"width: 200px;height:200px;background-color: #EBF0F4;padding:5px;\">" + ImageHTMLHelper.GetHTMLThumb(ImageHTMLHelper.GetImageUrl(albumItem.ExpandedStorePreview, store), 200, albumItem.PreviewSize.Width, albumItem.PreviewSize.Height) + "</div>");

            sb.Append("<div class='textBigDescribe clearFix' style=\" padding-left:5px;padding-top:5px;width:200px;\">");
			sb.Append("<div style=\"padding-top: 5px; float: left;\">" + PhotoManagerResource.EditPhotoNameTitle + "</div>");

			sb.Append("<div style=\"float: right;\">");
			sb.Append("<label class='textMediumDescribe' for=\"face_" + countItems + "\">");
			sb.Append(PhotoManagerResource.AlbumCoverTitle + "</label><input type=\"radio\" id=\"face_" + countItems + "\" name=\"album_face\" value=\"" + albumItem.Id + "\" " + (isFace ? "checked" : "") + " /></div></div>");

			sb.Append("<div><input class=\"textEdit\" style=\"width:200px;margin-top:5px;\" maxlength=\"255\" name=\"" + ASC.PhotoManager.PhotoConst.PARAM_EDIT_NAME + countItems + "\" id=\"" + ASC.PhotoManager.PhotoConst.PARAM_EDIT_NAME + countItems + "\" value='" + HttpUtility.HtmlEncode(albumItem.Name) + "' type=\"text\"/></div>");
			sb.Append("</span>");

			sb.Append("</div>");

			countItems++;

			return sb.ToString();
		}
Пример #21
0
        private string GetHTMLSmallThumb(AlbumItem image, int maxSize, string link, Data.Storage.IDataStore store)
        {
            var sb = new StringBuilder();

            var limit = ImageHTMLHelper.GetImageSizeLimit(image, maxSize);

            sb.Append("<span style=\"padding: 3px;	display: inline-block;	position: relative;	text-align: center;	vertical-align: top;\" >");
            sb.Append("<table border=0 cellpadding=\"0\" cellspacing=\"0\"><tr><td style=\"text-align:center;vertical-align:middle;border:solid 0px #cfcfcf;height:" + maxSize + "px;width:" + maxSize + "px;table-layout:fixed;\">");
            sb.Append("<a href=\"" + link + "\">");
            sb.Append("<img " + limit + " title=\"" + (image != null ? HttpUtility.HtmlEncode(image.Name) : "") + "\" src=\"" + (image != null ? ImageHTMLHelper.GetImageUrl(image.ExpandedStoreThumb, store) : "") + "\" class=\"borderBase\">");

            sb.Append("</a></td></tr></table></span>");

            return sb.ToString();
        }