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);
                }
            }
        }
Beispiel #2
0
        private static void ConfigureComments(CommentsList commentList, Feed feed)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);
            commentList.Simple = false;
            commentList.BehaviorID = "_commentsObj";
            commentList.FckDomainName = "news_comments";

            commentList.JavaScriptAddCommentFunctionName = "Default.AddComment";
            commentList.JavaScriptPreviewCommentFunctionName = "Default.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName = "Default.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName = "Default.UpdateComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "Default.LoadCommentText";

            commentList.ObjectID = feed != null ? feed.Id.ToString(CultureInfo.CurrentCulture) : "";
        }
        public AjaxResponse GetImage(string imageID)
        {
            var storage = StorageFactory.GetStorage();
            var store = Data.Storage.StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(), "photo");
            var currentItem = storage.GetAlbumItem(Convert.ToInt64(imageID));
            if (currentItem == null)
                return new AjaxResponse
                           {
                               status = "error",
                               message = "have no photo",
                               rs2 = "",
                               rs3 = WebImageSupplier.GetAbsoluteWebPath("blank.gif")
                           };
            var items = storage.GetAlbumItems(currentItem.Album);
            var pos = items.IndexOf(currentItem);

            var htw = new HtmlTextWriter(new StringWriter());
            var imageComments = StorageFactory.GetStorage().GetComments(currentItem.Id);
            var comments = new List<CommentInfo>();
            AppendChildsComments(ref comments, imageComments);

            var CommentsList = new CommentsList();
            ConfigureCommentsList(CommentsList, currentItem);
            CommentsList.Items = comments;
            CommentsList.RenderControl(htw);

            if (!SecurityContext.DemoMode)
                storage.ReadAlbumItem(currentItem.Id, currentUserID.ToString());

            return new AjaxResponse
                       {
                           rs1 = currentItem.Id.ToString(),
                           rs2 = (currentItem.Name ?? string.Empty).HtmlEncode(),
                           rs3 = ImageHTMLHelper.GetImageUrl(currentItem.ExpandedStorePreview, store),
                           rs4 = (currentItem.Description ?? string.Empty).HtmlEncode(),
                           rs5 = currentItem.PreviewSize.Width.ToString(),
                           rs6 = currentItem.PreviewSize.Height.ToString(),
                           rs7 = Grammatical.ViewsCount(currentItem.ViewsCount),
                           rs8 = Grammatical.CommentsCount(currentItem.CommentsCount),
                           rs9 = RenderEditPhotoLink(currentItem),
                           rs10 = RenderSlideShowLink(currentItem),
                           rs11 = pos > 0 ? items[pos - 1].Id.ToString() : "",
                           rs12 = pos < items.Count - 1 ? items[pos + 1].Id.ToString() : "",
                           rs13 = htw.InnerWriter.ToString()
                       };
        }
        private string GetHTMLComment(Comment comment, bool isPreview)
        {
            var info = new CommentInfo
                           {
                               CommentID = comment.Id.ToString(),
                               UserID = new Guid(comment.UserID),
                               TimeStamp = comment.Timestamp,
                               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
                           };

            if (!isPreview)
            {
                info.IsEditPermissions = CommunitySecurity.CheckPermissions(image, PhotoConst.Action_EditRemoveComment);

                info.IsResponsePermissions = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddComment);
            }

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

            return Web.Controls.CommentInfoHelper.CommentsHelper.GetOneCommentHtmlWithContainer(defComment, info, comment.ParentId <= 0, false);
        }
        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;
        }
        public static void CommentsConfigure(CommentsList commentList)
        {

            commentList.DisableCtrlEnter = (SetupInfo.WorkMode == WorkMode.Promo);

            commentList.PID = CommonLinkUtility.GetProductID().ToString();
            commentList.InactiveMessage = Resources.Resource.CommentRemovedMessage;
            commentList.UserProfileUrlResolver = user => CommonLinkUtility.GetUserProfile(user);
            commentList.UserPageLinkWithParam = VirtualPathUtility.ToAbsolute("~/userprofile.aspx") + "?" + CommonLinkUtility.GetProductParamsPair(new Guid(commentList.PID)) + "&uid";
            commentList.AddCommentLink = Resources.Resource.AddNewCommentButton;

            commentList.SaveButton = Resources.Resource.PublishButton;
            commentList.BehaviorID = "_commentObj";

            commentList.PreviewButton = Resources.Resource.PreviewButton;
            commentList.HidePrevuewButton = Resources.Resource.CloseButton;
            commentList.CancelButton = Resources.Resource.CancelButton;
            commentList.InactiveMessage = Resources.Resource.CommentWasRemoved;

            commentList.RemoveCommentLink = Resources.Resource.DeleteButton;
            commentList.ResponseCommentLink = Resources.Resource.AnswerButton;
            commentList.EditCommentLink = Resources.Resource.EditButton;

            commentList.FCKBasePath = FCKEditorBasePath;

            commentList.CommentsTitle = Resources.Resource.Comments;

            commentList.ConfirmRemoveCommentMessage = Resources.Resource.ConfirmRemoveCommentMessage;

            commentList.AdditionalSubmitText = "<span class=\"textMediumDescribe\" style=\"margin-left:5px;\">" + Resources.Resource.OrPress + "</span> <span class=\"textBase\">" + Resources.Resource.CtrlEnterKeys + "</span>";

            commentList.FCKEditorAreaCss = WebSkin.GetUserSkin().BaseCSSFileAbsoluteWebPath;

            commentList.LoaderImage = WebImageSupplier.GetAbsoluteWebPath("ajax_progress_loader.gif");
            commentList.CommentSendingMsg = Resources.Resource.PleaseWaitMessage;


            commentList.OnEditedCommentJS = "FCKCommentsController.EditCommentHandler";
            commentList.OnCanceledCommentJS = "FCKCommentsController.CancelCommentHandler";
            commentList.OnRemovedCommentJS = "FCKCommentsController.RemoveCommentHandler";

            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof (CommonControlsConfigurer));
            }
            catch
            {
            }
        }
        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";

        }
