Merge branch '1.8.x' into 1.x

This commit is contained in:
Sebastien Ros
2014-05-02 10:41:32 -07:00
5 changed files with 18 additions and 10 deletions

View File

@@ -249,14 +249,15 @@ namespace Orchard.Core.Contents.Controllers {
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Couldn't create content"))) if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Couldn't create content")))
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
_contentManager.Create(contentItem, VersionOptions.Draft);
var model = _contentManager.UpdateEditor(contentItem, this); var model = _contentManager.UpdateEditor(contentItem, this);
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
_transactionManager.Cancel(); _transactionManager.Cancel();
return View(model); return View(model);
} }
_contentManager.Create(contentItem, VersionOptions.Draft);
conditionallyPublish(contentItem); conditionallyPublish(contentItem);
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName) Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)

View File

@@ -27,11 +27,8 @@ namespace Orchard.Comments.Controllers {
return this.RedirectLocal(returnUrl, "~/"); return this.RedirectLocal(returnUrl, "~/");
var comment = Services.ContentManager.New<CommentPart>("Comment"); var comment = Services.ContentManager.New<CommentPart>("Comment");
Services.ContentManager.Create(comment, VersionOptions.Draft);
var editorShape = Services.ContentManager.UpdateEditor(comment, this); var editorShape = Services.ContentManager.UpdateEditor(comment, this);
if (!ModelState.IsValidField("Comments.Author")) { if (!ModelState.IsValidField("Comments.Author")) {
Services.Notifier.Error(T("Name is mandatory and must have less than 255 chars")); Services.Notifier.Error(T("Name is mandatory and must have less than 255 chars"));
} }

View File

@@ -11,7 +11,7 @@
@if (HasText(mediaUrl)) { @if (HasText(mediaUrl)) {
<div class="file-name"> <div class="file-name">
<em>@T("Filename:")</em> <em>@T("Filename:")</em>
<span><a href="@mediaUrl">@Path.GetFileName(mediaUrl)</a></span> <span><a href="@mediaUrl">@HttpUtility.UrlDecode(Path.GetFileName(mediaUrl))</a></span>
</div> </div>
} }
<div class="mime-type"> <div class="mime-type">

View File

@@ -58,8 +58,10 @@ namespace Orchard.MediaProcessing.Services {
public string GetImageProfileUrl(string path, string profileName, FilterRecord customFilter, ContentItem contentItem) { public string GetImageProfileUrl(string path, string profileName, FilterRecord customFilter, ContentItem contentItem) {
// path is the publicUrl of the media, so it might contain url-encoded chars
// try to load the processed filename from cache // try to load the processed filename from cache
var filePath = _fileNameProvider.GetFileName(profileName, path); var filePath = _fileNameProvider.GetFileName(profileName, System.Web.HttpUtility.UrlDecode(path));
bool process = false; bool process = false;
// if the filename is not cached, process it // if the filename is not cached, process it

View File

@@ -33,9 +33,17 @@ namespace Orchard.Workflows.Handlers {
() => new Dictionary<string, object> { { "Content", context.ContentItem } })); () => new Dictionary<string, object> { { "Content", context.ContentItem } }));
OnUpdated<ContentPart>( OnUpdated<ContentPart>(
(context, part) => (context, part) => {
workflowManager.TriggerEvent("ContentUpdated", context.ContentItem, if(context.ContentItemRecord == null) {
() => new Dictionary<string, object> { { "Content", context.ContentItem } })); return;
}
workflowManager.TriggerEvent(
"ContentUpdated",
context.ContentItem,
() => new Dictionary<string, object> { { "Content", context.ContentItem } }
);
});
} }
} }
} }