Added 'Restore' action class

+ menu option for items in the recycle bin.
This commit is contained in:
leekelleher
2014-06-09 17:56:33 +01:00
parent ef0ad41c8e
commit 0c7826b250
3 changed files with 94 additions and 0 deletions

View File

@@ -177,6 +177,7 @@ namespace Umbraco.Web.Trees
if (item.Path.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Contains(RecycleBinId.ToInvariantString()))
{
nodeMenu.DefaultMenuAlias = null;
nodeMenu.Items.Insert(2, new MenuItem(ActionRestore.Instance, ui.Text("actions", ActionRestore.Instance.Alias)));
}
else
{

View File

@@ -0,0 +1,92 @@
using System;
using umbraco.interfaces;
using umbraco.BasePages;
namespace umbraco.BusinessLogic.Actions
{
/// <summary>
/// This action is invoked when the content item is to be restored from the recycle bin
/// </summary>
public class ActionRestore : IAction
{
private static readonly ActionRestore m_instance = new ActionRestore();
/// <summary>
/// A public constructor exists ONLY for backwards compatibility in regards to 3rd party add-ons.
/// All Umbraco assemblies should use the singleton instantiation (this.Instance)
/// When this applicatio is refactored, this constuctor should be made private.
/// </summary>
[Obsolete("Use the singleton instantiation instead of a constructor")]
public ActionRestore() { }
public static ActionRestore Instance
{
get { return m_instance; }
}
#region IAction Members
public char Letter
{
get
{
return '8'; // TODO: Check if this char is available? Is it still used?
}
}
public string JsFunctionName
{
get
{
return null;
}
}
public string JsSource
{
get
{
return null;
}
}
public string Alias
{
get
{
return "restore";
}
}
public string Icon
{
get
{
return "undo";
}
}
public bool ShowInNotifier
{
get
{
return true;
}
}
public bool CanBePermissionAssigned
{
get
{
return true;
}
}
#endregion
}
}

View File

@@ -211,6 +211,7 @@
<Compile Include="Actions\ActionUnPublish.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Actions\ActionRestore.cs" />
<Compile Include="Actions\LegacyActionMenuItemAttribute.cs" />
<Compile Include="businesslogic\CMSPreviewNode.cs" />
<Compile Include="businesslogic\datatype\AbstractDataEditorControl.cs" />