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_LinkedInCompanyProfile: CMSAbstractWebPart
{
#region "Public properties"
///
/// Company ID.
///
public string CompanyID
{
get
{
return ValidationHelper.GetString(GetValue("CompanyID"), string.Empty);
}
set
{
SetValue("CompanyID", value);
}
}
///
/// Width of the web part in pixels.
///
public int Width
{
get
{
return ValidationHelper.GetInteger(GetValue("Width"), 110);
}
set
{
SetValue("Width", value);
}
}
///
/// Display mode.
///
public string DisplayMode
{
get
{
return ValidationHelper.GetString(GetValue("DisplayMode"), string.Empty);
}
set
{
SetValue("DisplayMode", value);
}
}
///
/// Behavior.
///
public string Behavior
{
get
{
return ValidationHelper.GetString(GetValue("Behavior"), string.Empty);
}
set
{
SetValue("Behavior", value);
}
}
///
/// Company name.
///
public string CompanyName
{
get
{
return ValidationHelper.GetString(GetValue("DataText"), string.Empty);
}
set
{
SetValue("DataText", value);
}
}
///
/// Show connections.
///
public bool ShowConnections
{
get
{
return ValidationHelper.GetBoolean(GetValue("ShowConnections"), false);
}
set
{
SetValue("ShowConnections", 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
{
// Initialize variables
string src = "http://platform.linkedin.com/in.js";
string dataFormat = null, dataText = null;
string apiKey = LinkedInHelper.GetLinkedInApiKey(CMSContext.CurrentSiteName);
// Check optional parameters
if (DisplayMode.EqualsCSafe("inline"))
{
dataFormat = DisplayMode;
}
else
{
dataFormat = Behavior;
}
if (DisplayMode.EqualsCSafe("iconname"))
{
dataText = " data-text=\"" + CompanyName + "\"";
}
else
{
dataText = String.Empty;
}
// Build plugin code
string output = "
";
ltlPluginCode.Text = String.Format(output, Width.ToString(), src, CompanyID, dataFormat, ShowConnections.ToString().ToLowerCSafe(), dataText, apiKey);
}
}
///
/// Reloads the control data.
///
public override void ReloadData()
{
base.ReloadData();
SetupControl();
}
#endregion
}