Beispiel #8
0
        public string GetPreview(string text, string commentID)
        {
            var info = GetPrevHTMLComment(text, commentID);
            var defComment = new CommentsList();
            ConfigureComments(defComment, null);

            return CommentsHelper.GetOneCommentHtmlWithContainer(defComment, info, true, false);
        }
Beispiel #9
0
        public AjaxResponse AddComment(string parentCommentId, string pageName, string text, string pid)
        {
            var resp = new AjaxResponse();
            resp.rs1 = parentCommentId;

            //var newComment = new Comment
            //                     {
            //                         Body = text,
            //                         Date = TenantUtil.DateTimeNow(),
            //                         UserId = SecurityContext.CurrentAccount.ID,
            //                     };

            //if (!string.IsNullOrEmpty(parentCommentId))
            //{
            //    newComment.ParentId = new Guid(parentCommentId);
            //}
            //newComment.PageName = pageName;


            //newComment = Wiki.SaveComment(newComment);

            //WikiActivityPublisher.AddPageComment(Wiki.GetPage(newComment.PageName), newComment);
            var parentIdGuid = String.IsNullOrEmpty(parentCommentId) ? Guid.Empty : new Guid(parentCommentId);
            var newComment = Wiki.CreateComment(new Comment { Body = text, PageName = pageName, ParentId = parentIdGuid });

            var info = GetCommentInfo(newComment);

            var defComment = new CommentsList();
            ConfigureComments(defComment, pageName);

            var visibleCommentsCount = Wiki.GetComments(pageName).Count;

            resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer(
                defComment,
                info,
                string.IsNullOrEmpty(parentCommentId),
                visibleCommentsCount % 2 == 1);

            //WikiNotifyClient.SendNoticeAsync(
            //    SecurityContext.CurrentAccount.ID.ToString(),
            //    Common.Constants.EditPage,
            //    pageName,
            //    null,
            //    GetListOfTagValForNotify(pageName, "new wiki page comment", newComment.Body));

            return resp;
        }
