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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kipusoep/UrlTracker
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: bauerxcelmedia/UrlTracker
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 4 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 1, 2016

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f7a901f View commit details
  2. Removed ContentService.Moving, ContentService_Deleting and content.Be…

    …foreClearDocumentCache events
    Azadeh-h committed Jul 1, 2016
    Copy the full SHA
    ca5c79a View commit details

Commits on Jul 3, 2016

  1. Merge pull request #1 from bauerxcelmedia/feature/dsp-1011

    [DSP-1011]-Disable urlTracker on publishing in CMS
    Azadeh-h authored Jul 3, 2016
    Copy the full SHA
    eb03dfc View commit details

Commits on Jul 5, 2016

  1. Added description to the dll

    Azadeh-h committed Jul 5, 2016
    Copy the full SHA
    9786157 View commit details
Showing with 2 additions and 143 deletions.
  1. +1 −1 Properties/AssemblyInfo.cs
  2. +1 −142 UrlTrackerApplicationEventHandler.cs
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("InfoCaster UrlTracker")]
[assembly: AssemblyTitle("InfoCaster UrlTracker Bauer media customized version")]
[assembly: AssemblyDescription("UrlTracker for Umbraco")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("InfoCaster")]
143 changes: 1 addition & 142 deletions UrlTrackerApplicationEventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
using InfoCaster.Umbraco.UrlTracker.Extensions;
using InfoCaster.Umbraco.UrlTracker.Helpers;
using InfoCaster.Umbraco.UrlTracker.Models;
using InfoCaster.Umbraco.UrlTracker.Helpers;
using InfoCaster.Umbraco.UrlTracker.Repositories;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using umbraco;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.web;
using umbraco.DataLayer;
using umbraco.NodeFactory;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Publishing;
using Umbraco.Core.Services;
using Umbraco.Web.UI.Pages;

namespace InfoCaster.Umbraco.UrlTracker
@@ -43,139 +29,12 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica
if (!UrlTrackerSettings.IsDisabled && !UrlTrackerSettings.IsTrackingDisabled)
{
UrlTrackerRepository.ReloadForcedRedirectsCache();

ContentService.Moving += ContentService_Moving;
ContentService.Publishing += ContentService_Publishing;
ContentService.Deleting += ContentService_Deleting;
content.BeforeClearDocumentCache += content_BeforeClearDocumentCache;
Domain.AfterDelete += Domain_AfterDelete;
Domain.AfterSave += Domain_AfterSave;
Domain.New += Domain_New;
}
}

void ContentService_Deleting(IContentService sender, DeleteEventArgs<IContent> e)
{
foreach (IContent content in e.DeletedEntities)
{
#if !DEBUG
try
#endif
{
UrlTrackerRepository.DeleteUrlTrackerEntriesByNodeId(content.Id);
}
#if !DEBUG
catch (Exception ex)
{
ex.LogException();
}
#endif
}
}

void ContentService_Publishing(IPublishingStrategy sender, PublishEventArgs<IContent> e)
{
// When content is renamed or 'umbracoUrlName' property value is added/updated
foreach (IContent content in e.PublishedEntities)
{
#if !DEBUG
try
#endif
{
Node node = new Node(content.Id);
if (node.Name != content.Name && !string.IsNullOrEmpty(node.Name)) // If name is null, it's a new document
{
// Rename occurred
UrlTrackerRepository.AddUrlMapping(content, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.Renamed);

if (ClientTools != null)
ClientTools.ChangeContentFrameUrl(string.Concat("/umbraco/editContent.aspx?id=", content.Id));
}
if (content.HasProperty("umbracoUrlName"))
{
string contentUmbracoUrlNameValue = content.GetValue("umbracoUrlName") != null ? content.GetValue("umbracoUrlName").ToString() : string.Empty;
string nodeUmbracoUrlNameValue = node.GetProperty("umbracoUrlName") != null ? node.GetProperty("umbracoUrlName").Value : string.Empty;
if (contentUmbracoUrlNameValue != nodeUmbracoUrlNameValue)
{
// 'umbracoUrlName' property value added/changed
UrlTrackerRepository.AddUrlMapping(content, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.UrlOverwritten);

if (ClientTools != null)
ClientTools.ChangeContentFrameUrl(string.Concat("/umbraco/editContent.aspx?id=", content.Id));
}
}
if (UrlTrackerSettings.SEOMetadataInstalled && content.HasProperty(UrlTrackerSettings.SEOMetadataPropertyName))
{
string contentSEOMetadataValue = content.GetValue(UrlTrackerSettings.SEOMetadataPropertyName) != null ? content.GetValue(UrlTrackerSettings.SEOMetadataPropertyName).ToString() : string.Empty;
string nodeSEOMetadataValue = node.GetProperty(UrlTrackerSettings.SEOMetadataPropertyName) != null ? node.GetProperty(UrlTrackerSettings.SEOMetadataPropertyName).Value : string.Empty;
if (contentSEOMetadataValue != nodeSEOMetadataValue)
{
dynamic contentJson = JObject.Parse(contentSEOMetadataValue);
string contentUrlName = contentJson.urlName;

dynamic nodeJson = JObject.Parse(nodeSEOMetadataValue);
string nodeUrlName = nodeJson.urlName;

if (contentUrlName != nodeUrlName)
{
// SEOMetadata UrlName property value added/changed
UrlTrackerRepository.AddUrlMapping(content, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.UrlOverwrittenSEOMetadata);

if (ClientTools != null)
ClientTools.ChangeContentFrameUrl(string.Concat("/umbraco/editContent.aspx?id=", content.Id));
}
}
}
}
#if !DEBUG
catch (Exception ex)
{
ex.LogException();
}
#endif
}
}

void ContentService_Moving(IContentService sender, MoveEventArgs<IContent> e)
{
IContent content = e.Entity;
#if !DEBUG
try
#endif
{
if (content != null)
{
Node node = new Node(content.Id);

if (node != null && !string.IsNullOrEmpty(node.NiceUrl) && !content.Path.StartsWith("-1,-20")) // -1,-20 == Recycle bin | Not moved to recycle bin
UrlTrackerRepository.AddUrlMapping(content, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.Moved);
}
}
#if !DEBUG
catch (Exception ex)
{
ex.LogException();
}
#endif
}

#pragma warning disable 0618
void content_BeforeClearDocumentCache(Document doc, DocumentCacheEventArgs e)
#pragma warning restore
{
#if !DEBUG
try
#endif
{
UrlTrackerRepository.AddGoneEntryByNodeId(doc.Id);
}
#if !DEBUG
catch (Exception ex)
{
ex.LogException();
}
#endif
}

void Domain_New(Domain sender, NewEventArgs e)
{