Final Merge with 4.11.0

This commit is contained in:
Morten Christensen
2012-11-23 19:59:28 -01:00
7 changed files with 176 additions and 30 deletions

View File

@@ -12,3 +12,4 @@ d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
8d7d8609e2e4b971da99cd97f72132ce85ce3333 Release-4.9.1
f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.0
20e4dff821d8ac2527a5353618fa1a23ea1d8b34 Release-4.11.0

View File

@@ -99,9 +99,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ClientDependency.1.5.1.0\lib\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="ClientDependency.Core.Mvc">
<HintPath>..\packages\ClientDependency-Mvc.1.5.1.0\lib\ClientDependency.Core.Mvc.dll</HintPath>
</Reference>
<Reference Include="CookComputing.XmlRpcV2, Version=2.5.0.0, Culture=neutral, PublicKeyToken=a7d6e17aa302004d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\CookComputing.XmlRpcV2.dll</HintPath>

View File

@@ -275,11 +275,7 @@
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@@ -1,3 +1,5 @@
using System.IO;
using Umbraco.Core.IO;
using umbraco.BusinessLogic;
namespace umbraco.presentation.install.steps
@@ -32,7 +34,9 @@ namespace umbraco.presentation.install.steps
if (!cms.businesslogic.skinning.Skinning.IsStarterKitInstalled())
customizeSite.Visible = false;
var initTrees = new ApplicationTreeRegistrar();
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/PluginCache");
if(Directory.Exists(tempFolder))
Directory.Delete(tempFolder, true);
}
#region Web Form Designer generated code

View File

