mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-23 21:32:14 +08:00
Fixing bug 16561.
--HG-- branch : dev
This commit is contained in:
@@ -32,16 +32,20 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MenuPart part, IUpdateModel updater) {
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(part.MenuPosition))
|
||||
if (string.IsNullOrEmpty(part.MenuPosition)) {
|
||||
part.MenuPosition = Position.GetNext(_navigationManager.BuildMenu("main"));
|
||||
}
|
||||
|
||||
updater.TryUpdateModel(part, Prefix, null, null);
|
||||
if (part.OnMainMenu && String.IsNullOrEmpty(part.MenuText)) {
|
||||
|
||||
if (part.OnMainMenu && string.IsNullOrEmpty(part.MenuText)) {
|
||||
updater.AddModelError("MenuText", T("The MenuText field is required"));
|
||||
}
|
||||
|
||||
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Web.Mvc;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Core.Navigation.Models {
|
||||
@@ -11,6 +12,7 @@ namespace Orchard.Core.Navigation.Models {
|
||||
set { Record.OnMainMenu = value; }
|
||||
}
|
||||
|
||||
[StringLength(MenuPartRecord.DefaultMenuTextLength)]
|
||||
public string MenuText {
|
||||
get { return Record.MenuText; }
|
||||
set { Record.MenuText = value; }
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using Orchard.ContentManagement.Records;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Core.Navigation.Models {
|
||||
public class MenuPartRecord : ContentPartRecord {
|
||||
public const ushort DefaultMenuTextLength = 255;
|
||||
|
||||
[StringLength(DefaultMenuTextLength)]
|
||||
public virtual string MenuText { get; set; }
|
||||
public virtual string MenuPosition { get; set; }
|
||||
public virtual bool OnMainMenu { get; set; }
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Orchard.Data.Migration.Generator {
|
||||
|
||||
var command = new CreateTableCommand(tableName);
|
||||
|
||||
foreach(var column in table.ColumnIterator) {
|
||||
foreach (var column in table.ColumnIterator) {
|
||||
var table1 = table;
|
||||
var column1 = column;
|
||||
var sqlType = column1.GetSqlTypeCode(mapping);
|
||||
@@ -109,8 +109,8 @@ namespace Orchard.Data.Migration.Generator {
|
||||
|
||||
|
||||
if ( column1.IsLengthDefined()
|
||||
&& new DbType[] { DbType.StringFixedLength, DbType.String, DbType.AnsiString, DbType.AnsiStringFixedLength }.Contains(sqlType.DbType)
|
||||
&& column1.Length != 255 ) {
|
||||
&& new DbType[] { DbType.StringFixedLength, DbType.String, DbType.AnsiString, DbType.AnsiStringFixedLength }.Contains(sqlType.DbType)
|
||||
&& column1.Length != Column.DefaultLength) {
|
||||
action.WithLength(column1.Length);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,11 @@ namespace Orchard.Data {
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
if (_scope != null) {
|
||||
if (!_cancelled){
|
||||
if (!_cancelled) {
|
||||
Logger.Debug("Marking transaction as complete");
|
||||
_scope.Complete();
|
||||
}
|
||||
|
||||
Logger.Debug("Final work for transaction being performed");
|
||||
_scope.Dispose();
|
||||
Logger.Debug("Transaction disposed");
|
||||
|
||||
Reference in New Issue
Block a user