Revert "Optimizing client forms validation"

This reverts commit 878f45ad86.
This commit is contained in:
Sebastien Ros
2014-03-21 09:20:03 -07:00
parent 0a970e88f3
commit 6e8e010fe2
2 changed files with 5 additions and 3 deletions

View File

@@ -27,9 +27,11 @@ namespace Orchard.Comments.Controllers {
return this.RedirectLocal(returnUrl, "~/");
var comment = Services.ContentManager.New<CommentPart>("Comment");
Services.ContentManager.Create(comment, VersionOptions.Draft);
var editorShape = Services.ContentManager.UpdateEditor(comment, this);
if (!ModelState.IsValidField("Comments.Author")) {
Services.Notifier.Error(T("Name is mandatory and must have less than 255 chars"));
}
@@ -47,6 +49,7 @@ namespace Orchard.Comments.Controllers {
}
if (ModelState.IsValid) {
Services.ContentManager.Create(comment);
var commentPart = comment.As<CommentPart>();
@@ -55,8 +58,6 @@ namespace Orchard.Comments.Controllers {
Services.TransactionManager.Cancel();
return this.RedirectLocal(returnUrl, "~/");
}
Services.ContentManager.Create(comment.ContentItem, VersionOptions.Published);
var commentsPart = Services.ContentManager.Get(commentPart.CommentedOn).As<CommentsPart>();

View File

@@ -122,6 +122,8 @@ namespace Orchard.CustomForms.Controllers {
if (!Services.Authorizer.Authorize(Permissions.CreateSubmitPermission(customForm.ContentType), contentItem, T("Couldn't create content")))
return new HttpUnauthorizedResult();
if(customForm.SaveContentItem)
_contentManager.Create(contentItem, VersionOptions.Draft);
var model = _contentManager.UpdateEditor(contentItem, this);
@@ -162,7 +164,6 @@ namespace Orchard.CustomForms.Controllers {
// save the submitted form
if (customForm.SaveContentItem) {
_contentManager.Create(contentItem, VersionOptions.Draft);
conditionallyPublish(contentItem);
}