Beispiel #1
0
        protected override void PageLoad()
        {
            if (!BookmarkingPermissionsCheck.PermissionCheckCreateBookmark())
            {
                Response.Redirect(BookmarkingRequestConstants.BookmarkingPageName);
            }

            BookmarkingBusinessFactory.UpdateDisplayMode(BookmarkDisplayMode.CreateBookmark);

            var c = LoadControl(BookmarkUserControlPath.CreateBookmarkUserControlPath) as CreateBookmarkUserControl;

            c.IsNewBookmark = true;
            BookmarkingPageContent.Controls.Add(c);

            var url = Request.QueryString[BookmarkingRequestConstants.UrlGetRequest];
            var s   = string.Empty;

            if (!string.IsNullOrEmpty(url))
            {
                s = string.Format(" getBookmarkUrlInput().val(\"{0}\"); getBookmarkByUrlButtonClick(); ", url.Replace("\"", "\\\""));
            }

            var script = string.Format("showAddBookmarkPanel(); {0}", s);

            Page.RegisterInlineScript(script);

            InitBreadcrumbs(BookmarkingUCResource.AddBookmarkLink);
            Title = HeaderStringHelper.GetPageTitle(BookmarkingUCResource.AddBookmarkLink);
        }
Beispiel #2
0
        public static CommentInfo ConvertComment(Comment comment, IList <Comment> commentList)
        {
            var userID = comment.UserID;

            var c = new CommentInfo
            {
                CommentID             = comment.ID.ToString(),
                UserID                = userID,
                TimeStamp             = comment.Datetime,
                TimeStampStr          = comment.Datetime.Ago(),
                Inactive              = comment.Inactive,
                CommentBody           = HtmlUtility.GetFull(comment.Content),
                UserFullName          = DisplayUserSettings.GetFullUserName(userID),
                UserProfileLink       = CommonLinkUtility.GetUserProfile(userID),
                UserAvatarPath        = UserPhotoManager.GetBigPhotoURL(userID),
                IsEditPermissions     = BookmarkingPermissionsCheck.PermissionCheckEditComment(comment),
                IsResponsePermissions = BookmarkingPermissionsCheck.PermissionCheckCreateComment(),
                UserPost              = BookmarkingServiceHelper.GetUserInfo(userID).Title
            };

            var commentsList = new List <CommentInfo>();

            var childComments = GetChildComments(comment, commentList);

            if (childComments != null)
            {
                foreach (var item in childComments)
                {
                    commentsList.Add(ConvertComment(item, commentList));
                }
            }
            c.CommentList = commentsList;
            return(c);
        }
Beispiel #3
0
        private static SideActions GetBookmarkingActions()
        {
            var actions = new SideActions();

            if (BookmarkingPermissionsCheck.PermissionCheckCreateBookmark())
            {
                actions.Controls.Add(new NavigationItem(BookmarkingResource.AddBookmarkLink, BookmarkingServiceHelper.GetCreateBookmarkPageUrl()));
            }

            if (SecurityContext.IsAuthenticated)
            {
                var serviceHelper = BookmarkingServiceHelper.GetCurrentInstanse();
                var isSubscribed  = serviceHelper.IsSubscribed(serviceHelper.SubscriptionRecentBookmarkID, BookmarkingBusinessConstants.NotifyActionNewBookmark);
                actions.Controls.Add(new BookmarkingNavigationItem()
                {
                    Name = BookmarkingResource.SubscribeOnRecentBookmarks,
                    URL  = "javascript:subscribeOnRecentBookmarks()",
                    BookmarkingClientID = "subscribeOnRecentBookmarks",
                    DisplayOnPage       = !isSubscribed,
                    IsPromo             = (SetupInfo.WorkMode == WorkMode.Promo)
                });

                actions.Controls.Add(new BookmarkingNavigationItem()
                {
                    Name = BookmarkingResource.UnSubscribeOnRecentBookmarks,
                    URL  = "javascript:unSubscribeOnRecentBookmarks()",
                    BookmarkingClientID = "unSubscribeOnRecentBookmarks",
                    DisplayOnPage       = isSubscribed,
                    IsPromo             = (SetupInfo.WorkMode == WorkMode.Promo)
                });
            }

            return(actions);
        }
