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_LinkedInMemberProfile: CMSAbstractWebPart { #region "Public properties" /// /// Public profile URL of LinkedIn member. /// public string ProfileUrl { get { return ValidationHelper.GetString(GetValue("ProfileUrl"), string.Empty); } set { SetValue("ProfileUrl", 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); } } /// /// Profile name. /// public string ProfileName { 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=\"" + ProfileName + "\""; } else { dataText = String.Empty; } // Build plugin code string output = "
"; ltlPluginCode.Text = String.Format(output, Width.ToString(), src, ProfileUrl, dataFormat, ShowConnections.ToString().ToLowerCSafe(), dataText, apiKey); } } /// /// Reloads the control data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); } #endregion }