Beispiel #10
0
        private static void ConfigureComments(CommentsList commentList, int totalCount, Post postToUpdate)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(postToUpdate, ASC.Blogs.Core.Constants.Action_AddComment);
            commentList.CommentsCountTitle = totalCount > 0 ? totalCount.ToString() : "";
            commentList.FckDomainName = 

            commentList.ObjectID = postToUpdate != null ? postToUpdate.ID.ToString() : "";
            commentList.Simple = false;
            commentList.BehaviorID = "commentsObj";
            commentList.JavaScriptAddCommentFunctionName = "ViewBlog.AddComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "ViewBlog.LoadCommentBBCode";
            commentList.JavaScriptPreviewCommentFunctionName = "ViewBlog.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName = "ViewBlog.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName = "ViewBlog.UpdateComment";
            commentList.FckDomainName = "blogs_comments";

            commentList.TotalCount = totalCount;
        }
Beispiel #11
0
        private string GetHTMLComment(Comment comment, bool isPreview)
        {
            CommentInfo info = new CommentInfo();

            info.CommentID = comment.ID.ToString();
            info.UserID = comment.UserID;
            info.TimeStamp = comment.Datetime;
            info.TimeStampStr = comment.Datetime.Ago();

            info.IsRead = true;
            info.Inactive = comment.Inactive;
            info.CommentBody = comment.Content;
            info.UserFullName = DisplayUserSettings.GetFullUserName(comment.UserID);
            info.UserAvatar = ImageHTMLHelper.GetHTMLUserAvatar(comment.UserID);
            info.UserPost = CoreContext.UserManager.GetUsers(comment.UserID).Title;

            if (!isPreview)
            {
                info.IsEditPermissions = CommunitySecurity.CheckPermissions(comment, ASC.Blogs.Core.Constants.Action_EditRemoveComment);

                info.IsResponsePermissions = CommunitySecurity.CheckPermissions(comment.Post, ASC.Blogs.Core.Constants.Action_AddComment);
            }
            var defComment = new CommentsList();
            ConfigureComments(defComment, 0, null);

            return Web.Controls.CommentInfoHelper.CommentsHelper.GetOneCommentHtmlWithContainer(
                    defComment,
                    info,
                    comment.IsRoot(),
                    false);
        }
        private static void ConfigureComments(CommentsList commentList, Task taskToUpdate)
        {
            var commentsCount = Global.EngineFactory.GetCommentEngine().Count(taskToUpdate);

            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.IsShowAddCommentBtn = ProjectSecurity.CanCreateComment();

            commentList.CommentsCountTitle = commentsCount != 0 ? commentsCount.ToString() : "";

            commentList.ObjectID = taskToUpdate != null ? taskToUpdate.ID.ToString() : "";
            commentList.Simple = false;
            commentList.BehaviorID = "commentsObj";
            commentList.JavaScriptAddCommentFunctionName = "AjaxPro.TaskDescriptionView.AddComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "AjaxPro.TaskDescriptionView.LoadCommentBBCode";
            commentList.JavaScriptPreviewCommentFunctionName = "AjaxPro.TaskDescriptionView.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName = "AjaxPro.TaskDescriptionView.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName = "AjaxPro.TaskDescriptionView.UpdateComment";
            commentList.FckDomainName = "projects_comments";

            commentList.TotalCount = commentsCount;

        }
        private string GetHTMLComment(Comment comment, bool isPreview)
        {

            var info = new CommentInfo
                           {
                               CommentID = comment.ID.ToString(),
                               UserID = comment.CreateBy,
                               TimeStamp = comment.CreateOn,
                               TimeStampStr = comment.CreateOn.Ago(),
                               UserPost = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo.Title,
                               Inactive = comment.Inactive,
                               CommentBody = comment.Content,
                               UserFullName = DisplayUserSettings.GetFullUserName(Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo),
                               UserAvatar = Global.GetHTMLUserAvatar(comment.CreateBy)
                           };

            var defComment = new CommentsList();
            ConfigureComments(defComment, null);

            if (!isPreview)
            {
                var when = Global.EngineFactory.GetParticipantEngine().WhenReaded(Page.Participant.ID, Task.UniqID);
                info.IsRead = when.HasValue && when.Value > comment.CreateOn;
                info.IsEditPermissions = ProjectSecurity.CanEditComment(Task.Project, comment);
                info.IsResponsePermissions = ProjectSecurity.CanCreateComment();
            }

            return CommentsHelper.GetOneCommentHtmlWithContainer(
                defComment,
                info,
                comment.Parent == Guid.Empty,
                false);

        }
        private string GetHTMLComment(Comment comment)
        {
            var oCommentInfo = new CommentInfo
                                   {
                                       TimeStamp = comment.CreateOn,
                                       TimeStampStr = comment.CreateOn.Ago(),
                                       CommentBody = comment.Content,
                                       CommentID = comment.ID.ToString(),
                                       UserID = comment.CreateBy,
                                       UserFullName = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo.DisplayUserName(),
                                       Inactive = comment.Inactive,
                                       IsEditPermissions = ProjectSecurity.CanEditComment(Task != null ? Task.Project : null, comment),
                                       IsResponsePermissions = ProjectSecurity.CanCreateComment(),
                                       IsRead = true,
                                       UserAvatar = Global.GetHTMLUserAvatar(comment.CreateBy),
                                       UserPost = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo.Title

                                   };

            if (commentList == null)
            {
                commentList = new CommentsList();
                ConfigureComments(commentList, null);

            }

            return CommentsHelper.GetOneCommentHtmlWithContainer(
                commentList,
                oCommentInfo,
                comment.Parent == Guid.Empty,
                false);

        }
