2014-08-18 17:47:55 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
using Umbraco.Core.IO;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Models
|
|
|
|
|
|
{
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
|
//internal class PartialViewMacro : PartialView
|
|
|
|
|
|
//{
|
|
|
|
|
|
// public PartialViewMacro()
|
|
|
|
|
|
// : base(string.Empty)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// public PartialViewMacro(string path) : base(path)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// public IMacro AssociatedMacro { get; set; }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
2014-08-18 17:47:55 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents a Partial View file
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
[DataContract(IsReference = true)]
|
2015-01-09 19:15:01 +11:00
|
|
|
|
public class PartialView : File, IPartialView
|
2014-08-18 17:47:55 +02:00
|
|
|
|
{
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
|
//public PartialView(): base(string.Empty)
|
|
|
|
|
|
//{
|
|
|
|
|
|
//}
|
2014-08-18 17:47:55 +02:00
|
|
|
|
|
|
|
|
|
|
public PartialView(string path)
|
|
|
|
|
|
: base(path)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Path = path;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Boolean indicating whether the file could be validated
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>True if file is valid, otherwise false</returns>
|
|
|
|
|
|
public override bool IsValid()
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
|
{
|
|
|
|
|
|
//TODO: Why is this here? Needs to go on the FileService
|
|
|
|
|
|
|
|
|
|
|
|
var validatePath = IOHelper.ValidateEditPath(Path, new[] { SystemDirectories.MvcViews + "/Partials/", SystemDirectories.MvcViews + "/MacroPartials/" });
|
2014-08-19 12:51:07 +02:00
|
|
|
|
var verifyFileExtension = IOHelper.VerifyFileExtension(Path, new List<string> { "cshtml" });
|
|
|
|
|
|
|
|
|
|
|
|
return validatePath && verifyFileExtension;
|
2014-08-18 17:47:55 +02:00
|
|
|
|
}
|
Updates PartialView & PartialViewMacros models/services/repositories, streamlines their operations, fixes up other underlying problems with the FileRepository, fixes tree syncing for partial views, partial view macros and scripts, fixes scripts being created in folders, allows partial views and partial view macros to be managed and created in folders, fixes FileUnitOfWork to use a queue, publicizes some internal test classes, fixes tree syncing when dealing with invariant case, adds correct validation to the create dialogs of scripts and partial views (and partial view macros)
2014-10-22 16:44:45 +10:00
|
|
|
|
|
2014-08-18 17:47:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|