Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
[BugFix] Rootnode resolving bug fixed ([#69](#69))
Browse files Browse the repository at this point in the history
  • Loading branch information
kipusoep committed Mar 21, 2015
1 parent a2af5ec commit f2b323d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 38 deletions.
75 changes: 38 additions & 37 deletions Extensions/INodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@

namespace InfoCaster.Umbraco.UrlTracker.Extensions
{
public static class INodeExtensions
{
/// <summary>
/// Retrieve the root node
/// </summary>
/// <param name="node">The current node</param>
/// <returns>The root node</returns>
public static Node GetRootNode(this INode node)
{
if (node == null)
throw new ArgumentNullException("node");
public static class INodeExtensions
{
/// <summary>
/// Retrieve the root node
/// </summary>
/// <param name="node">The current node</param>
/// <returns>The root node</returns>
public static Node GetRootNode(this INode node)
{
if (node == null)
throw new ArgumentNullException("node");

INode parent = node;
INode parent = node;

while (parent != null)
{
node = parent;
parent = node.Parent;
}
while (parent != null)
{
node = parent;
parent = node.Parent;
}

return (Node)node;
}
return (Node)node;
}

/// <summary>
/// Retreive the closest ancestor or self with a host name set, or the root node if no hostnames are set
/// </summary>
/// <param name="node">The current node</param>
/// <returns>The closest ancestor or self with a host name set, or the root node if no hostnames are set</returns>
public static Node GetDomainRootNode(this INode node)
{
if (node == null)
throw new ArgumentNullException("node");
/// <summary>
/// Retreive the closest ancestor or self with a host name set, or the root node if no hostnames are set
/// </summary>
/// <param name="node">The current node</param>
/// <returns>The closest ancestor or self with a host name set, or the root node if no hostnames are set</returns>
public static Node GetDomainRootNode(this INode node)
{
if (node == null)
throw new ArgumentNullException("node");

INode parent = node;
INode parent = node;
INode deepParent = node;
INode deepNode = node;
while (parent != null)
Expand All @@ -67,13 +67,14 @@ public static Node GetDomainRootNode(this INode node)
}
}

if (((Node)deepNode).Parent.Id == node.Id)
{
// if the found node is a child of the normal root, then use this one...
node = deepNode;
}
// I don't know what the purpose is, but it contains a bug (https://github.com/kipusoep/UrlTracker/issues/69) - Stefan Kip
//if (((Node)deepNode).Parent.Id == node.Id)
//{
// // if the found node is a child of the normal root, then use this one...
// node = deepNode;
//}

return (Node)node;
}
}
return (Node)node;
}
}
}
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.5.*")]
[assembly: AssemblyVersion("3.6.*")]

// SQL
[assembly: WebResource("InfoCaster.Umbraco.UrlTracker.SQL.MicrosoftSqlServer.create-table-1.sql", "text/plain")]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Set to true to disable tracking not found (404) requests.
Set to false to disable appending a port number to redirect URLs

## Changelog ##
* 3.6 [2015/03/21]
* [BugFix] Rootnode resolving bug fixed ([#69](https://github.com/kipusoep/UrlTracker/issues/69))
* 3.5 [2015/02/20]
* [BugFix] Date in the changelog of v3.4 was wrong
* [BugFix] Manual redirects not working with root set to / ([#62](https://github.com/kipusoep/UrlTracker/issues/62))
Expand Down
6 changes: 6 additions & 0 deletions UI/UrlTrackerInfo.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
</div>
<div class="tab-pane" id="changeLog">
<ul>
<li>
3.6 [2015/03/21]
<ul>
<li>[BugFix] Rootnode resolving bug fixed (<a target="_blank" href="https://github.com/kipusoep/UrlTracker/issues/69">#69</a>)</li>
</ul>
</li>
<li>
3.5 [2015/02/20]
<ul>
Expand Down
9 changes: 9 additions & 0 deletions UrlTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,28 @@
<ItemGroup>
<Reference Include="businesslogic">
<HintPath>lib\businesslogic.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ClientDependency.Core, Version=1.7.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\ClientDependency.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="cms">
<HintPath>lib\cms.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="controls">
<HintPath>lib\controls.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="interfaces">
<HintPath>lib\interfaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="log4net">
<HintPath>lib\log4net.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down Expand Up @@ -96,12 +102,15 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="umbraco">
<HintPath>lib\umbraco.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Umbraco.Core">
<HintPath>lib\Umbraco.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="umbraco.DataLayer">
<HintPath>lib\umbraco.DataLayer.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit f2b323d

Please sign in to comment.