Example #1
0
        protected void OnRepNewUsersBound(object sender, RepeaterItemEventArgs e)
        {
            DataObjectUser   user       = (DataObjectUser)e.Item.DataItem;
            PlaceHolder      ph         = e.Item.FindControl("phSUO") as PlaceHolder;
            Control          ctrl       = LoadControl("~/UserControls/Templates/SmallOutputUser2.ascx");
            ISmallOutputUser userOutput = ctrl as ISmallOutputUser;

            userOutput.UserName       = user.Nickname;
            userOutput.UserPictureURL = SiteConfig.MediaDomainName + user.GetImage(PictureVersion.S);
            userOutput.PrimaryColor   = user.PrimaryColor;
            userOutput.SecondaryColor = user.SecondaryColor;
            userOutput.UserDetailURL  = SiteConfig.SiteVRoot + Helper.GetDetailLink(Helper.GetObjectTypeNumericID("User"), user.Nickname);
            ctrl.ID = null;
            ph.Controls.Add(ctrl);
        }
Example #2
0
        public override bool ShowObject(string settingsXml)
        {
            DataObjectCommunity community = new DataObjectCommunity(UserDataContext.GetUserDataContext());

            community.ObjectID = CommunityID.ToString();
            community.Load();
            if (community.ObjectType == ObjectType.ProfileCommunity)
            {
                DataObjectUser user = new DataObjectUser(UserDataContext.GetUserDataContext());
                user.ObjectID = community.UserID;
                user.Load();

                string image = user.GetImage(PictureVersion.S);
                if (string.IsNullOrEmpty(image))
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + Constants.DEFIMG_USER;
                }
                else
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + image;
                }
            }
            else
            {
                string image = community.GetImage(PictureVersion.S);
                if (string.IsNullOrEmpty(image))
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + Constants.DEFIMG_COMMUNITY;
                }
                else
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + image;
                }
            }
            return(true);
        }
        public string GetHtml()
        {
            if (DataObjectUser != null)
            {
                UserName = DataObjectUser.Nickname;
                if (!string.IsNullOrEmpty(DataObjectUser.FacebookUserId))
                {
                    UserPictureURL = string.Format("http://graph.facebook.com/{0}/picture?type=square", DataObjectUser.FacebookUserId);
                }
                else
                {
                    UserPictureURL = SiteConfig.MediaDomainName + DataObjectUser.GetImage(PictureVersion.XS);
                }
                PrimaryColor   = DataObjectUser.PrimaryColor;
                SecondaryColor = DataObjectUser.SecondaryColor;
                if (LinkActive)
                {
                    UserDetailURL = Helper.GetDetailLink(DataObjectUser.ObjectType, DataObjectUser.Nickname);
                }
            }

            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(secondaryColor) && !string.IsNullOrEmpty(primaryColor))
            {
                sb.AppendFormat("<div class=\"userOutput\">");
                sb.AppendFormat("  <div class=\"userOutputColor1\">");
                if (!string.IsNullOrEmpty(userDetailURL))
                {
                    sb.AppendFormat("<a href=\"{0}\">", userDetailURL);
                }
                if (hasElementName)
                {
                    sb.AppendFormat("    <img name=\"sco\" src=\"{0}{1}.png\" />", Constants.SECONDARY_COLOR_ICONS_PATH, secondaryColor);
                }
                else
                {
                    sb.AppendFormat("    <img src=\"{0}{1}.png\" />", Constants.SECONDARY_COLOR_ICONS_PATH, secondaryColor);
                }
                if (!string.IsNullOrEmpty(userDetailURL))
                {
                    sb.AppendFormat("</a>");
                }
                sb.AppendFormat("  </div>");
                sb.AppendFormat("  <div class=\"userOutputImage\">");
                if (!string.IsNullOrEmpty(userDetailURL))
                {
                    sb.AppendFormat("<a href=\"{0}\">", userDetailURL);
                }
                sb.AppendFormat("    <img src=\"{0}\" />", userPictureURL);
                if (!string.IsNullOrEmpty(userDetailURL))
                {
                    sb.AppendFormat("</a>");
                }
                sb.AppendFormat("  </div>");
                sb.AppendFormat("  <div class=\"userOutputColor2\">");
                if (!string.IsNullOrEmpty(userDetailURL))
                {
                    sb.AppendFormat("<a href=\"{0}\">", userDetailURL);
                }
                if (hasElementName)
                {
                    sb.AppendFormat("    <img name=\"pco\" src=\"{0}{1}.png\" />", Constants.PRIMARY_COLOR_ICONS_PATH, primaryColor);
                }
                else
                {
                    sb.AppendFormat("    <img src=\"{0}{1}.png\" />", Constants.PRIMARY_COLOR_ICONS_PATH, primaryColor);
                }
                if (!string.IsNullOrEmpty(userDetailURL))
                {
                    sb.AppendFormat("</a>");
                }
                sb.AppendFormat("  </div>");
                sb.AppendFormat("</div>");
            }

            if (!string.IsNullOrEmpty(userDetailURL) && !string.IsNullOrEmpty(username))
            {
                sb.AppendFormat("<div class=\"userOutputName\"><a href=\"{0}\">{1}</a></div>", userDetailURL, username.CropString(16));
            }
            else if (!string.IsNullOrEmpty(username))
            {
                sb.AppendFormat("<div class=\"userOutputName\">{0}</div>", username.CropString(16));
            }

            return(sb.ToString());
        }
Example #4
0
 protected string UserPictureURL(PictureVersion size)
 {
     return(MediaDomainName + DataObjectUser.GetImage(size));
 }