Beispiel #15
0
        public AjaxResponse AddComment(string parentCommentId, string newsId, string text, string pid)
        {
            var resp = new AjaxResponse();
            resp.rs1 = parentCommentId;

            var comment = new FeedComment(long.Parse(newsId));
            comment.Comment = text;
            var storage = FeedStorageFactory.Create();
            if (!string.IsNullOrEmpty(parentCommentId))
                comment.ParentId = Convert.ToInt64(parentCommentId);

            var feed = storage.GetFeed(long.Parse(newsId, CultureInfo.CurrentCulture));
            comment = storage.SaveFeedComment(feed, comment);

            var info = GetCommentInfo(comment);
            var defComment = new CommentsList();
            ConfigureComments(defComment, feed);

            var visibleCommentsCount = 0;
            storage.GetFeedComments(feed.Id).ForEach((cmm) => { visibleCommentsCount += (cmm.Inactive ? 0 : 1); });

            resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer(
                defComment, info, comment.IsRoot(), visibleCommentsCount%2 == 1);

            return resp;
        }
Beispiel #16
0
        private void ConfigureComments(CommentsList commentList, string pageName)
        {

            CommonControlsConfigurer.CommentsConfigure(commentList);

            commentList.Simple = false;
            commentList.BehaviorID = "_commentsWikiObj";

            commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(Common.Constants.Action_AddComment);

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

            commentList.ObjectID = pageName;
        }
Beispiel #17
0
        public string GetPreview(string text, string commentID)
        {
            var storage = FeedStorageFactory.Create();

            var comment = new FeedComment(1)
                              {
                                  Date = TenantUtil.DateTimeNow(),
                                  Creator = SecurityContext.CurrentAccount.ID.ToString()
                              };

            if (!string.IsNullOrEmpty(commentID))
            {
                comment = storage.GetFeedComment(long.Parse(commentID, CultureInfo.CurrentCulture));
            }

            comment.Comment = text;

            var info = GetCommentInfo(comment);

            info.IsEditPermissions = false;
            info.IsResponsePermissions = false;

            var defComment = new CommentsList();
            ConfigureComments(defComment, null);

            return CommentsHelper.GetOneCommentHtmlWithContainer(
                defComment, info, true, false);
        }
 public static CommentsList CommentsGetDefault()
 {
     var commentList = new CommentsList();
     CommentsConfigure(commentList);
     return commentList;
 }