From 43eeb4e7d77a34941d2b6ab1873c13b995a41ab2 Mon Sep 17 00:00:00 2001 From: Erik Porter Date: Thu, 4 Mar 2010 22:21:47 -0800 Subject: [PATCH] Made the path for where tinymce saves media dynamic --HG-- branch : dev --- .../Common/Views/EditorTemplates/Parts/Common.Body.ascx | 2 +- .../Modules/TinyMce/Extensions/HtmlHelperExtensions.cs | 4 +++- .../TinyMce/Views/EditorTemplates/TinyMceTextEditor.ascx | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Body.ascx b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Body.ascx index 9a43aae1f..643bf2d8e 100644 --- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Body.ascx +++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Body.ascx @@ -2,6 +2,6 @@ <%@ Import Namespace="Orchard.Core.Common.ViewModels" %>
- <%=Html.EditorFor(m => m.Text, Model.TextEditorTemplate) %> + <%=Html.Partial("EditorTemplates/" + Model.TextEditorTemplate, Model) %> <%=Html.ValidationMessageFor(m => m.Text) %>
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/TinyMce/Extensions/HtmlHelperExtensions.cs b/src/Orchard.Web/Modules/TinyMce/Extensions/HtmlHelperExtensions.cs index ce999f3c8..d194137a7 100644 --- a/src/Orchard.Web/Modules/TinyMce/Extensions/HtmlHelperExtensions.cs +++ b/src/Orchard.Web/Modules/TinyMce/Extensions/HtmlHelperExtensions.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Web.Mvc; +using System.Web.UI; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Models; @@ -16,7 +17,8 @@ namespace TinyMce.Extensions { var currentModule = htmlHelper.Resolve().ActiveExtensions().FirstOrDefault(ee => ee.Descriptor.ExtensionType == "Module" && ee.Assembly == currentDriver.GetType().Assembly); var routable = body.ContentItem.Has() ? body.ContentItem.As() : null; - return string.Format("{0}/{1}{2}", "~/Media", currentModule.Descriptor.Name, routable != null && !string.IsNullOrEmpty(routable.ContainerPath) ? "/" + routable.ContainerPath : ""); + //TODO: (erikpo) Get the value for the media folder from settings instead of hardcoding it + return ((Control)htmlHelper.ViewDataContainer).ResolveUrl(string.Format("{0}/{1}{2}", "~/Media", currentModule.Descriptor.Name, routable != null && !string.IsNullOrEmpty(routable.ContainerPath) ? "/" + routable.ContainerPath : "")); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/TinyMce/Views/EditorTemplates/TinyMceTextEditor.ascx b/src/Orchard.Web/Modules/TinyMce/Views/EditorTemplates/TinyMceTextEditor.ascx index 92e4cf927..04d96e31f 100644 --- a/src/Orchard.Web/Modules/TinyMce/Views/EditorTemplates/TinyMceTextEditor.ascx +++ b/src/Orchard.Web/Modules/TinyMce/Views/EditorTemplates/TinyMceTextEditor.ascx @@ -1,8 +1,8 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> <%@ Import Namespace="TinyMce.Extensions"%> <%@ Import Namespace="Orchard.Core.Common.ViewModels"%> <% Html.RegisterScript("tiny_mce.js"); %> -<%=Html.TextArea("", Model, 25, 80, new { @class = "html" }) %> +<%=Html.TextArea("Text", Model.Text, 25, 80, new { @class = "html" }) %> <% using (this.Capture("end-of-page-scripts")) {%> @@ -18,7 +18,7 @@ using (this.Capture("end-of-page-scripts")) {%> theme_advanced_buttons2: "", theme_advanced_buttons3: "", addmedia_action: "<%=Url.Action("AddFromClient", "Admin", new {area = "Orchard.Media"}) %>", - addmedia_path: "somepath", + addmedia_path: "<%=Html.GetCurrentMediaPath() %>", request_verification_token: "<%=Html.AntiForgeryTokenValueOrchard() %>" }); <%