Beispiel #4
0
        public static CommentInfo ConvertComment(Comment comment, IList <Comment> commentList)
        {
            var userID = comment.UserID;

            CommentInfo c = new CommentInfo();

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

            c.Inactive              = comment.Inactive;
            c.CommentBody           = comment.Content;
            c.UserFullName          = DisplayUserSettings.GetFullUserName(userID);
            c.UserAvatar            = BookmarkingServiceHelper.GetHTMLUserAvatar(userID);
            c.IsEditPermissions     = BookmarkingPermissionsCheck.PermissionCheckEditComment(comment);
            c.IsResponsePermissions = BookmarkingPermissionsCheck.PermissionCheckCreateComment();

            c.UserPost = BookmarkingServiceHelper.GetUserInfo(userID).Title;

            var commentsList = new List <CommentInfo>();

            var childComments = GetChildComments(comment, commentList);

            if (childComments != null)
            {
                foreach (var item in childComments)
                {
                    commentsList.Add(ConvertComment(item, commentList));
                }
            }
            c.CommentList = commentsList;
            return(c);
        }
Beispiel #5
0
 public bool PermissionCheckRemoveFromFavourite()
 {
     if (UserBookmark != null)
     {
         return(BookmarkingPermissionsCheck.PermissionCheckRemoveFromFavourite(UserBookmark));
     }
     return(false);
 }
Beispiel #6
0
        public static string GetCreateContentPageUrl()
        {
            if (BookmarkingPermissionsCheck.PermissionCheckCreateBookmark())
            {
                return(VirtualPathUtility.ToAbsolute("~/products/community/modules/bookmarking/" + BookmarkingServiceHelper.GetCreateBookmarkPageUrl()));
            }

            return(null);
        }
Beispiel #7
0
        public string RemoveBookmarkComment(string commentid)
        {
            var comment = BookmarkingServiceHelper.GetCurrentInstanse().GetCommentById(commentid);

            if (comment != null && BookmarkingPermissionsCheck.PermissionCheckEditComment(comment))
            {
                BookmarkingServiceHelper.GetCurrentInstanse().RemoveComment(commentid);
                return(commentid);
            }
            return(null);
        }
Beispiel #8
0
        public string RemoveComment(string commentID, string pid)
        {
            var comment = _serviceHelper.GetCommentById(commentID);

            if (comment != null && BookmarkingPermissionsCheck.PermissionCheckEditComment(comment))
            {
                _serviceHelper.RemoveComment(commentID);
                return(commentID);
            }
            return(null);
        }
Beispiel #9
0
 public BookmarkingModule()
 {
     Context = new ModuleContext
     {
         DefaultSortOrder                = 4,
         SmallIconFileName               = "bookmarking_mini_icon.png",
         IconFileName                    = "bookmarking_icon.png",
         SubscriptionManager             = new BookmarkingSubscriptionManager(),
         SearchHandler                   = new BookmarkingSearchHandler(),
         GetCreateContentPageAbsoluteUrl = () => BookmarkingPermissionsCheck.PermissionCheckCreateBookmark() ? VirtualPathUtility.ToAbsolute("~/products/community/modules/bookmarking/" + BookmarkingServiceHelper.GetCreateBookmarkPageUrl()) : null,
     };
 }
Beispiel #10
0
        public string UpdateBookmarkComment(string commentid, string content)
        {
            var comment = BookmarkingServiceHelper.GetCurrentInstanse().GetCommentById(commentid);

            if (comment == null || !BookmarkingPermissionsCheck.PermissionCheckEditComment(comment))
            {
                throw new ArgumentException();
            }

            BookmarkingServiceHelper.GetCurrentInstanse().UpdateComment(commentid, content);
            return(HtmlUtility.GetFull(content));
        }
        private void ConfigureComments(CommentsList commentList)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            // add comments permission check
            commentList.IsShowAddCommentBtn = BookmarkingPermissionsCheck.PermissionCheckCreateComment();

            commentList.BehaviorID    = "commentsObj";
            commentList.ModuleName    = "bookmarks";
            commentList.FckDomainName = "bookmarking_comments";
            commentList.TotalCount    = BookmarkComments.Count;
            commentList.ShowCaption   = false;
            commentList.ObjectID      = BookmarkID.ToString();
        }
