Merge branch 'dev' into issue/8773

This commit is contained in:
Benedek Farkas 2024-04-17 10:26:53 +02:00
commit 7b07ab9b3b
3 changed files with 33 additions and 24 deletions

View File

@ -1,26 +1,26 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
using System.Web.Routing;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Contents.Settings;
using Orchard.Core.Navigation.Models; using Orchard.Core.Navigation.Models;
using Orchard.Core.Navigation.Services; using Orchard.Core.Navigation.Services;
using Orchard.Core.Navigation.ViewModels; using Orchard.Core.Navigation.ViewModels;
using Orchard.Localization;
using Orchard.Mvc.Extensions;
using Orchard.UI;
using Orchard.UI.Notify;
using Orchard.UI.Navigation;
using Orchard.Utility;
using System;
using Orchard.ContentManagement.Handlers;
using Orchard.Logging;
using Orchard.Exceptions;
using Orchard.ContentManagement.Aspects;
using Orchard.Utility.Extensions;
using Orchard.Mvc.Html;
using Orchard.Core.Contents.Settings;
using Orchard.Data; using Orchard.Data;
using System.Web.Routing; using Orchard.Exceptions;
using Orchard.Localization;
using Orchard.Logging;
using Orchard.Mvc.Extensions;
using Orchard.Mvc.Html;
using Orchard.UI;
using Orchard.UI.Navigation;
using Orchard.UI.Notify;
using Orchard.Utility;
using Orchard.Utility.Extensions;
namespace Orchard.Core.Navigation.Controllers { namespace Orchard.Core.Navigation.Controllers {
[ValidateInput(false)] [ValidateInput(false)]
@ -249,13 +249,14 @@ namespace Orchard.Core.Navigation.Controllers {
} }
[HttpPost, ActionName("Edit")] [HttpPost, ActionName("Edit")]
[Mvc.FormValueRequired("submit.Save")] [Mvc.FormValueRequired("submit.Publish")]
public ActionResult EditPOST(int id, string returnUrl) { public ActionResult EditPOST(int id, string returnUrl) {
return EditPOST(id, returnUrl, contentItem => { return EditPOST(id, returnUrl, contentItem => {
if (!contentItem.Has<IPublishingControlAspect>() && !contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable) if (!contentItem.Has<IPublishingControlAspect>() && !contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
_contentManager.Publish(contentItem); _contentManager.Publish(contentItem);
}); });
} }
private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) { private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) {
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired); var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);

View File

@ -40,7 +40,8 @@
taxonomyFieldName: '@Model.FieldName', taxonomyFieldName: '@Model.FieldName',
contentId: @Model.Id, contentId: @Model.Id,
culture: culture, culture: culture,
selectedValues: selectedValues, selectedValues: selectedValues
},
success: function (html) { success: function (html) {
var container = $(".taxonomy-wrapper[data-id-prefix='@Taxonomyprefix']"); var container = $(".taxonomy-wrapper[data-id-prefix='@Taxonomyprefix']");
@ -210,4 +211,5 @@
//]]> //]]>
</script> </script>
} }
} }

View File

@ -42,7 +42,7 @@ namespace Orchard.Data {
return _shellSettings.DataTablePrefix + "_" + tableName; return _shellSettings.DataTablePrefix + "_" + tableName;
} }
// based on https://stackoverflow.com/a/39518098/2669614 // based on https://stackoverflow.com/a/39518098/2669614
public override SqlString OnPrepareStatement(SqlString sql) { public override SqlString OnPrepareStatement(SqlString sql) {
// only work on select queries // only work on select queries
@ -167,7 +167,7 @@ namespace Orchard.Data {
} }
} }
// rebuild query // rebuild query
for(int i = 0; i < affectedCaptures.Count; i++) { for (int i = 0; i < affectedCaptures.Count; i++) {
var inner = affectedCaptures[i]; var inner = affectedCaptures[i];
for (int j = i + 1; j < affectedCaptures.Count; j++) { for (int j = i + 1; j < affectedCaptures.Count; j++) {
var outer = affectedCaptures[j]; var outer = affectedCaptures[j];
@ -203,7 +203,7 @@ namespace Orchard.Data {
public bool IsAltered { get; set; } public bool IsAltered { get; set; }
public void AddNoLockHints() { public void AddNoLockHints() {
Value = AddNoLockHints(Value, TableNames); Value = AddNoLockHints(Value, TableNames);
} }
private string AddNoLockHints(string query, IEnumerable<string> tableNames) { private string AddNoLockHints(string query, IEnumerable<string> tableNames) {
@ -240,13 +240,19 @@ namespace Orchard.Data {
if (tableIndex == fromIndex + 1 if (tableIndex == fromIndex + 1
|| parts[tableIndex - 1].Equals(",")) { || parts[tableIndex - 1].Equals(",")) {
parts.Insert(tableIndex + 2, "WITH(NOLOCK)"); if (parts[tableIndex + 1].Equals("where", StringComparison.OrdinalIgnoreCase)) {
// There is no alias in the query, so we add "WITH(NOLOCK)" immediately after table name but before the "where" clause.
parts.Insert(tableIndex + 1, "WITH(NOLOCK)");
} else {
// We add "WITH(NOLOCK)" after the table alias.
parts.Insert(tableIndex + 2, "WITH(NOLOCK)");
}
} else { } else {
// probably doing a join, so edit the next "on" and make it // probably doing a join, so edit the next "on" and make it
// "WITH (NOLOCK) on" // "WITH (NOLOCK) on"
for (int i = tableIndex + 1; i < whereIndex; i++) { for (int i = tableIndex + 1; i < whereIndex; i++) {
if (parts[i].Trim().Equals("WITH(NOLOCK)", StringComparison.OrdinalIgnoreCase)) { if (parts[i].Trim().Equals("WITH(NOLOCK)", StringComparison.OrdinalIgnoreCase)) {
// we processed this table anme already // we processed this table name already.
break; break;
} }
if (parts[i].Trim().Equals("on", StringComparison.OrdinalIgnoreCase)) { if (parts[i].Trim().Equals("on", StringComparison.OrdinalIgnoreCase)) {