mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 20:13:52 +08:00
Added a little UI to set the default culture for the site (in /admin/settings)
--HG-- branch : dev
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Web.ApplicationServices" />
|
<Reference Include="System.Web.ApplicationServices" />
|
||||||
<Reference Include="System.Web.DynamicData" />
|
<Reference Include="System.Web.DynamicData" />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Orchard.Core.Settings.Models;
|
|||||||
using Orchard.Core.Settings.ViewModels;
|
using Orchard.Core.Settings.ViewModels;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Localization.Services;
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
@@ -10,10 +11,12 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
public class AdminController : Controller, IUpdateModel {
|
public class AdminController : Controller, IUpdateModel {
|
||||||
private readonly ISiteService _siteService;
|
private readonly ISiteService _siteService;
|
||||||
|
private readonly ICultureManager _cultureManager;
|
||||||
public IOrchardServices Services { get; private set; }
|
public IOrchardServices Services { get; private set; }
|
||||||
|
|
||||||
public AdminController(ISiteService siteService, IOrchardServices services) {
|
public AdminController(ISiteService siteService, IOrchardServices services, ICultureManager cultureManager) {
|
||||||
_siteService = siteService;
|
_siteService = siteService;
|
||||||
|
_cultureManager = cultureManager;
|
||||||
Services = services;
|
Services = services;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
@@ -25,7 +28,8 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
var model = new SettingsIndexViewModel {
|
var model = new SettingsIndexViewModel {
|
||||||
Site = _siteService.GetSiteSettings().As<SiteSettings>()
|
Site = _siteService.GetSiteSettings().As<SiteSettings>(),
|
||||||
|
AvailableCultures = _cultureManager.ListCultures()
|
||||||
};
|
};
|
||||||
model.ViewModel = Services.ContentManager.BuildEditorModel(model.Site);
|
model.ViewModel = Services.ContentManager.BuildEditorModel(model.Site);
|
||||||
return View(model);
|
return View(model);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Web.Mvc;
|
using System.Collections.Generic;
|
||||||
|
using System.Web.Mvc;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
using Orchard.Core.Settings.Models;
|
using Orchard.Core.Settings.Models;
|
||||||
@@ -6,6 +7,7 @@ using Orchard.Core.Settings.Models;
|
|||||||
namespace Orchard.Core.Settings.ViewModels {
|
namespace Orchard.Core.Settings.ViewModels {
|
||||||
public class SettingsIndexViewModel : BaseViewModel {
|
public class SettingsIndexViewModel : BaseViewModel {
|
||||||
public SiteSettings Site { get; set; }
|
public SiteSettings Site { get; set; }
|
||||||
|
public IEnumerable<string> AvailableCultures { get; set; }
|
||||||
public ContentItemViewModel ViewModel { get; set; }
|
public ContentItemViewModel ViewModel { get; set; }
|
||||||
|
|
||||||
|
|
||||||
@@ -20,12 +22,16 @@ namespace Orchard.Core.Settings.ViewModels {
|
|||||||
set { Site.As<SiteSettings>().Record.PageTitleSeparator = value; }
|
set { Site.As<SiteSettings>().Record.PageTitleSeparator = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SiteName
|
public string SiteName {
|
||||||
{
|
|
||||||
get { return Site.As<SiteSettings>().Record.SiteName; }
|
get { return Site.As<SiteSettings>().Record.SiteName; }
|
||||||
set { Site.As<SiteSettings>().Record.SiteName = value; }
|
set { Site.As<SiteSettings>().Record.SiteName = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string SiteCulture {
|
||||||
|
get { return Site.As<SiteSettings>().Record.SiteCulture; }
|
||||||
|
set { Site.As<SiteSettings>().Record.SiteCulture = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public string SuperUser {
|
public string SuperUser {
|
||||||
get { return Site.As<SiteSettings>().Record.SuperUser; }
|
get { return Site.As<SiteSettings>().Record.SuperUser; }
|
||||||
set { Site.As<SiteSettings>().Record.SuperUser = value; }
|
set { Site.As<SiteSettings>().Record.SuperUser = value; }
|
||||||
|
|||||||
@@ -2,21 +2,26 @@
|
|||||||
<%@ Import Namespace="Orchard.Core.Settings.ViewModels"%>
|
<%@ Import Namespace="Orchard.Core.Settings.ViewModels"%>
|
||||||
<h1><%=Html.TitleForPage(T("Manage Settings").ToString())%></h1>
|
<h1><%=Html.TitleForPage(T("Manage Settings").ToString())%></h1>
|
||||||
<%using (Html.BeginFormAntiForgeryPost()) { %>
|
<%using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
<%= Html.ValidationSummary() %>
|
<%=Html.ValidationSummary() %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><%=_Encoded("Global Settings")%></legend>
|
<legend><%:T("Global Settings")%></legend>
|
||||||
<div>
|
<div>
|
||||||
<label for="SiteName"><%=_Encoded("Site name") %></label>
|
<label for="SiteName"><%:T("Site name")%></label>
|
||||||
<%=Html.EditorFor(m => m.SiteName)%>
|
<%=Html.EditorFor(m => m.SiteName)%>
|
||||||
<%=Html.ValidationMessage("SiteName", "*") %>
|
<%=Html.ValidationMessage("SiteName", "*") %>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="PageTitleSeparator"><%=_Encoded("Page title separator") %></label>
|
<label for="SiteCulture"><%:T("Default Site Culture") %></label>
|
||||||
|
<%=Html.DropDownList("SiteCulture", new SelectList(Model.AvailableCultures, Model.SiteCulture)) %>
|
||||||
|
<%=Html.ValidationMessage("SiteCulture", "*") %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="PageTitleSeparator"><%:T("Page title separator")%></label>
|
||||||
<%=Html.EditorFor(x => x.PageTitleSeparator)%>
|
<%=Html.EditorFor(x => x.PageTitleSeparator)%>
|
||||||
<%=Html.ValidationMessage("PageTitleSeparator", "*")%>
|
<%=Html.ValidationMessage("PageTitleSeparator", "*")%>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="SuperUser"><%=_Encoded("Super user") %></label>
|
<label for="SuperUser"><%:T("Super user")%></label>
|
||||||
<%=Html.EditorFor(x=>x.SuperUser) %>
|
<%=Html.EditorFor(x=>x.SuperUser) %>
|
||||||
<%=Html.ValidationMessage("SuperUser", "*") %>
|
<%=Html.ValidationMessage("SuperUser", "*") %>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,6 +29,6 @@
|
|||||||
<%= Html.EditorForItem(Model.ViewModel) %>
|
<%= Html.EditorForItem(Model.ViewModel) %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<%=Html.EditorFor(s => s.Id) %>
|
<%=Html.EditorFor(s => s.Id) %>
|
||||||
<input class="button primaryAction" type="submit" value="<%=_Encoded("Save") %>" />
|
<input class="button primaryAction" type="submit" value="<%:T("Save") %>" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Web.Mvc;
|
||||||
using System.Web.Mvc;
|
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Search.Services;
|
using Orchard.Search.Services;
|
||||||
using Orchard.Search.ViewModels;
|
using Orchard.Search.ViewModels;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System.Web.Mvc;
|
||||||
using System.Linq;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Search.Services;
|
using Orchard.Search.Services;
|
||||||
using Orchard.Search.ViewModels;
|
using Orchard.Search.ViewModels;
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Orchard.Indexing;
|
|
||||||
|
|
||||||
namespace Orchard.Search.Models {
|
|
||||||
public interface ISearchResult {
|
|
||||||
IEnumerable<ISearchHit> Page { get; set; }
|
|
||||||
int TotalCount { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Orchard.Indexing;
|
|
||||||
|
|
||||||
namespace Orchard.Search.Models {
|
|
||||||
public class SearchResult : ISearchResult {
|
|
||||||
public IEnumerable<ISearchHit> Page { get; set; }
|
|
||||||
public int TotalCount { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -71,9 +71,7 @@
|
|||||||
<Compile Include="Filters\SearchFilter.cs" />
|
<Compile Include="Filters\SearchFilter.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
<Compile Include="Permissions.cs" />
|
||||||
<Compile Include="Routes.cs" />
|
<Compile Include="Routes.cs" />
|
||||||
<Compile Include="Models\ISearchResult.cs" />
|
|
||||||
<Compile Include="Services\ISearchService.cs" />
|
<Compile Include="Services\ISearchService.cs" />
|
||||||
<Compile Include="Models\SearchResult.cs" />
|
|
||||||
<Compile Include="Services\SearchService.cs" />
|
<Compile Include="Services\SearchService.cs" />
|
||||||
<Compile Include="ViewModels\SearchIndexViewModel.cs" />
|
<Compile Include="ViewModels\SearchIndexViewModel.cs" />
|
||||||
<Compile Include="ViewModels\SearchResultViewModel.cs" />
|
<Compile Include="ViewModels\SearchResultViewModel.cs" />
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.Linq;
|
|||||||
using Orchard.Collections;
|
using Orchard.Collections;
|
||||||
using Orchard.Indexing;
|
using Orchard.Indexing;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Search.Models;
|
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.Search.Services
|
namespace Orchard.Search.Services
|
||||||
|
|||||||
Reference in New Issue
Block a user