Beispiel #12
0
        public AjaxResponse UpdateComment(string commentID, string text, string pid)
        {
            var resp    = new AjaxResponse();
            var comment = _serviceHelper.GetCommentById(commentID);

            if (comment != null)
            {
                if (BookmarkingPermissionsCheck.PermissionCheckEditComment(comment))
                {
                    _serviceHelper.UpdateComment(commentID, text);
                    resp.rs1 = commentID;
                    resp.rs2 = text + CodeHighlighter.GetJavaScriptLiveHighlight(true);
                }
            }
            return(resp);
        }
 public BookmarkingModule()
 {
     Context = new ModuleContext
     {
         DefaultSortOrder        = 4,
         ThemesFolderVirtualPath = "~/products/community/modules/bookmarking/app_themes",
         ImageFolder             = "images",
         SmallIconFileName       = "bookmarking_mini_icon.png",
         IconFileName            = "bookmarking_icon.png",
         SubscriptionManager     = new BookmarkingSubscriptionManager(),
         SearchHandler           = new BookmarkingSearchHandler(),
         StatisticProvider       = new BookmarkingStatisticProvider(),
         UserActivityPublishers  = new List <IUserActivityPublisher> {
             new BookmarkingUserActivityPublisher()
         },
         GetCreateContentPageAbsoluteUrl = () => BookmarkingPermissionsCheck.PermissionCheckCreateBookmark() ? VirtualPathUtility.ToAbsolute("~/products/community/modules/bookmarking/" + BookmarkingServiceHelper.GetCreateBookmarkPageUrl()) : null,
     };
 }
