using System;
using System.Web;
using CMS.CMSHelper;
using CMS.GlobalHelper;
using CMS.MembershipProvider;
using CMS.PortalControls;
using CMS.DocumentEngine;
public partial class CMSWebParts_CommunityServices_Facebook_FacebookComments : CMSAbstractWebPart
{
#region "Properties"
///
/// Url to comment on.
///
public string Url
{
get
{
return ValidationHelper.GetString(GetValue("URL"), string.Empty);
}
set
{
SetValue("URL", value);
}
}
///
/// Number of posts.
///
public int Posts
{
get
{
return ValidationHelper.GetInteger(GetValue("Posts"), 0);
}
set
{
SetValue("Posts", value);
}
}
///
/// Width of the web part in pixels.
///
public int Width
{
get
{
return ValidationHelper.GetInteger(GetValue("Width"), 500);
}
set
{
SetValue("Width", value);
}
}
///
/// Color scheme of the web part.
///
public string ColorScheme
{
get
{
return ValidationHelper.GetString(GetValue("ColorScheme"), string.Empty);
}
set
{
SetValue("ColorScheme", value);
}
}
///
/// Indicates if HTML 5 output should be generated.
///
public bool UseHTML5
{
get
{
return ValidationHelper.GetBoolean(GetValue("UseHTML5"), false);
}
set
{
SetValue("UseHTML5", value);
}
}
#endregion
#region "Methods"
///
/// Content loaded event handler.
///
public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
}
///
/// Initializes the control properties.
///
protected void SetupControl()
{
if (StopProcessing)
{
// Do not process
}
else
{
string pageUrl = String.Empty;
if (string.IsNullOrEmpty(Url))
{
// If parameter URL is empty, set URL of current document
if (CMSContext.CurrentDocument != null)
{
TreeNode node = CMSContext.CurrentDocument;
pageUrl = CMSContext.GetUrl(node.NodeAliasPath, node.DocumentUrlPath, CMSContext.CurrentSiteName);
}
else
{
// Query string will be removed
pageUrl = URLHelper.RemoveQuery(URLHelper.CurrentURL);
}
}
else
{
pageUrl = ResolveUrl(Url);
}
pageUrl = URLHelper.GetAbsoluteUrl(HTMLHelper.HTMLEncode(pageUrl));
// Register javascript SDK
ScriptHelper.RegisterFacebookJavascriptSDK(Page, CMSContext.PreferredCultureCode, FacebookConnectHelper.GetFacebookApiKey(CMSContext.CurrentSiteName));
if (UseHTML5)
{
ltlComments.Text = "
";
}
else
{
ltlComments.Text = "";
}
}
}
///
/// Reloads the control data.
///
public override void ReloadData()
{
base.ReloadData();
SetupControl();
}
#endregion
}