Skip to content

Commit 89bb16b

Browse files
committed
Merge branch '2.0.x' into 2.x
Conflicts: changelog.md src/Presentation/SmartStore.Web/Views/Shared/_Root.Head.Mobile.cshtml
2 parents 881dbae + 8b65d6c commit 89bb16b

46 files changed

Lines changed: 738 additions & 471 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
* #340 Admin: Header overlays TinyMCE in fullscreen mode
1010
* #341 Orders are not cancellable
1111
* #342 Backend: order total is not editable
12+
* #348 Messaging: OrderPlacedStoreOwnerNotification overwrites email account sender name with the customer's name
1213
* Default value for plugin description not loaded into edit popup window
14+
* Fixed "Controller does not implement IController" (concerning plugin controllers)
15+
16+
###Improvements###
17+
* #250 Implemented validation to theme configuration editing
1318

1419

1520
##SmartStore.NET 2.0.1##

src/Libraries/SmartStore.Core/Extensions/ConversionExtensions.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,36 @@
1515
using System.Security.Cryptography;
1616
using SmartStore.Core.ComponentModel;
1717
using SmartStore.Core.Domain.Shipping;
18+
using SmartStore.Core.Domain.Catalog;
1819

1920
namespace SmartStore
2021
{
2122

2223
public static class ConversionExtensions
2324
{
25+
private readonly static IDictionary<Type, TypeConverter> s_customTypeConverters;
26+
27+
static ConversionExtensions()
28+
{
29+
var intConverter = new GenericListTypeConverter<int>();
30+
var decConverter = new GenericListTypeConverter<decimal>();
31+
var stringConverter = new GenericListTypeConverter<string>();
32+
var soListConverter = new ShippingOptionListTypeConverter();
33+
var bundleDataListConverter = new ProductBundleDataListTypeConverter();
34+
35+
s_customTypeConverters = new Dictionary<Type, TypeConverter>();
36+
s_customTypeConverters.Add(typeof(List<int>), intConverter);
37+
s_customTypeConverters.Add(typeof(IList<int>), intConverter);
38+
s_customTypeConverters.Add(typeof(List<decimal>), decConverter);
39+
s_customTypeConverters.Add(typeof(IList<decimal>), decConverter);
40+
s_customTypeConverters.Add(typeof(List<string>), stringConverter);
41+
s_customTypeConverters.Add(typeof(IList<string>), stringConverter);
42+
s_customTypeConverters.Add(typeof(ShippingOption), new ShippingOptionTypeConverter());
43+
s_customTypeConverters.Add(typeof(List<ShippingOption>), soListConverter);
44+
s_customTypeConverters.Add(typeof(IList<ShippingOption>), soListConverter);
45+
s_customTypeConverters.Add(typeof(List<ProductBundleItemOrderData>), bundleDataListConverter);
46+
s_customTypeConverters.Add(typeof(IList<ProductBundleItemOrderData>), bundleDataListConverter);
47+
}
2448

2549
#region Object
2650

@@ -111,7 +135,7 @@ public static object Convert(this object value, Type to, CultureInfo culture)
111135
return new Guid((string)value);
112136

113137
// see if source or target types have a TypeConverter that converts between the two
114-
TypeConverter toConverter = TypeDescriptor.GetConverter(fromType);
138+
TypeConverter toConverter = GetTypeConverter(fromType);
115139

116140
Type nonNullableTo = to.GetNonNullableType();
117141
bool isNullableTo = to != nonNullableTo;
@@ -122,7 +146,7 @@ public static object Convert(this object value, Type to, CultureInfo culture)
122146
return isNullableTo ? Activator.CreateInstance(typeof(Nullable<>).MakeGenericType(nonNullableTo), result) : result;
123147
}
124148

125-
TypeConverter fromConverter = TypeDescriptor.GetConverter(nonNullableTo);
149+
TypeConverter fromConverter = GetTypeConverter(nonNullableTo);
126150

127151
if (fromConverter != null && fromConverter.CanConvertFrom(fromType))
128152
{
@@ -172,6 +196,16 @@ public static object Convert(this object value, Type to, CultureInfo culture)
172196
#endregion
173197
}
174198

199+
internal static TypeConverter GetTypeConverter(Type type)
200+
{
201+
TypeConverter converter;
202+
if (s_customTypeConverters.TryGetValue(type, out converter))
203+
{
204+
return converter;
205+
}
206+
return TypeDescriptor.GetConverter(type);
207+
}
208+
175209
#endregion
176210

177211
#region int

src/Libraries/SmartStore.Core/Extensions/XmlNodeExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SmartStore
66
{
7-
/// <remarks>codehint: sm-add</remarks>
7+
88
public static class XmlNodeExtensions
99
{
1010
/// <summary>Safe way to get inner text of an attribute.</summary>

src/Libraries/SmartStore.Core/Infrastructure/CommonStartupTask.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Libraries/SmartStore.Core/Infrastructure/SmartStoreEngine.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ public void Initialize(SmartStoreConfig config)
8787
//startup tasks
8888
RunStartupTasks();
8989
}
90-
else
91-
{
92-
// TODO: (MC) not really good code. Find a better pattern!
93-
new CommonStartupTask().Execute();
94-
}
9590
}
9691

9792
public T Resolve<T>(string name = null) where T : class

src/Libraries/SmartStore.Core/SmartStore.Core.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@
212212
<Compile Include="Extensions\XmlWriterExtensions.cs" />
213213
<Compile Include="IMergedData.cs" />
214214
<Compile Include="Async\AsyncRunner.cs" />
215-
<Compile Include="Infrastructure\CommonStartupTask.cs" />
216215
<Compile Include="Infrastructure\DependencyManagement\AutofacLifetimeScopeProvider.cs" />
217216
<Compile Include="IO\Media\FileSystemStorageProvider.cs" />
218217
<Compile Include="IO\Media\IStorageFile.cs" />

src/Libraries/SmartStore.Core/Utilities/CommonHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.Dynamic;
45
using System.Globalization;
56
using System.IO;
@@ -134,5 +135,10 @@ public static ExpandoObject ToExpando(object value)
134135
return (ExpandoObject)expando;
135136
}
136137

