using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.PortalControls;
using CMS.GlobalHelper;
using CMS.CMSHelper;
using CMS.SettingsProvider;
using CMS.MembershipProvider;
public partial class CMSWebParts_CommunityServices_LinkedIn_LinkedInShareButton: CMSAbstractWebPart
{
#region "Public properties"
///
/// Url to share.
///
public string UrlToShare
{
get
{
return ValidationHelper.GetString(GetValue("UrlToShare"), string.Empty);
}
set
{
SetValue("UrlToShare", value);
}
}
///
/// Count box position.
///
public string CountBox
{
get
{
return ValidationHelper.GetString(GetValue("CountBox"), string.Empty);
}
set
{
SetValue("CountBox", value);
}
}
///
/// Width of the web part in pixels.
///
public int Width
{
get
{
return ValidationHelper.GetInteger(GetValue("Width"), 110);
}
set
{
SetValue("Width", 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
{
// Build plugin code
string src = "http://platform.linkedin.com/in.js";
string apiKey = LinkedInHelper.GetLinkedInApiKey(CMSContext.CurrentSiteName);
if (string.IsNullOrEmpty(UrlToShare))
{
UrlToShare = URLHelper.CurrentURL;
}
UrlToShare = URLHelper.GetAbsoluteUrl(ResolveUrl(HTMLHelper.HTMLEncode(UrlToShare)));
string output = "
";
ltlButtonCode.Text = String.Format(output, Width.ToString(), src, UrlToShare, CountBox, apiKey);
}
}
///
/// Reloads the control data.
///
public override void ReloadData()
{
base.ReloadData();
SetupControl();
}
#endregion
}