Fixing unit tests
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Umbraco.Web.UI
|
|||||||
/// specific app, they'd still be able to execute code to create/delete for any ITask regardless of what app
|
/// specific app, they'd still be able to execute code to create/delete for any ITask regardless of what app
|
||||||
/// they have access to.
|
/// they have access to.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
[Obsolete("ITask is used for legacy webforms back office editors, change to using the v7 angular approach")]
|
||||||
public abstract class LegacyDialogTask : ITaskReturnUrl, IAssignedApp
|
public abstract class LegacyDialogTask : ITaskReturnUrl, IAssignedApp
|
||||||
{
|
{
|
||||||
public virtual int ParentID { get; set; }
|
public virtual int ParentID { get; set; }
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ using Umbraco.Core.CodeAnnotations;
|
|||||||
using Umbraco.Core.IO;
|
using Umbraco.Core.IO;
|
||||||
using Umbraco.Core.Logging;
|
using Umbraco.Core.Logging;
|
||||||
using Umbraco.Web.Mvc;
|
using Umbraco.Web.Mvc;
|
||||||
|
using Umbraco.Web.UI;
|
||||||
using umbraco.BasePages;
|
using umbraco.BasePages;
|
||||||
using Umbraco.Core;
|
using Umbraco.Core;
|
||||||
|
using umbraco.BusinessLogic;
|
||||||
|
|
||||||
namespace umbraco
|
namespace umbraco
|
||||||
{
|
{
|
||||||
@@ -13,13 +15,10 @@ namespace umbraco
|
|||||||
/// The UI 'tasks' for the create dialog and delete processes
|
/// The UI 'tasks' for the create dialog and delete processes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")]
|
[UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")]
|
||||||
public class PartialViewMacroTasks : interfaces.ITaskReturnUrl
|
public class PartialViewMacroTasks : LegacyDialogTask
|
||||||
{
|
{
|
||||||
private string _alias;
|
private string _returnUrl = "";
|
||||||
private int _parentId;
|
|
||||||
private int _typeId;
|
|
||||||
private int _userId;
|
|
||||||
|
|
||||||
protected virtual string EditViewFile
|
protected virtual string EditViewFile
|
||||||
{
|
{
|
||||||
get { return "Settings/Views/EditView.aspx"; }
|
get { return "Settings/Views/EditView.aspx"; }
|
||||||
@@ -35,34 +34,11 @@ namespace umbraco
|
|||||||
get { return "MacroPartials"; }
|
get { return "MacroPartials"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int UserId
|
public override bool PerformSave()
|
||||||
{
|
{
|
||||||
set { _userId = value; }
|
var pipesIndex = Alias.IndexOf("|||", System.StringComparison.Ordinal);
|
||||||
}
|
var template = Alias.Substring(0, pipesIndex).Trim();
|
||||||
public int TypeID
|
var fileName = Alias.Substring(pipesIndex + 3, Alias.Length - pipesIndex - 3) + ".cshtml";
|
||||||
{
|
|
||||||
set { _typeId = value; }
|
|
||||||
get { return _typeId; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public string Alias
|
|
||||||
{
|
|
||||||
set { _alias = value; }
|
|
||||||
get { return _alias; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ParentID
|
|
||||||
{
|
|
||||||
set { _parentId = value; }
|
|
||||||
get { return _parentId; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Save()
|
|
||||||
{
|
|
||||||
var pipesIndex = _alias.IndexOf("|||", System.StringComparison.Ordinal);
|
|
||||||
var template = _alias.Substring(0, pipesIndex).Trim();
|
|
||||||
var fileName = _alias.Substring(pipesIndex + 3, _alias.Length - pipesIndex - 3) + ".cshtml";
|
|
||||||
|
|
||||||
var fullFilePath = IOHelper.MapPath(BasePath + fileName);
|
var fullFilePath = IOHelper.MapPath(BasePath + fileName);
|
||||||
|
|
||||||
@@ -97,27 +73,29 @@ namespace umbraco
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete()
|
public override string ReturnUrl
|
||||||
{
|
{
|
||||||
var path = IOHelper.MapPath(BasePath + _alias.TrimStart('/'));
|
get { return _returnUrl; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string AssignedApp
|
||||||
|
{
|
||||||
|
get { return DefaultApps.developer.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool PerformDelete()
|
||||||
|
{
|
||||||
|
var path = IOHelper.MapPath(BasePath + Alias.TrimStart('/'));
|
||||||
|
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
File.Delete(path);
|
File.Delete(path);
|
||||||
else if (Directory.Exists(path))
|
else if (Directory.Exists(path))
|
||||||
Directory.Delete(path, true);
|
Directory.Delete(path, true);
|
||||||
|
|
||||||
LogHelper.Info<PartialViewTasks>(string.Format("{0} Deleted by user {1}", _alias, UmbracoEnsuredPage.CurrentUser.Id));
|
LogHelper.Info<PartialViewTasks>(string.Format("{0} Deleted by user {1}", Alias, User.Id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ITaskReturnUrl Members
|
|
||||||
private string _returnUrl = "";
|
|
||||||
public string ReturnUrl
|
|
||||||
{
|
|
||||||
get { return _returnUrl; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,4 +107,4 @@ namespace umbraco
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace umbraco.interfaces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Summary description for ITask.
|
/// Summary description for ITask.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("ITask is used for legacy webforms back office editors, change to using the v7 angular approach")]
|
||||||
public interface ITask
|
public interface ITask
|
||||||
{
|
{
|
||||||
int ParentID {set; get;}
|
int ParentID {set; get;}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
namespace umbraco.interfaces
|
namespace umbraco.interfaces
|
||||||
{
|
{
|
||||||
|
[Obsolete("ITask is used for legacy webforms back office editors, change to using the v7 angular approach")]
|
||||||
public interface ITaskReturnUrl : ITask
|
public interface ITaskReturnUrl : ITask
|
||||||
{
|
{
|
||||||
string ReturnUrl {get;}
|
string ReturnUrl {get;}
|
||||||
|
|||||||
Reference in New Issue
Block a user