More work towards wrapping up the initial content localization experience

- moved the Localization feature into the Content category
- cleaned up the UI a bit

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-14 11:34:19 -07:00
parent 1d20556a83
commit fa129682a9
7 changed files with 29 additions and 31 deletions

View File

@@ -1,12 +1,15 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common;
using Orchard.Core.Localization.Models;
using Orchard.Core.Localization.Services;
using Orchard.Core.Localization.ViewModels;
using Orchard.Localization.Services;
using Orchard.Settings;
namespace Orchard.Core.Localization.Drivers {
[UsedImplicitly]
@@ -20,15 +23,20 @@ namespace Orchard.Core.Localization.Drivers {
Services = services;
}
protected virtual ISite CurrentSite { get; private set; }
public IOrchardServices Services { get; set; }
protected override DriverResult Display(Localized part, string displayType) {
var model = new ContentLocalizationsViewModel(part) {
CanLocalize = Services.Authorizer.Authorize(Permissions.ChangeOwner) && _cultureManager.ListCultures()
.Where(s => s != _cultureManager.GetCurrentCulture(new HttpContextWrapper(HttpContext.Current)) && s != _localizationService.GetContentCulture(part.ContentItem))
.Count() > 0,
Localizations = _localizationService.GetLocalizations(part.ContentItem)
.Select(c => {
var localized = c.ContentItem.As<Localized>();
if (localized.Culture == null)
localized.Culture = _cultureManager.GetCultureByName(_cultureManager.GetCurrentCulture(new HttpContextWrapper(HttpContext.Current)));
return c;
}).ToList()
};
return ContentPartTemplate(model, "Parts/Localization.ContentTranslations").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("primary", "5");
}