Beispiel #14
0
        private void ConfigureComments(CommentsList commentList)
        {
            CommonControlsConfigurer.CommentsConfigure(commentList);

            // add comments permission check
            commentList.IsShowAddCommentBtn = BookmarkingPermissionsCheck.PermissionCheckCreateComment();
            commentList.CommentsCountTitle  = BookmarkComments.Count.ToString();
            commentList.Simple     = false;
            commentList.BehaviorID = "commentsObj";
            commentList.JavaScriptAddCommentFunctionName        = "CommentsUserControl.AddComment";
            commentList.JavaScriptLoadBBcodeCommentFunctionName = "CommentsUserControl.LoadCommentBBCode";
            commentList.JavaScriptPreviewCommentFunctionName    = "CommentsUserControl.GetPreview";
            commentList.JavaScriptRemoveCommentFunctionName     = "CommentsUserControl.RemoveComment";
            commentList.JavaScriptUpdateCommentFunctionName     = "CommentsUserControl.UpdateComment";
            commentList.FckDomainName = "bookmarking_comments";
            commentList.TotalCount    = BookmarkComments.Count;
            commentList.ShowCaption   = false;
            commentList.ObjectID      = BookmarkID.ToString();
        }
        protected override void PageLoad()
        {
            if (!BookmarkingPermissionsCheck.PermissionCheckCreateBookmark())
            {
                Response.Redirect(BookmarkingRequestConstants.BookmarkingPageName);
            }

            ServiceHelper.DisplayMode = BookmarkingServiceHelper.BookmarkDisplayMode.CreateBookmark;


            var c = LoadControl(BookmarkUserControlPath.CreateBookmarkUserControlPath) as CreateBookmarkUserControl;

            c.IsNewBookmark = true;
            container.Body.Controls.Add(c);

            var url = Request.QueryString[BookmarkingRequestConstants.UrlGetRequest];
            var s   = string.Empty;

            if (!string.IsNullOrEmpty(url))
            {
                s = string.Format(" getBookmarkUrlInput().val(\"{0}\"); getBookmarkByUrlButtonClick(); ", url);
            }

            string script = string.Format("jq(document).ready(function() {{ showAddBookmarkPanel(); {0} }} )", s);

            Page.ClientScript.RegisterClientScriptBlock(typeof(string), "createBookmarkScript", script, true);

            Title = HeaderStringHelper.GetPageTitle(BookmarkingResource.AddBookmarkLink, container.BreadCrumbs);
            InitBreadcrumbs(BookmarkingResource.AddBookmarkLink);

            //Actions and Navigation
            BookmarkingNavigationUtil.SetBookmarkingActionsAndNavigation(BookmarkingSideHolder.Controls);
            BookmarkingNavigationUtil.SetPopularTagsCloud(BookmarkingSideHolder.Controls);

            sideRecentActivity.TenantId  = TenantProvider.CurrentTenantID;
            sideRecentActivity.ProductId = Product.CommunityProduct.ID;
            sideRecentActivity.ModuleId  = BookmarkingSettings.ModuleId;
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(BookmarkingUserControl));
            Utility.RegisterTypeForAjax(typeof(SingleBookmarkUserControl));

            BookmarkPageCounter = string.IsNullOrEmpty(Request["size"]) ? 20 : Convert.ToInt32(Request["size"]);

            var createBookmark = LoadControl(BookmarkUserControlPath.CreateBookmarkUserControlPath) as CreateBookmarkUserControl;

            CreateBookmarkPanel.Controls.Add(createBookmark);

            var removePopup = LoadControl(BookmarkingRemoverFromFavouritePopup.Location) as BookmarkingRemoverFromFavouritePopup;

            BookmarkingRemoveFromFavouritePopupContainer.Controls.Add(removePopup);

            InitSettings();

            var SortControl = new ViewSwitcher {
                SortItemsHeader = BookmarkingUCResource.ShowLabel
            };

            _serviceHelper.InitServiceHelper(SortControl);
            BookmarkingSortPanel.Controls.Add(SortControl);

            if (Bookmarks == null)
            {
                Bookmarks = _serviceHelper.GetBookmarks(BookmarkPageCounter);
            }

            if (Bookmarks == null || Bookmarks.Count == 0)
            {
                var hidePanelsFlag = false;

                var currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("bookmarks_icon.png", BookmarkingSettings.ModuleId),
                    Describe = currentUser.IsVisitor() ? BookmarkingUCResource.EmptyScreenTextVisitor : BookmarkingUCResource.EmptyScreenText
                };

                var displayMode = BookmarkingBusinessFactory.GetDisplayMode();

                if (displayMode.Equals(BookmarkDisplayMode.SearchBookmarks))
                {
                    hidePanelsFlag = true;

                    emptyScreenControl.Header = BookmarkingUCResource.EmptyScreenSearchCaption;
                }
                else
                {
                    var sortBy = Request.QueryString[BookmarkingRequestConstants.SortByParam];
                    if (string.IsNullOrEmpty(sortBy) ||
                        BookmarkingRequestConstants.MostRecentParam.Equals(sortBy) ||
                        BookmarkingRequestConstants.PopularityParam.Equals(sortBy))
                    {
                        hidePanelsFlag = true;

                        emptyScreenControl.Header = BookmarkingUCResource.EmptyScreenCaption;

                        if (BookmarkingPermissionsCheck.PermissionCheckCreateBookmark())
                        {
                            emptyScreenControl.ButtonHTML = String.Format("<a class='link underline blue plus' href='CreateBookmark.aspx'>{0}</a>", BookmarkingUCResource.EmptyScreenLink);
                        }
                    }
                    else
                    {
                        emptyScreenControl.Header = BookmarkingUCResource.EmptyScreenSearchCaption;
                    }
                }

                BookmarksHolder.Controls.Add(emptyScreenControl);
                if (hidePanelsFlag)
                {
                    BookmarkingSortPanel.Visible = false;
                    CreateBookmarkPanel.Visible  = false;
                    BookmarksMainPanel.Visible   = false;
                }
            }
            else
            {
                LoadBookmarks(Bookmarks);
            }
            InitScripts();
        }
