diff --git a/src/Umbraco.Tests/PluginManagerTests.cs b/src/Umbraco.Tests/PluginManagerTests.cs
index df7ede9de5..6f72b9d5ef 100644
--- a/src/Umbraco.Tests/PluginManagerTests.cs
+++ b/src/Umbraco.Tests/PluginManagerTests.cs
@@ -306,13 +306,6 @@ namespace Umbraco.Tests
Assert.AreEqual(7, apps.Count());
}
- [Test]
- public void Resolves_Action_Handlers()
- {
- var types = PluginManager.Current.ResolveActionHandlers();
- Assert.AreEqual(1, types.Count());
- }
-
[Test]
public void Resolves_DataTypes()
{
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index cf69164722..04e74bf30b 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -588,7 +588,6 @@
-
ASPXCodeBehind
@@ -936,9 +935,6 @@
Code
-
- Code
-
delete.aspx
ASPXCodeBehind
diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs
index 9bf99a3b15..5ee06f01d3 100644
--- a/src/Umbraco.Web/umbraco.presentation/content.cs
+++ b/src/Umbraco.Web/umbraco.presentation/content.cs
@@ -523,8 +523,6 @@ namespace umbraco
var cachedFieldKeyStart = string.Format("{0}{1}_", CacheKeys.ContentItemCacheKey, d.Id);
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(cachedFieldKeyStart);
- Action.RunActionHandlers(d, ActionPublish.Instance);
-
FireAfterUpdateDocumentCache(d, e);
}
}
@@ -552,10 +550,6 @@ namespace umbraco
ClearContextCache();
}
- foreach (Document d in Documents)
- {
- Action.RunActionHandlers(d, ActionPublish.Instance);
- }
}
///
@@ -636,12 +630,6 @@ namespace umbraco
}
}
- if (x != null)
- {
- // Run Handler
- Action.RunActionHandlers(doc, ActionUnPublish.Instance);
- }
-
//SD: changed to fire event BEFORE running the sitemap!! argh.
FireAfterClearDocumentCache(doc, e);
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/SimilarNodeNameComparer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/SimilarNodeNameComparer.cs
deleted file mode 100644
index 3b67907bd2..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/SimilarNodeNameComparer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace umbraco.ActionHandlers
-{
- ///
- /// Comparer that takes into account the duplicate index of a node name
- /// This is needed as a normal alphabetic sort would go Page (1), Page (10), Page (2) etc.
- ///
- [Obsolete("This class is no longer used and will be removed from the codebase in future versions")]
- public class SimilarNodeNameComparer : IComparer
- {
- public int Compare(string x, string y)
- {
- if (x.LastIndexOf(')') == x.Length - 1 && y.LastIndexOf(')') == y.Length - 1)
- {
- if (x.ToLower().Substring(0, x.LastIndexOf('(')) == y.ToLower().Substring(0, y.LastIndexOf('(')))
- {
- int xDuplicateIndex = ExtractDuplicateIndex(x);
- int yDuplicateIndex = ExtractDuplicateIndex(y);
-
- if (xDuplicateIndex != 0 && yDuplicateIndex != 0)
- {
- return xDuplicateIndex.CompareTo(yDuplicateIndex);
- }
- }
- }
- return x.ToLower().CompareTo(y.ToLower());
- }
-
- private int ExtractDuplicateIndex(string text)
- {
- int index = 0;
-
- if (text.LastIndexOf('(') != -1 && text.LastIndexOf('(') < text.Length - 2)
- {
- int startPos = text.LastIndexOf('(') + 1;
- int length = text.Length - 1 - startPos;
-
- int.TryParse(text.Substring(startPos, length), out index);
- }
-
- return index;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs
deleted file mode 100644
index 8a311aae44..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Linq;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using umbraco.cms.businesslogic.web;
-using umbraco.BusinessLogic.Actions;
-
-namespace umbraco.ActionHandlers
-{
- ///
- /// umbEnsureUniqueName is a standard Umbraco action handler.
- /// It ensures that new content nodes gets a unique name, and thereby avoiding conflictiong URLs.
- /// It can be disabled in the umbracoSettings.config file.
- ///
- [Obsolete("This handler is no longer used")]
- public class umbEnsureUniqueName : IActionHandler
- {
- public umbEnsureUniqueName()
- {
- }
- #region IActionHandler Members
-
- ///
- /// Actionhandler name
- ///
- ///
- public string HandlerName()
- {
- return "umbEnsureUniqueName";
- }
-
- ///
- /// Executes on the current document object when the specified actions occur
- ///
- /// The document object.
- /// The action.
- /// Returns true if successfull, otherwise false
- public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, interfaces.IAction action)
- {
-
- if (UmbracoConfig.For.UmbracoSettings().Content.EnsureUniqueNaming)
- {
- string currentName = documentObject.Text;
- int uniqueNumber = 1;
-
- // Check for all items underneath the parent to see if they match
- // as any new created documents are stored in the bottom, we can just
- // keep checking for other documents with a uniquenumber from
-
- //store children array here because iterating over an Array property object is very inneficient.
- var c = Document.GetChildrenBySearch(documentObject.ParentId, currentName + "%");
-
- // must sort the list or else duplicate name will exist if pages are out out sequence
- //e.g. Page (1), Page (3), Page (2)
- var results = c.OrderBy(x => x.Text, new SimilarNodeNameComparer());
- foreach (Document d in results)
- {
- if (d.Id != documentObject.Id && d.Text.ToLower() == currentName.ToLower())
- {
- currentName = documentObject.Text + " (" + uniqueNumber.ToString() + ")";
- uniqueNumber++;
- }
- }
-
- // if name has been changed, update the documentobject
- if (currentName != documentObject.Text)
- {
- // add name change to the log
- LogHelper.Debug("Title changed from '" + documentObject.Text + "' to '" + currentName + "' for document id" + documentObject.Id);
-
- documentObject.Text = currentName;
-
- return true;
- }
- }
-
- return false;
- }
-
- ///
- /// Returns a collection of Iactions this handler reacts on.
- /// The umbEnsureUniqueName handler reacts on ActionNew() actions by default.
- ///
- ///
- public interfaces.IAction[] ReturnActions()
- {
- interfaces.IAction[] _retVal = { };
- return _retVal;
- }
-
- #endregion
- }
-}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs
index da69599d44..208b2a9780 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs
@@ -32,8 +32,8 @@ namespace umbraco.dialogs
int docId;
if (int.TryParse(Request.QueryString["id"], out docId))
{
- var document = new Document(docId);
- BusinessLogic.Actions.Action.RunActionHandlers(document, ActionToPublish.Instance);
+
+ //TODO Send to publish!!
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs
index 9a9ccbd467..00d1cd76f4 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs
@@ -27,7 +27,7 @@ namespace umbraco.presentation.translation
{
public _default()
{
- CurrentApp = BusinessLogic.DefaultApps.translation.ToString();
+ CurrentApp = DefaultApps.translation.ToString();
}
protected void Page_Load(object sender, EventArgs e)
@@ -118,7 +118,7 @@ namespace umbraco.presentation.translation
{
try
{
- foreach (Task translation in importTranslatationFile(translationFileXml.FullName))
+ foreach (Task translation in ImportTranslatationFile(translationFileXml.FullName))
{
sb.Append("" + translation.Node.Text + " " + ui.Text("preview") + "");
@@ -142,7 +142,7 @@ namespace umbraco.presentation.translation
else
{
StringBuilder sb = new StringBuilder();
- List l = importTranslatationFile(tempFileName);
+ List l = ImportTranslatationFile(tempFileName);
if (l.Count == 1)
{
@@ -167,12 +167,7 @@ namespace umbraco.presentation.translation
}
}
- private void hideAll()
- {
- pane_uploadFile.Visible = false;
- pane_tasks.Visible = false;
- }
- private List importTranslatationFile(string tempFileName)
+ private List ImportTranslatationFile(string tempFileName)
{
try
{
@@ -200,9 +195,8 @@ namespace umbraco.presentation.translation
{
// update node contents
- Document d = new Document(t.Node.Id);
+ var d = new Document(t.Node.Id);
Document.Import(d.ParentId, getUser(), (XmlElement)taskNode);
- BusinessLogic.Actions.Action.RunActionHandlers(d, ActionTranslate.Instance);
/* d.Text = taskNode.Attributes.GetNamedItem("nodeName").Value.Trim();
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
index b18e34292f..a6e2d7e402 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
@@ -160,8 +160,6 @@ namespace umbraco.presentation.webservices
if (parentNode != null)
content.SortNodes(ref parentNode);
- // fire actionhandler, check for content
- BusinessLogic.Actions.Action.RunActionHandlers(new Document(parentId), ActionSort.Instance);
}
catch (Exception ex)
{
diff --git a/src/umbraco.cms/Actions/Action.cs b/src/umbraco.cms/Actions/Action.cs
index e29546d8ca..a4e7c097ce 100644
--- a/src/umbraco.cms/Actions/Action.cs
+++ b/src/umbraco.cms/Actions/Action.cs
@@ -33,7 +33,7 @@ namespace umbraco.BusinessLogic.Actions
[Obsolete("Actions and ActionHandlers are obsolete and should no longer be used")]
public class Action
{
- private static readonly List ActionHandlers = new List();
+
private static readonly Dictionary ActionJs = new Dictionary();
private static readonly object Lock = new object();
@@ -58,81 +58,14 @@ namespace umbraco.BusinessLogic.Actions
{
//TODO: Based on the above, this is a big hack as types should all be cleared on package install!
ActionsResolver.Reset(false); // and do NOT reset the whole resolution!
- ActionHandlers.Clear();
//TODO: Based on the above, this is a big hack as types should all be cleared on package install!
ActionsResolver.Current = new ActionsResolver(
() => TypeFinder.FindClassesOfType(PluginManager.Current.AssembliesToScan));
-
- RegisterIActionHandlers();
}
}
}
- ///
- /// Stores all IActionHandlers that have been loaded into memory into a list
- ///
- private static void RegisterIActionHandlers()
- {
- if (ActionHandlers.Count == 0)
- {
- ActionHandlers.AddRange(
- PluginManager.Current.CreateInstances(
- PluginManager.Current.ResolveActionHandlers()));
- }
-
- }
-
- ///
- /// Whenever an action is performed upon a document/media/member, this method is executed, ensuring that
- /// all registered handlers will have an oppotunity to handle the action.
- ///
- /// The document being operated on
- /// The action triggered
- public static void RunActionHandlers(Document d, IAction action)
- {
- foreach (IActionHandler ia in ActionHandlers)
- {
- try
- {
- foreach (IAction a in ia.ReturnActions())
- {
- if (a.Alias == action.Alias)
- {
- // Uncommented for auto publish support
- // System.Web.HttpContext.Current.Trace.Write("BusinessLogic.Action.RunActionHandlers", "Running " + ia.HandlerName() + " (matching action: " + a.Alias + ")");
- ia.Execute(d, action);
- }
- }
- }
- catch (Exception iaExp)
- {
- LogHelper.Error(string.Format("Error loading actionhandler '{0}'", ia.HandlerName()), iaExp);
- }
- }
-
- // Run notification
- // Find current user
- User u;
- try
- {
- u = User.GetCurrent();
- }
- catch
- {
- u = User.GetUser(0);
- }
- if (u == null)
- {
- //GE 2012-02-29
- //user will be null when using distributed calls
- //can't easily get the real publishing user to bubble all the way through the distributed call framework
- //so just check for it and set it to admin, so at least the notification gets sent
- u = User.GetUser(0);
- }
- Notification.GetNotifications(d, u, action);
- }
-
///
/// Jacascript for the contextmenu
/// Suggestion: this method should be moved to the presentation layer.
diff --git a/src/umbraco.cms/Actions/IActionHandler.cs b/src/umbraco.cms/Actions/IActionHandler.cs
deleted file mode 100644
index cc4fecd51c..0000000000
--- a/src/umbraco.cms/Actions/IActionHandler.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using umbraco.cms.businesslogic.web;
-using umbraco.interfaces;
-
-namespace umbraco.BusinessLogic.Actions
-{
- ///
- /// Implement the IActionHandler interface in order to automatically get code
- /// run whenever a document, member or media changed, deleted, created etc.
- /// The Clases implementing IActionHandler are loaded at runtime which means
- /// that there are no other setup when creating a custom actionhandler.
- ///
- ///
- ///
- ///
- [Obsolete("Legacy! Use events instead")]
- public interface IActionHandler
- {
- bool Execute(Document documentObject, IAction action);
- IAction[] ReturnActions();
- string HandlerName();
- }
-}
diff --git a/src/umbraco.cms/PluginManagerExtensions.cs b/src/umbraco.cms/PluginManagerExtensions.cs
index b0d50a7276..a51c0b3af0 100644
--- a/src/umbraco.cms/PluginManagerExtensions.cs
+++ b/src/umbraco.cms/PluginManagerExtensions.cs
@@ -15,16 +15,6 @@ namespace umbraco.cms
public static class PluginManagerExtensions
{
- ///
- /// Returns all available IActionHandler in application
- ///
- ///
- ///
- internal static IEnumerable ResolveActionHandlers(this PluginManager resolver)
- {
- return resolver.ResolveTypes();
- }
-
///
/// Returns all available IActions in application
///
diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs
index 0bf1160b59..547c338ca6 100644
--- a/src/umbraco.cms/businesslogic/web/Document.cs
+++ b/src/umbraco.cms/businesslogic/web/Document.cs
@@ -323,9 +323,6 @@ namespace umbraco.cms.businesslogic.web
// Log
LogHelper.Info(string.Format("New document {0}", d.Id));
- // Run Handler
- BusinessLogic.Actions.Action.RunActionHandlers(d, ActionNew.Instance);
-
// Save doc
d.Save();
@@ -761,9 +758,7 @@ namespace umbraco.cms.businesslogic.web
FireBeforeSendToPublish(e);
if (!e.Cancel)
{
- BusinessLogic.Log.Add(BusinessLogic.LogTypes.SendToPublish, u, this.Id, "");
-
- BusinessLogic.Actions.Action.RunActionHandlers(this, ActionToPublish.Instance);
+ Log.Add(LogTypes.SendToPublish, u, this.Id, "");
FireAfterSendToPublish(e);
return true;
@@ -1161,8 +1156,6 @@ namespace umbraco.cms.businesslogic.web
var content = ApplicationContext.Current.Services.ContentService.Copy(Content, CopyTo, RelateToOrignal, u.Id);
newDoc = new Document(content);
- // Have to run the ActionNew handler to do umbEnsureUniqueName (for example)
- BusinessLogic.Actions.Action.RunActionHandlers(newDoc, ActionNew.Instance);
// Then save to preserve any changes made by action handlers
newDoc.Save();
@@ -1578,7 +1571,6 @@ namespace umbraco.cms.businesslogic.web
if (!e.Cancel)
{
- umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance);
if (Content != null)
{
ApplicationContext.Current.Services.ContentService.Delete(Content);
@@ -1609,7 +1601,6 @@ namespace umbraco.cms.businesslogic.web
if (!e.Cancel)
{
- umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance);
UnPublish();
if (Content != null)
{
diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj
index 502acdff59..8ffb190744 100644
--- a/src/umbraco.cms/umbraco.cms.csproj
+++ b/src/umbraco.cms/umbraco.cms.csproj
@@ -207,7 +207,6 @@
Code
-