mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 04:43:35 +08:00
More admin menu adjustments.
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
|
@@ -17,6 +17,8 @@ namespace Orchard.Comments.Handlers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site")
|
||||
return;
|
||||
base.GetItemMetadata(context);
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Comments")));
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Orchard.ContentManagement;
|
||||
using System;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Email.Models;
|
||||
using Orchard.Localization;
|
||||
@@ -19,12 +20,18 @@ namespace Orchard.Email.Drivers {
|
||||
|
||||
protected override string Prefix { get { return "SmtpSettings"; } }
|
||||
|
||||
protected override DriverResult Editor(SmtpSettingsPart part, dynamic shapeHelper) {
|
||||
protected override DriverResult Editor(SmtpSettingsPart part, string groupInfoId, dynamic shapeHelper) {
|
||||
if (!string.Equals(groupInfoId, "email", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return ContentShape("Parts_SmtpSettings_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(SmtpSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
protected override DriverResult Editor(SmtpSettingsPart part, IUpdateModel updater, string groupInfoId, dynamic shapeHelper) {
|
||||
if (!string.Equals(groupInfoId, "email", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
var previousPassword = part.Password;
|
||||
updater.TryUpdateModel(part, Prefix, null, null);
|
||||
|
||||
|
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Email.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.Email.Handlers {
|
||||
@@ -12,6 +14,7 @@ namespace Orchard.Email.Handlers {
|
||||
private readonly IEncryptionService _encryptionService;
|
||||
|
||||
public SmtpSettingsPartHandler(IRepository<SmtpSettingsPartRecord> repository, IEncryptionService encryptionService) {
|
||||
T = NullLocalizer.Instance;
|
||||
_encryptionService = encryptionService;
|
||||
Filters.Add(new ActivatingFilter<SmtpSettingsPart>("Site"));
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
@@ -23,5 +26,14 @@ namespace Orchard.Email.Handlers {
|
||||
part.PasswordField.Getter(() => String.IsNullOrWhiteSpace(part.Record.Password) ? String.Empty : Encoding.UTF8.GetString(_encryptionService.Decode(Convert.FromBase64String(part.Record.Password))));
|
||||
part.PasswordField.Setter(value => part.Record.Password = String.IsNullOrWhiteSpace(value) ? String.Empty : Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(value))));
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site")
|
||||
return;
|
||||
base.GetItemMetadata(context);
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Email")));
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,9 +8,8 @@ namespace Orchard.Indexing {
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.AddImageSet("search")
|
||||
.Add(T("Settings"),
|
||||
menu => menu.Add(T("Search"), "15", item => item.Action("Index", "Admin", new {area = "Orchard.Indexing"})
|
||||
builder.Add(T("Settings"),
|
||||
menu => menu.Add(T("Search Index"), "5", item => item.Action("Index", "Admin", new {area = "Orchard.Indexing"})
|
||||
.Permission(StandardPermissions.SiteOwner)));
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@ namespace Orchard.Media.Handlers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site")
|
||||
return;
|
||||
base.GetItemMetadata(context);
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Media")));
|
||||
}
|
||||
|
@@ -23,7 +23,10 @@ namespace Orchard.Search.Drivers {
|
||||
|
||||
protected override string Prefix { get { return "SearchSettings"; } }
|
||||
|
||||
protected override DriverResult Editor(SearchSettingsPart part, dynamic shapeHelper) {
|
||||
protected override DriverResult Editor(SearchSettingsPart part, string groupInfoId, dynamic shapeHelper) {
|
||||
if (!string.Equals(groupInfoId, "search", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
SearchSettingsViewModel model = new SearchSettingsViewModel();
|
||||
String [] searchedFields = part.SearchedFields;
|
||||
|
||||
@@ -38,7 +41,10 @@ namespace Orchard.Search.Drivers {
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Search.SiteSettings", Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(SearchSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
protected override DriverResult Editor(SearchSettingsPart part, IUpdateModel updater, string groupInfoId, dynamic shapeHelper) {
|
||||
if (!string.Equals(groupInfoId, "search", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
SearchSettingsViewModel model = new SearchSettingsViewModel();
|
||||
|
||||
if (updater.TryUpdateModel(model, Prefix, null, null)) {
|
||||
|
@@ -1,4 +1,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Search.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
@@ -7,8 +9,18 @@ namespace Orchard.Search.Handlers {
|
||||
[UsedImplicitly]
|
||||
public class SearchSettingsPartHandler : ContentHandler {
|
||||
public SearchSettingsPartHandler(IRepository<SearchSettingsPartRecord> repository) {
|
||||
T = NullLocalizer.Instance;
|
||||
Filters.Add(new ActivatingFilter<SearchSettingsPart>("Site"));
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site")
|
||||
return;
|
||||
base.GetItemMetadata(context);
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Search")));
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,6 +18,8 @@ namespace Orchard.Users.Handlers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site")
|
||||
return;
|
||||
base.GetItemMetadata(context);
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Users")));
|
||||
}
|
||||
|
@@ -110,8 +110,14 @@ namespace Orchard.UI.Navigation {
|
||||
var orderer = new FlatPositionComparer();
|
||||
|
||||
return sources.SelectMany(x => x).ToArray()
|
||||
// group same menus
|
||||
.GroupBy(key => key, (key, items) => Join(items), comparer)
|
||||
.OrderBy(item => item.Position, orderer);
|
||||
// group same position
|
||||
.GroupBy(item => item.Position)
|
||||
// order position groups by position
|
||||
.OrderBy(positionGroup => positionGroup.Key, orderer)
|
||||
// ordered by item text in the postion group
|
||||
.SelectMany(positionGroup => positionGroup.OrderBy(item => item.Text));
|
||||
}
|
||||
|
||||
static MenuItem Join(IEnumerable<MenuItem> items) {
|
||||
|
Reference in New Issue
Block a user