Beispiel #17
0
 public bool PermissionCheckCreateBookmark()
 {
     return(BookmarkingPermissionsCheck.PermissionCheckCreateBookmark());
 }
 public bool PermissionCheckRemoveFromFavourite()
 {
     return(UserBookmark != null && BookmarkingPermissionsCheck.PermissionCheckRemoveFromFavourite(UserBookmark));
 }
 public static bool PermissionCheckAddToFavourite()
 {
     return(BookmarkingPermissionsCheck.PermissionCheckAddToFavourite());
 }
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            BookmarkingServiceHelper  serviceHelper  = BookmarkingServiceHelper.GetCurrentInstanse();
            BookmarkingWidgetSettings widgetSettings = SettingsManager.Instance.LoadSettingsFor <BookmarkingWidgetSettings>(serviceHelper.GetCurrentUserID());
            var           bookmarksCount             = widgetSettings.MaxCountBookmarks;
            var           bookmarks = serviceHelper.GetMostRecentBookmarksForWidget(bookmarksCount);
            StringBuilder sb        = new StringBuilder();

            foreach (var b in bookmarks)
            {
                sb.Append("<div class='clearFix' style='margin-bottom:20px;'>");
                sb.Append(@"
<table cellspacing='0' cellpadding='0' border='0' style='width: 100%;'><tr valign='top'>");

                sb.Append(@"
	<td style='width:30px; text-align:left;'>"    );
                sb.AppendFormat("<span class='textMediumDescribe'>{0} {1}</span>", b.Date.ToShortDayMonth(), b.Date.ToShortTimeString());
                sb.Append(@"
	</td>"    );


                //title
                sb.Append(@"
	<td style='padding-left:10px;'>
		<div style='margin-bottom:5px; word-wrap: break-word;'>"        );

                sb.Append(@"
			<a href='"             + VirtualPathUtility.ToAbsolute("~/Products/Community/Modules/Bookmarking/") + BookmarkingServiceHelper.GenerateBookmarkInfoUrl(b.URL) + "'>" + HttpUtility.HtmlEncode(HtmlUtility.GetText(b.Name, SymbolsCount)) + "</a>");
                sb.Append(@"
		</div>"        );

                //description
                sb.Append(@"
		<div style='margin-bottom:5px; word-wrap: break-word;'>"        );
                sb.Append(HttpUtility.HtmlEncode(HtmlUtility.GetText(b.Description, 120, true)));
                sb.Append(@"
		</div>"        );


                //added by
                sb.Append(@"
		<div class='clearFix' style='margin-top:5px;'>"        );
                sb.AppendFormat(@"			
			<div style='float:left'>
				<img src='{0}' alt=''/>
			</div>
			<div style='float:left; margin-right: 10px;' class='textMediumDescribe'>
				{1}
			</div>"            , WebImageSupplier.GetAbsoluteWebPath(BookmarkingRequestConstants.UserRaitingOne, BookmarkingConst.BookmarkingId), serviceHelper.GetUserBookmarksCount(b));
                sb.Append(BookmarkingServiceHelper.RenderUserProfile(b.UserCreatorID));

                sb.Append(@"
		</div>
	</td>
</tr>
</table>");
                sb.Append(@"
</div>");
            }

            if (bookmarks.Count > 0 || !BookmarkingPermissionsCheck.PermissionCheckCreateBookmark())
            {
                sb.Append("<div style='margin-top:10px;'>");
                sb.Append("<a href=\"" + VirtualPathUtility.ToAbsolute(BookmarkingRequestConstants.BookmarkingBasePath + "/" + BookmarkingRequestConstants.BookmarkingPageName) + "\">" + BookmarkingResource.AllBookmarks + "</a>");
                sb.Append("</div>");
            }
            else
            {
                sb.Append("<div class=\"empty-widget\" style=\"padding:40px; text-align: center;\">" +
                          string.Format(Resources.BookmarkingResource.NoBookmarksWidgetMessage,
                                        string.Format("<div style=\"padding-top:3px;\"><a class=\"promoAction\" href=\"{0}\">", VirtualPathUtility.ToAbsolute("~/products/community/modules/bookmarking/" + BookmarkingServiceHelper.GetCreateBookmarkPageUrl())),
                                        "</a></div>") + "</div>");
            }

            writer.Write(sb.ToString());
        }