/// <summary> /// Displays warning message in "Design mode". /// </summary> /// <param name="message">Message that will be displayed. Default misconfiration message is used when no parameter is given.</param> private bool DisplayMessage(string message = null) { // Error label is displayed in Design mode when Facebook Connect is disabled if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { if (String.IsNullOrEmpty(message)) { // Default message informing about misconfiguration is dispalyed. StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmsfacebookconnect")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } message = String.Format(GetString("mem.facebook.disabled"), parameter); } lblError.Text = message; lblError.Visible = true; plcFBButton.Visible = false; imgSignOut.Visible = false; lnkSignOutImageBtn.Visible = false; lnkSignOutLink.Visible = false; } return(lblError.Visible); }
/// <summary> /// Ensures that the <see cref="ApplicationUrl"/> property has a value. /// </summary> /// <param name="request"></param> internal void EnsureApplicationUrl(HttpRequestBase request = null) { //Fixme: This causes problems with site swap on azure because azure pre-warms a site by calling into `localhost` and when it does that // it changes the URL to `localhost:80` which actually doesn't work for pinging itself, it only works internally in Azure. The ironic part // about this is that this is here specifically for the slot swap scenario https://issues.umbraco.org/issue/U4-10626 // see U4-10626 - in some cases we want to reset the application URL // (this is a simplified version of what was in 7.x) // note: should this be optional? is it expensive? var url = request == null ? null : ApplicationUrlHelper.GetApplicationUrlFromCurrentRequest(request, _globalSettings); var change = url != null && !_applicationUrls.Contains(url); if (change) { _logger.Info(typeof(ApplicationUrlHelper), "New url {Url} detected, re-discovering application url.", url); _applicationUrls.Add(url); } if (ApplicationUrl != null && !change) { return; } ApplicationUrl = new Uri(ApplicationUrlHelper.GetApplicationUrl(_logger, _globalSettings, _settings, ServerRegistrar, request)); }
/// <summary> /// Prepares JSON object to be inserted to the breadcrumbs. This object will be used when updating breadcrumbs after changing display name of the campaign. /// </summary> /// <returns>List of objects containing breadcrumb for root element and single campaign.</returns> private object GetBreadcrumbsData() { var breadcrumbsList = new List <object>(); var application = UIContext.UIElement.Application; // Root application string rootRedirectUrl = UrlResolver.ResolveUrl(ApplicationUrlHelper.GetApplicationUrl(application)); breadcrumbsList.Add(new { text = MacroResolver.Resolve(application.ElementDisplayName), redirectUrl = rootRedirectUrl, isRoot = true }); // (Campaign) breadcrumbsList.Add(new { suffix = GetString("analytics.campaign") }); return(new { data = breadcrumbsList, pin = new { elementGuid = UIElementInfo.Provider.Get(UIContext.UIElement.ElementParentID).ElementGUID, applicationGuid = application.ElementGUID, objectType = CampaignInfo.OBJECT_TYPE } }); }
protected void btnWebSite_onClick(object sender, EventArgs e) { if (!VirtualPathHelper.UsingVirtualPathProvider) { AuthenticationHelper.AuthenticateUser(UserInfoProvider.AdministratorUserName, false); URLHelper.Redirect(ApplicationUrlHelper.GetApplicationUrl("cms", "administration")); } else { URLHelper.Redirect(ResolveUrl("~/default.aspx")); } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do nothing } else { if (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableWindowsLiveID")) { plcPasswordNew.Visible = AllowFormsAuthentication; pnlExistingUser.Visible = AllowExistingUser; liveUser = SessionHelper.GetValue("windowsliveloginuser") as WindowsLiveLogin.User; // There is no windows live user object stored in session - hide all if ((liveUser == null) && HideForNoLiveID) { Visible = false; } // WAI validation lblPasswordNew.AssociatedControlClientID = passStrength.InputClientID; } else { // Error label is displayed in Design mode when Windows Live ID is disabled if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmswindowsliveid")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } lblError.Text = String.Format(GetString("mem.liveid.disabled"), parameter.ToString()); plcError.Visible = true; plcContent.Visible = false; } else { Visible = false; } } } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { Visible = false; return; } // Check if OpenID module is enabled if (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOpenID")) { ltlScript.Text = ScriptHelper.GetScriptTag(PROVIDERS_LOCATION + "OpenIDSelector.js"); lblError.Text = GetString("openid.invalidid"); SetProviders(); DisplayButtons(); openIDhelper = new CMSOpenIDHelper(); CheckStatus(); } else { // Error label is displayed in Design mode when OpenID is disabled if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmsopenid")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } lblError.Text = String.Format(GetString("mem.openid.disabled"), parameter); lblError.Visible = true; txtInput.Visible = false; } else { Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { // Try skip IIS http errors Response.TrySkipIisCustomErrors = true; // Set error state Response.StatusCode = 503; titleElem.TitleText = GetString("InvalidLicense.Header"); lblRawUrl.Text = GetString("InvalidLicense.RawUrl"); lblResult.Text = GetString("InvalidLicense.Result"); // URL string rawUrl = QueryHelper.GetString("rawUrl", String.Empty).Trim(); if (rawUrl != String.Empty) { lblRawUrlValue.Text = HttpUtility.HtmlEncode(rawUrl); } else { lblRawUrl.Visible = false; lblRawUrlValue.Visible = false; } // Validation result LicenseValidationEnum mResult = (LicenseValidationEnum)QueryHelper.GetInteger("Result", Convert.ToInt32(LicenseValidationEnum.NotAvailable)); lblResultValue.Text = LicenseHelper.GetValidationResultString(mResult); // URL 'Go to:' lnkGoToValue.NavigateUrl = ApplicationUrlHelper.GetApplicationUrl("Licenses", "Licenses"); lblAddLicenseValue.Text = RequestContext.CurrentDomain; // How to get license options lnkOpt1.NavigateUrl = CLIENT_PORTAL; lnkOpt1.ToolTip = CLIENT_PORTAL; lnkOpt3.NavigateUrl = CLIENT_PORTAL; lnkOpt3.ToolTip = CLIENT_PORTAL; if (mResult == LicenseValidationEnum.Expired) { genTrial.InnerHtml = GetString("invalidlicense.trialexpired"); genTrial.Visible = true; } }
/// <summary> /// Gets HTML list code representing the <paramref name="uiElement"/> where can visitors go after the import has finished. /// </summary> /// <param name="uiElement">UI element the caption, icon and link are loaded from</param> /// <param name="description">Description of the element (i.e. some clarification what the application is good for)</param> /// <returns>HTML list code representing the <paramref name="uiElement"/> with given <paramref name="description"/></returns> private string GetContinueToSmartTipListContent(UIElementInfo uiElement, string description) { string applicationUrl = ApplicationUrlHelper.GetApplicationUrl(ApplicationUrlHelper.GetResourceName(uiElement.ElementResourceID), uiElement.ElementName); return(string.Format(@" <li> <div class=""om-import-csv-next-steps-initial""> <i aria-hidden=""true"" class=""{0} cms-icon-100""></i> </div> <div class=""om-import-csv-next-steps-description""> <p class=""lead""> <a href=""{1}"" target=""_blank"">{2}</a> </p> <p> {3} </p> </div> </li>", uiElement.ElementIconClass, UrlResolver.ResolveUrl(applicationUrl), MacroResolver.Resolve(uiElement.ElementCaption), description)); }
/// <summary> /// Ensures that the <see cref="ApplicationUrl"/> property has a value. /// </summary> /// <param name="request"></param> internal void EnsureApplicationUrl(HttpRequestBase request = null) { // see U4-10626 - in some cases we want to reset the application url // (this is a simplified version of what was in 7.x) // note: should this be optional? is it expensive? var url = request == null ? null : ApplicationUrlHelper.GetApplicationUrlFromCurrentRequest(request, _globalSettings); var change = url != null && !_applicationUrls.Contains(url); if (change) { _logger.Info(typeof(ApplicationUrlHelper), "New url {Url} detected, re-discovering application url.", url); _applicationUrls.Add(url); } if (ApplicationUrl != null && !change) { return; } ApplicationUrl = new Uri(ApplicationUrlHelper.GetApplicationUrl(_logger, _globalSettings, _settings, ServerRegistrar, request)); }
protected void Page_Load(object sender, EventArgs e) { // Try skip IIS http errors Response.TrySkipIisCustomErrors = true; // Set error state Response.StatusCode = 503; string mPrefix = "http://"; titleElem.TitleText = GetString("Message.InvalidWebSite"); string mDomain = RequestContext.URL.Host; if (RequestContext.URL.Port != 80) { mDomain = mDomain + ":" + RequestContext.URL.Port.ToString(); } if (RequestContext.IsSSL) { mPrefix = "https://"; } lblMessage.Text = GetString("Message.TextInvalidWebSite") + " "; lblMessageUrl.Text = mPrefix + mDomain + HttpUtility.HtmlEncode(RequestContext.CurrentURL); lblInfo1.Text = GetString("Message.InfoInvalidWebSite1") + " "; lblInfo2.Text = " " + GetString("Message.InfoInvalidWebSite2") + " "; lblInfoDomain.Text = mDomain; // Get the Sites page url lnkAdministration.Text = GetString("Message.LinkInvalidWebSite"); lnkAdministration.NavigateUrl = ApplicationUrlHelper.GetApplicationUrl("cms", "sites"); if (LicenseContext.CurrentLicenseInfo == null) { pnlLicense.Visible = true; } }
private void CheckSubscriptionLicences() { // Hide message if requested by user if (!CheckWarningMessage(SESSION_KEY_SUBSCRIPTION_LICENCES)) { pnlSubscriptionLicencesWarning.Visible = false; CacheHelper.Add(SUBSCRIPTION_LICENSES_WARNING_ALREADY_CLOSED_TODAY, true, CacheHelper.GetCacheDependency($"{LicenseKeyInfo.OBJECT_TYPE}|all"), DateTime.Now.AddDays(1), CacheConstants.NoSlidingExpiration); SessionHelper.Remove(SESSION_KEY_SUBSCRIPTION_LICENCES); return; } if (!AreSubscriptionLicensesValid(out int numberOfInvalidLicenses, out bool onlyWarning, out int daysToExpiration)) { if (onlyWarning) { // Warning was already closed by someone and will be displayed after 24h again if (!CacheHelper.TryGetItem(SUBSCRIPTION_LICENSES_WARNING_ALREADY_CLOSED_TODAY, out bool _)) { pnlSubscriptionLicencesWarning.Visible = true; ltlSubscriptionLicenceWarning.Text = numberOfInvalidLicenses > 1 ? ResHelper.GetStringFormat("subscriptionlicenses.warning.multiple", UrlResolver.ResolveUrl(ApplicationUrlHelper.GetApplicationUrl("Licenses", "Licenses")), numberOfInvalidLicenses) : ResHelper.GetStringFormat("subscriptionlicenses.warning.single", daysToExpiration); } } else { pnlSubscriptionLicencesError.Visible = true; ltlSubscriptionLicenceError.Text = numberOfInvalidLicenses > 1 ? GetMultipleSubscriptionLicensesErrorMessage() : GetSingleSubscriptionLicenseErrorMessage(); } } string GetMultipleSubscriptionLicensesErrorMessage() { return(daysToExpiration > 0 ? ResHelper.GetStringFormat("subscriptionlicenses.error.multiple", UrlResolver.ResolveUrl(ApplicationUrlHelper.GetApplicationUrl("Licenses", "Licenses")), numberOfInvalidLicenses, daysToExpiration) : ResHelper.GetString("subscriptionlicenses.error.graceperiodexpired")); } string GetSingleSubscriptionLicenseErrorMessage() { return(daysToExpiration > 0 ? ResHelper.GetStringFormat("subscriptionlicenses.error.single", daysToExpiration) : ResHelper.GetString("subscriptionlicenses.error.graceperiodexpired")); } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (!StopProcessing) { plcError.Visible = false; // Check if LinkedIn module is enabled if (!LinkedInHelper.LinkedInIsAvailable(SiteContext.CurrentSiteName) && !plcError.Visible) { // Error label is displayed only in Design mode if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmslinkedin")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } lblError.Text = String.Format(GetString("mem.linkedin.disabled"), parameter); plcError.Visible = true; plcContent.Visible = false; } // In other modes is web part hidden else { Visible = false; } } // Display web part when no error occurred if (!plcError.Visible && Visible) { // Hide web part if user is authenticated if (AuthenticationHelper.IsAuthenticated()) { Visible = false; return; } plcPasswordNew.Visible = AllowFormsAuthentication; pnlExistingUser.Visible = AllowExistingUser; SetLinkedInProfileFromSession(); // There is no LinkedIn profile stored in session - hide all if (mLinkedInProfile == null && HideForNoLinkedInUserID) { Visible = false; } else if (!RequestHelper.IsPostBack()) { LoadData(); } } } else { Visible = false; } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (!StopProcessing) { plcError.Visible = false; // Check if OpenID module is enabled if (!SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOpenID") && !plcError.Visible) { // Error label is displayed only in Design mode if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmsopenid")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } lblError.Text = String.Format(GetString("mem.openid.disabled"), parameter.ToString()); plcError.Visible = true; plcContent.Visible = false; } // In other modes is webpart hidden else { Visible = false; } } // Display webpart when no error occured if (!plcError.Visible && Visible) { if (!AuthenticationHelper.IsAuthenticated()) { plcPasswordNew.Visible = AllowFormsAuthentication; pnlExistingUser.Visible = AllowExistingUser; // Initialize OpenID session response = (Dictionary <string, object>)SessionHelper.GetValue(SESSION_NAME_USERDATA); userProviderUrl = ValidationHelper.GetString(SessionHelper.GetValue(SESSION_NAME_URL), null); // Check that OpenID is not already registered if (response != null) { UserInfo ui = OpenIDUserInfoProvider.GetUserInfoByOpenID((string)response["ClaimedIdentifier"]); // OpenID is already registered to some user if (ui != null) { plcContent.Visible = false; plcError.Visible = true; lblError.Text = GetString("mem.openid.openidregistered"); } } // There is no OpenID response object stored in session - hide all if (response == null) { if (HideForNoOpenID) { Visible = false; } } else if (!RequestHelper.IsPostBack()) { LoadData(); } } // Hide webpart for authenticated users else { Visible = false; } } } // Hide control when StopProcessing = TRUE else { Visible = false; } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do nothing } else { if (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableWindowsLiveID")) { string siteName = SiteContext.CurrentSiteName; if (!string.IsNullOrEmpty(siteName)) { // Get LiveID settings string appId = SettingsKeyInfoProvider.GetValue(siteName + ".CMSApplicationID"); string secret = SettingsKeyInfoProvider.GetValue(siteName + ".CMSApplicationSecret"); if (!WindowsLiveLogin.UseServerSideAuthorization) { // Add windows live ID script ScriptHelper.RegisterClientScriptInclude(Page, typeof(string), "WLScript", LIVE_CONNECT_API_URL); btnHidden.Visible = true; // Add login functions String loginLiveIDClientScript = @" function signUserIn() { WL.login({ scope: 'wl.signin' }); } function refreshLiveID(param) { " + ControlsHelper.GetPostBackEventReference(btnHidden, "#").Replace("'#'", "param") + @" } "; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ClientInitLiveIDScript", ScriptHelper.GetScript(loginLiveIDClientScript)); } // Check valid Windows LiveID parameters if ((appId == string.Empty) || (secret == string.Empty)) { lblError.Visible = true; lblError.Text = GetString("liveid.incorrectsettings"); return; } WindowsLiveLogin wll = new WindowsLiveLogin(appId, secret); var designMode = PortalContext.IsDesignMode(ViewMode); // If user is already authenticated if (AuthenticationHelper.IsAuthenticated()) { // Signout is visible when ShowSignOut set to true and user has LiveID registered (ignored on design mode) if ((ShowSignOut && !String.IsNullOrEmpty(MembershipContext.AuthenticatedUser.UserSettings.WindowsLiveID)) || designMode) { // Get data from auth cookie string[] userData = AuthenticationHelper.GetUserDataFromAuthCookie(); // Check if user has truly logged in by LiveID (ignored on design mode) if (((userData != null) && (Array.IndexOf(userData, "liveidlogin") >= 0)) || designMode) { // Redirect to Windows Live and back to "home" page string defaultAliasPath = SettingsKeyInfoProvider.GetValue(siteName + ".CMSDefaultAliasPath"); string url = DocumentURLProvider.GetUrl(defaultAliasPath); string navUrl = wll.GetLogoutUrl(URLHelper.GetAbsoluteUrl(url)); // If text is set use text/button link if (!string.IsNullOrEmpty(SignOutText)) { // Button link if (ShowAsButton) { btnSignOut.CommandArgument = navUrl; btnSignOut.Text = SignOutText; btnSignOut.Visible = true; } // Text link else { btnSignOutLink.CommandArgument = navUrl; btnSignOutLink.Text = SignOutText; btnSignOutLink.Visible = true; } } // Image link else { btnSignOutImage.CommandArgument = navUrl; btnSignOutImage.ImageUrl = ResolveUrl(SignOutImageURL); btnSignOutImage.Visible = true; btnSignOut.Text = GetString("webparts_membership_signoutbutton.signout"); } } } else { Visible = false; } } // Sign In else { // Create return URL string returnUrl = QueryHelper.GetText("returnurl", null); if (!URLHelper.IsLocalUrl(returnUrl)) { returnUrl = RequestContext.CurrentURL; } // Create parameters for LiveID request URL String[] parameters = new String[3]; parameters[0] = returnUrl; parameters[1] = TrackConversionName; parameters[2] = ConversionValue.ToString(); SessionHelper.SetValue("LiveIDInformtion", parameters); returnUrl = wll.GetLoginUrl(); // Get App ID appId = SettingsKeyInfoProvider.GetValue(siteName + ".CMSApplicationID"); // Create full LiveID request URL string navUrl = AUTHORIZATION_URL + "?client_id=" + appId + "&redirect=true&scope=wl.signin&response_type=code&redirect_uri=" + HttpUtility.UrlEncode(returnUrl); // If text is set use text/button link if (!string.IsNullOrEmpty(SignInText)) { // Button link if (ShowAsButton) { AssignButtonControl(navUrl, returnUrl, appId); btnSignIn.Text = SignInText; } // Text link else { AssignHyperlinkControl(navUrl, returnUrl, appId); lnkSignIn.Text = SignInText; } } // Image link else { AssignHyperlinkControl(navUrl, returnUrl, appId); lnkSignIn.ImageUrl = ResolveUrl(SignInImageURL); lnkSignIn.Text = GetString("webparts_membership_signoutbutton.signin"); } } } } else { // Error label is displayed in Design mode when Windows Live ID is disabled if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmswindowsliveid")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } lblError.Text = String.Format(GetString("mem.liveid.disabled"), parameter); lblError.Visible = true; } else { Visible = false; } } } }
private void lnkSkipLicense_Click(object sender, EventArgs e) { AuthenticationHelper.AuthenticateUser(UserInfoProvider.AdministratorUserName, false); URLHelper.Redirect(ApplicationUrlHelper.GetApplicationUrl("cms", "sites", "action=new")); }
private void SetupContactSelector() { contactsSelector.WhereCondition = "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"; contactsSelector.OnItemsSelected += ContactSelector_OnItemsSelected; contactsSelector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; contactsSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addcontacts.nodata"), UrlResolver.ResolveUrl(ApplicationUrlHelper.GetApplicationUrl(ModuleName.CONTACTMANAGEMENT, "ContactsFrameset", "?tabname=contacts"))); contactsSelector.FilterControl = "~/CMSModules/ContactManagement/FormControls/SearchContactFullName.ascx"; contactsSelector.UseDefaultNameFilter = false; }
private void SetupContactGroupSelector() { contactGroupsSelector.OnItemsSelected += CGSelector_OnItemsSelected; contactGroupsSelector.DialogButton.ButtonStyle = ButtonStyle.Primary; contactGroupsSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addcontactgroups.nodata"), UrlResolver.ResolveUrl(ApplicationUrlHelper.GetApplicationUrl(ModuleName.CONTACTMANAGEMENT, "ContactGroups"))); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (!StopProcessing) { plcError.Visible = false; // Check renamed DLL library if (!SystemContext.IsFullTrustLevel) { // Error label is displayed when OpenID library is not enabled lblError.ResourceString = "socialnetworking.fulltrustrequired"; plcError.Visible = true; plcContent.Visible = false; } // Check if LinkedIn module is enabled if (!LinkedInHelper.LinkedInIsAvailable(SiteContext.CurrentSiteName) && !plcError.Visible) { // Error label is displayed only in Design mode if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { StringBuilder parameter = new StringBuilder(); parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> "); parameter.Append(GetString("settingscategory.cmsmembership") + " -> "); parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> "); parameter.Append(GetString("settingscategory.cmslinkedin")); if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Make it link for Admin parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">"); parameter.Append("</a>"); } lblError.Text = String.Format(GetString("mem.linkedin.disabled"), parameter); plcError.Visible = true; plcContent.Visible = false; } // In other modes is web part hidden else { Visible = false; } } // Display web part when no error occurred if (!plcError.Visible && Visible) { // Hide web part if user is authenticated if (AuthenticationHelper.IsAuthenticated()) { Visible = false; return; } plcPasswordNew.Visible = AllowFormsAuthentication; pnlExistingUser.Visible = AllowExistingUser; // Load LinkedIn data from session linkedInHelper = new LinkedInHelper(); string linkedInData = ValidationHelper.GetString(SessionHelper.GetValue(SESSION_NAME_USERDATA), string.Empty); if (!string.IsNullOrEmpty(linkedInData)) { var doc = new XmlDocument(); doc.LoadXml(linkedInData); linkedInHelper.Initialize(doc); } // There is no LinkedIn user ID stored in session - hide all if (string.IsNullOrEmpty(linkedInHelper.MemberId) && HideForNoLinkedInUserID) { Visible = false; } else if (!RequestHelper.IsPostBack()) { LoadData(); } } } else { Visible = false; } }