diff --git a/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx b/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx index b34560a19e..685eb26e8c 100644 --- a/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx +++ b/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx @@ -3,7 +3,7 @@ <%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> - + * diff --git a/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx.cs b/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx.cs index 07a918acc0..12aa180282 100644 --- a/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx.cs +++ b/src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx.cs @@ -19,6 +19,10 @@ namespace Umbraco.Web.UI.Umbraco.Create DataBind(); LoadTemplates(PartialViewTemplate); + + // Enable new contect item in folders to place items in that folder. + if (Request["nodeType"] == "partialViewsFolder") + FileName.Text = Request["nodeId"] + "/"; } private static void LoadTemplates(ListControl list) diff --git a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml index 7bf4a33758..c2a4c90d0a 100644 --- a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml +++ b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml @@ -330,6 +330,14 @@ + +
Macro
+ /Create/PartialView.ascx + + + + +
Macro
/Create/PartialViewMacro.ascx @@ -338,4 +346,12 @@
+ +
Macro
+ /Create/PartialViewMacro.ascx + + + + +
diff --git a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx index d268027959..723656e1be 100644 --- a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx +++ b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx @@ -4,7 +4,7 @@ <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - + * diff --git a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs index ab017f3653..ba227b7c08 100644 --- a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs +++ b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs @@ -19,6 +19,10 @@ namespace Umbraco.Web.UI.Umbraco.Create DataBind(); LoadTemplates(PartialViewTemplate); + + // Enable new contect item in folders to place items in that folder. + if (Request["nodeType"] == "partialViewMacrosFolder") + FileName.Text = Request["nodeId"] + "/"; } private static void LoadTemplates(ListControl list) diff --git a/src/Umbraco.Web.UI/umbraco/create/script.ascx b/src/Umbraco.Web.UI/umbraco/create/script.ascx index 1d099a9f22..32ff1d6f0e 100644 --- a/src/Umbraco.Web.UI/umbraco/create/script.ascx +++ b/src/Umbraco.Web.UI/umbraco/create/script.ascx @@ -3,7 +3,7 @@ - + * diff --git a/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs b/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs index 4343c1b1df..226b3131d1 100644 --- a/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs @@ -150,7 +150,10 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views { //we are editing a view (i.e. partial view) OriginalFileName = HttpUtility.UrlDecode(Request.QueryString["file"]); - TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName); + + //TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName); + + TemplateTreeSyncPath = DeepLink.GetTreePathFromFilePath(OriginalFileName.TrimStart("MacroPartials/").TrimStart("Partials/")); } else { diff --git a/src/Umbraco.Web/Trees/PartialViewMacrosTree.cs b/src/Umbraco.Web/Trees/PartialViewMacrosTree.cs index 1278648de5..f5a9df97c2 100644 --- a/src/Umbraco.Web/Trees/PartialViewMacrosTree.cs +++ b/src/Umbraco.Web/Trees/PartialViewMacrosTree.cs @@ -31,7 +31,17 @@ namespace Umbraco.Web.Trees UmbClientMgr.contentFrame('Settings/Views/EditView.aspx?treeType=partialViewMacros&file=MacroPartials%2f' + id); } "); - } + + }/// + /// Ensures that no folders can be added + /// + /// + protected override void OnRenderFolderNode(ref XmlTreeNode xNode) + { + base.OnRenderFolderNode(ref xNode); + + xNode.NodeType = "partialViewMacrosFolder"; + } protected override void ChangeNodeAction(XmlTreeNode xNode) { diff --git a/src/Umbraco.Web/Trees/PartialViewsTree.cs b/src/Umbraco.Web/Trees/PartialViewsTree.cs index c971f9573d..1cd9a9f0b2 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTree.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTree.cs @@ -57,7 +57,11 @@ namespace Umbraco.Web.Trees /// protected override void OnRenderFolderNode(ref XmlTreeNode xNode) { - xNode = null; + // We should allow folder hierarchy for organization in large sites. + xNode.Action = "javascript:void(0);"; + xNode.NodeType = "partialViewsFolder"; + xNode.Menu = new List(new IAction[] { ActionDelete.Instance, ContextMenuSeperator.Instance, ActionNew.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance }); + } protected virtual void ChangeNodeAction(XmlTreeNode xNode) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs index 57c0312100..0f82ae96ec 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs @@ -76,6 +76,7 @@ namespace umbraco xNode.Menu = new List(new IAction[] { ActionDelete.Instance, ContextMenuSeperator.Instance, ActionNew.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance }); xNode.Action = "javascript:void(0)"; xNode.NodeType = "scriptsFolder"; + xNode.Action = "javascript:void(0);"; } protected override void OnRenderFileNode(ref XmlTreeNode xNode) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx index d94265f87a..91db522712 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx @@ -3,7 +3,7 @@ - + * diff --git a/src/umbraco.cms/businesslogic/web/StyleSheet.cs b/src/umbraco.cms/businesslogic/web/StyleSheet.cs index eb96b04edf..293dc32eaa 100644 --- a/src/umbraco.cms/businesslogic/web/StyleSheet.cs +++ b/src/umbraco.cms/businesslogic/web/StyleSheet.cs @@ -254,7 +254,7 @@ namespace umbraco.cms.businesslogic.web { var e = new DeleteEventArgs(); FireBeforeDelete(e); - + if (!e.Cancel) { File.Delete(IOHelper.MapPath(String.Format("{0}/{1}.css", SystemDirectories.Css, this.Text))); @@ -272,6 +272,13 @@ namespace umbraco.cms.businesslogic.web public void saveCssToFile() { + if (this.Text.Contains('/')) + { + var dir = string.Format("{0}/{1}", IOHelper.MapPath(SystemDirectories.Css), this.Text.Substring(0, this.Text.LastIndexOf('/'))); + if (!Directory.Exists(dir)) + Directory.CreateDirectory(dir); + } + using (StreamWriter SW = File.CreateText(IOHelper.MapPath(string.Format("{0}/{1}.css", SystemDirectories.Css, this.Text)))) { string tmpCss = this.Content ;