public ActionResult Configure(ConfigurationModel model, FormCollection form)
		{
			if (!ModelState.IsValid)
				return Configure();

			ModelState.Clear();

			var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
			int storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _services.WorkContext);
			var settings = _services.Settings.LoadSetting<AmazonPaySettings>(storeScope);

			model.Copy(settings, false);

			storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, _services.Settings);

			_services.Settings.SaveSetting(settings, x => x.DataFetching, 0, false);
			_services.Settings.SaveSetting(settings, x => x.PollingMaxOrderCreationDays, 0, false);

			_apiService.DataPollingTaskUpdate(settings.DataFetching == AmazonPayDataFetchingType.Polling, model.PollingTaskMinutes * 60);

			_services.Settings.ClearCache();
			NotifySuccess(_services.Localization.GetResource("Plugins.Payments.AmazonPay.ConfigSaveNote"));

			return Configure();
		}
Exemplo n.º 2
0
        public ActionResult Configure()
        {
            // load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var settings = _settingService.LoadSetting<ProfilerSettings>(storeScope);

            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            storeDependingSettingHelper.GetOverrideKeys(settings, settings, storeScope, _settingService);

            return View(settings);
        }
		public ActionResult Configure()
		{
			var model = new PayUMeaStandardConfigurationModel();
			int storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _services.WorkContext);
			var settings = _services.Settings.LoadSetting<PayUMeaStandardPaymentSettings>(storeScope);

			model.Copy(settings, true);

			var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
			storeDependingSettingHelper.GetOverrideKeys(settings, model, storeScope, _services.Settings);

			return View(model);
		}
Exemplo n.º 4
0
        public ActionResult Configure(ProfilerSettings model, FormCollection form)
        {
            if (!ModelState.IsValid)
                return Configure();

            ModelState.Clear();

            // load settings for a chosen store scope
            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);

            storeDependingSettingHelper.UpdateSettings(model /*settings*/, form, storeScope, _settingService);
            _settingService.ClearCache();

            return Configure();
        }
        public ActionResult Configure()
        {
            if (!HasPermission(false))
                return AccessDeniedPartialView();

            var model = new ConfigurationModel();
            int storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext);
            var settings = _services.Settings.LoadSetting<FacebookExternalAuthSettings>(storeScope);

            model.ClientKeyIdentifier = settings.ClientKeyIdentifier;
            model.ClientSecret = settings.ClientSecret;

            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            storeDependingSettingHelper.GetOverrideKeys(settings, model, storeScope, _services.Settings);

            return View(model);
        }
        public ActionResult Configure()
        {
            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var googleAnalyticsSettings = _settingService.LoadSetting<GoogleAnalyticsSettings>(storeScope);
            var model = new ConfigurationModel();
            model.GoogleId = googleAnalyticsSettings.GoogleId;
            model.TrackingScript = googleAnalyticsSettings.TrackingScript;
            model.EcommerceScript = googleAnalyticsSettings.EcommerceScript;
            model.EcommerceDetailScript = googleAnalyticsSettings.EcommerceDetailScript;

            model.ZoneId = googleAnalyticsSettings.WidgetZone;
            model.AvailableZones.Add(new SelectListItem() { Text = "<head> HTML tag", Value = "head_html_tag"});
            model.AvailableZones.Add(new SelectListItem() { Text = "Before <body> end HTML tag", Value = "body_end_html_tag_before" });

            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            storeDependingSettingHelper.GetOverrideKeys(googleAnalyticsSettings, model, storeScope, _settingService);

            return View(model);
        }
        public ActionResult Configure(ConfigurationModel model, FormCollection form)
        {
			//load settings for a chosen store scope
			var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
			var googleAnalyticsSettings = _settingService.LoadSetting<GoogleAnalyticsSettings>(storeScope);
            googleAnalyticsSettings.GoogleId = model.GoogleId;
            googleAnalyticsSettings.TrackingScript = model.TrackingScript; 
            googleAnalyticsSettings.EcommerceScript = model.EcommerceScript;
            googleAnalyticsSettings.EcommerceDetailScript = model.EcommerceDetailScript;
            googleAnalyticsSettings.WidgetZone = model.ZoneId;

			_settingService.SaveSetting(googleAnalyticsSettings, x => x.WidgetZone, 0, false);

			var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
			storeDependingSettingHelper.UpdateSettings(googleAnalyticsSettings, form, storeScope, _settingService);

			//now clear settings cache
			_settingService.ClearCache();

            return Configure();
        }