@@ -15,6 +15,7 @@ using umbraco.interfaces;
using umbraco.BusinessLogic.Utils;
using umbraco.BusinessLogic;
using umbraco.BasePages;
using TypeFinder = umbraco.BusinessLogic.Utils.TypeFinder;
namespace umbraco.cms.presentation.Trees
{
@@ -151,11 +152,12 @@ namespace umbraco.cms.presentation.Trees
l.UpgradeToWriteLock();
var foundITrees = PluginManager.Current.ResolveTrees();
List<Type> foundITrees = TypeFinder.FindClassesOfType<ITree>();
//var foundITrees = PluginManager.Current.ResolveTrees();
var objTrees = ApplicationTree.getAll();
var appTrees = new List<ApplicationTree>();
List<ApplicationTree> appTrees = new List<ApplicationTree>();
//var appTrees = new List<ApplicationTree>();
appTrees.AddRange(objTrees);
var apps = Application.getAll();

View File

@@ -25,15 +25,18 @@ namespace umbraco.cms.businesslogic.template
return IOHelper.MapPath(SystemDirectories.Masterpages + "/" + t.Alias.Replace(" ", "") + ".master");
}
internal static string CreateMasterPage(Template t, bool overWrite = false)
internal static string CreateMasterPage(Template t, bool overWrite = false)
{
string masterpageContent = "";
if (!File.Exists(GetFilePath(t)) || overWrite)
masterpageContent = SaveTemplateToFile(t, t.Alias);
if (!File.Exists(GetFilePath(t)) || overWrite)
{
masterpageContent = CreateDefaultMasterPageContent(t, t.Alias);
saveDesignToFile(t, null, masterpageContent);
}
else
{
System.IO.TextReader tr = new StreamReader(GetFilePath(t));
System.IO.TextReader tr = new StreamReader(GetFilePath(t));
masterpageContent = tr.ReadToEnd();
tr.Close();
}
@@ -56,7 +59,152 @@ namespace umbraco.cms.businesslogic.template
internal static string UpdateMasterPageFile(Template t, string currentAlias)
{
return SaveTemplateToFile(t, currentAlias);
var template = updateMasterPageContent(t, currentAlias);
updateChildTemplates(t, currentAlias);
saveDesignToFile(t, currentAlias, template);
return template;
}
internal static string CreateDefaultMasterPageContent(Template template, string currentAlias)
{
string design = GetMasterPageHeader(template) + "\n";
if (template.HasMasterTemplate)
{
var master = new Template(template.MasterTemplate);
foreach (string cpId in master.contentPlaceholderIds())
{
design += "<asp:content ContentPlaceHolderId=\"" + cpId +
"\" runat=\"server\">\n\t\n</asp:content>\n\n";
}
}
else
{
design += GetMasterContentElement(template) + "\n";
design += template.Design;
design += "\n</asp:Content>" + Environment.NewLine;
}
return design;
/*
var masterPageContent = template.Design;
if (!IsMasterPageSyntax(masterPageContent))
masterPageContent = ConvertToMasterPageSyntax(template);
// Add header to master page if it doesn't exist
if (!masterPageContent.TrimStart().StartsWith("<%@"))
{
masterPageContent = GetMasterPageHeader(template) + "\n" + masterPageContent;
}
else
{
// verify that the masterpage attribute is the same as the masterpage
string masterHeader =
masterPageContent.Substring(0, masterPageContent.IndexOf("%>") + 2).Trim(
Environment.NewLine.ToCharArray());
// find the masterpagefile attribute
MatchCollection m = Regex.Matches(masterHeader, "(?<attributeName>\\S*)=\"(?<attributeValue>[^\"]*)\"",
RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
foreach (Match attributeSet in m)
{
if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
{
// validate the masterpagefile
string currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
string currentMasterTemplateFile = ParentTemplatePath(template);
if (currentMasterPageFile != currentMasterTemplateFile)
{
masterPageContent =
masterPageContent.Replace(
attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
"\"");
}
}
}
}
return masterPageContent;
* */
}
internal static string updateMasterPageContent(Template template, string currentAlias)
{
var masterPageContent = template.Design;
if (!string.IsNullOrEmpty(currentAlias) && currentAlias != template.Alias)
{
string masterHeader =
masterPageContent.Substring(0, masterPageContent.IndexOf("%>") + 2).Trim(
Environment.NewLine.ToCharArray());
// find the masterpagefile attribute
MatchCollection m = Regex.Matches(masterHeader, "(?<attributeName>\\S*)=\"(?<attributeValue>[^\"]*)\"",
RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
foreach (Match attributeSet in m)
{
if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
{
// validate the masterpagefile
string currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
string currentMasterTemplateFile = ParentTemplatePath(template);
if (currentMasterPageFile != currentMasterTemplateFile)
{
masterPageContent =
masterPageContent.Replace(
attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
"\"");
}
}
}
}
return masterPageContent;
}
private static void updateChildTemplates(Template t, string currentAlias)
{
//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) && currentAlias != t.Alias)
{
//Ensure that child templates have the right master masterpage file name
if (t.HasChildren)
{
var c = t.Children;
foreach (CMSNode cmn in c)
UpdateMasterPageFile(new Template(cmn.Id), null);
}
}
}
private static void saveDesignToFile(Template t, string currentAlias, string design)
{
//kill the old file..
if (!string.IsNullOrEmpty(currentAlias) && currentAlias != t.Alias)
{
string _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, System.Text.Encoding.UTF8);
}
internal static void RemoveMasterPageFile(string alias)

View File

@@ -383,18 +383,15 @@ namespace umbraco.cms.businesslogic.template
return engine;
}
public static Template MakeNew(string Name, BusinessLogic.User u, Template master)
{
return MakeNew(Name, u, master, null);
}
private static Template MakeNew(string Name, BusinessLogic.User u, Template master, string design)
public static Template MakeNew(string Name, BusinessLogic.User u, Template master)
{
Template t = MakeNew(Name, u, design);
t.MasterTemplate = master.Id;
return MakeNew(Name, u, master, null);
}
t.Save();
return t;
private static Template MakeNew(string name, BusinessLogic.User u, string design)
{
return MakeNew(name, u, null, design);
}
public static Template MakeNew(string name, BusinessLogic.User u)
@@ -402,7 +399,7 @@ namespace umbraco.cms.businesslogic.template
return MakeNew(name, u, design: null);
}
private static Template MakeNew(string name, BusinessLogic.User u, string design)
private static Template MakeNew(string name, BusinessLogic.User u, Template master, string design)
{
// CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueID)
@@ -418,8 +415,6 @@ namespace umbraco.cms.businesslogic.template
name = name.Substring(0, 95) + "...";
SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)",
SqlHelper.CreateParameter("@nodeId", n.Id),
SqlHelper.CreateParameter("@alias", name),
@@ -430,6 +425,9 @@ namespace umbraco.cms.businesslogic.template
NewEventArgs e = new NewEventArgs();
t.OnNew(e);
if (master != null)
t.MasterTemplate = master.Id;
switch (DetermineRenderingEngine(t, design))
{
case RenderingEngine.Mvc: