/// <summary>
 /// Save DNN Avatar as YAF Remote Avatar with relative Path.
 /// </summary>
 /// <param name="fileId">The file id.</param>
 /// <param name="yafUserId">The YAF user id.</param>
 /// <param name="portalGUID">The portal GUID.</param>
 /// <param name="boardSettings">The board settings.</param>
 private static void SaveDnnAvatar(string fileId, int yafUserId, Guid portalGUID, YafBoardSettings boardSettings)
 {
     LegacyDb.user_saveavatar(
         yafUserId,
         "{0}LinkClick.aspx?fileticket={1}".FormatWith(
             YafBuildLink.GetBasePath(boardSettings),
             UrlUtils.EncryptParameter(fileId, portalGUID.ToString())),
         null,
         null);
 }
Exemple #2
0
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="output">
        /// The output.
        /// </param>
        protected override void Render([NotNull] HtmlTextWriter output)
        {
            var displayName = this.ReplaceName.IsNotSet()
                                  ? this.Get <IUserDisplayName>().GetName(this.UserID)
                                  : this.ReplaceName;

            if (this.UserID == -1 || !displayName.IsSet())
            {
                return;
            }

            // is this the guest user? If so, guest's don't have a profile.
            var isGuest = this.IsGuest ? this.IsGuest : UserMembershipHelper.IsGuestUser(this.UserID);

            output.BeginRender();

            if (!isGuest)
            {
                output.WriteBeginTag("a");

                output.WriteAttribute("href", YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.UserID));

                if (this.CanViewProfile && this.IsHoverCardEnabled)
                {
                    if (this.CssClass.IsSet())
                    {
                        this.CssClass += " userHoverCard";
                    }
                    else
                    {
                        this.CssClass = "userHoverCard";
                    }

                    output.WriteAttribute(
                        "data-hovercard",
                        "{0}resource.ashx?userinfo={1}&type=json&forumUrl={2}".FormatWith(
                            YafForumInfo.ForumClientFileRoot,
                            this.UserID,
                            HttpUtility.UrlEncode(YafBuildLink.GetBasePath())));
                }
                else
                {
                    output.WriteAttribute("title", this.GetText("COMMON", "VIEW_USRPROFILE"));
                }

                if (this.Get <YafBoardSettings>().UseNoFollowLinks)
                {
                    output.WriteAttribute("rel", "nofollow");
                }

                if (this.BlankTarget)
                {
                    output.WriteAttribute("target", "_blank");
                }
            }
            else
            {
                output.WriteBeginTag("span");
            }

            this.RenderMainTagAttributes(output);

            output.Write(HtmlTextWriter.TagRightChar);

            // Replace Name with Crawler Name if Set, otherwise use regular display name or Replace Name if set
            if (this.CrawlerName.IsSet())
            {
                output.WriteEncodedText(this.CrawlerName);
            }
            else if (!this.CrawlerName.IsSet() && this.ReplaceName.IsSet() && isGuest)
            {
                output.WriteEncodedText(this.ReplaceName);
            }
            else
            {
                output.WriteEncodedText(displayName);
            }

            output.WriteEndTag(!isGuest ? "a" : "span");

            if (this.PostfixText.IsSet())
            {
                output.Write(this.PostfixText);
            }

            output.EndRender();
        }
Exemple #3
0
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="output">
        /// The output.
        /// </param>
        protected override void Render([NotNull] HtmlTextWriter output)
        {
            var displayName = this.ReplaceName.IsNotSet()
                                  ? this.Get <IUserDisplayName>().GetName(this.UserID)
                                  : this.ReplaceName;

            if (this.UserID == -1 || !displayName.IsSet())
            {
                return;
            }

            // is this the guest user? If so, guest's don't have a profile.
            var isGuest = this.IsGuest ? this.IsGuest : UserMembershipHelper.IsGuestUser(this.UserID);

            output.BeginRender();

            if (!isGuest)
            {
                output.WriteBeginTag("a");

                output.WriteAttribute("href", YafBuildLink.GetLink(ForumPages.profile, "u={0}&name={1}", this.UserID, displayName));

                if (this.CanViewProfile && this.IsHoverCardEnabled)
                {
                    if (this.CssClass.IsSet())
                    {
                        this.CssClass += " btn-sm userHoverCard";
                    }
                    else
                    {
                        this.CssClass = " btn-sm userHoverCard";
                    }

                    output.WriteAttribute(
                        "data-hovercard",
                        "{0}resource.ashx?userinfo={1}&boardId={2}&type=json&forumUrl={3}".FormatWith(
                            Config.IsDotNetNuke ? BaseUrlBuilder.GetBaseUrlFromVariables() + BaseUrlBuilder.AppPath : YafForumInfo.ForumClientFileRoot,
                            this.UserID,
                            YafContext.Current.PageBoardID,
                            HttpUtility.UrlEncode(YafBuildLink.GetBasePath())));
                }
                else
                {
                    output.WriteAttribute("title", this.GetText("COMMON", "VIEW_USRPROFILE"));

                    if (this.CssClass.IsSet())
                    {
                        if (this.CssClass.Equals("dropdown-toggle"))
                        {
                            output.WriteAttribute("data-toggle", "dropdown");
                            output.WriteAttribute("aria-haspopup", "true");
                            output.WriteAttribute("aria-expanded", "false");
                        }

                        this.CssClass += " btn-sm";
                    }
                    else
                    {
                        this.CssClass = " btn-sm";
                    }
                }

                if (this.Get <YafBoardSettings>().UseNoFollowLinks)
                {
                    output.WriteAttribute("rel", "nofollow");
                }

                if (this.BlankTarget)
                {
                    output.WriteAttribute("target", "_blank");
                }
            }
            else
            {
                output.WriteBeginTag("span");
            }

            this.RenderMainTagAttributes(output);

            output.Write(HtmlTextWriter.TagRightChar);

            // show online icon
            if (this.Get <YafBoardSettings>().ShowUserOnlineStatus)
            {
                var onlineStatusIcon = new OnlineStatusIcon {
                    UserId = this.UserID
                };

                onlineStatusIcon.RenderControl(output);

                output.Write("&nbsp;");
            }

            // Replace Name with Crawler Name if Set, otherwise use regular display name or Replace Name if set
            if (this.CrawlerName.IsSet())
            {
                output.WriteEncodedText(this.CrawlerName);
            }
            else if (!this.CrawlerName.IsSet() && this.ReplaceName.IsSet() && isGuest)
            {
                output.WriteEncodedText(this.ReplaceName);
            }
            else
            {
                output.WriteEncodedText(displayName);
            }

            output.WriteEndTag(!isGuest ? "a" : "span");

            if (this.PostfixText.IsSet())
            {
                output.Write(this.PostfixText);
            }

            output.EndRender();
        }