GetShortMarkup() public méthode

Returns markup in a short format - for comments
public GetShortMarkup ( ) : string
Résultat string
        public static string GetCommentMarkup(string markupStr, DateTime creationDate, User user, string text, int commentId, LikeInfo likeInfo, Node commentNode)
        {
            if (markupStr == null)
            {
                return(null);
            }

            markupStr = ReplaceResources(markupStr);

            markupStr = markupStr.Replace("{{commentid}}", commentId.ToString());
            markupStr = markupStr.Replace("{{avatar}}", UITools.GetAvatarUrl(user));
            markupStr = markupStr.Replace("{{username}}", user.FullName);
            markupStr = markupStr.Replace("{{userlink}}", Actions.ActionUrl(Content.Create(user), "Profile"));
            markupStr = markupStr.Replace("{{text}}", text);
            markupStr = markupStr.Replace("{{date}}", creationDate.ToString());
            markupStr = markupStr.Replace("{{friendlydate}}", UITools.GetFriendlyDate(creationDate));
            markupStr = markupStr.Replace("{{likeboxdisplay}}", likeInfo.Count > 0 ? "inline" : "none");
            markupStr = markupStr.Replace("{{likes}}", likeInfo.GetShortMarkup());
            markupStr = markupStr.Replace("{{ilikedisplay}}", !likeInfo.iLike ? "inline" : "none");
            markupStr = markupStr.Replace("{{iunlikedisplay}}", likeInfo.iLike ? "inline" : "none");

            // user interaction allowed
            var haspermission = WallHelper.HasLikePermission(commentNode);

            markupStr = markupStr.Replace("{{interactdisplay}}", haspermission ? "inline" : "none");
            // show 'like' icon for comment likes if user does not have permission -> in this case like icon would not appear since like link is hidden
            markupStr = markupStr.Replace("{{interactclass}}", haspermission ? string.Empty : "sn-commentlike");
            return(markupStr);
        }
Exemple #2
0
        public ActionResult Like(string itemId, string contextPath, bool fullMarkup, string rnd)
        {
            AssertPermission();

            var parentId = 0;
            DataLayer.CreateLike(itemId, contextPath, out parentId);

            var likeInfo = new LikeInfo(parentId);
            return Json(fullMarkup ? likeInfo.GetLongMarkup() : likeInfo.GetShortMarkup(), JsonRequestBehavior.AllowGet);
        }
Exemple #3
0
        public ActionResult Like(string itemId, string contextPath, bool fullMarkup, string rnd)
        {
            AssertPermission();

            var parentId = 0;

            DataLayer.CreateLike(itemId, contextPath, out parentId);

            var likeInfo = new LikeInfo(parentId);

            return(Json(fullMarkup ? likeInfo.GetLongMarkup() : likeInfo.GetShortMarkup(), JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public static string Like(Content content, string itemId, bool fullMarkup)
        {
            AssertPermission(PlaceholderPath);
            SetCurrentWorkspace(content.Path);
            var parentId = 0;

            DataLayer.CreateLike(itemId, content.Path, out parentId);

            var likeInfo = new LikeInfo(parentId);

            return(fullMarkup ? likeInfo.GetLongMarkup() : likeInfo.GetShortMarkup());
        }
Exemple #5
0
        public static string GetCommentMarkup(string markupStr, DateTime creationDate, User user, string text, int commentId, LikeInfo likeInfo, Node commentNode)
        {
            if (markupStr == null)
                return null;

            markupStr = markupStr.Replace("{{commentid}}", commentId.ToString());
            markupStr = markupStr.Replace("{{avatar}}", UITools.GetAvatarUrl(user));
            markupStr = markupStr.Replace("{{username}}", user.Name);
            markupStr = markupStr.Replace("{{userlink}}", Actions.ActionUrl(Content.Create(user), "Profile"));
            markupStr = markupStr.Replace("{{text}}", text);
            markupStr = markupStr.Replace("{{date}}", creationDate.ToString());
            markupStr = markupStr.Replace("{{friendlydate}}", UITools.GetFriendlyDate(creationDate));
            markupStr = markupStr.Replace("{{likeboxdisplay}}", likeInfo.Count > 0 ? "inline" : "none");
            markupStr = markupStr.Replace("{{likes}}", likeInfo.GetShortMarkup());
            markupStr = markupStr.Replace("{{ilikedisplay}}", !likeInfo.iLike ? "inline" : "none");
            markupStr = markupStr.Replace("{{iunlikedisplay}}", likeInfo.iLike ? "inline" : "none");

            // user interaction allowed
            var haspermission = WallHelper.HasLikePermission(commentNode);
            markupStr = markupStr.Replace("{{interactdisplay}}", haspermission ? "inline" : "none");
            // show 'like' icon for comment likes if user does not have permission -> in this case like icon would not appear since like link is hidden
            markupStr = markupStr.Replace("{{interactclass}}", haspermission ? string.Empty : "sn-commentlike");
            return markupStr;
        }