diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs
index 8fb6fa627..ecac3f423 100644
--- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs
@@ -362,6 +362,32 @@ namespace Orchard.Core.Contents.Controllers {
});
}
+ ///
+ /// This action is specific to the submit button of the edit form.
+ /// Unpublish logic is the same of the Unpublish action, which is called by the content list.
+ ///
+ ///
+ ///
+ ///
+ [HttpPost, ActionName("Edit")]
+ [Mvc.FormValueRequired("submit.Unpublish")]
+ public ActionResult EditUnpublishPOST(int id, string returnUrl) {
+ return Unpublish(id, returnUrl);
+ }
+
+ ///
+ /// This action is specific to the submit button of the edit form.
+ /// Delete logic is the same of the Remove action, which is called by the content list.
+ ///
+ ///
+ ///
+ ///
+ [HttpPost, ActionName("Edit")]
+ [Mvc.FormValueRequired("submit.Delete")]
+ public ActionResult EditDeletePOST(int id, string returnUrl) {
+ return Remove(id, returnUrl);
+ }
+
private ActionResult EditPOST(int id, string returnUrl, Func conditionallyPublish) {
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
diff --git a/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs b/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs
index baa2845fd..6e85fecb0 100644
--- a/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs
+++ b/src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs
@@ -17,12 +17,17 @@ namespace Orchard.Core.Contents.Drivers {
}
protected override DriverResult Editor(ContentPart part, dynamic shapeHelper) {
- var results = new List();
+ var results = new List { ContentShape("Content_SaveButton", saveButton => saveButton) };
- if (part.TypeDefinition.Settings.GetModel().Draftable)
- results.Add(ContentShape("Content_SaveButton", saveButton => saveButton));
+ if (part.TypeDefinition.Settings.GetModel().Draftable) {
+ results.Add(ContentShape("Content_PublishButton", publishButton => publishButton));
+ results.Add(ContentShape("Content_UnpublishButton", unpublishButton => unpublishButton));
+ }
- results.Add(ContentShape("Content_PublishButton", publishButton => publishButton));
+ if (part.Id > 0) {
+ results.Add(ContentShape("Content_DeleteButton", deleteButton => deleteButton));
+ }
+
results.Add(ContentShape("Content_CancelButton", cancelButton => cancelButton));
return Combined(results.ToArray());
diff --git a/src/Orchard.Web/Core/Contents/Placement.info b/src/Orchard.Web/Core/Contents/Placement.info
index 30362f02a..29ac646ca 100644
--- a/src/Orchard.Web/Core/Contents/Placement.info
+++ b/src/Orchard.Web/Core/Contents/Placement.info
@@ -7,8 +7,10 @@
-->
-
-
+
+
+
+
diff --git a/src/Orchard.Web/Core/Contents/Views/Content.DeleteButton.cshtml b/src/Orchard.Web/Core/Contents/Views/Content.DeleteButton.cshtml
new file mode 100644
index 000000000..20f1a7871
--- /dev/null
+++ b/src/Orchard.Web/Core/Contents/Views/Content.DeleteButton.cshtml
@@ -0,0 +1,8 @@
+@using Orchard.ContentManagement;
+@using Orchard.Core.Contents;
+
+@if (Authorizer.Authorize(Permissions.DeleteContent, (IContent)Model.ContentItem)) {
+
+}
diff --git a/src/Orchard.Web/Core/Contents/Views/Content.UnpublishButton.cshtml b/src/Orchard.Web/Core/Contents/Views/Content.UnpublishButton.cshtml
new file mode 100644
index 000000000..13c885c6f
--- /dev/null
+++ b/src/Orchard.Web/Core/Contents/Views/Content.UnpublishButton.cshtml
@@ -0,0 +1,12 @@
+@using Orchard.ContentManagement;
+@using Orchard.Core.Contents;
+
+@{
+ var contentItem = Model.ContentItem as IContent;
+}
+
+@if (Authorizer.Authorize(Permissions.PublishContent, contentItem) && contentItem.IsPublished()) {
+
+}
diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj
index 918c2e714..c8933eaa5 100644
--- a/src/Orchard.Web/Core/Orchard.Core.csproj
+++ b/src/Orchard.Web/Core/Orchard.Core.csproj
@@ -629,12 +629,16 @@
+
+
+
+
+
+
Designer
-
-
10.0
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
index 0e8bdca1c..e04158fc6 100644
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
@@ -1,6 +1,5 @@
using System;
using System.Linq;
-using System.Reflection;
using System.Web.Mvc;
using Orchard.Blogs.Extensions;
using Orchard.Blogs.Models;
@@ -138,6 +137,12 @@ namespace Orchard.Blogs.Controllers {
});
}
+ [HttpPost, ActionName("Edit")]
+ [Mvc.FormValueRequired("submit.Delete")]
+ public ActionResult EditDeletePOST(int blogId, int postId, string returnUrl) {
+ return Delete(blogId, postId);
+ }
+
[HttpPost, ActionName("Edit")]
[FormValueRequired("submit.Publish")]
public ActionResult EditAndPublishPOST(int blogId, int postId, string returnUrl) {
@@ -156,6 +161,12 @@ namespace Orchard.Blogs.Controllers {
return EditPOST(blogId, postId, returnUrl, contentItem => Services.ContentManager.Publish(contentItem));
}
+ [HttpPost, ActionName("Edit")]
+ [Mvc.FormValueRequired("submit.Unpublish")]
+ public ActionResult EditUnpublishPOST(int blogId, int postId, string returnUrl) {
+ return Unpublish(blogId, postId);
+ }
+
public ActionResult EditPOST(int blogId, int postId, string returnUrl, Action conditionallyPublish) {
var blog = _blogService.Get(blogId, VersionOptions.Latest);
if (blog == null)
diff --git a/src/Orchard.Web/Modules/Orchard.Caching/Services/ICacheStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.Caching/Services/ICacheStorageProvider.cs
index 4be4dc974..200f001fc 100644
--- a/src/Orchard.Web/Modules/Orchard.Caching/Services/ICacheStorageProvider.cs
+++ b/src/Orchard.Web/Modules/Orchard.Caching/Services/ICacheStorageProvider.cs
@@ -8,4 +8,8 @@ namespace Orchard.Caching.Services {
void Remove(string key);
void Clear();
}
+
+ public interface ICacheStorageProviderWithKeyPrefix : ICacheStorageProvider {
+ void Clear(string key);
+ }
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs
index 3240df55d..2bbd1a903 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Drivers/EnumerationFieldDriver.cs
@@ -4,41 +4,46 @@ using Orchard.ContentManagement.Handlers;
using Orchard.Fields.Fields;
using Orchard.Fields.Settings;
using Orchard.Localization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
namespace Orchard.Fields.Drivers {
public class EnumerationFieldDriver : ContentFieldDriver {
public IOrchardServices Services { get; set; }
-
private const string TemplateName = "Fields/Enumeration.Edit";
public EnumerationFieldDriver(IOrchardServices services) {
Services = services;
-
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
- private static string GetPrefix(ContentField field, ContentPart part) =>
- part.PartDefinition.Name + "." + field.Name;
+ private static string GetPrefix(ContentField field, ContentPart part) {
+ return part.PartDefinition.Name + "." + field.Name;
+ }
- private static string GetDifferentiator(EnumerationField field) => field.Name;
+ private static string GetDifferentiator(EnumerationField field, ContentPart part) {
+ return field.Name;
+ }
protected override DriverResult Display(ContentPart part, EnumerationField field, string displayType, dynamic shapeHelper) {
- return ContentShape("Fields_Enumeration", GetDifferentiator(field), () => shapeHelper.Fields_Enumeration());
+ return ContentShape("Fields_Enumeration", GetDifferentiator(field, part),
+ () => shapeHelper.Fields_Enumeration());
}
protected override DriverResult Editor(ContentPart part, EnumerationField field, dynamic shapeHelper) {
- return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field), () => {
- if (part.IsNew() && string.IsNullOrEmpty(field.Value)) {
- var settings = field.PartFieldDefinition.Settings.GetModel();
- if (!string.IsNullOrWhiteSpace(settings.DefaultValue)) {
- field.SelectedValues = new string[] { settings.DefaultValue };
+ return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field, part),
+ () => {
+ if (part.IsNew() && String.IsNullOrEmpty(field.Value)) {
+ var settings = field.PartFieldDefinition.Settings.GetModel();
+ if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
+ field.Value = settings.DefaultValue;
+ }
}
- }
-
- return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
- });
+ return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
+ });
}
protected override DriverResult Editor(ContentPart part, EnumerationField field, IUpdateModel updater, dynamic shapeHelper) {
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Fields/EnumerationField.cs b/src/Orchard.Web/Modules/Orchard.Fields/Fields/EnumerationField.cs
index ee572b66b..a81d6829e 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Fields/EnumerationField.cs
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Fields/EnumerationField.cs
@@ -7,16 +7,28 @@ namespace Orchard.Fields.Fields {
private const char Separator = ';';
public string Value {
- get => Storage.Get()?.Trim(Separator) ?? "";
- set => Storage.Set(string.IsNullOrWhiteSpace(value)
- ? string.Empty
- // It is now the responsibility of this field to (re-)add the separators.
- : Separator + value.Trim(Separator) + Separator);
+ get { return Storage.Get(); }
+ set { Storage.Set(value ?? String.Empty); }
}
public string[] SelectedValues {
- get => Value?.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries) ?? new string[0];
- set => Value = value?.Length > 0 ? string.Join(Separator.ToString(), value) : "";
+ get {
+ var value = Value;
+ if(string.IsNullOrWhiteSpace(value)) {
+ return new string[0];
+ }
+
+ return value.Split(new [] { Separator }, StringSplitOptions.RemoveEmptyEntries);
+ }
+
+ set {
+ if (value == null || value.Length == 0) {
+ Value = String.Empty;
+ }
+ else {
+ Value = Separator + string.Join(Separator.ToString(), value) + Separator;
+ }
+ }
}
}
}
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj b/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj
index d4c296342..239ad497d 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj
@@ -169,7 +169,6 @@
-
@@ -220,4 +219,4 @@
-
+
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml
index 0f3d10036..bf63c5e00 100644
--- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Enumeration.Edit.cshtml
@@ -4,30 +4,48 @@
@{
var settings = Model.PartFieldDefinition.Settings.GetModel();
- string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ? settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None) : new string[] { T("Select an option").ToString() };
+ string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ?
+ settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None)
+ : new string[] { T("Select an option").ToString() };
}