From 2753dbe5b445b8cb7acd04dc18f4b0c88f1a483a Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Tue, 2 Oct 2012 21:19:21 +0500 Subject: [PATCH] ensures enctype attribute is added in BeginUmbracoForm. Adds CurrentCulture to RenderModel --- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 6 ++++++ src/Umbraco.Web/Mvc/RenderModel.cs | 14 ++++++++++---- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 3 ++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 865b0920b0..30b036685f 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -366,6 +366,12 @@ namespace Umbraco.Web object additionalRouteVals = null) { + //ensure that the multipart/form-data is added to the html attributes + if (!htmlAttributes.ContainsKey("enctype")) + { + htmlAttributes.Add("enctype", "multipart/form-data"); + } + var tagBuilder = new TagBuilder("form"); tagBuilder.MergeAttributes(htmlAttributes); // action is implicitly generated, so htmlAttributes take precedence. diff --git a/src/Umbraco.Web/Mvc/RenderModel.cs b/src/Umbraco.Web/Mvc/RenderModel.cs index e9d428eb54..9e53e10f43 100644 --- a/src/Umbraco.Web/Mvc/RenderModel.cs +++ b/src/Umbraco.Web/Mvc/RenderModel.cs @@ -1,3 +1,4 @@ +using System.Globalization; using System.Xml; using Umbraco.Core.Models; using umbraco; @@ -9,10 +10,15 @@ namespace Umbraco.Web.Mvc /// Represents the model for the current rendering page in Umbraco /// public class RenderModel - { - //NOTE: the model isn't just IPublishedContent because in the future we will most likely want to add other properties here, - //or we will want to add extensions. + { + /// + /// Returns the current IPublishedContent object + /// + public IPublishedContent CurrentContent { get; internal set; } - public IPublishedContent CurrentContent { get; set; } + /// + /// Returns the current Culture assigned to the page being rendered + /// + public CultureInfo CurrentCulture { get; internal set; } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index ab50da9543..352fa11f49 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -44,7 +44,8 @@ namespace Umbraco.Web.Mvc var renderModel = new RenderModel() { - CurrentContent = docRequest.PublishedContent + CurrentContent = docRequest.PublishedContent, + CurrentCulture = docRequest.Culture }; //put essential data into the data tokens, the 'umbraco' key is required to be there for the view engine