138+
public static TypeConverter GetTypeConverter(Type type)
139+
{
140+
return ConversionExtensions.GetTypeConverter(type);
141+
}
142+
137143
}
138144
}

src/Libraries/SmartStore.Core/WebHelper.cs

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Text;
77
using System.Text.RegularExpressions;
88
using System.Web;
9+
using System.Web.Configuration;
910
using System.Web.Hosting;
1011
using SmartStore.Core.Data;
1112
using SmartStore.Core.Domain;
@@ -19,6 +20,7 @@ namespace SmartStore.Core
1920
/// </summary>
2021
public partial class WebHelper : IWebHelper
2122
{
23+
private static bool? s_optimizedCompilationsEnabled = null;
2224
private static AspNetHostingPermissionLevel? s_trustLevel = null;
2325
private static readonly Regex s_staticExts = new Regex(@"(.*?)\.(css|js|png|jpg|jpeg|gif|bmp|html|htm|xml|pdf|doc|xls|rar|zip|ico|eot|svg|ttf|woff|otf|axd|ashx|less)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
2426

@@ -539,11 +541,14 @@ public virtual void RestartAppDomain(bool makeRedirect = false, string redirectU
539541
{
540542
if (WebHelper.GetTrustLevel() > AspNetHostingPermissionLevel.Medium)
541543
{
542-
//full trust
543-
HttpRuntime.UnloadAppDomain();
544+
//full trust
545+
HttpRuntime.UnloadAppDomain();
544546

545-
// not a good idea with optimized compilation!
546-
//TryWriteGlobalAsax();
547+
if (!OptimizedCompilationsEnabled)
548+
{
549+
// not a good idea with optimized compilation!
550+
TryWriteGlobalAsax();
551+
}
547552
}
548553
else
549554
{
@@ -611,11 +616,11 @@ private bool TryWriteGlobalAsax()
611616
{
612617
//When a new plugin is dropped in the Plugins folder and is installed into SmartSTore.NET,
613618
//even if the plugin has registered routes for its controllers,
614-
//these routes will not be working as the MVC framework couldn't
615-
//find the new controller types and couldn't instantiate the requested controller.
619+
//these routes will not be working as the MVC framework can't
620+
//find the new controller types in order to instantiate the requested controller.
616621
//That's why you get these nasty errors
617622
//i.e "Controller does not implement IController".
618-
//The solutino is to touch global.asax file
623+
//The solution is to touch the 'top-level' global.asax file
619624
File.SetLastWriteTimeUtc(MapPath("~/global.asax"), DateTime.UtcNow);
620625
return true;
621626
}
@@ -625,6 +630,40 @@ private bool TryWriteGlobalAsax()
625630
}
626631
}
627632

633+
private bool TryWriteBinFolder()
634+
{
635+
try
636+
{
637+
var binMarker = MapPath("~/bin/HostRestart");
638+
Directory.CreateDirectory(binMarker);
639+
640+
using (var stream = File.CreateText(Path.Combine(binMarker, "marker.txt")))
641+
{
642+
stream.WriteLine("Restart on '{0}'", DateTime.UtcNow);
643+
stream.Flush();
644+
}
645+
return true;
646+
}
647+
catch
648+
{
649+
return false;
650+
}
651+
}
652+
653+
internal static bool OptimizedCompilationsEnabled
654+
{
655+
get
656+
{
657+
if (!s_optimizedCompilationsEnabled.HasValue)
658+
{
659+
var section = (CompilationSection)ConfigurationManager.GetSection("system.web/compilation");
660+
s_optimizedCompilationsEnabled = section.OptimizeCompilations;
661+
}
662+
663+
return s_optimizedCompilationsEnabled.Value;
664+
}
665+
}
666+
628667
/// <summary>
629668
/// Get a value indicating whether the request is made by search engine (web crawler)
630669
/// </summary>

src/Libraries/SmartStore.Data/Migrations/201404232319321_LessValidation.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace SmartStore.Data.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
using SmartStore.Data.Setup;
6+
7+
public partial class LessValidation : DbMigration, ILocaleResourcesProvider, IDataSeeder<SmartObjectContext>
8+
{
9+
public override void Up()
10+
{
11+
}
12+
13+
public override void Down()
14+
{
15+
}
16+
17+
public bool RollbackOnFailure
18+
{
19+
get { return false; }
20+
}
21+
22+
public void Seed(SmartObjectContext context)
23+
{
24+
context.MigrateLocaleResources(MigrateLocaleResources);
25+
}
26+
27+
public void MigrateLocaleResources(LocaleResourcesBuilder builder)
28+
{
29+
builder.AddOrUpdate("Admin.Configuration.Themes.Notifications.ConfigureError",
30+
"LESS CSS Parser Error: Your changes were not saved because your configuration would lead to an error in the shop. For details see report.",
31+
"LESS CSS Parser Fehler: Ihre Änderungen wurden nicht gespeichert, da Ihre Konfiguration zu einem Fehler im Shop führen würde. Details siehe Fehlerbericht.");
32+
33+
builder.AddOrUpdate("Admin.Configuration.Themes.Validation.ErrorReportTitle",
34+
"LESS parser error report",
35+
"LESS Parser Fehlerbericht");
36+
37+
builder.AddOrUpdate("Admin.Configuration.Themes.Validation.RestorePrevValues",
38+
"Restore previous values",
39+
"Vorherige Werte widerherstellen");
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)