small updates to skinning

This commit is contained in:
starfighter83
2011-01-05 11:38:49 -01:00
parent 682104a1f1
commit 6795f700d5
5 changed files with 19 additions and 16 deletions

Binary file not shown.

View File

@@ -28,24 +28,25 @@ namespace umbraco.cms.businesslogic.skinning.tasks
HtmlDocument doc = new HtmlDocument();
doc.Load(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
if (doc.DocumentNode.SelectSingleNode(string.Format("//link [@href = '{0}']", Value)) == null)
{
//if (doc.DocumentNode.SelectSingleNode(string.Format("//link [@href = '{0}']", Value)) == null)
//{
HtmlNode target = doc.DocumentNode.SelectSingleNode(string.IsNullOrEmpty(TargetSelector) ? "//head" : TargetSelector.ToLower());
if (target != null)
{
HtmlNode s = new HtmlNode(HtmlNodeType.Element, doc, 0);
s.Name = "link";
s.Attributes.Add("rel", "stylesheet");
s.Attributes.Add("type", "text/css");
HtmlNode s = doc.CreateElement("link");
//s.Name = "link";
s.Attributes.Append("rel", "stylesheet");
s.Attributes.Append("type", "text/css");
s.Attributes.Add("href", Value);
s.Attributes.Append("href", Value);
if (!string.IsNullOrEmpty(Media))
s.Attributes.Add("media", Media);
s.Attributes.Append("media", Media);
target.AppendChild(s);
@@ -56,9 +57,9 @@ namespace umbraco.cms.businesslogic.skinning.tasks
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
//}
//else
// d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
return d;
}
@@ -72,7 +73,7 @@ namespace umbraco.cms.businesslogic.skinning.tasks
if (s != null)
{
s.Remove();
s.RemoveAll();
doc.Save(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);

View File

@@ -47,7 +47,7 @@ namespace umbraco.cms.businesslogic.skinning.tasks
{
if (target.Attributes[TargetAttribute] == null)
{
target.Attributes.Add(TargetAttribute, Value);
target.Attributes.Append(TargetAttribute, Value);
}
else
{

View File

@@ -101,7 +101,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack">
<Reference Include="HtmlAgilityPack, Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">

View File

@@ -186,7 +186,8 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
}
else
{
parent.ChildNodes.Add(module);
parent.AppendChild(module);
//parent.ChildNodes.Add(module);
}
doc.Save(TargetFile);
@@ -221,7 +222,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
{
HtmlNode r = doc.DocumentNode.SelectSingleNode(string.Format("//*[@id = '{0}']", TargetID)).Clone();
doc.DocumentNode.SelectSingleNode(string.Format("//*[@id = '{0}']", TargetID)).Remove();
doc.DocumentNode.SelectSingleNode(string.Format("//*[@id = '{0}']", TargetID)).RemoveAll();
doc.Save(TargetFile);