Made the path for where tinymce saves media dynamic

--HG--
branch : dev
This commit is contained in:
Erik Porter
2010-03-04 22:21:47 -08:00
parent 2d97d57749
commit 43eeb4e7d7
3 changed files with 7 additions and 5 deletions

View File

@@ -2,6 +2,6 @@
<%@ Import Namespace="Orchard.Core.Common.ViewModels" %>
<fieldset>
<label><%=_Encoded("Body")%></label>
<%=Html.EditorFor(m => m.Text, Model.TextEditorTemplate) %>
<%=Html.Partial("EditorTemplates/" + Model.TextEditorTemplate, Model) %>
<%=Html.ValidationMessageFor(m => m.Text) %>
</fieldset>

View File

@@ -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<IExtensionManager>().ActiveExtensions().FirstOrDefault(ee => ee.Descriptor.ExtensionType == "Module" && ee.Assembly == currentDriver.GetType().Assembly);
var routable = body.ContentItem.Has<RoutableAspect>() ? body.ContentItem.As<RoutableAspect>() : 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 : ""));
}
}
}

View File

@@ -1,8 +1,8 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<string>" %>
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BodyEditorViewModel>" %>
<%@ 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() %>"
});
</script><%