コード例 #1
0
        /// <summary>
        /// Prepare full-text settings model
        /// </summary>
        /// <returns>Full-text settings model</returns>
        protected virtual FullTextSettingsModel PrepareFullTextSettingsModel()
        {
            //load settings for a chosen store scope
            var commonSettings = _settingService.LoadSetting <CommonSettings>();

            //fill in model values from the entity
            var model = new FullTextSettingsModel
            {
                Enabled    = commonSettings.UseFullTextSearch,
                SearchMode = (int)commonSettings.FullTextMode
            };

            //fill in additional values (not existing in the entity)
            model.Supported        = _fulltextService.IsFullTextSupported();
            model.SearchModeValues = commonSettings.FullTextMode.ToSelectList();

            return(model);
        }
コード例 #2
0
        public ActionResult GeneralCommon()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            //set page timeout to 5 minutes
            Server.ScriptTimeout = 300;

            var model = new GeneralCommonSettingsModel();
            //store information
            var storeInformationSettings = _settingService.LoadSetting <StoreInformationSettings>();
            var commonSettings           = _settingService.LoadSetting <CommonSettings>();

            model.StoreInformationSettings.StoreClosed       = storeInformationSettings.StoreClosed;
            model.StoreInformationSettings.Name              = storeInformationSettings.Name;
            model.StoreInformationSettings.Url               = storeInformationSettings.Url;
            model.StoreInformationSettings.Hosts             = storeInformationSettings.Hosts;
            model.StoreInformationSettings.DefaultLanguageId = storeInformationSettings.DefaultLanguageId;

            //social setting
            var socialSettings = _settingService.LoadSetting <SocialSettings>();

            model.SocialSettings.FacebookAppId     = socialSettings.FacebookAppId;
            model.SocialSettings.FacebookAppSecret = socialSettings.FacebookAppSecret;

            //themes
            model.StoreInformationSettings.DefaultStoreTheme    = storeInformationSettings.DefaultStoreTheme;
            model.StoreInformationSettings.AvailableStoreThemes = _themeProvider
                                                                  .GetThemeConfigurations()
                                                                  .Select(x => new GeneralCommonSettingsModel.StoreInformationSettingsModel.ThemeConfigurationModel
            {
                ThemeTitle      = x.ThemeTitle,
                ThemeName       = x.ThemeName,
                PreviewImageUrl = x.PreviewImageUrl,
                PreviewText     = x.PreviewText,
                SupportRtl      = x.SupportRtl,
                Selected        =
                    x.ThemeName.Equals(storeInformationSettings.DefaultStoreTheme,
                                       StringComparison.InvariantCultureIgnoreCase)
            })
                                                                  .ToList();
            model.StoreInformationSettings.AllowCustomerToSelectTheme =
                storeInformationSettings.AllowCustomerToSelectTheme;
            //EU Cookie law
            model.StoreInformationSettings.DisplayEuCookieLawWarning =
                storeInformationSettings.DisplayEuCookieLawWarning;
            //social pages
            model.StoreInformationSettings.FacebookLink   = storeInformationSettings.FacebookLink;
            model.StoreInformationSettings.TwitterLink    = storeInformationSettings.TwitterLink;
            model.StoreInformationSettings.YoutubeLink    = storeInformationSettings.YoutubeLink;
            model.StoreInformationSettings.GooglePlusLink = storeInformationSettings.GooglePlusLink;
            //contact us
            model.StoreInformationSettings.SubjectFieldOnContactUsForm    = commonSettings.SubjectFieldOnContactUsForm;
            model.StoreInformationSettings.UseSystemEmailForContactUsForm =
                commonSettings.UseSystemEmailForContactUsForm;


            //seo settings
            var seoSettings = _settingService.LoadSetting <SeoSettings>();

            model.SeoSettings.PageTitleSeparator           = seoSettings.PageTitleSeparator;
            model.SeoSettings.PageTitleSeoAdjustment       = (int)seoSettings.PageTitleSeoAdjustment;
            model.SeoSettings.PageTitleSeoAdjustmentValues = seoSettings.PageTitleSeoAdjustment.ToSelectList();
            model.SeoSettings.DefaultTitle                = seoSettings.DefaultTitle;
            model.SeoSettings.DefaultMetaKeywords         = seoSettings.DefaultMetaKeywords;
            model.SeoSettings.DefaultMetaDescription      = seoSettings.DefaultMetaDescription;
            model.SeoSettings.GeneratePostMetaDescription = seoSettings.GeneratePostMetaDescription;
            model.SeoSettings.ConvertNonWesternChars      = seoSettings.ConvertNonWesternChars;
            model.SeoSettings.CanonicalUrlsEnabled        = seoSettings.CanonicalUrlsEnabled;
            model.SeoSettings.WwwRequirement              = (int)seoSettings.WwwRequirement;
            model.SeoSettings.WwwRequirementValues        = seoSettings.WwwRequirement.ToSelectList();
            model.SeoSettings.EnableJsBundling            = seoSettings.EnableJsBundling;
            model.SeoSettings.EnableCssBundling           = seoSettings.EnableCssBundling;
            model.SeoSettings.TwitterMetaTags             = seoSettings.TwitterMetaTags;
            model.SeoSettings.OpenGraphMetaTags           = seoSettings.OpenGraphMetaTags;


            //security settings
            var securitySettings = _settingService.LoadSetting <SecuritySettings>();
            var captchaSettings  = _settingService.LoadSetting <CaptchaSettings>();

            model.SecuritySettings.EncryptionKey = securitySettings.EncryptionKey;
            if (securitySettings.AdminAreaAllowedIpAddresses != null)
            {
                for (var i = 0; i < securitySettings.AdminAreaAllowedIpAddresses.Count; i++)
                {
                    model.SecuritySettings.AdminAreaAllowedIpAddresses +=
                        securitySettings.AdminAreaAllowedIpAddresses[i];
                    if (i != securitySettings.AdminAreaAllowedIpAddresses.Count - 1)
                    {
                        model.SecuritySettings.AdminAreaAllowedIpAddresses += ",";
                    }
                }
            }
            model.SecuritySettings.ForceSslForAllPages = securitySettings.ForceSslForAllPages;
            model.SecuritySettings.EnableXsrfProtectionForAdminArea   = securitySettings.EnableXsrfProtectionForAdminArea;
            model.SecuritySettings.EnableXsrfProtectionForPublicStore =
                securitySettings.EnableXsrfProtectionForPublicStore;
            model.SecuritySettings.HoneypotEnabled                        = securitySettings.HoneypotEnabled;
            model.SecuritySettings.CaptchaEnabled                         = captchaSettings.Enabled;
            model.SecuritySettings.CaptchaShowOnLoginPage                 = captchaSettings.ShowOnLoginPage;
            model.SecuritySettings.CaptchaShowOnRegistrationPage          = captchaSettings.ShowOnRegistrationPage;
            model.SecuritySettings.CaptchaShowOnContactUsPage             = captchaSettings.ShowOnContactUsPage;
            model.SecuritySettings.CaptchaShowOnEmailWishlistToFriendPage =
                captchaSettings.ShowOnEmailWishlistToFriendPage;
            model.SecuritySettings.CaptchaShowOnEmailPostToFriendPage = captchaSettings.ShowOnEmailPostToFriendPage;
            model.SecuritySettings.CaptchaShowOnBlogCommentPage       = captchaSettings.ShowOnBlogCommentPage;
            model.SecuritySettings.CaptchaShowOnNewsCommentPage       = captchaSettings.ShowOnNewsCommentPage;
            model.SecuritySettings.CaptchaShowOnPostReviewPage        = captchaSettings.ShowOnPostReviewPage;
            model.SecuritySettings.CaptchaShowOnApplyVendorPage       = captchaSettings.ShowOnApplyVendorPage;
            model.SecuritySettings.ReCaptchaPublicKey  = captchaSettings.ReCaptchaPublicKey;
            model.SecuritySettings.ReCaptchaPrivateKey = captchaSettings.ReCaptchaPrivateKey;


            //localization
            var localizationSettings = _settingService.LoadSetting <LocalizationSettings>();

            model.LocalizationSettings.UseImagesForLanguageSelection =
                localizationSettings.UseImagesForLanguageSelection;
            model.LocalizationSettings.SeoFriendlyUrlsForLanguagesEnabled =
                localizationSettings.SeoFriendlyUrlsForLanguagesEnabled;
            model.LocalizationSettings.AutomaticallyDetectLanguage   = localizationSettings.AutomaticallyDetectLanguage;
            model.LocalizationSettings.LoadAllLocaleRecordsOnStartup =
                localizationSettings.LoadAllLocaleRecordsOnStartup;
            model.LocalizationSettings.LoadAllLocalizedPropertiesOnStartup =
                localizationSettings.LoadAllLocalizedPropertiesOnStartup;
            model.LocalizationSettings.LoadAllUrlRecordsOnStartup = localizationSettings.LoadAllUrlRecordsOnStartup;

            //full-text support
            model.FullTextSettings.Supported        = _fulltextService.IsFullTextSupported();
            model.FullTextSettings.Enabled          = commonSettings.UseFullTextSearch;
            model.FullTextSettings.SearchMode       = (int)commonSettings.FullTextMode;
            model.FullTextSettings.SearchModeValues = commonSettings.FullTextMode.ToSelectList();


            return(View(model));
        }
コード例 #3
0
ファイル: CommonController.cs プロジェクト: thophamhuu/APIWB
 /// <summary>
 /// Gets value indicating whether Full-Text is supported
 /// </summary>
 /// <returns>Result</returns>
 public bool IsFullTextSupported()
 {
     return(_fulltextService.IsFullTextSupported());
 }