diff --git a/src/Orchard.Tests/DataMigration/Utilities/NullInterpreter.cs b/src/Orchard.Tests/DataMigration/Utilities/NullInterpreter.cs index a89772b80..025970a55 100644 --- a/src/Orchard.Tests/DataMigration/Utilities/NullInterpreter.cs +++ b/src/Orchard.Tests/DataMigration/Utilities/NullInterpreter.cs @@ -24,5 +24,10 @@ namespace Orchard.Tests.DataMigration.Utilities { public void Visit(DropForeignKeyCommand command) { } + + public string PrefixTableName(string tableName) { + return tableName; + } + } } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js b/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js index 347854cd5..08dc685de 100644 --- a/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js +++ b/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js @@ -42,7 +42,7 @@ // display a message on leave if changes have been made window.onbeforeunload = function (e) { - return leaveConfirmation; + return $("
").html(leaveConfirmation).text(); }; // cancel leaving message on save diff --git a/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml b/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml index bb81da637..2e36751c2 100644 --- a/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml @@ -22,7 +22,7 @@ @if (hasPermission) { @@ -134,12 +134,12 @@ @using (Script.Foot()) { } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml index c505a208b..cb568e8ff 100644 --- a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml +++ b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml @@ -6,7 +6,7 @@ @Html.LabelFor(m => m.CurrentMenuId, T("For Menu")) @T("Select which menu you want to display") diff --git a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.Navigation.Menu.Edit.cshtml b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.Navigation.Menu.Edit.cshtml index c81dd1ede..a51394ccc 100644 --- a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.Navigation.Menu.Edit.cshtml +++ b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.Navigation.Menu.Edit.cshtml @@ -11,7 +11,7 @@
@T("Select which menu you want the content item to be displayed on.") diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.Navigation.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.Navigation.Edit.cshtml index 8234426e4..972007790 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.Navigation.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/EditorTemplates/Parts.Navigation.Edit.cshtml @@ -29,7 +29,7 @@
@T("Select which menu you want the content item to be added on.") diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/EmailField.Design.cshtml b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/EmailField.Design.cshtml index b0bae7455..f16f885b1 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/EmailField.Design.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/EmailField.Design.cshtml @@ -5,7 +5,7 @@ var tagBuilder = TagBuilderExtensions.CreateElementTagBuilder(Model, "input"); tagBuilder.AddCssClass("text design"); - tagBuilder.Attributes["type"] = "email"; + tagBuilder.Attributes["type"] = "text"; tagBuilder.Attributes["value"] = element.Value; tagBuilder.Attributes["name"] = element.Name; } diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Drivers/ProjectionElementDriver.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Drivers/ProjectionElementDriver.cs index ea0939206..f81f5d971 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Drivers/ProjectionElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Drivers/ProjectionElementDriver.cs @@ -103,6 +103,9 @@ namespace Orchard.Layouts.Drivers { // Execute the query. var contentItems = _projectionManager.GetContentItems(query.Id, pager.GetStartIndex() + element.Skip, pager.PageSize).ToList(); + context.ElementShape.ContentItems = contentItems; + context.ElementShape.BuildShapes = (Func>) (displayType => contentItems.Select(x => _contentManager.BuildDisplay(x, displayType))); + // TODO: Figure out if we need this for a Projection Element, and if so, how. //// Sanity check so that content items with ProjectionPart can't be added here, or it will result in an infinite loop. //contentItems = contentItems.Where(x => !x.Has()).ToList(); diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Handlers/LayoutPartHandler.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Handlers/LayoutPartHandler.cs index 565a92e93..04648fb23 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Handlers/LayoutPartHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Handlers/LayoutPartHandler.cs @@ -1,5 +1,4 @@ -using Orchard.Caching; -using Orchard.ContentManagement; +using Orchard.ContentManagement; using Orchard.ContentManagement.Handlers; using Orchard.Data; using Orchard.DisplayManagement; diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj b/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj index d6b539d9d..d697e97da 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj @@ -24,6 +24,7 @@ + true @@ -669,6 +670,9 @@ + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Services/CurrentControllerAccessor.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Services/CurrentControllerAccessor.cs index 9ae1abeaa..546a3f8df 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Services/CurrentControllerAccessor.cs +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Services/CurrentControllerAccessor.cs @@ -1,16 +1,17 @@ +using System.Web; using System.Web.Mvc; using Orchard.Layouts.Filters; -using Orchard.Mvc; namespace Orchard.Layouts.Services { public class CurrentControllerAccessor : ICurrentControllerAccessor { - private readonly IHttpContextAccessor _httpContextAccessor; - public CurrentControllerAccessor(IHttpContextAccessor httpContextAccessor) { - _httpContextAccessor = httpContextAccessor; + private readonly HttpContextBase _httpContext; + + public CurrentControllerAccessor(HttpContextBase httpContext) { + _httpContext = httpContext; } public Controller CurrentController { - get { return (Controller) _httpContextAccessor.Current().Items[ControllerAccessorFilter.CurrentControllerKey]; } + get { return (Controller) _httpContext.Items[ControllerAccessorFilter.CurrentControllerKey]; } } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Views/Elements/Projection.Design.cshtml b/src/Orchard.Web/Modules/Orchard.Layouts/Views/Elements/Projection.Design.cshtml new file mode 100644 index 000000000..7919b2d76 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Views/Elements/Projection.Design.cshtml @@ -0,0 +1,11 @@ +@{ + var contentShapes = ((Func>)Model.BuildShapes)("Summary").ToList(); + var list = New.List(); + list.AddRange(contentShapes); +} +@if (contentShapes.Any()) { + @Display(list) +} +else { +

@T("The query returned no results.")

+} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.js b/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.js index ad88615d8..7fd4e0ae9 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.js +++ b/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.js @@ -43,7 +43,7 @@ var force = actionLink.data("feature-force"); var dependants = actionLink.data("feature-dependants"); - if (!dependants || /^\s*$/.test(dependants) || confirm(confirmDisableMessage + "\n\n" + dependants)) { + if (!dependants || /^\s*$/.test(dependants) || confirm($("
").html(confirmDisableMessage + "\n\n" + dependants).text())) { $("[name='submit.BulkExecute']").val("yes"); $("[name='featureIds']").val(featureId); diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.min.js b/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.min.js index dc6081236..1b85a1176 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.min.js +++ b/src/Orchard.Web/Modules/Orchard.Modules/Scripts/features.admin.min.js @@ -1,4 +1 @@ -$(function(){var n=function(){var n=$(".bulk-actions-wrapper").addClass("visible"),t=$(".switch-for-switchable");t.prepend(n);$("#search-box").focus().keyup(function(){var n=$(this).val(),t;if(n==""){$("li.category").show();$("li.feature:hidden").show();return}$("li.feature").each(function(){var t=$(this),i=t.find("h3:first").text();i.toLowerCase().indexOf(n.toLowerCase())>=0?t.show():t.hide()});$("li.category:hidden").show();t=$("li.category:not(:has(li.feature:visible))").hide()})},t=function(){$("li.feature h3").on("change","input[type='checkbox']",function(){var n=$(this).is(":checked"),t=$(this).parents("li.feature:first");t.toggleClass("selected",n)})},i=function(){$("li.feature .actions").on("click","a[data-feature-action]",function(n){var t=$(this),r=t.data("feature-id"),u=t.data("feature-action"),f=t.data("feature-force"),i=t.data("feature-dependants");(!i||/^\s*$/.test(i)||confirm(confirmDisableMessage+"\n\n"+i))&&($("[name='submit.BulkExecute']").val("yes"),$("[name='featureIds']").val(r),$("[name='bulkAction']").val(u),$("[name='force']").val(f),t.parents("form:first").submit());n.preventDefault()})};n();t();i()}); -/* -//# sourceMappingURL=features.admin.min.js.map -*/ \ No newline at end of file +$(function(){var n=function(){var n=$(".bulk-actions-wrapper").addClass("visible"),t=$(".switch-for-switchable");t.prepend(n);$("#search-box").keyup(function(){var n=$(this).val(),t;if(n==""){$("li.category").show();$("li.feature:hidden").show();return}$("li.feature").each(function(){var t=$(this),i=t.find("h3:first").text();i.toLowerCase().indexOf(n.toLowerCase())>=0?t.show():t.hide()});$("li.category:hidden").show();t=$("li.category:not(:has(li.feature:visible))").hide()})},t=function(){$("li.feature h3").on("change","input[type='checkbox']",function(){var n=$(this).is(":checked"),t=$(this).parents("li.feature:first");t.toggleClass("selected",n)})},i=function(){$("li.feature .actions").on("click","a[data-feature-action]",function(n){var t=$(this),r=t.data("feature-id"),u=t.data("feature-action"),f=t.data("feature-force"),i=t.data("feature-dependants");(!i||/^\s*$/.test(i)||confirm($("
").html(confirmDisableMessage+"\n\n"+i).text()))&&($("[name='submit.BulkExecute']").val("yes"),$("[name='featureIds']").val(r),$("[name='bulkAction']").val(u),$("[name='force']").val(f),t.parents("form:first").submit());n.preventDefault()})};n();t();i()}); \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml b/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml index 36295b52f..ec6da75a3 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml @@ -16,29 +16,29 @@ @if (Model.Features.Any()) { using (Html.BeginFormAntiForgeryPost()) { - @Html.Hidden("submit.BulkExecute") - @Html.Hidden("force", true) - @Html.Hidden("featureIds") -
-
- - -
-
- - - -
-
+ @Html.Hidden("submit.BulkExecute") + @Html.Hidden("force", true) + @Html.Hidden("featureIds") +
+
+ + +
+
+ + + +
+
-
    - @{ +
      + @{ var featureGroups = Model.Features.OrderBy(f => f.Descriptor.Category, new DoghouseComparer("Core")).GroupBy(f => f.Descriptor.Category).ToList(); foreach (var featureGroup in featureGroups) { if (!featureGroup.Any(x => Model.IsAllowed(x.Descriptor.Extension))) { @@ -98,8 +98,7 @@ @featureName - } - else { + } else { @featureName } @@ -138,14 +137,14 @@ }
    } - } -
} + } + } using (Script.Foot()) { } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index 5aaa07ad4..bf5580e8f 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -215,30 +215,39 @@ namespace Orchard.OutputCache.Filters { response.Filter = captureStream; captureStream.Captured += (output) => { try { - var cacheItem = new CacheItem() { - CachedOnUtc = _now, - Duration = cacheDuration, - GraceTime = cacheGraceTime, - Output = output, - ContentType = response.ContentType, - QueryString = filterContext.HttpContext.Request.Url.Query, - CacheKey = _cacheKey, - InvariantCacheKey = _invariantCacheKey, - Url = filterContext.HttpContext.Request.Url.AbsolutePath, - Tenant = _shellSettings.Name, - StatusCode = response.StatusCode, - Tags = new[] { _invariantCacheKey }.Union(contentItemIds).ToArray() - }; + // Since this is a callback any call to injected dependencies can result in an Autofac exception: "Instances + // cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed." + // To prevent access to the original lifetime scope a new work context scope should be created here and dependencies + // should be resolved from it. - // Write the rendered item to the cache. - _cacheStorageProvider.Remove(_cacheKey); - _cacheStorageProvider.Set(_cacheKey, cacheItem); + using (var scope = _workContextAccessor.CreateWorkContextScope()) { + var cacheItem = new CacheItem() { + CachedOnUtc = _now, + Duration = cacheDuration, + GraceTime = cacheGraceTime, + Output = output, + ContentType = response.ContentType, + QueryString = filterContext.HttpContext.Request.Url.Query, + CacheKey = _cacheKey, + InvariantCacheKey = _invariantCacheKey, + Url = filterContext.HttpContext.Request.Url.AbsolutePath, + Tenant = scope.Resolve().Name, + StatusCode = response.StatusCode, + Tags = new[] { _invariantCacheKey }.Union(contentItemIds).ToArray() + }; - Logger.Debug("Item '{0}' was written to cache.", _cacheKey); + // Write the rendered item to the cache. + var cacheStorageProvider = scope.Resolve(); + cacheStorageProvider.Remove(_cacheKey); + cacheStorageProvider.Set(_cacheKey, cacheItem); - // Also add the item tags to the tag cache. - foreach (var tag in cacheItem.Tags) { - _tagCache.Tag(tag, _cacheKey); + Logger.Debug("Item '{0}' was written to cache.", _cacheKey); + + // Also add the item tags to the tag cache. + var tagCache = scope.Resolve(); + foreach (var tag in cacheItem.Tags) { + tagCache.Tag(tag, _cacheKey); + } } } finally { @@ -449,6 +458,9 @@ namespace Orchard.OutputCache.Filters { private void ServeCachedItem(ActionExecutingContext filterContext, CacheItem cacheItem) { var response = filterContext.HttpContext.Response; + // Fix for missing charset in response headers + response.Charset = response.Charset; + // Adds some caching information to the output if requested. if (CacheSettings.DebugMode) { response.AddHeader("X-Cached-On", cacheItem.CachedOnUtc.ToString("r")); diff --git a/src/Orchard.Web/Modules/Orchard.Roles/Styles/Web.config b/src/Orchard.Web/Modules/Orchard.Roles/Styles/Web.config index 6e8ebec36..817198995 100644 --- a/src/Orchard.Web/Modules/Orchard.Roles/Styles/Web.config +++ b/src/Orchard.Web/Modules/Orchard.Roles/Styles/Web.config @@ -1,14 +1,5 @@ - - - - - - - - - diff --git a/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs b/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs index e7e029c19..0acb1c2ed 100644 --- a/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs +++ b/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs @@ -59,10 +59,11 @@ namespace Orchard.Search.Controllers { var viewModel = new MediaManagerMediaItemsViewModel { MediaItems = mediaItems, - MediaItemsCount = mediaPartsCount + MediaItemsCount = mediaPartsCount, + FolderPath = folderPath }; return View(viewModel); } } -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.Search/Views/Media/MediaItems.cshtml b/src/Orchard.Web/Modules/Orchard.Search/Views/Media/MediaItems.cshtml index 5263d9707..3dad0b9ef 100644 --- a/src/Orchard.Web/Modules/Orchard.Search/Views/Media/MediaItems.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Search/Views/Media/MediaItems.cshtml @@ -17,8 +17,9 @@ mimeTypeClass = x.MediaPart.MimeType.HtmlClassify(), thumbnail = Display(x.Shape).ToString(), editLink = Url.ItemEditUrl(x.MediaPart) - }).ToArray() + }).ToArray(), + folderPath = Model.FolderPath })) } - \ No newline at end of file + diff --git a/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Drivers/SslSettingsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Drivers/SslSettingsPartDriver.cs index fa259a1cf..89dd0cd63 100644 --- a/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Drivers/SslSettingsPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Drivers/SslSettingsPartDriver.cs @@ -36,25 +36,8 @@ namespace Orchard.SecureSocketsLayer.Drivers { } protected override void Importing(SslSettingsPart part, ImportContentContext context) { - var elementName = part.PartDefinition.Name; - part.Enabled = bool.Parse(context.Attribute(elementName, "Enabled") ?? "false"); - part.SecureEverything = bool.Parse(context.Attribute(elementName, "SecureEverything") ?? "true"); - part.CustomEnabled = bool.Parse(context.Attribute(elementName, "CustomEnabled") ?? "false"); - part.Urls = context.Attribute(elementName, "Urls") ?? ""; - part.InsecureHostName = context.Attribute(elementName, "InsecureHostName") ?? ""; - part.SecureHostName = context.Attribute(elementName, "SecureHostName") ?? ""; - + base.Importing(part, context); _signals.Trigger(SslSettingsPart.CacheKey); } - - protected override void Exporting(SslSettingsPart part, ExportContentContext context) { - var el = context.Element(part.PartDefinition.Name); - el.SetAttributeValue("Enabled", part.Enabled); - el.SetAttributeValue("SecureEverything", part.SecureEverything); - el.SetAttributeValue("CustomEnabled", part.CustomEnabled); - el.SetAttributeValue("Urls", part.Urls); - el.SetAttributeValue("InsecureHostName", part.InsecureHostName); - el.SetAttributeValue("SecureHostName", part.SecureHostName); - } } -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs b/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs index f36230eb2..bf0688b20 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs @@ -61,11 +61,11 @@ namespace Orchard.Setup { builder.RegisterType().As().InstancePerLifetimeScope(); builder.RegisterType().As().InstancePerLifetimeScope(); builder.RegisterType().As().InstancePerLifetimeScope(); - //builder.RegisterType().As().InstancePerMatchingLifetimeScope("shell"); builder.RegisterType().As().InstancePerLifetimeScope(); builder.RegisterType().As().InstancePerLifetimeScope(); builder.RegisterType().As().InstancePerMatchingLifetimeScope("shell"); builder.RegisterType().As().SingleInstance(); + builder.RegisterType().As().InstancePerLifetimeScope(); // setup mode specific implementations of needed service interfaces builder.RegisterType().As().InstancePerLifetimeScope(); @@ -100,6 +100,12 @@ namespace Orchard.Setup { } + internal class SetupBackgroundService : IBackgroundService { + public void Sweep() { + // Don't run any background service in setup mode. + } + } + class SafeModeText : IText { public LocalizedString Get(string textHint, params object[] args) { if (args == null || args.Length == 0) { diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs index 1cd5a6d19..ab64d3179 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs @@ -22,7 +22,7 @@ namespace Orchard.Taxonomies.Drivers { public IOrchardServices Services { get; set; } public TaxonomyFieldDriver( - IOrchardServices services, + IOrchardServices services, ITaxonomyService taxonomyService, IRepository repository) { _taxonomyService = taxonomyService; @@ -81,8 +81,10 @@ namespace Orchard.Taxonomies.Drivers { } protected override DriverResult Editor(ContentPart part, TaxonomyField field, IUpdateModel updater, dynamic shapeHelper) { - var viewModel = new TaxonomyFieldViewModel { Terms = new List() }; - + // Initializing viewmodel using the terms that are already selected to prevent loosing them when updating an editor group this field isn't displayed in. + var viewModel = new TaxonomyFieldViewModel { Terms = field.Terms.Select(t => t.CreateTermEntry()).ToList() }; + foreach (var item in viewModel.Terms) item.IsChecked = true; + if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) { var checkedTerms = viewModel.Terms .Where(t => (t.IsChecked || t.Id == viewModel.SingleTermId)) @@ -128,9 +130,9 @@ namespace Orchard.Taxonomies.Drivers { private TermPart GetOrCreateTerm(TermEntry entry, int taxonomyId, TaxonomyField field) { var term = default(TermPart); - if (entry.Id > 0) - term = _taxonomyService.GetTerm(entry.Id); - + if (entry.Id > 0) + term = _taxonomyService.GetTerm(entry.Id); + //Prevents creation of existing term if (term == null && !string.IsNullOrEmpty(entry.Name)) term = _taxonomyService.GetTermByName(taxonomyId, entry.Name.Trim()); diff --git a/src/Orchard.Web/Modules/Orchard.Workflows/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Workflows/Controllers/AdminController.cs index 20e55e9ca..12c8bb6f8 100644 --- a/src/Orchard.Web/Modules/Orchard.Workflows/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Workflows/Controllers/AdminController.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; +using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Web; using System.Web.Mvc; @@ -223,6 +224,15 @@ namespace Orchard.Workflows.Controllers { } } + public JsonResult State(int? id) { + if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to edit workflows"))) + throw new AuthenticationException(""); + + var workflowDefinitionRecord = id.HasValue ? _workflowDefinitionRecords.Get(id.Value) : null; + var isRunning = workflowDefinitionRecord != null && workflowDefinitionRecord.WorkflowRecords.Any(); + return Json(new { isRunning = isRunning }, JsonRequestBehavior.AllowGet); + } + public ActionResult Edit(int id, string localId, int? workflowId) { if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to edit workflows"))) return new HttpUnauthorizedResult(); @@ -329,6 +339,7 @@ namespace Orchard.Workflows.Controllers { var activitiesIndex = new Dictionary(); workflowDefinitionRecord.ActivityRecords.Clear(); + workflowDefinitionRecord.WorkflowRecords.Clear(); foreach (var activity in state.Activities) { ActivityRecord activityRecord; diff --git a/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/Edit.cshtml index fdaf466b8..c1acd41b5 100644 --- a/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/Edit.cshtml @@ -42,6 +42,7 @@ // @@ -82,6 +84,16 @@ var workflow = loadWorkflow(localId); var data = JSON.stringify(workflow); $("[name='data']").val(data); + + $.ajax({ + url: stateUrl + "/" + $("#id").val(), + async: false, + success: function(state) { + if(state.isRunning && !confirm($("#confirm-delete-instances").val())) { + e.preventDefault(); + } + } + }); }); //]]> @@ -100,4 +112,4 @@ @using (Capture(Layout.Messages)) { -} \ No newline at end of file +} diff --git a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs index 72f634421..bb0da3d20 100644 --- a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs +++ b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs @@ -91,7 +91,7 @@ namespace Orchard.Data.Migration.Interpreters { RunPendingStatements(); } - private string PrefixTableName(string tableName) { + public string PrefixTableName(string tableName) { if (string.IsNullOrEmpty(_shellSettings.DataTablePrefix)) return tableName; return _shellSettings.DataTablePrefix + "_" + tableName; diff --git a/src/Orchard/Data/Migration/Interpreters/IDataMigrationInterpreter.cs b/src/Orchard/Data/Migration/Interpreters/IDataMigrationInterpreter.cs index a2225b12f..81ed48590 100644 --- a/src/Orchard/Data/Migration/Interpreters/IDataMigrationInterpreter.cs +++ b/src/Orchard/Data/Migration/Interpreters/IDataMigrationInterpreter.cs @@ -9,5 +9,6 @@ namespace Orchard.Data.Migration.Interpreters { void Visit(SqlStatementCommand command); void Visit(CreateForeignKeyCommand command); void Visit(DropForeignKeyCommand command); + string PrefixTableName(string tableName); } } diff --git a/src/Orchard/Data/Migration/Schema/SchemaBuilder.cs b/src/Orchard/Data/Migration/Schema/SchemaBuilder.cs index 66dc64287..de5291a61 100644 --- a/src/Orchard/Data/Migration/Schema/SchemaBuilder.cs +++ b/src/Orchard/Data/Migration/Schema/SchemaBuilder.cs @@ -28,6 +28,13 @@ namespace Orchard.Data.Migration.Schema { public Func FormatPrefix { get { return _formatPrefix; } } + + /// + /// Translate Table name into database table name - including prefixes + /// + public virtual string TableDbName(string srcTable) { + return _interpreter.PrefixTableName(String.Concat(FormatPrefix(FeaturePrefix), srcTable)); + } public SchemaBuilder CreateTable(string name, Action table) { var createTable = new CreateTableCommand(String.Concat(_formatPrefix(_featurePrefix), name)); diff --git a/src/Orchard/Mvc/Html/ContentItemExtensions.cs b/src/Orchard/Mvc/Html/ContentItemExtensions.cs index 4f30ea2a9..8524091c7 100644 --- a/src/Orchard/Mvc/Html/ContentItemExtensions.cs +++ b/src/Orchard/Mvc/Html/ContentItemExtensions.cs @@ -7,11 +7,20 @@ using Orchard.Utility.Extensions; namespace Orchard.Mvc.Html { public static class ContentItemExtensions { + public static MvcHtmlString ItemDisplayText(this HtmlHelper html, IContent content) { + return ItemDisplayText(html, content, true); + } + + public static MvcHtmlString ItemDisplayText(this HtmlHelper html, IContent content, bool encode) { var metadata = content.ContentItem.ContentManager.GetItemMetadata(content); if (metadata.DisplayText == null) return null; - return MvcHtmlString.Create(html.Encode(metadata.DisplayText)); + if (encode) { + return MvcHtmlString.Create(html.Encode(metadata.DisplayText)); + } else { + return MvcHtmlString.Create(metadata.DisplayText); + } } public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContent content) { diff --git a/src/Orchard/Mvc/IHttpContextAccessor.cs b/src/Orchard/Mvc/IHttpContextAccessor.cs index ba4f8fe5e..f34462581 100644 --- a/src/Orchard/Mvc/IHttpContextAccessor.cs +++ b/src/Orchard/Mvc/IHttpContextAccessor.cs @@ -1,5 +1,4 @@ -using System; -using System.Web; +using System.Web; using Autofac; namespace Orchard.Mvc { diff --git a/src/Orchard/Tasks/BackgroundService.cs b/src/Orchard/Tasks/BackgroundService.cs index fab64aa73..4fd64a38f 100644 --- a/src/Orchard/Tasks/BackgroundService.cs +++ b/src/Orchard/Tasks/BackgroundService.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Orchard.Data; using Orchard.Environment.Configuration; using Orchard.Logging; -using Orchard.ContentManagement; namespace Orchard.Tasks { @@ -18,7 +17,7 @@ namespace Orchard.Tasks { public BackgroundService( IEnumerable tasks, - ITransactionManager transactionManager, + ITransactionManager transactionManager, ShellSettings shellSettings) { _tasks = tasks;