<%:Html.ActionLink(T("Remove").Text, "RemoveFieldFrom", new { area = "Orchard.ContentTypes", id = Model.Part.Name, Model.Name }, new { itemprop = "RemoveUrl UnsafeUrl" })%><%--// <- some experimentation--%>
<%
- Html.RenderTemplates(Model.Templates); %>
- <%:Html.HiddenFor(m => m.Name) %><%:Html.HiddenFor(m => m.FieldDefinition.Name) %>
+ Html.RenderTemplates(Model.Templates);
+ %><%:Html.HiddenFor(m => m.Name)
+ %><%:Html.HiddenFor(m => m.FieldDefinition.Name)
+ %><%:Html.HiddenFor(m => m.Index) %>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/Fields.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/Fields.ascx
index dba3f94eb..29b577a43 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/Fields.ascx
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/Fields.ascx
@@ -2,11 +2,9 @@
<%
if (Model.Any()) { %>
<%
} %>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePart.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePart.ascx
index d2382be7d..256ba7e85 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePart.ascx
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePart.ascx
@@ -12,5 +12,6 @@
<%:Html.ActionLink(T("Edit global part config").Text, "EditPart", new { area = "Orchard.ContentTypes", id = Model.PartDefinition.Name })%>
<%:Html.DisplayFor(m => m.PartDefinition.Settings, "Settings", "PartDefinition")
%><%:Html.EditorFor(m => m.PartDefinition.Fields, "TypePartFields", "PartDefinition")
- %><%:Html.Hidden("PartDefinition.Name", Model.PartDefinition.Name) %>
+ %><%:Html.HiddenFor(m => m.PartDefinition.Name)
+ %><%:Html.HiddenFor(m => m.Index) %>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartField.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartField.ascx
index f7f933c7d..2b236a4a3 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartField.ascx
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartField.ascx
@@ -6,5 +6,7 @@
Html.RenderTemplates(Model.Templates); %>
<%
} %>
- <%:Html.HiddenFor(m => m.Name) %><%:Html.HiddenFor(m => m.FieldDefinition.Name) %>
+ <%:Html.HiddenFor(m => m.Name)
+ %><%:Html.HiddenFor(m => m.FieldDefinition.Name)
+ %><%:Html.HiddenFor(m => m.Index) %>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartFields.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartFields.ascx
index 5c270aa45..a1c1b86e6 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartFields.ascx
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypePartFields.ascx
@@ -1,10 +1,8 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %>
<%
if (Model.Any()) {
- var fi = 0;
foreach (var field in Model) {
- var f = field;
- var htmlFieldName = string.Format("Fields[{0}]", fi++); %>
- <%:Html.EditorFor(m => f, "TypePartField", htmlFieldName) %><%
+ var f = field; %>
+ <%:Html.EditorFor(m => f, "TypePartField", f.Prefix) %><%
}
} %>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypeParts.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypeParts.ascx
index cc41743b0..c6035fba2 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypeParts.ascx
+++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/EditorTemplates/TypeParts.ascx
@@ -2,11 +2,9 @@
<%
if (Model.Any()) { %>
<%
} %>
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Commands/IndexingCommands.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Commands/IndexingCommands.cs
index 292546ab1..f5b587871 100644
--- a/src/Orchard.Web/Modules/Orchard.Indexing/Commands/IndexingCommands.cs
+++ b/src/Orchard.Web/Modules/Orchard.Indexing/Commands/IndexingCommands.cs
@@ -83,8 +83,8 @@ namespace Orchard.Indexing.Commands {
Context.Output.WriteLine("│ {0} │ {1,6} │", "Title" + new string(' ', 60 - "Title".Length), "Score");
Context.Output.WriteLine("├──────────────────────────────────────────────────────────────┼────────┤");
foreach ( var searchHit in results ) {
- var title = searchHit.GetString("title");
- title = title.Substring(0, Math.Min(60, title.Length)) ?? "- no title -";
+ var title = searchHit.GetString("title") ?? "- no title -";
+ title = title.Substring(0, Math.Min(60, title.Length));
var score = searchHit.Score;
Context.Output.WriteLine("│ {0} │ {1,6} │", title + new string(' ', 60 - title.Length), score);
}
diff --git a/src/Orchard.Web/Modules/Orchard.Modules/styles/admin.css b/src/Orchard.Web/Modules/Orchard.Modules/styles/admin.css
index 6c98fa853..3ceabbae5 100644
--- a/src/Orchard.Web/Modules/Orchard.Modules/styles/admin.css
+++ b/src/Orchard.Web/Modules/Orchard.Modules/styles/admin.css
@@ -56,6 +56,12 @@
.features.summary-view .disabled.feature {
border-color:#CCC;
}
+.features .update.feature {
+ background:#ECC;
+}
+.features.summary-view .update.feature {
+ border-color:#E77;
+}
.features.detail-view .feature {
border-bottom:1px solid #CCC;
}
@@ -109,26 +115,7 @@
right:.4em;
top:.4em;
}
-
-a.update {
+.features .feature .actions form.inline.link,
+.features .feature .actions a {
margin-left:.5em;
-}
-.features .update.feature {
- background:#ecc;
-}
-.features.summary-view .update.feature {
- border-color:#e77;
-}
-
-.cathedral {
- bottom:0;
- font-size:.8em;
- position:absolute;
- right:3px;
-}
-.cathedral a,
-.cathedral a:link,
-.cathedral a:visited,
-.cathedral form.inline.link button {
- color:#aeaeae;
-}
+}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs
index 089dca490..b4c7569f8 100644
--- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs
+++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs
@@ -160,7 +160,7 @@ namespace Orchard.Setup.Services {
// add default culture
var cultureManager = environment.Resolve();
cultureManager.AddCulture("en-US");
- cultureManager.AddCulture("fr-FR");
+ cultureManager.AddCulture("fr");
var contentManager = environment.Resolve();
diff --git a/src/Orchard/ContentManagement/MetaData/Builders/ContentTypeDefinitionBuilder.cs b/src/Orchard/ContentManagement/MetaData/Builders/ContentTypeDefinitionBuilder.cs
index dfe1747aa..c0df7d18f 100644
--- a/src/Orchard/ContentManagement/MetaData/Builders/ContentTypeDefinitionBuilder.cs
+++ b/src/Orchard/ContentManagement/MetaData/Builders/ContentTypeDefinitionBuilder.cs
@@ -11,7 +11,7 @@ namespace Orchard.ContentManagement.MetaData.Builders {
private readonly SettingsDictionary _settings;
public ContentTypeDefinitionBuilder()
- : this(new ContentTypeDefinition(null)) {
+ : this(new ContentTypeDefinition(null, null)) {
}
public ContentTypeDefinitionBuilder(ContentTypeDefinition existing) {
diff --git a/src/Orchard/ContentManagement/MetaData/IContentDefinitionManager.cs b/src/Orchard/ContentManagement/MetaData/IContentDefinitionManager.cs
index a17decb2b..076cb99f1 100644
--- a/src/Orchard/ContentManagement/MetaData/IContentDefinitionManager.cs
+++ b/src/Orchard/ContentManagement/MetaData/IContentDefinitionManager.cs
@@ -18,7 +18,7 @@ namespace Orchard.ContentManagement.MetaData {
public static class ContentDefinitionManagerExtensions{
public static void AlterTypeDefinition(this IContentDefinitionManager manager, string name, Action alteration) {
- var typeDefinition = manager.GetTypeDefinition(name) ?? new ContentTypeDefinition(name);
+ var typeDefinition = manager.GetTypeDefinition(name) ?? new ContentTypeDefinition(name, name);
var builder = new ContentTypeDefinitionBuilder(typeDefinition);
alteration(builder);
manager.StoreTypeDefinition(builder.Build());
diff --git a/src/Orchard/ContentManagement/MetaData/Models/ContentTypeDefinition.cs b/src/Orchard/ContentManagement/MetaData/Models/ContentTypeDefinition.cs
index 09406bc04..cc1e00675 100644
--- a/src/Orchard/ContentManagement/MetaData/Models/ContentTypeDefinition.cs
+++ b/src/Orchard/ContentManagement/MetaData/Models/ContentTypeDefinition.cs
@@ -11,8 +11,9 @@ namespace Orchard.ContentManagement.MetaData.Models {
Settings = settings;
}
- public ContentTypeDefinition(string name) {
+ public ContentTypeDefinition(string name, string displayName) {
Name = name;
+ DisplayName = displayName;
Parts = Enumerable.Empty();
Settings = new SettingsDictionary();
}
@@ -20,7 +21,7 @@ namespace Orchard.ContentManagement.MetaData.Models {
[StringLength(128)]
public string Name { get; private set; }
[Required, StringLength(1024)]
- public string DisplayName { get; set; }
+ public string DisplayName { get; private set; }
public IEnumerable Parts { get; private set; }
public SettingsDictionary Settings { get; private set; }
diff --git a/src/Orchard/Localization/Commands/CultureCommands.cs b/src/Orchard/Localization/Commands/CultureCommands.cs
new file mode 100644
index 000000000..841187d55
--- /dev/null
+++ b/src/Orchard/Localization/Commands/CultureCommands.cs
@@ -0,0 +1,49 @@
+using System.Linq;
+using JetBrains.Annotations;
+using Orchard.Commands;
+using Orchard.Localization.Services;
+using Orchard.Settings;
+
+namespace Orchard.Localization.Commands {
+ public class CultureCommands : DefaultOrchardCommandHandler {
+ private readonly ICultureManager _cultureManager;
+
+ protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
+
+ public CultureCommands(ICultureManager cultureManager) {
+ _cultureManager = cultureManager;
+ }
+
+ [CommandHelp("cultures list \r\n\t" + "List site cultures")]
+ [CommandName("cultures list")]
+ public void ListCultures() {
+ Context.Output.WriteLine(T("Listing Cultures:"));
+
+ string cultures = _cultureManager.ListCultures().Aggregate(null, (current, culture) => current + culture + " ");
+
+ Context.Output.WriteLine(cultures);
+ }
+
+
+ [CommandHelp("cultures get site culture \r\n\t" + "Get culture for the site")]
+ [CommandName("cultures get site culture")]
+ public void GetSiteCulture() {
+ Context.Output.WriteLine(T("Site Culture is {0}", CurrentSite.SiteCulture));
+ }
+
+ [CommandHelp("cultures set site culture \r\n\t" + "Set culture for the site")]
+ [CommandName("cultures set site culture")]
+ public void SetSiteCulture(string cultureName) {
+ Context.Output.WriteLine(T("Setting site culture to {0}", cultureName));
+
+ if (!_cultureManager.IsValidCulture(cultureName)) {
+ Context.Output.WriteLine(T("Supplied culture name {0} is not valid.", cultureName));
+ return;
+ }
+ CurrentSite.SiteCulture = cultureName;
+
+ Context.Output.WriteLine(T("Site culture set to {0} successfully", cultureName));
+ }
+ }
+}
+
diff --git a/src/Orchard/Localization/Services/DefaultCultureManager.cs b/src/Orchard/Localization/Services/DefaultCultureManager.cs
index e689ab82b..86f4cfcbf 100644
--- a/src/Orchard/Localization/Services/DefaultCultureManager.cs
+++ b/src/Orchard/Localization/Services/DefaultCultureManager.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using JetBrains.Annotations;
+using Orchard.Caching;
using Orchard.Data;
using Orchard.Localization.Records;
using Orchard.Settings;
@@ -12,10 +13,12 @@ namespace Orchard.Localization.Services {
public class DefaultCultureManager : ICultureManager {
private readonly IRepository _cultureRepository;
private readonly IEnumerable _cultureSelectors;
+ private readonly ISignals _signals;
- public DefaultCultureManager(IRepository cultureRepository, IEnumerable cultureSelectors) {
+ public DefaultCultureManager(IRepository cultureRepository, IEnumerable cultureSelectors, ISignals signals) {
_cultureRepository = cultureRepository;
_cultureSelectors = cultureSelectors;
+ _signals = signals;
}
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
@@ -30,6 +33,7 @@ namespace Orchard.Localization.Services {
throw new ArgumentException("cultureName");
}
_cultureRepository.Create(new CultureRecord { Culture = cultureName });
+ _signals.Trigger("culturesChanged");
}
public void DeleteCulture(string cultureName) {
@@ -38,8 +42,10 @@ namespace Orchard.Localization.Services {
}
var culture = _cultureRepository.Get(cr => cr.Culture == cultureName);
- if (culture != null)
+ if (culture != null) {
_cultureRepository.Delete(culture);
+ _signals.Trigger("culturesChanged");
+ }
}
public string GetCurrentCulture(HttpContext requestContext) {
@@ -71,7 +77,7 @@ namespace Orchard.Localization.Services {
// "" or
// "-" or
// "--"
- private static bool IsValidCulture(string cultureName) {
+ public bool IsValidCulture(string cultureName) {
Regex cultureRegex = new Regex(@"\w{2}(-\w{2,})*");
if (cultureRegex.IsMatch(cultureName)) {
return true;
diff --git a/src/Orchard/Localization/Services/DefaultResourceManager.cs b/src/Orchard/Localization/Services/DefaultResourceManager.cs
index 3f0871041..a51be91e2 100644
--- a/src/Orchard/Localization/Services/DefaultResourceManager.cs
+++ b/src/Orchard/Localization/Services/DefaultResourceManager.cs
@@ -14,6 +14,7 @@ namespace Orchard.Localization.Services {
private readonly IExtensionManager _extensionManager;
private readonly ICacheManager _cacheManager;
private readonly ShellSettings _shellSettings;
+ private readonly ISignals _signals;
const string CoreLocalizationFilePathFormat = "/Core/App_Data/Localization/{0}/orchard.core.po";
const string ModulesLocalizationFilePathFormat = "/Modules/{0}/App_Data/Localization/{1}/orchard.module.po";
const string RootLocalizationFilePathFormat = "/App_Data/Localization/{0}/orchard.root.po";
@@ -24,12 +25,14 @@ namespace Orchard.Localization.Services {
IWebSiteFolder webSiteFolder,
IExtensionManager extensionManager,
ICacheManager cacheManager,
- ShellSettings shellSettings) {
+ ShellSettings shellSettings,
+ ISignals signals) {
_cultureManager = cultureManager;
_webSiteFolder = webSiteFolder;
_extensionManager = extensionManager;
_cacheManager = cacheManager;
_shellSettings = shellSettings;
+ _signals = signals;
}
// This will translate a string into a string in the target cultureName.
@@ -96,6 +99,7 @@ namespace Orchard.Localization.Services {
Translations = LoadTranslationsForCulture(culture, ctx)
});
}
+ ctx.Monitor(_signals.When("culturesChanged"));
return cultures;
});
diff --git a/src/Orchard/Localization/Services/ICultureManager.cs b/src/Orchard/Localization/Services/ICultureManager.cs
index 0ae822a42..e866e78c6 100644
--- a/src/Orchard/Localization/Services/ICultureManager.cs
+++ b/src/Orchard/Localization/Services/ICultureManager.cs
@@ -10,5 +10,6 @@ namespace Orchard.Localization.Services {
string GetCurrentCulture(HttpContext requestContext);
CultureRecord GetCultureById(int id);
string GetSiteCulture();
+ bool IsValidCulture(string cultureName);
}
}
diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj
index e9337076f..b94b67613 100644
--- a/src/Orchard/Orchard.Framework.csproj
+++ b/src/Orchard/Orchard.Framework.csproj
@@ -406,6 +406,7 @@
+