/// <summary> /// Initializes the control properties. /// </summary> protected override void SetupControl() { if (StopProcessing) { // Do not process } else { // Initialize variables string src = "http://platform.linkedin.com/in.js"; string dataModules = String.Empty; string apiKey = LinkedInHelper.GetLinkedInApiKey(SiteContext.CurrentSiteName); //Check optional parameters if (ShowNetwork) { dataModules += ",innetwork"; } if (ShowNewHires) { dataModules += ",newhires"; } if (ShowPromotions) { dataModules += ",jobchanges"; } // Build plugin code string output = "<div style=\"overflow: hidden;\"><script src=\"{0}\" type=\"text/javascript\">api_key: {3}</script><script type=\"IN/CompanyInsider\" data-id=\"{1}\" data-modules=\"{2}\"></script></div>"; ltlPluginCode.Text = String.Format(output, src, CompanyID, dataModules.TrimStart(','), apiKey); } }
/// <summary> /// Initializes the control properties. /// </summary> 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); // Try to parse product URL if (ProductID.ToLowerCSafe().StartsWithCSafe("http")) { int indexStart = ProductID.LastIndexOfCSafe("-"); int indexEnd = ProductID.LastIndexOfCSafe("/"); if ((indexStart != -1) && (indexEnd != -1)) { ProductID = ProductID.Substring(indexStart + 1, indexEnd - indexStart - 1); } } string output = "<div style=\"overflow: hidden; width: {0}px;\"><script src=\"{1}\" type=\"text/javascript\">api_key: {5}</script><script type=\"IN/RecommendProduct\" data-company=\"{2}\" data-product=\"{3}\" data-counter=\"{4}\"></script></div>"; ltlButtonCode.Text = String.Format(output, Width.ToString(), src, CompanyID, ProductID, CountBox, apiKey); } }
/// <summary> /// Sign in button event. /// </summary> protected void btnSignIn_Click(object sender, EventArgs e) { var apiKey = LinkedInHelper.GetLinkedInApiKey(CurrentSiteName); var apiSecret = LinkedInHelper.GetLinkedInSecretKey(CurrentSiteName); var data = new LinkedInData(apiKey, apiSecret); linkedInHelper.SendRequest(data); }
/// <summary> /// Sign in button event. /// </summary> protected void btnSignIn_Click(object sender, EventArgs e) { var apiKey = LinkedInHelper.GetLinkedInApiKey(CurrentSiteName); var apiSecret = LinkedInHelper.GetLinkedInSecretKey(CurrentSiteName); var data = new LinkedInData(apiKey, apiSecret); data.AdditionalQueryParameters["scope"] = Scope; linkedInHelper.SendRequest(data); }
/// <summary> /// Initializes the control properties. /// </summary> 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.GetAbsoluteUrl(URLHelper.CurrentURL); } string output = "<div style=\"overflow: hidden; width: {0}px;\"><script src=\"{1}\" type=\"text/javascript\">api_key: {4}</script><script type=\"IN/Share\" data-url=\"{2}\" data-counter=\"{3}\"></script></div>"; ltlButtonCode.Text = String.Format(output, Width.ToString(), src, UrlToShare, CountBox, apiKey); } }
/// <summary> /// Initializes the control properties. /// </summary> 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 = "<div style=\"overflow: hidden; width: {0}px;\"><script src=\"{1}\" type=\"text/javascript\">api_key: {6}</script><script type=\"IN/CompanyProfile\" data-id=\"{2}\" data-format=\"{3}\" data-related=\"{4}\"{5}></script></div>"; ltlPluginCode.Text = String.Format(output, Width.ToString(), src, CompanyID, dataFormat, ShowConnections.ToString().ToLowerCSafe(), dataText, apiKey); } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do not process } else { // Initialize variables string dataJobLocation = String.Empty, dataLogo = String.Empty, dataThemeColor = String.Empty, dataButtonSize = String.Empty, dataQuestions = String.Empty; string src = "http://platform.linkedin.com/in.js"; string apiKey = LinkedInHelper.GetLinkedInApiKey(CMSContext.CurrentSiteName); string apiSecret = LinkedInHelper.GetLinkedInSecretKey(CMSContext.CurrentSiteName); // Check settings if (!String.IsNullOrEmpty(apiKey) && !String.IsNullOrEmpty(apiSecret)) { // Check if optional parameters are set and transform them accordingly if (!string.IsNullOrEmpty(CompanyLogo)) { dataLogo = "data-logo=\"" + URLHelper.GetAbsoluteUrl(CompanyLogo) + "\""; } if (!string.IsNullOrEmpty(JobLocation)) { dataJobLocation = "data-joblocation=\"" + JobLocation + "\""; } if (!string.IsNullOrEmpty(ThemeColor)) { dataThemeColor = "data-themecolor=\"" + ThemeColor + "\""; } if (ButtonSize.EqualsCSafe("medium")) { dataButtonSize = "data-size=\"medium\""; } // Parse questions string and format it if (!string.IsNullOrEmpty(Questions)) { dataQuestions = "data-questions='["; string[] questionArray = Questions.Split(new string[1] { Environment.NewLine }, StringSplitOptions.None); foreach (string s in questionArray) { dataQuestions += "{\"question\": \"" + s + "\"},"; } dataQuestions = dataQuestions.TrimEnd(','); dataQuestions += "]'"; } // Build plugin code string output = "<div style=\"overflow: hidden; width: {0}px;\"><script src=\"{1}\" type=\"text/javascript\">api_key: {2}</script><script type=\"IN/Apply\" data-companyid=\"{3}\" data-jobtitle=\"{4}\" data-email=\"{5}\" {6} data-phone=\"{7}\" data-coverletter=\"{8}\" {9} data-showtext=\"{10}\" {11} {12} {13}></script></div>"; ltlPluginCode.Text = String.Format(output, Width, src, apiKey, CompanyID, JobTitle, DeliveryEmail, dataJobLocation, RequestPhone, RequestCoverLetter, dataLogo, ShowHelpText.ToString().ToLowerCSafe(), dataThemeColor, dataButtonSize, dataQuestions); } else { if (CMSContext.ViewMode == ViewModeEnum.Design) { string pathToSettings = SocialNetworkingHelper.GetPathToLinkedInSettings(); ltlPluginCode.Text = "<span class='ErrorLabel'>" + String.Format(ResHelper.GetString("socialnetworking.linkedin.settingsrequired"), pathToSettings) + "</span>"; } // Log event EventLogProvider.LogException("SocialNetworking", "LinkedInApplyWith", new Exception("Missing LinkedIn settings.")); } } }