diff --git a/.editorconfig b/.editorconfig
index c63ef39430..5a35b71ce6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -34,4 +34,7 @@ dotnet_naming_style.prefix_underscore.required_prefix = _
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
-csharp_prefer_braces = false : none
+csharp_prefer_braces = false : none
+
+[*.{js,less}]
+trim_trailing_whitespace = false
diff --git a/.github/README.md b/.github/README.md
index 5a1340006e..ba5293e8c2 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -6,7 +6,7 @@ _Ready to try out Version 8? [See the quick start guide](V8_GETTING_STARTED.md).
When is Umbraco 8 coming?
=========================
-When it's ready. We're done with the major parts of the architecture work and are focusing on three seperate tracks to prepare Umbraco 8 for release:
+When it's ready. We're done with the major parts of the architecture work and are focusing on three separate tracks to prepare Umbraco 8 for release:
1) Editor Track (_currently in progress_). Without editors, there's no market for Umbraco. So we want to make sure that Umbraco 8 is full of love for editors.
2) Partner Track. Without anyone implementing Umbraco, there's nothing for editors to update. So we want to make sure that Umbraco 8 is a joy to implement
3) Contributor Track. Without our fabulous ecosystem of both individual Umbracians and 3rd party ISVs, Umbraco wouldn't be as rich a platform as it is today. We want to make sure that it's easy, straight forward and as backwards-compatible as possible to create packages for Umbraco
diff --git a/.gitignore b/.gitignore
index 279bdb39dd..57b4e18aaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@
*.suo
*.vs10x
*.ndproj
+*.ignorer.*
# common directories
.DS_Store
@@ -156,4 +157,4 @@ build/temp/
-# eof
\ No newline at end of file
+# eof
diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec
index 3cb3d0d875..a188377c19 100644
--- a/build/NuSpecs/UmbracoCms.nuspec
+++ b/build/NuSpecs/UmbracoCms.nuspec
@@ -52,10 +52,8 @@
-
-
diff --git a/src/Umbraco.Core/Composing/Composers/ConfigurationComposer.cs b/src/Umbraco.Core/Composing/Composers/ConfigurationComposer.cs
index ca86f623cc..7fba47a2cd 100644
--- a/src/Umbraco.Core/Composing/Composers/ConfigurationComposer.cs
+++ b/src/Umbraco.Core/Composing/Composers/ConfigurationComposer.cs
@@ -15,7 +15,6 @@ namespace Umbraco.Core.Composing.Composers
// register others
composition.RegisterUnique(factory => factory.GetInstance().Content);
- composition.RegisterUnique(factory => factory.GetInstance().Templates);
composition.RegisterUnique(factory => factory.GetInstance().RequestHandler);
composition.RegisterUnique(factory => factory.GetInstance().Security);
diff --git a/src/Umbraco.Core/Composing/Composers/ServicesComposer.cs b/src/Umbraco.Core/Composing/Composers/ServicesComposer.cs
index 8c9ccd1088..3f1bc1df5e 100644
--- a/src/Umbraco.Core/Composing/Composers/ServicesComposer.cs
+++ b/src/Umbraco.Core/Composing/Composers/ServicesComposer.cs
@@ -73,11 +73,6 @@ namespace Umbraco.Core.Composing.Composers
factory.GetInstance(), factory.GetInstance(),
new DirectoryInfo(IOHelper.GetRootDirectorySafe())));
- //TODO: These are replaced in the web project - we need to declare them so that
- // something is wired up, just not sure this is very nice but will work for now.
- composition.RegisterUnique();
- composition.RegisterUnique();
-
return composition;
}
@@ -88,7 +83,7 @@ namespace Umbraco.Core.Composing.Composers
///
///
private static PackagesRepository CreatePackageRepository(IFactory factory, string packageRepoFileName)
- => new PackagesRepository(
+ => new PackagesRepository(
factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(),
packageRepoFileName);
diff --git a/src/Umbraco.Core/Composing/TypeLoader.cs b/src/Umbraco.Core/Composing/TypeLoader.cs
index acb12ab575..4c4139848d 100644
--- a/src/Umbraco.Core/Composing/TypeLoader.cs
+++ b/src/Umbraco.Core/Composing/TypeLoader.cs
@@ -185,9 +185,7 @@ namespace Umbraco.Core.Composing
// the app code folder and everything in it
new Tuple(new DirectoryInfo(IOHelper.MapPath("~/App_Code")), false),
// global.asax (the app domain also monitors this, if it changes will do a full restart)
- new Tuple(new FileInfo(IOHelper.MapPath("~/global.asax")), false),
- // trees.config - use the contents to create the hash since this gets resaved on every app startup!
- new Tuple(new FileInfo(IOHelper.MapPath(SystemDirectories.Config + "/trees.config")), true)
+ new Tuple(new FileInfo(IOHelper.MapPath("~/global.asax")), false)
}, _logger);
return _currentAssembliesHash;
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs
deleted file mode 100644
index 67fd58030b..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- public interface ITemplatesSection : IUmbracoConfigurationSection
- {
- RenderingEngine DefaultRenderingEngine { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
index 28da03ff2d..33416d38cc 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
@@ -1,5 +1,4 @@
using System;
-using System.ComponentModel;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
@@ -12,8 +11,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
ISecuritySection Security { get; }
IRequestHandlerSection RequestHandler { get; }
-
- ITemplatesSection Templates { get; }
ILoggingSection Logging { get; }
@@ -22,6 +19,5 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
IProvidersSection Providers { get; }
IWebRoutingSection WebRouting { get; }
-
}
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs
deleted file mode 100644
index 8c929b02d8..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class TemplatesElement : UmbracoConfigurationElement, ITemplatesSection
- {
- [ConfigurationProperty("defaultRenderingEngine", IsRequired = true)]
- internal InnerTextConfigurationElement DefaultRenderingEngine
- {
- get { return GetOptionalTextElement("defaultRenderingEngine", RenderingEngine.Mvc); }
- }
-
- RenderingEngine ITemplatesSection.DefaultRenderingEngine
- {
- get { return DefaultRenderingEngine; }
- }
-
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
index d36410f317..9ed635f6a9 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
@@ -1,11 +1,7 @@
-using System;
-using System.ComponentModel;
-using System.Configuration;
-using System.Linq;
+using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
-
public class UmbracoSettingsSection : ConfigurationSection, IUmbracoSettingsSection
{
[ConfigurationProperty("backOffice")]
@@ -32,12 +28,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (RequestHandlerElement)this["requestHandler"]; }
}
- [ConfigurationProperty("templates")]
- internal TemplatesElement Templates
- {
- get { return (TemplatesElement)this["templates"]; }
- }
-
[ConfigurationProperty("logging")]
internal LoggingElement Logging
{
@@ -77,11 +67,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return RequestHandler; }
}
- ITemplatesSection IUmbracoSettingsSection.Templates
- {
- get { return Templates; }
- }
-
IBackOfficeSection IUmbracoSettingsSection.BackOffice
{
get { return BackOffice; }
@@ -106,6 +91,5 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return WebRouting; }
}
-
}
}
diff --git a/src/Umbraco.Core/Deploy/IGridCellValueConnector.cs b/src/Umbraco.Core/Deploy/IGridCellValueConnector.cs
index 827a902b89..15ed404d31 100644
--- a/src/Umbraco.Core/Deploy/IGridCellValueConnector.cs
+++ b/src/Umbraco.Core/Deploy/IGridCellValueConnector.cs
@@ -22,20 +22,17 @@ namespace Umbraco.Core.Deploy
/// Gets the value to be deployed from the control value as a string.
///
/// The control containing the value.
- /// The property where the control is located. Do not modify - only used for context
/// The dependencies of the property.
/// The grid cell value to be deployed.
/// Note that
- string GetValue(GridValue.GridControl gridControl, Property property, ICollection dependencies);
+ string GetValue(GridValue.GridControl gridControl, ICollection dependencies);
///
/// Allows you to modify the value of a control being deployed.
///
/// The control being deployed.
- /// The property where the is located. Do not modify - only used for context.
/// Follows the pattern of the property value connectors (). The SetValue method is used to modify the value of the .
- /// Note that only the value should be modified - not the .
- /// The should only be used to assist with context data relevant when setting the value.
- void SetValue(GridValue.GridControl gridControl, Property property);
+
+ void SetValue(GridValue.GridControl gridControl);
}
}
diff --git a/src/Umbraco.Core/Deploy/IValueConnector.cs b/src/Umbraco.Core/Deploy/IValueConnector.cs
index 92589ab6cf..7d9f43b5fe 100644
--- a/src/Umbraco.Core/Deploy/IValueConnector.cs
+++ b/src/Umbraco.Core/Deploy/IValueConnector.cs
@@ -20,16 +20,18 @@ namespace Umbraco.Core.Deploy
/// Gets the deploy property value corresponding to a content property value, and gather dependencies.
///
/// The content property value.
+ /// The value property type
/// The content dependencies.
/// The deploy property value.
- string ToArtifact(object value, ICollection dependencies);
+ string ToArtifact(object value, PropertyType propertyType, ICollection dependencies);
///
/// Gets the content property value corresponding to a deploy property value.
///
/// The deploy property value.
+ /// The value property type<
/// The current content property value.
/// The content property value.
- object FromArtifact(string value, object currentValue);
+ object FromArtifact(string value, PropertyType propertyType, object currentValue);
}
}
diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs
index 7fc846319b..63a1259acb 100644
--- a/src/Umbraco.Core/IO/FileSystems.cs
+++ b/src/Umbraco.Core/IO/FileSystems.cs
@@ -19,7 +19,6 @@ namespace Umbraco.Core.IO
private ShadowWrapper _partialViewsFileSystem;
private ShadowWrapper _stylesheetsFileSystem;
private ShadowWrapper _scriptsFileSystem;
- private ShadowWrapper _masterPagesFileSystem;
private ShadowWrapper _mvcViewsFileSystem;
// well-known file systems lazy initialization
@@ -102,16 +101,6 @@ namespace Umbraco.Core.IO
}
}
- ///
- public IFileSystem MasterPagesFileSystem
- {
- get
- {
- if (Volatile.Read(ref _wkfsInitialized) == false) EnsureWellKnownFileSystems();
- return _masterPagesFileSystem;
- }
- }
-
///
public IFileSystem MvcViewsFileSystem
{
@@ -135,14 +124,12 @@ namespace Umbraco.Core.IO
var partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews);
var stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css);
var scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts);
- var masterPagesFileSystem = new PhysicalFileSystem(SystemDirectories.Masterpages);
var mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews);
_macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "Views/MacroPartials", IsScoped);
_partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "Views/Partials", IsScoped);
_stylesheetsFileSystem = new ShadowWrapper(stylesheetsFileSystem, "css", IsScoped);
_scriptsFileSystem = new ShadowWrapper(scriptsFileSystem, "scripts", IsScoped);
- _masterPagesFileSystem = new ShadowWrapper(masterPagesFileSystem, "masterpages", IsScoped);
_mvcViewsFileSystem = new ShadowWrapper(mvcViewsFileSystem, "Views", IsScoped);
// fixme locking?
@@ -150,7 +137,6 @@ namespace Umbraco.Core.IO
_shadowWrappers.Add(_partialViewsFileSystem);
_shadowWrappers.Add(_stylesheetsFileSystem);
_shadowWrappers.Add(_scriptsFileSystem);
- _shadowWrappers.Add(_masterPagesFileSystem);
_shadowWrappers.Add(_mvcViewsFileSystem);
return null;
diff --git a/src/Umbraco.Core/IO/IFileSystems.cs b/src/Umbraco.Core/IO/IFileSystems.cs
index d74ad48145..f7d35058e3 100644
--- a/src/Umbraco.Core/IO/IFileSystems.cs
+++ b/src/Umbraco.Core/IO/IFileSystems.cs
@@ -25,11 +25,6 @@
///
IFileSystem ScriptsFileSystem { get; }
- ///
- /// Gets the masterpages filesystem.
- ///
- IFileSystem MasterPagesFileSystem { get; }
-
///
/// Gets the MVC views filesystem.
///
diff --git a/src/Umbraco.Core/IO/MasterPageHelper.cs b/src/Umbraco.Core/IO/MasterPageHelper.cs
deleted file mode 100644
index 049db04b9a..0000000000
--- a/src/Umbraco.Core/IO/MasterPageHelper.cs
+++ /dev/null
@@ -1,445 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using Umbraco.Core.Models;
-using Umbraco.Core.Persistence.Repositories;
-using Umbraco.Core.Services;
-using Umbraco.Core.Xml;
-
-namespace Umbraco.Core.IO
-{
- internal class MasterPageHelper
- {
- private readonly IFileSystem _masterPageFileSystem;
- internal static readonly string DefaultMasterTemplate = SystemDirectories.Umbraco + "/masterpages/default.master";
- //private static readonly char[] NewLineChars = Environment.NewLine.ToCharArray();
-
- public MasterPageHelper(IFileSystem masterPageFileSystem)
- {
- if (masterPageFileSystem == null) throw new ArgumentNullException("masterPageFileSystem");
- _masterPageFileSystem = masterPageFileSystem;
- }
-
- public bool MasterPageExists(ITemplate t)
- {
- return _masterPageFileSystem.FileExists(GetFilePath(t));
- }
-
- private string GetFilePath(ITemplate t)
- {
- return GetFilePath(t.Alias);
- }
-
- private string GetFilePath(string alias)
- {
- return alias + ".master";
- }
-
- public string CreateMasterPage(ITemplate t, ITemplateRepository templateRepo, bool overWrite = false)
- {
- string masterpageContent = "";
-
- var filePath = GetFilePath(t);
- if (_masterPageFileSystem.FileExists(filePath) == false || overWrite)
- {
- masterpageContent = t.Content.IsNullOrWhiteSpace() ? CreateDefaultMasterPageContent(t, templateRepo) : t.Content;
-
- var data = Encoding.UTF8.GetBytes(masterpageContent);
- var withBom = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
-
- using (var ms = new MemoryStream(withBom))
- {
- _masterPageFileSystem.AddFile(filePath, ms, true);
- }
- }
- else
- {
- using (var s = _masterPageFileSystem.OpenFile(filePath))
- using (var tr = new StreamReader(s, Encoding.UTF8))
- {
- masterpageContent = tr.ReadToEnd();
- tr.Close();
- }
- }
-
- return masterpageContent;
- }
-
- //internal string GetFileContents(ITemplate t)
- //{
- // var masterpageContent = "";
- // if (_masterPageFileSystem.FileExists(GetFilePath(t)))
- // {
- // using (var s = _masterPageFileSystem.OpenFile(GetFilePath(t)))
- // using (var tr = new StreamReader(s))
- // {
- // masterpageContent = tr.ReadToEnd();
- // tr.Close();
- // }
- // }
-
- // return masterpageContent;
- //}
-
- public string UpdateMasterPageFile(ITemplate t, string currentAlias, ITemplateRepository templateRepo)
- {
- var template = UpdateMasterPageContent(t, currentAlias);
- UpdateChildTemplates(t, currentAlias, templateRepo);
- var filePath = GetFilePath(t);
-
- var data = Encoding.UTF8.GetBytes(template);
- var withBom = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
-
- using (var ms = new MemoryStream(withBom))
- {
- _masterPageFileSystem.AddFile(filePath, ms, true);
- }
- return template;
- }
-
- private string CreateDefaultMasterPageContent(ITemplate template, ITemplateRepository templateRepo)
- {
- var design = new StringBuilder();
- design.Append(GetMasterPageHeader(template) + Environment.NewLine);
-
- if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
- {
- var master = templateRepo.Get(template.MasterTemplateAlias);
- if (master != null)
- {
- foreach (var cpId in GetContentPlaceholderIds(master))
- {
- design.Append("" +
- Environment.NewLine +
- Environment.NewLine +
- "" +
- Environment.NewLine +
- Environment.NewLine);
- }
-
- return design.ToString();
- }
- }
-
- design.Append(GetMasterContentElement(template) + Environment.NewLine);
- design.Append(template.Content + Environment.NewLine);
- design.Append("" + Environment.NewLine);
-
- return design.ToString();
- }
-
- public static IEnumerable GetContentPlaceholderIds(ITemplate template)
- {
- var retVal = new List();
-
- var mp = template.Content;
- var path = "";
- var r = new Regex(path, RegexOptions.IgnoreCase);
- var m = r.Match(mp);
-
- while (m.Success)
- {
- var cc = m.Groups[3].Captures;
- retVal.AddRange(cc.Cast().Where(c => c.Value != "server").Select(c => c.Value));
-
- m = m.NextMatch();
- }
-
- return retVal;
- }
-
- private static string UpdateMasterPageContent(ITemplate template, string currentAlias)
- {
- var masterPageContent = template.Content;
-
- if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != template.Alias)
- {
- var masterHeader =
- masterPageContent.Substring(0, masterPageContent.IndexOf("%>", StringComparison.Ordinal) + 2).Trim(
- Environment.NewLine.ToCharArray());
-
- // find the masterpagefile attribute
- var m = Regex.Matches(masterHeader, "(?\\S*)=\"(?[^\"]*)\"",
- RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
-
- foreach (Match attributeSet in m)
- {
- if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
- {
- // validate the masterpagefile
- var currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
- var currentMasterTemplateFile = ParentTemplatePath(template);
-
- if (currentMasterPageFile != currentMasterTemplateFile)
- {
- masterPageContent =
- masterPageContent.Replace(
- attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
- attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
- "\"");
- }
- }
- }
- }
-
- return masterPageContent;
- }
-
- private void UpdateChildTemplates(ITemplate template, string currentAlias, ITemplateRepository templateRepo)
- {
- //if we have a Old Alias if the alias and therefor the masterpage file name has changed...
- //so before we save the new masterfile, we'll clear the old one, so we don't up with
- //Unused masterpage files
- if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != template.Alias)
- {
- //Ensure that child templates have the right master masterpage file name
- if (template.IsMasterTemplate)
- {
- var children = templateRepo.GetChildren(template.Id);
- foreach (var t in children)
- UpdateMasterPageFile(t, null, templateRepo);
- }
- }
- }
-
-
- //private void SaveDesignToFile(ITemplate t, string currentAlias, string design)
- //{
- // //kill the old file..
- // if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != t.Alias)
- // {
- // var oldFile =
- // IOHelper.MapPath(SystemDirectories.Masterpages + "/" + currentAlias.Replace(" ", "") + ".master");
- // if (System.IO.File.Exists(oldFile))
- // System.IO.File.Delete(oldFile);
- // }
-
- // // save the file in UTF-8
- // System.IO.File.WriteAllText(GetFilePath(t), design, Encoding.UTF8);
- //}
-
- //internal static void RemoveMasterPageFile(string alias)
- //{
- // if (string.IsNullOrWhiteSpace(alias) == false)
- // {
- // string file = IOHelper.MapPath(SystemDirectories.Masterpages + "/" + alias.Replace(" ", "") + ".master");
- // if (System.IO.File.Exists(file))
- // System.IO.File.Delete(file);
- // }
- //}
-
- //internal string SaveTemplateToFile(ITemplate template, string currentAlias, ITemplateRepository templateRepo)
- //{
- // var masterPageContent = template.Content;
- // if (IsMasterPageSyntax(masterPageContent) == false)
- // masterPageContent = ConvertToMasterPageSyntax(template);
-
- // // Add header to master page if it doesn't exist
- // if (masterPageContent.TrimStart().StartsWith("<%@") == false)
- // {
- // masterPageContent = GetMasterPageHeader(template) + Environment.NewLine + masterPageContent;
- // }
- // else
- // {
- // // verify that the masterpage attribute is the same as the masterpage
- // var masterHeader =
- // masterPageContent.Substring(0, masterPageContent.IndexOf("%>", StringComparison.Ordinal) + 2).Trim(NewLineChars);
-
- // // find the masterpagefile attribute
- // var m = Regex.Matches(masterHeader, "(?\\S*)=\"(?[^\"]*)\"",
- // RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
-
- // foreach (Match attributeSet in m)
- // {
- // if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
- // {
- // // validate the masterpagefile
- // var currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
- // var currentMasterTemplateFile = ParentTemplatePath(template);
-
- // if (currentMasterPageFile != currentMasterTemplateFile)
- // {
- // masterPageContent =
- // masterPageContent.Replace(
- // attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
- // attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
- // "\"");
-
- // }
- // }
- // }
-
- // }
-
- // //we have a Old Alias if the alias and therefor the masterpage file name has changed...
- // //so before we save the new masterfile, we'll clear the old one, so we don't up with
- // //Unused masterpage files
- // if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != template.Alias)
- // {
-
- // //Ensure that child templates have the right master masterpage file name
- // if (template.IsMasterTemplate)
- // {
- // var children = templateRepo.GetChildren(template.Id);
-
- // foreach (var t in children)
- // UpdateMasterPageFile(t, null, templateRepo);
- // }
-
- // //then kill the old file..
- // var oldFile = GetFilePath(currentAlias);
- // if (_masterPageFileSystem.FileExists(oldFile))
- // _masterPageFileSystem.DeleteFile(oldFile);
- // }
-
- // // save the file in UTF-8
- // System.IO.File.WriteAllText(GetFilePath(template), masterPageContent, Encoding.UTF8);
-
- // return masterPageContent;
- //}
-
- //internal static string ConvertToMasterPageSyntax(ITemplate template)
- //{
- // string masterPageContent = GetMasterContentElement(template) + Environment.NewLine;
-
- // masterPageContent += template.Content;
-
- // // Parse the design for getitems
- // masterPageContent = EnsureMasterPageSyntax(template.Alias, masterPageContent);
-
- // // append ending asp:content element
- // masterPageContent += Environment.NewLine + "" + Environment.NewLine;
-
- // return masterPageContent;
- //}
-
- public static bool IsMasterPageSyntax(string code)
- {
- return Regex.IsMatch(code, @"<%@\s*Master", RegexOptions.IgnoreCase) ||
- code.InvariantContains("", ParentTemplatePath(template)) + Environment.NewLine;
- }
-
- private static string ParentTemplatePath(ITemplate template)
- {
- var masterTemplate = DefaultMasterTemplate;
- if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
- masterTemplate = SystemDirectories.Masterpages + "/" + template.MasterTemplateAlias + ".master";
-
- return masterTemplate;
- }
-
- internal static string GetMasterContentElement(ITemplate template)
- {
- if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
- {
- string masterAlias = template.MasterTemplateAlias;
- return
- String.Format("", masterAlias);
- }
- else
- return
- String.Format("");
-
- }
-
- internal static string EnsureMasterPageSyntax(string templateAlias, string masterPageContent)
- {
- ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", true);
- ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", false);
-
- // Parse the design for macros
- ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", true);
- ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", false);
-
- // Parse the design for load childs
- masterPageContent = masterPageContent.Replace("", CreateDefaultPlaceHolder(templateAlias))
- .Replace("", CreateDefaultPlaceHolder(templateAlias));
- // Parse the design for aspnet forms
- GetAspNetMasterPageForm(ref masterPageContent, templateAlias);
- masterPageContent = masterPageContent.Replace("?ASPNET_FORM>", "");
- // Parse the design for aspnet heads
- masterPageContent = masterPageContent.Replace("", String.Format("", templateAlias.Replace(" ", "")));
- masterPageContent = masterPageContent.Replace("?ASPNET_HEAD>", "");
- return masterPageContent;
- }
-
-
- private static void GetAspNetMasterPageForm(ref string design, string templateAlias)
- {
- var formElement = Regex.Match(design, GetElementRegExp("?ASPNET_FORM", false), RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
-
- if (string.IsNullOrEmpty(formElement.Value) == false)
- {
- string formReplace = String.Format("