Exemplo n.º 8
0
        public virtual void OnActionExecuted(ActionExecutedContext filterContext)
        {
            var viewResult = filterContext.Result as ViewResultBase;

            if (viewResult != null)
            {
                var model = viewResult.Model;

                if (model == null)
                {
                    // Nothing to override. E.g. insufficient permission.
                    return;
                }

                var modelType      = model.GetType();
                var settingsHelper = new StoreDependingSettingHelper(filterContext.Controller.ViewData);
                if (IsRootedModel)
                {
                    settingsHelper.CreateViewDataObject(_storeId);
                }

                foreach (var param in _settingParams)
                {
                    var settingInstance = param.Instance;
                    var modelInstance   = model;

                    if (IsRootedModel)
                    {
                        modelInstance = modelType.GetProperty(settingInstance.GetType().Name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase)?.GetValue(model);
                        if (modelInstance == null)
                        {
                            continue;
                        }
                    }

                    settingsHelper.GetOverrideKeys(settingInstance, modelInstance, _storeId, Services.Settings, !IsRootedModel);
                }
            }
        }
Exemplo n.º 9
0
        public virtual void OnActionExecuted(ActionExecutedContext filterContext)
        {
            var viewResult = filterContext.Result as ViewResultBase;

            if (viewResult != null)
            {
                var model = viewResult.Model;

                if (model == null)
                {
                    // Nothing to override. E.g. insufficient permission.
                    return;
                }

                var settingsHelper = new StoreDependingSettingHelper(filterContext.Controller.ViewData);

                foreach (var param in _settingParams)
                {
                    settingsHelper.GetOverrideKeys(param.Instance, model, _storeId, Services.Settings);
                }
            }
        }
        public ActionResult Configure(ConfigurationModel model, FormCollection form)
        {
            if (!HasPermission(false))
                return Configure();

            if (!ModelState.IsValid)
                return Configure();

            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            int storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext);
            var settings = _services.Settings.LoadSetting<FacebookExternalAuthSettings>(storeScope);

            settings.ClientKeyIdentifier = model.ClientKeyIdentifier;
            settings.ClientSecret = model.ClientSecret;

            storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, _services.Settings);
            _services.Settings.ClearCache();

            NotifySuccess(_services.Localization.GetResource("Admin.Common.DataSuccessfullySaved"));

            return Configure();
        }
		public ActionResult Configure(PayUMeaStandardConfigurationModel model, FormCollection form)
		{
			if (!ModelState.IsValid)
				return Configure();

			ModelState.Clear();

			var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
			int storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _services.WorkContext);
			var settings = _services.Settings.LoadSetting<PayUMeaStandardPaymentSettings>(storeScope);

			model.Copy(settings, false);

			storeDependingSettingHelper.UpdateSettings(settings, form, storeScope, _services.Settings);

			// multistore context not possible, see IPN handling
			_services.Settings.SaveSetting(settings, x => x.UseSandbox, 0, false);

			_services.Settings.ClearCache();
			NotifySuccess(_services.Localization.GetResource("Plugins.Payments.PayUMea.ConfigSaveNote"));

			return Configure();
		}
        public ActionResult Configure()
        {
			//load settings for a chosen store scope
			var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
			var trustedShopsSealSettings = _settingService.LoadSetting<TrustedShopsSealSettings>(storeScope);

            var model = new ConfigurationModel();
            model.TrustedShopsId = trustedShopsSealSettings.TrustedShopsId;
            model.IsTestMode = trustedShopsSealSettings.IsTestMode;
            model.ShopName = trustedShopsSealSettings.ShopName;
            model.ShopText = trustedShopsSealSettings.ShopText;
            model.WidgetZone = trustedShopsSealSettings.WidgetZone;

            model.AvailableZones.Add(new SelectListItem() { Text = "Before left side column", Value = "left_side_column_before" });
            model.AvailableZones.Add(new SelectListItem() { Text = "After left side column", Value = "left_side_column_after" });
            model.AvailableZones.Add(new SelectListItem() { Text = "Before right side column", Value = "right_side_column_before" });
            model.AvailableZones.Add(new SelectListItem() { Text = "After right side column", Value = "right_side_column_after" });
            model.AvailableZones.Add(new SelectListItem() { Text = "Homepage bottom", Value = "home_page_bottom" });

			var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
			storeDependingSettingHelper.GetOverrideKeys(trustedShopsSealSettings, model, storeScope, _settingService);
            
            return View("SmartStore.Plugin.Widgets.TrustedShopsSeal.Views.TrustedShopsSeal.Configure", model);
        }
