/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (this.StopProcessing) { // Do not process } else { // Iframe code string query = null; string src = "http://www.facebook.com/plugins/likebox.php"; // Default height if nothing additional is shown int height = heightDefault; // If faces and stream are shown if (ShowFaces && ShowStream) { height = heightStreamFaces; } // If only stream is shown else if (ShowStream) { height = heightStream; } // If only faces are shown else if (ShowFaces) { height = heightFaces; } // If stream or faces are shown and header is too if (ShowHeader && (ShowFaces || ShowStream)) { height = height + 35; } query = URLHelper.AddUrlParameter(query, "href", FBPageUrl); query = URLHelper.AddUrlParameter(query, "header", ShowHeader.ToString()); query = URLHelper.AddUrlParameter(query, "width", Width.ToString()); query = URLHelper.AddUrlParameter(query, "show_faces", ShowFaces.ToString()); query = URLHelper.AddUrlParameter(query, "stream", ShowStream.ToString()); query = URLHelper.AddUrlParameter(query, "colorscheme", ColorScheme); query = URLHelper.AddUrlParameter(query, "height", height.ToString()); src = URLHelper.EncodeQueryString(URLHelper.AppendQuery(src, query)); ltlLikeBox.Text = "<iframe src=\"" + src + "\""; ltlLikeBox.Text += " scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:" + Width + "px; height:" + height + "px;\"></iframe>"; } }
/// <summary> /// Initializes the control properties. /// </summary> protected override void SetupControl() { if (StopProcessing) { // Do not process } else { // Default height if nothing additional is shown int height = heightDefault; // If faces and stream are shown if (ShowFaces && ShowStream) { height = heightStreamFaces; } // If only stream is shown else if (ShowStream) { height = heightStream; } // If only faces are shown else if (ShowFaces) { height = heightFaces; } // If stream or faces are shown and header is too if (ShowHeader && (ShowFaces || ShowStream)) { height = height + 35; } if (UseHTML5) { StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"fb-like-box\" data-href=\"", HTMLHelper.EncodeForHtmlAttribute(FBPageUrl), "\" data-width=\"", Width, "\" data-height=\"", height, "\" data-header=\"", ShowHeader, "\" data-stream=\"", ShowStream, "\" data-show-faces=\"", ShowFaces, "\" data-colorscheme=\"", ColorScheme, "\" data-force-wall=\"", ForceWall, "\" data-show-border=\"", ShowBorder, "\""); sb.Append("></div>"); string fbApiKey = FacebookConnectHelper.GetFacebookApiKey(SiteContext.CurrentSiteName); if (String.IsNullOrEmpty(fbApiKey)) { ShowError(lblErrorMessage, "socialnetworking.facebook.apikeynotset"); } // Register Facebook javascript SDK ScriptHelper.RegisterFacebookJavascriptSDK(Page, LocalizationContext.PreferredCultureCode, fbApiKey); ltlLikeBox.Text = sb.ToString(); } else { // Iframe code string src = "http://www.facebook.com/plugins/likebox.php"; string query = URLHelper.AddUrlParameter(null, "href", FBPageUrl); query = URLHelper.AddUrlParameter(query, "header", ShowHeader.ToString()); query = URLHelper.AddUrlParameter(query, "width", Width.ToString()); query = URLHelper.AddUrlParameter(query, "show_faces", ShowFaces.ToString()); query = URLHelper.AddUrlParameter(query, "stream", ShowStream.ToString()); query = URLHelper.AddUrlParameter(query, "colorscheme", ColorScheme); query = URLHelper.AddUrlParameter(query, "height", height.ToString()); query = URLHelper.AddUrlParameter(query, "force_wall", ForceWall.ToString()); query = URLHelper.AddUrlParameter(query, "show_border", ShowBorder.ToString()); src = HTMLHelper.EncodeForHtmlAttribute(URLHelper.AppendQuery(src, query)); ltlLikeBox.Text = "<iframe src=\"" + src + "\""; ltlLikeBox.Text += " scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:" + Width + "px; height:" + height + "px;\"></iframe>"; } } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do not process } else { // Default height if nothing additional is shown int height = heightDefault; // If faces and stream are shown if (ShowFaces && ShowStream) { height = heightStreamFaces; } // If only stream is shown else if (ShowStream) { height = heightStream; } // If only faces are shown else if (ShowFaces) { height = heightFaces; } // If stream or faces are shown and header is too if (ShowHeader && (ShowFaces || ShowStream)) { height = height + 35; } string borderColor = null; if (!string.IsNullOrEmpty(BorderColor)) { borderColor = BorderColor; // Replace # if it is present if (!UseHTML5) { borderColor = borderColor.Replace("#", "%23"); } } if (UseHTML5) { StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"fb-like-box\" data-href=\"", URLHelper.EncodeQueryString(FBPageUrl), "\" data-width=\"", Width, "\" data-height=\"", height, "\" data-header=\"", ShowHeader, "\" data-stream=\"", ShowStream, "\" data-show-faces=\"", ShowFaces, "\" data-colorscheme=\"", ColorScheme, "\""); if (!string.IsNullOrEmpty(borderColor)) { sb.Append(" data-border-color=\"", borderColor, "\""); } sb.Append("></div>"); // Register Facebook javascript SDK ScriptHelper.RegisterFacebookJavascriptSDK(Page, CMSContext.PreferredCultureCode); ltlLikeBox.Text = sb.ToString(); } else { // Iframe code string query = null; string src = "http://www.facebook.com/plugins/likebox.php"; if (!string.IsNullOrEmpty(borderColor)) { query = URLHelper.AddUrlParameter(query, "border_color", borderColor); } query = URLHelper.AddUrlParameter(query, "href", FBPageUrl); query = URLHelper.AddUrlParameter(query, "header", ShowHeader.ToString()); query = URLHelper.AddUrlParameter(query, "width", Width.ToString()); query = URLHelper.AddUrlParameter(query, "show_faces", ShowFaces.ToString()); query = URLHelper.AddUrlParameter(query, "stream", ShowStream.ToString()); query = URLHelper.AddUrlParameter(query, "colorscheme", ColorScheme); query = URLHelper.AddUrlParameter(query, "height", height.ToString()); src = URLHelper.EncodeQueryString(URLHelper.AppendQuery(src, query)); ltlLikeBox.Text = "<iframe src=\"" + src + "\""; ltlLikeBox.Text += " scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:" + Width + "px; height:" + height + "px;\"></iframe>"; } } }