Exemplo n.º 13
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            if (filterContext.Controller.ViewData.ModelState.IsValid)
            {
                var updateSettings = true;
                var redirectResult = filterContext.Result as RedirectToRouteResult;
                if (redirectResult != null)
                {
                    var controllerName = redirectResult.RouteValues["controller"] as string;
                    var areaName       = redirectResult.RouteValues["area"] as string;
                    if (controllerName.IsCaseInsensitiveEqual("security") && areaName.IsCaseInsensitiveEqual("admin"))
                    {
                        // Insufficient permission. We must not save because the action did not run.
                        updateSettings = false;
                    }
                }

                if (updateSettings)
                {
                    var settingHelper = new StoreDependingSettingHelper(filterContext.Controller.ViewData);

                    foreach (var param in _settingParams)
                    {
                        settingHelper.UpdateSettings(param.Instance, _form, _storeId, Services.Settings);
                    }
                }
            }

            if (_settingsWriteBatch != null)
            {
                _settingsWriteBatch.Dispose();
                _settingsWriteBatch = null;
            }

            base.OnActionExecuted(filterContext);
        }
		public ActionResult Configure(ConfigurationModel model, FormCollection form)
        {
            if (!ModelState.IsValid)
                return Configure();

			//load settings for a chosen store scope
			var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
			var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
			var trustedShopsSealSettings = _settingService.LoadSetting<TrustedShopsSealSettings>(storeScope);

			bool trustedShopIdOverride = storeDependingSettingHelper.IsOverrideChecked(trustedShopsSealSettings, "TrustedShopsId", form);
			bool isTrustedShopIdValid = true;

			if (trustedShopIdOverride || storeScope == 0)	// do validation
			{
				isTrustedShopIdValid = IsTrustedShopIdValid(model);

				if (isTrustedShopIdValid)
					NotifySuccess(_localizationService.GetResource("Plugins.Widgets.TrustedShopsSeal.CheckIdSuccess"), true);
				else
					NotifyError(_localizationService.GetResource("Plugins.Widgets.TrustedShopsSeal.CheckIdError"), true);
			}

			if (isTrustedShopIdValid)	//save settings
			{
				trustedShopsSealSettings.TrustedShopsId = model.TrustedShopsId;
				trustedShopsSealSettings.IsTestMode = model.IsTestMode;
				trustedShopsSealSettings.WidgetZone = model.WidgetZone;
				trustedShopsSealSettings.ShopName = model.ShopName;
				trustedShopsSealSettings.ShopText = model.ShopText;

				storeDependingSettingHelper.UpdateSettings(trustedShopsSealSettings, form, storeScope, _settingService);
				_settingService.ClearCache();
			}

            return Configure();
        }