WIP WIP WIP. Started working on U4-5648 which led to quite a lot of other things, once IDataType was removed (U4-5858), this lead to U4-5546, U4-5416, U4-5484, U4-5805. So much of this stuff is etched deep into the codebase, so nice to get rid of it. Had to remove the codefirst tests too for now since they relied on old apis and we don't really support it/use it. Commented out all of the code relating to the document type editor UI bits since they need to be rewritten and removed.
This commit is contained in:
@@ -296,10 +296,7 @@ namespace Umbraco.Core
|
||||
|
||||
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
|
||||
() => PluginManager.Current.ResolveCacheRefreshers());
|
||||
|
||||
DataTypesResolver.Current = new DataTypesResolver(
|
||||
() => PluginManager.Current.ResolveDataTypes());
|
||||
|
||||
|
||||
MacroFieldEditorsResolver.Current = new MacroFieldEditorsResolver(
|
||||
() => PluginManager.Current.ResolveMacroRenderings());
|
||||
|
||||
@@ -313,9 +310,6 @@ namespace Umbraco.Core
|
||||
MigrationResolver.Current = new MigrationResolver(
|
||||
() => PluginManager.Current.ResolveTypes<IMigration>());
|
||||
|
||||
// todo: remove once we drop IPropertyEditorValueConverter support.
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
PluginManager.Current.ResolvePropertyEditorValueConverters());
|
||||
|
||||
// need to filter out the ones we dont want!!
|
||||
PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver(
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// A resolver to return all IDataType objects
|
||||
/// </summary>
|
||||
[Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")]
|
||||
internal sealed class DataTypesResolver : LegacyTransientObjectsResolver<DataTypesResolver, IDataType>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="dataTypes"></param>
|
||||
internal DataTypesResolver(Func<IEnumerable<Type>> dataTypes)
|
||||
: base(dataTypes)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="ICacheRefresher"/> implementations.
|
||||
/// </summary>
|
||||
public IEnumerable<IDataType> DataTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureIsInitialized();
|
||||
return Values;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Guid GetUniqueIdentifier(IDataType obj)
|
||||
{
|
||||
return obj.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,21 +32,6 @@ namespace Umbraco.Core.Models
|
||||
private string _propertyEditorAlias;
|
||||
private DataTypeDatabaseType _databaseType;
|
||||
|
||||
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the alternative contructor that specifies an alias")]
|
||||
public DataTypeDefinition(int parentId, Guid controlId)
|
||||
{
|
||||
_parentId = parentId;
|
||||
|
||||
_propertyEditorAlias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(controlId, false);
|
||||
if (_propertyEditorAlias == null)
|
||||
{
|
||||
//convert to Label!
|
||||
LogHelper.Warn<DataTypeDefinition>("Could not find a GUID -> Alias mapping for the legacy property editor with id " + controlId + ". The DataType has been converted to a Label.");
|
||||
_propertyEditorAlias = Constants.PropertyEditors.NoEditAlias;
|
||||
}
|
||||
|
||||
_additionalData = new Dictionary<string, object>();
|
||||
}
|
||||
public DataTypeDefinition(int parentId, string propertyEditorAlias)
|
||||
{
|
||||
_parentId = parentId;
|
||||
@@ -205,27 +190,6 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Id of the DataType control
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead. This method will return a generated GUID for any property editor alias not explicitly mapped to a legacy ID")]
|
||||
public Guid ControlId
|
||||
{
|
||||
get
|
||||
{
|
||||
return LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(
|
||||
_propertyEditorAlias, LegacyPropertyEditorIdToAliasConverter.NotFoundLegacyIdResponseBehavior.GenerateId).Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(value, true);
|
||||
PropertyEditorAlias = alias;
|
||||
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
|
||||
_additionalData["ControlId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the DatabaseType for which the DataType's value is saved as
|
||||
/// </summary>
|
||||
|
||||
@@ -10,12 +10,6 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
string PropertyEditorAlias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of the DataType control
|
||||
/// </summary>
|
||||
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead")]
|
||||
Guid ControlId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the DatabaseType for which the DataType's value is saved as
|
||||
/// </summary>
|
||||
|
||||
@@ -170,8 +170,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
_converter = null;
|
||||
|
||||
//get all converters for this property type
|
||||
// todo: remove Union() once we drop IPropertyEditorValueConverter support.
|
||||
var foundConverters = converters.Union(GetCompatConverters()).Where(x => x.IsConverter(this)).ToArray();
|
||||
var foundConverters = converters.Where(x => x.IsConverter(this)).ToArray();
|
||||
if (foundConverters.Length == 1)
|
||||
{
|
||||
_converter = foundConverters[0];
|
||||
@@ -357,43 +356,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
|
||||
#endregion
|
||||
|
||||
#region Compat
|
||||
|
||||
// backward-compatibility: support IPropertyEditorValueConverter while we have to
|
||||
// todo: remove once we drop IPropertyEditorValueConverter support.
|
||||
|
||||
IEnumerable<IPropertyValueConverter> GetCompatConverters()
|
||||
{
|
||||
var propertyEditorGuid = LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(PropertyEditorAlias, LegacyPropertyEditorIdToAliasConverter.NotFoundLegacyIdResponseBehavior.ReturnNull);
|
||||
return PropertyEditorValueConvertersResolver.HasCurrent && propertyEditorGuid.HasValue
|
||||
? PropertyEditorValueConvertersResolver.Current.Converters
|
||||
.Where(x => x.IsConverterFor(propertyEditorGuid.Value, ContentType.Alias, PropertyTypeAlias))
|
||||
.Select(x => new CompatConverter(x))
|
||||
: Enumerable.Empty<IPropertyValueConverter>();
|
||||
}
|
||||
|
||||
private class CompatConverter : PropertyValueConverterBase
|
||||
{
|
||||
private readonly IPropertyEditorValueConverter _converter;
|
||||
|
||||
public CompatConverter(IPropertyEditorValueConverter converter)
|
||||
{
|
||||
_converter = converter;
|
||||
}
|
||||
|
||||
public override bool IsConverter(PublishedPropertyType propertyType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
|
||||
{
|
||||
// NOTE: ignore preview, because IPropertyEditorValueConverter does not support it
|
||||
return _converter.ConvertPropertyValue(source).Result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Detached
|
||||
|
||||
|
||||
@@ -14,6 +14,5 @@ namespace Umbraco.Core.Packaging.Models
|
||||
public IEnumerable<IMacro> ConflictingMacroAliases { get; set; }
|
||||
public IEnumerable<ITemplate> ConflictingTemplateAliases { get; set; }
|
||||
public IEnumerable<IFile> ConflictingStylesheetNames { get; set; }
|
||||
public IEnumerable<string> AssembliesWithLegacyPropertyEditors { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -447,7 +447,6 @@ namespace Umbraco.Core.Packaging
|
||||
|
||||
installWarnings.UnsecureFiles = FindUnsecureFiles(sourceDestination);
|
||||
installWarnings.FilesReplaced = FindFilesToBeReplaced(sourceDestination);
|
||||
installWarnings.AssembliesWithLegacyPropertyEditors = FindLegacyPropertyEditors(packagePath, sourceDestination);
|
||||
|
||||
return installWarnings;
|
||||
}
|
||||
@@ -456,20 +455,7 @@ namespace Umbraco.Core.Packaging
|
||||
{
|
||||
return sourceDestination.Where(sd => File.Exists(Path.Combine(FullPathToRoot, sd.Value))).ToArray();
|
||||
}
|
||||
|
||||
private IEnumerable<string> FindLegacyPropertyEditors(string packagePath, IEnumerable<KeyValuePair<string, string>> sourceDestinationPair)
|
||||
{
|
||||
var dlls = sourceDestinationPair.Where(
|
||||
sd => (Path.GetExtension(sd.Value) ?? string.Empty).Equals(".dll", StringComparison.InvariantCultureIgnoreCase)).Select(sd => sd.Key).ToArray();
|
||||
|
||||
if (dlls.Any() == false) { return new List<string>(); }
|
||||
|
||||
// Now we want to see if the DLLs contain any legacy data types since we want to warn people about that
|
||||
string[] assemblyErrors;
|
||||
IEnumerable<byte[]> assemblyesToScan =_packageExtraction.ReadFilesFromArchive(packagePath, dlls);
|
||||
return PackageBinaryInspector.ScanAssembliesForTypeReference<IDataType>(assemblyesToScan, out assemblyErrors).ToArray();
|
||||
}
|
||||
|
||||
|
||||
private KeyValuePair<string, string>[] FindUnsecureFiles(IEnumerable<KeyValuePair<string, string>> sourceDestinationPair)
|
||||
{
|
||||
return sourceDestinationPair.Where(sd => IsFileDestinationUnsecure(sd.Value)).ToArray();
|
||||
|
||||
@@ -510,24 +510,8 @@ namespace Umbraco.Core
|
||||
return ResolveTypes<ICacheRefresher>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all available IPropertyEditorValueConverter
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal IEnumerable<Type> ResolvePropertyEditorValueConverters()
|
||||
{
|
||||
return ResolveTypes<IPropertyEditorValueConverter>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all available IDataType in application
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal IEnumerable<Type> ResolveDataTypes()
|
||||
{
|
||||
return ResolveTypes<IDataType>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns all available IMacroGuiRendering in application
|
||||
/// </summary>
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This is used purelty to attempt to maintain some backwards compatibility with new property editors that don't have a
|
||||
/// legacy property editor predecessor when developers are using the legacy APIs
|
||||
/// </summary>
|
||||
internal class BackwardsCompatibleData : IData, IDataValueSetter
|
||||
{
|
||||
private readonly string _propertyEditorAlias;
|
||||
private bool _valueLoaded = false;
|
||||
private object _value;
|
||||
|
||||
public BackwardsCompatibleData(string propertyEditorAlias)
|
||||
{
|
||||
_propertyEditorAlias = propertyEditorAlias;
|
||||
}
|
||||
|
||||
public int PropertyId { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// This returns the value
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There's code here to load the data from the db just like the legacy DefaultData does but in theory the value of this
|
||||
/// IData should always be set using the IDataValueSetter.SetValue which is done externally. Just in case there's some edge
|
||||
/// case out there that doesn't set this value, we'll go and get it based on the same logic in DefaultData.
|
||||
/// </remarks>
|
||||
public virtual object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
//Lazy load the value when it is required.
|
||||
if (_valueLoaded == false)
|
||||
{
|
||||
LoadValueFromDatabase();
|
||||
_valueLoaded = true;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
_valueLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public XmlNode ToXMl(XmlDocument data)
|
||||
{
|
||||
//we'll get the property editor by alias, if it exists (which it absolutely should), then we'll have to create a
|
||||
// fake 'Property' object and pass it to the ConvertDbToXml method so we can get the correct XML fragment that
|
||||
// it needs to make.
|
||||
var propertyEditor = PropertyEditorResolver.Current.GetByAlias(_propertyEditorAlias);
|
||||
if (propertyEditor != null)
|
||||
{
|
||||
//create a 'fake' property - we will never know the actual db type here so we'll just make it nvarchar, this shouldn't
|
||||
// make any difference for the conversion process though.
|
||||
var property = new Property(new PropertyType(_propertyEditorAlias, DataTypeDatabaseType.Nvarchar))
|
||||
{
|
||||
Id = PropertyId,
|
||||
Value = Value
|
||||
};
|
||||
var xd = new XmlDocument();
|
||||
var xNode = propertyEditor.ValueEditor.ConvertDbToXml(property, property.PropertyType, ApplicationContext.Current.Services.DataTypeService);
|
||||
|
||||
//check if this xml fragment can be converted to an XmlNode
|
||||
var xContainer = xNode as XContainer;
|
||||
if (xContainer != null)
|
||||
{
|
||||
//imports to the document
|
||||
xContainer.GetXmlNode(xd);
|
||||
// return the XML node.
|
||||
return data.ImportNode(xd.DocumentElement, true);
|
||||
}
|
||||
|
||||
return ReturnCDataElement(data);
|
||||
}
|
||||
|
||||
//if for some reason the prop editor wasn't found we'll default to returning the string value in a CDATA block.
|
||||
return ReturnCDataElement(data);
|
||||
}
|
||||
|
||||
private XmlNode ReturnCDataElement(XmlDocument doc)
|
||||
{
|
||||
var sValue = Value != null ? Value.ToString() : string.Empty;
|
||||
return doc.CreateCDataSection(sValue);
|
||||
}
|
||||
|
||||
public void MakeNew(int propertyId)
|
||||
{
|
||||
//DO nothing
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
typeof(IData)
|
||||
+ " is a legacy object and is not supported by runtime generated "
|
||||
+ " instances to maintain backwards compatibility with the legacy APIs. Consider upgrading your code to use the new Services APIs.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is here for performance reasons since in some cases we will have already resolved the value from the db
|
||||
/// and want to just give this object the value so it doesn't go re-look it up from the database.
|
||||
/// </summary>
|
||||
/// <param name="val"></param>
|
||||
/// <param name="strDbType"></param>
|
||||
void IDataValueSetter.SetValue(object val, string strDbType)
|
||||
{
|
||||
_value = val;
|
||||
_valueLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In the case where the value is not set, this will go get it from the db ourselves - this shouldn't really ever be needed,
|
||||
/// the value should always be set with IDataValueSetter.SetValue
|
||||
/// </summary>
|
||||
private void LoadValueFromDatabase()
|
||||
{
|
||||
var sql = new Sql();
|
||||
sql.Select("*")
|
||||
.From<PropertyDataDto>()
|
||||
.InnerJoin<PropertyTypeDto>()
|
||||
.On<PropertyTypeDto, PropertyDataDto>(x => x.Id, y => y.PropertyTypeId)
|
||||
.InnerJoin<DataTypeDto>()
|
||||
.On<DataTypeDto, PropertyTypeDto>(x => x.DataTypeId, y => y.DataTypeId)
|
||||
.Where<PropertyDataDto>(x => x.Id == PropertyId);
|
||||
var dto = ApplicationContext.Current.DatabaseContext.Database.Fetch<PropertyDataDto, PropertyTypeDto, DataTypeDto>(sql).FirstOrDefault();
|
||||
|
||||
if (dto != null)
|
||||
{
|
||||
//get the value for the data type, if null, set it to an empty string
|
||||
_value = dto.GetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using System;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This is used purelty to attempt to maintain some backwards compatibility with new property editors that don't have a
|
||||
/// legacy property editor predecessor when developers are using the legacy APIs
|
||||
/// </summary>
|
||||
internal class BackwardsCompatibleDataType : IDataType
|
||||
{
|
||||
public Guid Id { get; private set; }
|
||||
public string DataTypeName { get; private set; }
|
||||
public IData Data { get; private set; }
|
||||
public int DataTypeDefinitionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a runtime instance
|
||||
/// </summary>
|
||||
/// <param name="propEdAlias"></param>
|
||||
/// <param name="legacyId"></param>
|
||||
/// <param name="dataTypeDefId"></param>
|
||||
/// <returns></returns>
|
||||
internal static BackwardsCompatibleDataType Create(string propEdAlias, Guid legacyId, int dataTypeDefId)
|
||||
{
|
||||
var dt = new BackwardsCompatibleDataType
|
||||
{
|
||||
Id = legacyId,
|
||||
DataTypeName = propEdAlias,
|
||||
DataTypeDefinitionId = dataTypeDefId,
|
||||
Data = new BackwardsCompatibleData(propEdAlias)
|
||||
};
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
public IDataEditor DataEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
typeof(IDataEditor)
|
||||
+ " is a legacy object and is not supported by runtime generated "
|
||||
+ typeof(IDataType)
|
||||
+ " instances to maintain backwards compatibility with the legacy APIs. Consider upgrading your code to use the new Services APIs.");
|
||||
}
|
||||
}
|
||||
public IDataPrevalue PrevalueEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
typeof(IDataPrevalue)
|
||||
+ " is a legacy object and is not supported by runtime generated "
|
||||
+ typeof(IDataType)
|
||||
+ " instances to maintain backwards compatibility with the legacy APIs. Consider upgrading your code to use the new Services APIs.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors
|
||||
{
|
||||
/// Maps a property source value to a data object.
|
||||
/// </summary>
|
||||
// todo: drop IPropertyEditorValueConverter support (when?).
|
||||
[Obsolete("Use IPropertyValueConverter.")]
|
||||
public interface IPropertyEditorValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether this provider applies to the specified property.
|
||||
/// </summary>
|
||||
/// <param name="datatypeGuid">A Guid identifying the property datatype.</param>
|
||||
/// <param name="contentTypeAlias">The content type alias.</param>
|
||||
/// <param name="propertyTypeAlias">The property alias.</param>
|
||||
/// <returns>True if this provider applies to the specified property.</returns>
|
||||
bool IsConverterFor(Guid datatypeGuid, string contentTypeAlias, string propertyTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to convert a source value specified into a property model.
|
||||
/// </summary>
|
||||
/// <param name="sourceValue">The source value.</param>
|
||||
/// <returns>An <c>Attempt</c> representing the result of the conversion.</returns>
|
||||
/// <remarks>The source value is dependent on the content cache. With the Xml content cache it
|
||||
/// is always a string, but with other caches it may be an object (numeric, time...) matching
|
||||
/// what is in the database. Be prepared.</remarks>
|
||||
Attempt<object> ConvertPropertyValue(object sourceValue);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages the list of IPropertyEditorValueConverter's
|
||||
/// </summary>
|
||||
internal sealed class PropertyEditorValueConvertersResolver : ManyObjectsResolverBase<PropertyEditorValueConvertersResolver, IPropertyEditorValueConverter>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PropertyEditorValueConvertersResolver"/> class with
|
||||
/// an initial list of converter types.
|
||||
/// </summary>
|
||||
/// <param name="converters">The list of converter types</param>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal PropertyEditorValueConvertersResolver(IEnumerable<Type> converters)
|
||||
: base(converters)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PropertyEditorValueConvertersResolver"/> class with
|
||||
/// an initial list of converter types.
|
||||
/// </summary>
|
||||
/// <param name="converters">The list of converter types</param>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal PropertyEditorValueConvertersResolver(params Type[] converters)
|
||||
: base(converters)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the converteres.
|
||||
/// </summary>
|
||||
public IEnumerable<IPropertyEditorValueConverter> Converters
|
||||
{
|
||||
get { return Values; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,26 +355,6 @@ namespace Umbraco.Core.Services
|
||||
Audit.Add(AuditTypes.Delete, string.Format("Delete DataTypeDefinition performed by user"), userId, dataTypeDefinition.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IDataType"/> specified by it's unique ID
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType, which corresponds to the Guid Id of the control</param>
|
||||
/// <returns><see cref="IDataType"/> object</returns>
|
||||
[Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")]
|
||||
public IDataType GetDataTypeById(Guid id)
|
||||
{
|
||||
return DataTypesResolver.Current.GetById(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a complete list of all registered <see cref="IDataType"/>'s
|
||||
/// </summary>
|
||||
/// <returns>An enumerable list of <see cref="IDataType"/> objects</returns>
|
||||
[Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")]
|
||||
public IEnumerable<IDataType> GetAllDataTypes()
|
||||
{
|
||||
return DataTypesResolver.Current.DataTypes;
|
||||
}
|
||||
|
||||
#region Event Handlers
|
||||
/// <summary>
|
||||
|
||||
@@ -63,21 +63,6 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="userId">Id of the user issueing the deletion</param>
|
||||
void Delete(IDataTypeDefinition dataTypeDefinition, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IDataType"/> specified by it's unique ID
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType, which corresponds to the Guid Id of the control</param>
|
||||
/// <returns><see cref="IDataType"/> object</returns>
|
||||
[Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")]
|
||||
IDataType GetDataTypeById(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a complete list of all registered <see cref="IDataType"/>'s
|
||||
/// </summary>
|
||||
/// <returns>An enumerable list of <see cref="IDataType"/> objects</returns>
|
||||
[Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")]
|
||||
IEnumerable<IDataType> GetAllDataTypes();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// </summary>
|
||||
|
||||
@@ -515,9 +515,6 @@ namespace Umbraco.Core.Services
|
||||
//If no DataTypeDefinition with the guid from the xml wasn't found OR the ControlId on the DataTypeDefinition didn't match the DataType Id
|
||||
//We look up a DataTypeDefinition that matches
|
||||
|
||||
//we'll check if it is a GUID (legacy id for a property editor)
|
||||
var legacyPropertyEditorId = Guid.Empty;
|
||||
Guid.TryParse(property.Element("Type").Value, out legacyPropertyEditorId);
|
||||
//get the alias as a string for use below
|
||||
var propertyEditorAlias = property.Element("Type").Value.Trim();
|
||||
|
||||
@@ -526,22 +523,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
if (dataTypeDefinition == null)
|
||||
{
|
||||
var dataTypeDefinitions = legacyPropertyEditorId != Guid.Empty
|
||||
? _dataTypeService.GetDataTypeDefinitionByControlId(legacyPropertyEditorId)
|
||||
: _dataTypeService.GetDataTypeDefinitionByPropertyEditorAlias(propertyEditorAlias);
|
||||
if (dataTypeDefinitions != null && dataTypeDefinitions.Any())
|
||||
{
|
||||
dataTypeDefinition = dataTypeDefinitions.First();
|
||||
}
|
||||
}
|
||||
else if (legacyPropertyEditorId != Guid.Empty && dataTypeDefinition.ControlId != legacyPropertyEditorId)
|
||||
{
|
||||
var dataTypeDefinitions = _dataTypeService.GetDataTypeDefinitionByControlId(legacyPropertyEditorId);
|
||||
var dataTypeDefinitions = _dataTypeService.GetDataTypeDefinitionByPropertyEditorAlias(propertyEditorAlias);
|
||||
if (dataTypeDefinitions != null && dataTypeDefinitions.Any())
|
||||
{
|
||||
dataTypeDefinition = dataTypeDefinitions.First();
|
||||
}
|
||||
}
|
||||
|
||||
else if (dataTypeDefinition.PropertyEditorAlias != propertyEditorAlias)
|
||||
{
|
||||
var dataTypeDefinitions = _dataTypeService.GetDataTypeDefinitionByPropertyEditorAlias(propertyEditorAlias);
|
||||
@@ -736,29 +724,14 @@ namespace Umbraco.Core.Services
|
||||
? databaseTypeAttribute.Value.EnumParse<DataTypeDatabaseType>(true)
|
||||
: DataTypeDatabaseType.Ntext;
|
||||
|
||||
//check if the Id was a GUID, that means it is referenced using the legacy property editor GUID id
|
||||
if (legacyPropertyEditorId != Guid.Empty)
|
||||
//the Id field is actually the string property editor Alias
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, dataTypeElement.Attribute("Id").Value.Trim())
|
||||
{
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, legacyPropertyEditorId)
|
||||
{
|
||||
Key = dataTypeDefinitionId,
|
||||
Name = dataTypeDefinitionName,
|
||||
DatabaseType = databaseType
|
||||
};
|
||||
dataTypes.Add(dataTypeDefinitionName, dataTypeDefinition);
|
||||
}
|
||||
else
|
||||
{
|
||||
//the Id field is actually the string property editor Alias
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, dataTypeElement.Attribute("Id").Value.Trim())
|
||||
{
|
||||
Key = dataTypeDefinitionId,
|
||||
Name = dataTypeDefinitionName,
|
||||
DatabaseType = databaseType
|
||||
};
|
||||
dataTypes.Add(dataTypeDefinitionName, dataTypeDefinition);
|
||||
}
|
||||
|
||||
Key = dataTypeDefinitionId,
|
||||
Name = dataTypeDefinitionName,
|
||||
DatabaseType = databaseType
|
||||
};
|
||||
dataTypes.Add(dataTypeDefinitionName, dataTypeDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ namespace Umbraco.Core.Standalone
|
||||
|
||||
base.InitializeApplicationRootPath(_baseDirectory);
|
||||
|
||||
// this is only here to ensure references to the assemblies needed for
|
||||
// the DataTypesResolver otherwise they won't be loaded into the AppDomain.
|
||||
var interfacesAssemblyName = typeof(IDataType).Assembly.FullName;
|
||||
}
|
||||
|
||||
protected override void InitializeApplicationEventsResolver()
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
<Compile Include="Persistence\SqlSyntax\SqlServerSyntax.cs" />
|
||||
<Compile Include="Persistence\SqlSyntax\SqlServerVersionName.cs" />
|
||||
<Compile Include="Persistence\SqlSyntax\SqlSyntaxProviderExtensions.cs" />
|
||||
<Compile Include="PropertyEditors\LegacyPropertyEditorIdToAliasConverter.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyCacheValue.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyValueCacheAttribute.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyValueTypeAttribute.cs" />
|
||||
@@ -561,12 +562,9 @@
|
||||
<Compile Include="Persistence\Repositories\Interfaces\ITagRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\MacroRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\TagRepository.cs" />
|
||||
<Compile Include="PropertyEditors\BackwardsCompatibleData.cs" />
|
||||
<Compile Include="PropertyEditors\BackwardsCompatibleDataType.cs" />
|
||||
<Compile Include="PropertyEditors\EmailValidator.cs" />
|
||||
<Compile Include="PropertyEditors\IParameterEditor.cs" />
|
||||
<Compile Include="PropertyEditors\LegacyParameterEditorAliasConverter.cs" />
|
||||
<Compile Include="PropertyEditors\LegacyPropertyEditorIdToAliasConverter.cs" />
|
||||
<Compile Include="Persistence\Mappers\MapperForAttribute.cs" />
|
||||
<Compile Include="Persistence\Mappers\MemberMapper.cs" />
|
||||
<Compile Include="Persistence\Mappers\MemberTypeMapper.cs" />
|
||||
@@ -967,7 +965,6 @@
|
||||
<Compile Include="ObjectResolution\WeightedPluginAttribute.cs" />
|
||||
<Compile Include="Persistence\PetaPoco.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\DatePickerValueConverter.cs" />
|
||||
<Compile Include="PropertyEditors\IPropertyEditorValueConverter.cs" />
|
||||
<Compile Include="Dynamics\ParseException.cs" />
|
||||
<Compile Include="Dynamics\PropertyResult.cs" />
|
||||
<Compile Include="Dynamics\Res.cs" />
|
||||
@@ -978,7 +975,6 @@
|
||||
<Compile Include="CacheRefreshersResolver.cs" />
|
||||
<Compile Include="Configuration\GlobalSettings.cs" />
|
||||
<Compile Include="CustomBooleanTypeConverter.cs" />
|
||||
<Compile Include="DataTypesResolver.cs" />
|
||||
<Compile Include="DisposableObject.cs" />
|
||||
<Compile Include="DisposableTimer.cs" />
|
||||
<Compile Include="ExpressionHelper.cs" />
|
||||
@@ -993,7 +989,6 @@
|
||||
<Compile Include="Macros\MacroFieldEditorsResolver.cs" />
|
||||
<Compile Include="Macros\PersistableMacroProperty.cs" />
|
||||
<Compile Include="ObjectExtensions.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyEditorValueConvertersResolver.cs" />
|
||||
<Compile Include="ObjectResolution\ManyObjectsResolverBase.cs" />
|
||||
<Compile Include="ObjectResolution\ObjectLifetimeScope.cs" />
|
||||
<Compile Include="ObjectResolution\Resolution.cs" />
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]
|
||||
public class AliasAttribute : Attribute
|
||||
{
|
||||
public AliasAttribute(string @alias)
|
||||
{
|
||||
Alias = alias;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Alias of the Property
|
||||
/// </summary>
|
||||
public string Alias { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets an optional name of the Property
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
public class ContentTypeAttribute : Attribute
|
||||
{
|
||||
public ContentTypeAttribute(string @alias)
|
||||
{
|
||||
Alias = alias;
|
||||
|
||||
IconUrl = "folder.gif";
|
||||
Thumbnail = "folder.png";
|
||||
Description = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Alias of the ContentType
|
||||
/// </summary>
|
||||
public string Alias { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional Name of the ContentType
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional Description of the ContentType
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional IconUrl of the ContentType
|
||||
/// </summary>
|
||||
public string IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional Thumbnail of the ContentType
|
||||
/// </summary>
|
||||
public string Thumbnail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional array of Allowed Child ContentTypes of the ContentType
|
||||
/// </summary>
|
||||
public Type[] AllowedChildContentTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional array of Allowed Template names of the ContentType
|
||||
/// </summary>
|
||||
public string[] AllowedTemplates { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class DescriptionAttribute : Attribute
|
||||
{
|
||||
public DescriptionAttribute(string description)
|
||||
{
|
||||
Description = description;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Description of the Property
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]
|
||||
public class MixinAttribute : Attribute
|
||||
{
|
||||
public MixinAttribute(Type type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Type of the implementing class
|
||||
/// </summary>
|
||||
public Type Type { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.CodeFirst.Definitions;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class Numeric : PropertyTypeAttribute
|
||||
{
|
||||
public Numeric(string dataTypeName)
|
||||
: base(typeof(IntegerPropertyEditor))
|
||||
{
|
||||
DataTypeName = dataTypeName;
|
||||
DatabaseType = DataTypeDatabaseType.Integer;
|
||||
}
|
||||
|
||||
public string DataTypeName { get; set; }
|
||||
|
||||
public string PreValue { get; set; }
|
||||
|
||||
public override PropertyDefinition GetPropertyConvention()
|
||||
{
|
||||
var definition = new PropertyDefinition();
|
||||
|
||||
definition.Mandatory = Mandatory;
|
||||
definition.ValidationRegExp = string.IsNullOrEmpty(ValidationRegExp) ? ValidationRegExp : string.Empty;
|
||||
definition.PropertyGroup = string.IsNullOrEmpty(PropertyGroup) ? "Generic Properties" : PropertyGroup;
|
||||
definition.DataTypeDefinition = Conventions.CreateDataTypeDefinitionFromAttribute(this, DataTypeName);
|
||||
|
||||
if(string.IsNullOrEmpty(PreValue) == false)
|
||||
{
|
||||
//TODO - test inserting a prevalue when a DataTypeDefinition has been created, as its currently throwing a foreignkey constraint error.
|
||||
Conventions.CreatePrevalueForDataTypeDefinition(definition.DataTypeDefinition.Id, PreValue, 0, string.Empty);
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.CodeFirst.Definitions;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class PropertyTypeAttribute : PropertyTypeConventionAttribute
|
||||
{
|
||||
public PropertyTypeAttribute(Type type)
|
||||
{
|
||||
Type = type;
|
||||
PropertyGroup = "Generic Properties";
|
||||
Mandatory = false;
|
||||
ValidationRegExp = string.Empty;
|
||||
DatabaseType = DataTypeDatabaseType.Nvarchar;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Type of the DataType
|
||||
/// </summary>
|
||||
public Type Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Database Type to use for the chosen DataType.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that the DatabaseType only needs to be set when
|
||||
/// creating a new DataType definition.
|
||||
/// </remarks>
|
||||
public DataTypeDatabaseType DatabaseType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name of the PropertyGroup that this PropertyType belongs to
|
||||
/// </summary>
|
||||
public string PropertyGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean indicating that a value is required for this PropertyType
|
||||
/// </summary>
|
||||
public bool Mandatory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Regular Expression for validating PropertyType's values
|
||||
/// </summary>
|
||||
public string ValidationRegExp { get; set; }
|
||||
|
||||
public override PropertyDefinition GetPropertyConvention()
|
||||
{
|
||||
var definition = new PropertyDefinition();
|
||||
|
||||
definition.Mandatory = Mandatory;
|
||||
definition.ValidationRegExp = string.IsNullOrEmpty(ValidationRegExp) ? ValidationRegExp : string.Empty;
|
||||
definition.PropertyGroup = string.IsNullOrEmpty(PropertyGroup) ? "Generic Properties" : PropertyGroup;
|
||||
definition.DataTypeDefinition = Conventions.GetDataTypeDefinitionByAttributeOrType(this, Type);
|
||||
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Tests.CodeFirst.Definitions;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public abstract class PropertyTypeConventionAttribute : Attribute
|
||||
{
|
||||
public abstract PropertyDefinition GetPropertyConvention();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class RichtextAttribute : PropertyTypeAttribute
|
||||
{
|
||||
public RichtextAttribute()
|
||||
: base(typeof(RichTextPropertyEditor))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
public class SortOrderAttribute : Attribute
|
||||
{
|
||||
public SortOrderAttribute(int order)
|
||||
{
|
||||
Order = order;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sort order of the Property
|
||||
/// </summary>
|
||||
public int Order { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Tests.CodeFirst.Definitions;
|
||||
using Umbraco.Tests.CodeFirst.TestModels;
|
||||
using Umbraco.Tests.CodeFirst.TestModels.Composition;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
[DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)]
|
||||
[TestFixture]
|
||||
public class CodeFirstTests : BaseDatabaseFactoryTest
|
||||
{
|
||||
[SetUp]
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
//LegacyUmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
|
||||
base.Initialize();
|
||||
|
||||
var jsonNetSerializer = new JsonNetSerializer();
|
||||
SerializationService = new SerializationService(jsonNetSerializer);
|
||||
}
|
||||
|
||||
[Ignore("With the changes to the data type definition GUID -> Alias this no longer passes, will need Morten's help with this one")]
|
||||
[Test]
|
||||
public void Can_Create_Model_With_NonExisting_DataTypeDefinition()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var modelType = typeof(ModelWithNewDataType);
|
||||
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
|
||||
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes();
|
||||
ServiceContext.ContentTypeService.Save(mappedContentTypes);
|
||||
|
||||
var model = ServiceContext.ContentTypeService.GetContentType(NodeDto.NodeIdSeed + 1);
|
||||
Assert.That(model, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_ContentType_From_Decorated_Home_Model()
|
||||
{
|
||||
var modelType = typeof(Home);
|
||||
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
|
||||
|
||||
Assert.That(contentType, Is.Not.Null);
|
||||
Assert.That(contentType.Value.PropertyGroups, Is.Not.Null);
|
||||
Assert.That(contentType.Value.PropertyTypes.Any(), Is.True);
|
||||
Assert.That(contentType.Value.PropertyTypes.Count(), Is.EqualTo(2));
|
||||
|
||||
var result = SerializationService.ToStream(contentType.Value);
|
||||
var json = result.ResultStream.ToJsonString();
|
||||
Console.WriteLine(json);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_ContentType_From_Decorated_ContentPage_Model()
|
||||
{
|
||||
var modelType = typeof(ContentPage);
|
||||
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
|
||||
|
||||
Assert.That(contentType, Is.Not.Null);
|
||||
Assert.That(contentType.Value.PropertyGroups, Is.Not.Null);
|
||||
Assert.That(contentType.Value.PropertyGroups.Any(), Is.True);
|
||||
Assert.That(contentType.Value.PropertyGroups.Count(), Is.EqualTo(1));
|
||||
Assert.That(contentType.Value.PropertyTypes.Any(), Is.True);
|
||||
Assert.That(contentType.Value.PropertyTypes.Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_ContentType_From_PlainPocoType_Model()
|
||||
{
|
||||
var modelType = typeof(PlainPocoType);
|
||||
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
|
||||
|
||||
Assert.That(contentType, Is.Not.Null);
|
||||
Assert.That(contentType.Value.PropertyGroups, Is.Not.Null);
|
||||
Assert.That(contentType.Value.PropertyTypes.Any(), Is.True);
|
||||
Assert.That(contentType.Value.PropertyGroups.Count(), Is.EqualTo(1));
|
||||
Assert.That(contentType.Value.PropertyTypes.Count(), Is.EqualTo(5));
|
||||
|
||||
var result = SerializationService.ToStream(contentType.Value);
|
||||
var json = result.ResultStream.ToJsonString();
|
||||
Console.WriteLine(json);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Retrieve_ContentTypes_After_Resolving()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var modelType = typeof(Home);
|
||||
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes();
|
||||
|
||||
Assert.That(mappedContentTypes, Is.Not.Null);
|
||||
Assert.That(mappedContentTypes.Any(), Is.True);
|
||||
Assert.That(mappedContentTypes.Count(), Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_Existing_ContentType_With_Decorated_Model()
|
||||
{
|
||||
var textPage = MockedContentTypes.CreateTextpageContentType();
|
||||
ServiceContext.ContentTypeService.Save(textPage);
|
||||
|
||||
var modelType = typeof(TextPage);
|
||||
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
|
||||
|
||||
Assert.That(contentType.Value.Id, Is.EqualTo(textPage.Id));
|
||||
|
||||
ServiceContext.ContentTypeService.Save(contentType.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Save_Models_To_Database()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var homeModel = typeof(Home);
|
||||
var textPageModel = typeof(TextPage);
|
||||
var homeContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(homeModel);
|
||||
var textPageContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(textPageModel);
|
||||
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes().ToList();
|
||||
ServiceContext.ContentTypeService.Save(mappedContentTypes);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_Parent_Child_ContentTypes_And_Save_To_Database()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var simplemodel = typeof(SimpleContentPage);
|
||||
var model = typeof(AdvancedContentPage);
|
||||
var sContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(simplemodel);
|
||||
var aContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(model);
|
||||
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes().ToList();
|
||||
ServiceContext.ContentTypeService.Save(mappedContentTypes);
|
||||
|
||||
var type1 = ServiceContext.ContentTypeService.GetContentType(NodeDto.NodeIdSeed);
|
||||
var type2 = ServiceContext.ContentTypeService.GetContentType(NodeDto.NodeIdSeed + 1);
|
||||
|
||||
Assert.That(type1, Is.Not.Null);
|
||||
Assert.That(type2, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_And_Save_Decorated_Model_To_Database()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var model = typeof(DecoratedModelPage);
|
||||
var modelContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(model);
|
||||
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes().ToList();
|
||||
ServiceContext.ContentTypeService.Save(mappedContentTypes);
|
||||
|
||||
var type1 = ServiceContext.ContentTypeService.GetContentType(NodeDto.NodeIdSeed + 2);
|
||||
|
||||
Assert.That(type1, Is.Not.Null);
|
||||
Assert.That(type1.PropertyGroups.Count(), Is.EqualTo(2));
|
||||
Assert.That(type1.PropertyTypes.Count(), Is.EqualTo(4));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Resolve_ContentType_Composition_And_Save_To_Database()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var metaSeoModel = typeof(MetaSeo);
|
||||
var seoContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(metaSeoModel);
|
||||
var metaModel = typeof(Meta);
|
||||
var metaContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(metaModel);
|
||||
var baseModel = typeof(Base);
|
||||
var baseContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(baseModel);
|
||||
var newsModel = typeof(News);
|
||||
var newsContentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(newsModel);
|
||||
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes().ToList();
|
||||
ServiceContext.ContentTypeService.Save(mappedContentTypes);
|
||||
|
||||
Assert.That(mappedContentTypes.Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
[Ignore("This now fails due to the new constraints on the db tables: A duplicate value cannot be inserted into a unique index. [ Table name = cmsPropertyTypeGroup,Constraint name = PK_cmsPropertyTypeGroup ]")]
|
||||
[Test]
|
||||
public void Can_Resolve_Full_List_Of_Models_Implementing_ContentTypeBase()
|
||||
{
|
||||
ContentTypeDefinitionFactory.ClearContentTypeCache();
|
||||
|
||||
var foundTypes = PluginManager.Current.ResolveContentTypeBaseTypes();
|
||||
var contentTypeList = foundTypes.Select(ContentTypeDefinitionFactory.GetContentTypeDefinition).ToList();
|
||||
|
||||
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes();
|
||||
|
||||
Assert.That(contentTypeList.Count(), Is.EqualTo(mappedContentTypes.Count()));
|
||||
|
||||
ServiceContext.ContentTypeService.Save(mappedContentTypes);//Save to db
|
||||
}
|
||||
|
||||
private SerializationService SerializationService { get; set; }
|
||||
|
||||
[TearDown]
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
SerializationService = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Dynamics;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
public abstract class ContentTypeBase
|
||||
{
|
||||
private IPublishedContent _content;
|
||||
|
||||
protected ContentTypeBase(){}
|
||||
|
||||
internal IPublishedContent Content
|
||||
{
|
||||
set { _content = value; }
|
||||
}
|
||||
|
||||
#region Standard IPublisedContent properties
|
||||
|
||||
public IPublishedContent Parent
|
||||
{
|
||||
get { return _content.Parent; }
|
||||
}
|
||||
|
||||
public int Id
|
||||
{
|
||||
get { return _content.Id; }
|
||||
}
|
||||
public int TemplateId
|
||||
{
|
||||
get { return _content.TemplateId; }
|
||||
}
|
||||
public int SortOrder
|
||||
{
|
||||
get { return _content.SortOrder; }
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get { return _content.Name; }
|
||||
}
|
||||
public string UrlName
|
||||
{
|
||||
get { return _content.UrlName; }
|
||||
}
|
||||
public string DocumentTypeAlias
|
||||
{
|
||||
get { return _content.DocumentTypeAlias; }
|
||||
}
|
||||
public int DocumentTypeId
|
||||
{
|
||||
get { return _content.DocumentTypeId; }
|
||||
}
|
||||
public string WriterName
|
||||
{
|
||||
get { return _content.WriterName; }
|
||||
}
|
||||
public string CreatorName
|
||||
{
|
||||
get { return _content.CreatorName; }
|
||||
}
|
||||
public int WriterId
|
||||
{
|
||||
get { return _content.WriterId; }
|
||||
}
|
||||
public int CreatorId
|
||||
{
|
||||
get { return _content.CreatorId; }
|
||||
}
|
||||
public string Path
|
||||
{
|
||||
get { return _content.Path; }
|
||||
}
|
||||
public DateTime CreateDate
|
||||
{
|
||||
get { return _content.CreateDate; }
|
||||
}
|
||||
public DateTime UpdateDate
|
||||
{
|
||||
get { return _content.UpdateDate; }
|
||||
}
|
||||
public Guid Version
|
||||
{
|
||||
get { return _content.Version; }
|
||||
}
|
||||
public int Level
|
||||
{
|
||||
get { return _content.Level; }
|
||||
}
|
||||
|
||||
//Using this attribute to hide Properties from Intellisense (when compiled?)
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public ICollection<IPublishedProperty> Properties
|
||||
{
|
||||
get { return _content.Properties; }
|
||||
}
|
||||
|
||||
//Using this attribute to hide Properties from Intellisense (when compiled?)
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public IEnumerable<IPublishedContent> Children
|
||||
{
|
||||
get { return _content.Children; }
|
||||
}
|
||||
|
||||
//Using this attribute to hide Properties from Intellisense (when compiled?)
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public IPublishedProperty GetProperty(string alias)
|
||||
{
|
||||
return _content.GetProperty(alias);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Strongly typed queries
|
||||
public IEnumerable<T> ChildrenOfType<T>() where T : ContentTypeBase, new ()
|
||||
{
|
||||
var docTypeAlias = typeof (T).Name;
|
||||
return _content.Children
|
||||
.Where(x => x.DocumentTypeAlias == docTypeAlias)
|
||||
.Select(ContentTypeMapper.Map<T>);
|
||||
}
|
||||
public IEnumerable<T> Descendants<T>() where T : ContentTypeBase, new ()
|
||||
{
|
||||
var docTypeAlias = typeof(T).Name;
|
||||
return _content.Children.Map(x => true, (IPublishedContent n) => n.Children)
|
||||
.Where(x => x.DocumentTypeAlias == docTypeAlias)
|
||||
.Select(ContentTypeMapper.Map<T>);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class ContentTypeBaseExtensions
|
||||
{
|
||||
public static IEnumerable<T> Children<T>(this ContentTypeBase contentTypeBase)
|
||||
where T : ContentTypeBase, new()
|
||||
{
|
||||
var docTypeAlias = typeof(T).Name;
|
||||
return contentTypeBase.Children
|
||||
.Where(x => x.DocumentTypeAlias == docTypeAlias)
|
||||
.Select(ContentTypeMapper.Map<T>);
|
||||
}
|
||||
|
||||
public static IEnumerable<TSource> Map<TSource>(
|
||||
this IEnumerable<TSource> source,
|
||||
Func<TSource, bool> selectorFunction,
|
||||
Func<TSource, IEnumerable<TSource>> getChildrenFunction)
|
||||
{
|
||||
if (!source.Any())
|
||||
{
|
||||
return source;
|
||||
}
|
||||
// Add what we have to the stack
|
||||
var flattenedList = source.Where(selectorFunction);
|
||||
// Go through the input enumerable looking for children,
|
||||
// and add those if we have them
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
var secondInner = getChildrenFunction(element);
|
||||
if (secondInner.Any())
|
||||
{
|
||||
secondInner = secondInner.Map(selectorFunction, getChildrenFunction);
|
||||
}
|
||||
flattenedList = flattenedList.Concat(secondInner);
|
||||
}
|
||||
return flattenedList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
public static class ContentTypeMapper
|
||||
{
|
||||
public static T Map<T>(IPublishedContent content) where T : ContentTypeBase, new()
|
||||
{
|
||||
//TODO Verify passed in type T against DocumentType name/alias
|
||||
//TODO Cache mapped properties?
|
||||
|
||||
T mapped = new T();
|
||||
mapped.Content = content;
|
||||
|
||||
var propertyInfos = typeof(T).GetProperties();
|
||||
|
||||
foreach (var property in content.Properties)
|
||||
{
|
||||
var @alias = property.PropertyTypeAlias.ToLowerInvariant();
|
||||
|
||||
var propertyInfo = propertyInfos.FirstOrDefault(x => x.Name.ToLowerInvariant() == @alias);
|
||||
if (propertyInfo == null) continue;
|
||||
|
||||
object value = null;
|
||||
//TODO Proper mapping of types
|
||||
if (propertyInfo.PropertyType == typeof(string))
|
||||
value = property.Value;
|
||||
else if (propertyInfo.PropertyType == typeof(DateTime))
|
||||
value = DateTime.Parse(property.Value.ToString());
|
||||
else if (propertyInfo.PropertyType == typeof(Boolean))
|
||||
{
|
||||
if (String.IsNullOrEmpty(property.Value.ToString()) || property.Value == "0")
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
}
|
||||
|
||||
propertyInfo.SetValue(mapped, value, null);
|
||||
}
|
||||
|
||||
return mapped;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,387 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Definitions
|
||||
{
|
||||
public static class ContentTypeDefinitionFactory
|
||||
{
|
||||
private static ConcurrentDictionary<string, DependencyField> _contentTypeCache = new ConcurrentDictionary<string, DependencyField>();
|
||||
|
||||
public static Lazy<IContentType> GetContentTypeDefinition(Type modelType)
|
||||
{
|
||||
//Check for BaseType different from ContentTypeBase
|
||||
bool hasParent = modelType.BaseType != null && modelType.BaseType != typeof(ContentTypeBase) && modelType.BaseType != typeof(object);
|
||||
var parent = new Lazy<IContentType>();
|
||||
if(hasParent)
|
||||
{
|
||||
var isResolved = _contentTypeCache.ContainsKey(modelType.BaseType.FullName);
|
||||
parent = isResolved
|
||||
? _contentTypeCache[modelType.BaseType.FullName].ContentType
|
||||
: GetContentTypeDefinition(modelType.BaseType);
|
||||
}
|
||||
|
||||
var contentTypeAttribute = modelType.FirstAttribute<ContentTypeAttribute>();
|
||||
var contentTypeAlias = contentTypeAttribute == null ? modelType.Name.ToUmbracoAlias() : contentTypeAttribute.Alias;
|
||||
//Check if ContentType already exists by looking it up by Alias.
|
||||
var existing = ApplicationContext.Current.Services.ContentTypeService.GetContentType(contentTypeAlias);
|
||||
|
||||
Lazy<IContentType> contentType = contentTypeAttribute == null
|
||||
? PlainPocoConvention(modelType, existing)
|
||||
: ContentTypeConvention(contentTypeAttribute, modelType, existing);
|
||||
|
||||
//Check for interfaces that'll be used for ContentTypeComposition
|
||||
var mixins = GetAliasesFromTypeInterfaces(modelType);
|
||||
|
||||
var definitions = new List<PropertyDefinition>();
|
||||
int order = 0;
|
||||
var objProperties = modelType.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList();
|
||||
foreach (var propertyInfo in objProperties)
|
||||
{
|
||||
var propertyTypeAttribute = propertyInfo.FirstAttribute<PropertyTypeConventionAttribute>();
|
||||
var definition = propertyTypeAttribute == null
|
||||
? new PropertyDefinition()
|
||||
: propertyTypeAttribute.GetPropertyConvention();
|
||||
|
||||
//DataTypeDefinition fallback
|
||||
if(definition.DataTypeDefinition == null)
|
||||
{
|
||||
definition.DataTypeDefinition = Conventions.GetDataTypeDefinitionByAttributeOrType(null, propertyInfo.PropertyType);
|
||||
}
|
||||
|
||||
if(string.IsNullOrEmpty(definition.PropertyGroup))
|
||||
{
|
||||
definition.PropertyGroup = "Generic Properties";
|
||||
}
|
||||
|
||||
//Alias fallback
|
||||
if (string.IsNullOrEmpty(definition.Alias))
|
||||
{
|
||||
var aliasAttribute = propertyInfo.FirstAttribute<AliasAttribute>();
|
||||
definition.Alias = Conventions.GetPropertyTypeAlias(aliasAttribute, propertyInfo.Name);
|
||||
definition.Name = Conventions.GetPropertyTypeName(aliasAttribute, propertyInfo.Name);
|
||||
}
|
||||
|
||||
//Description fallback
|
||||
if (string.IsNullOrEmpty(definition.Description))
|
||||
{
|
||||
var descriptionAttribute = propertyInfo.FirstAttribute<DescriptionAttribute>();
|
||||
definition.Description = descriptionAttribute != null
|
||||
? descriptionAttribute.Description
|
||||
: string.Empty;
|
||||
}
|
||||
|
||||
//SortOrder fallback
|
||||
if (definition.Order == default(int))
|
||||
{
|
||||
var sortOrderAttribute = propertyInfo.FirstAttribute<SortOrderAttribute>();
|
||||
definition.Order = sortOrderAttribute != null ? sortOrderAttribute.Order : order;
|
||||
}
|
||||
|
||||
definitions.Add(definition);
|
||||
order++;
|
||||
}
|
||||
|
||||
//Loop through definitions for PropertyGroups and create those that not already exists
|
||||
var groupDefinitions = definitions.DistinctBy(d => d.PropertyGroup);
|
||||
foreach (var groupDefinition in groupDefinitions)
|
||||
{
|
||||
var groupExists = contentType.Value.PropertyGroups.Contains(groupDefinition.PropertyGroup);
|
||||
if(groupExists == false)
|
||||
{
|
||||
var propertyGroup = new PropertyGroup {Name = groupDefinition.PropertyGroup};
|
||||
contentType.Value.PropertyGroups.Add(propertyGroup);
|
||||
}
|
||||
}
|
||||
|
||||
//Loop through definitions for PropertyTypes and add them to the correct PropertyGroup
|
||||
foreach (var definition in definitions)
|
||||
{
|
||||
var group = contentType.Value.PropertyGroups.First(x => x.Name == definition.PropertyGroup);
|
||||
//Check if a PropertyType with the same alias already exists, as we don't want to override existing ones
|
||||
if(group.PropertyTypes.Contains(definition.Alias)) continue;
|
||||
|
||||
var propertyType = new PropertyType(definition.DataTypeDefinition)
|
||||
{
|
||||
Mandatory = definition.Mandatory,
|
||||
ValidationRegExp = definition.ValidationRegExp,
|
||||
SortOrder = definition.Order,
|
||||
Alias = definition.Alias,
|
||||
Name = definition.Name
|
||||
};
|
||||
|
||||
group.PropertyTypes.Add(propertyType);
|
||||
}
|
||||
|
||||
//If current ContentType has a Parent the ParentId should be set and the ContentType added to the composition.
|
||||
if(hasParent)
|
||||
{
|
||||
contentType.Value.SetLazyParentId(new Lazy<int>(() => parent.Value.Id));
|
||||
contentType.Value.AddContentType(parent.Value);
|
||||
}
|
||||
//Add the resolved ContentType to the internal cache
|
||||
var field = new DependencyField {ContentType = contentType, Alias = contentType.Value.Alias};
|
||||
var dependencies = new List<string>();
|
||||
//If current type has a parent (inherited model) we add the alias of that type as a dependency
|
||||
if(hasParent)
|
||||
{
|
||||
dependencies.Add(parent.Value.Alias);
|
||||
}
|
||||
//Check ContentType for existing 'Allowed ContentTypes'
|
||||
if(contentType.Value.AllowedContentTypes.Any())
|
||||
{
|
||||
dependencies.AddRange(contentType.Value.AllowedContentTypes.Select(allowed => allowed.Alias));
|
||||
}
|
||||
//Check for interfaces with AliasAttribute and add those as dependencies
|
||||
//NOTE: might also be an idea to check if ContentType has already been created/added to cache that implements the interface.
|
||||
if(mixins.Any())
|
||||
{
|
||||
foreach (var mixin in mixins)
|
||||
{
|
||||
if(dependencies.Contains(mixin.Item1)) continue;
|
||||
|
||||
dependencies.Add(mixin.Item1);
|
||||
var isMixinResolved = _contentTypeCache.ContainsKey(mixin.Item2);
|
||||
|
||||
Lazy<IContentType> compositionType = null;
|
||||
|
||||
if (isMixinResolved)
|
||||
{
|
||||
compositionType = _contentTypeCache[mixin.Item2].ContentType;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetContentTypeDefinition(mixin.Item3);
|
||||
compositionType = _contentTypeCache[mixin.Item2].ContentType;
|
||||
}
|
||||
|
||||
contentType.Value.AddContentType(compositionType.Value);
|
||||
}
|
||||
}
|
||||
field.DependsOn = dependencies.ToArray();
|
||||
_contentTypeCache.AddOrUpdate(modelType.FullName, field, (x, y) => field);
|
||||
return contentType;
|
||||
}
|
||||
|
||||
|
||||
private static int[] GetTopologicalSortOrder(IList<DependencyField> fields)
|
||||
{
|
||||
var g = new TopologicalSorter(fields.Count());
|
||||
var _indexes = new Dictionary<string, int>();
|
||||
|
||||
//add vertices
|
||||
for (int i = 0; i < fields.Count(); i++)
|
||||
{
|
||||
_indexes[fields[i].Alias.ToLower()] = g.AddVertex(i);
|
||||
}
|
||||
|
||||
//add edges
|
||||
for (int i = 0; i < fields.Count; i++)
|
||||
{
|
||||
if (fields[i].DependsOn != null)
|
||||
{
|
||||
for (int j = 0; j < fields[i].DependsOn.Length; j++)
|
||||
{
|
||||
g.AddEdge(i,
|
||||
_indexes[fields[i].DependsOn[j].ToLower()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int[] result = g.Sort();
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//public static IEnumerable<Lazy<IContentType>> RetrieveMappedContentTypes()
|
||||
public static IEnumerable<IContentType> RetrieveMappedContentTypes()
|
||||
{
|
||||
var fields = _contentTypeCache.Select(x => x.Value).ToList();
|
||||
int[] sortOrder = GetTopologicalSortOrder(fields);
|
||||
//var list = new List<Lazy<IContentType>>();
|
||||
var list = new List<IContentType>();
|
||||
for (int i = 0; i < sortOrder.Length; i++)
|
||||
{
|
||||
var field = fields[sortOrder[i]];
|
||||
list.Add(field.ContentType.Value);
|
||||
Console.WriteLine(field.Alias);
|
||||
if (field.DependsOn != null)
|
||||
foreach (var item in field.DependsOn)
|
||||
{
|
||||
Console.WriteLine(" -{0}", item);
|
||||
}
|
||||
}
|
||||
list.Reverse();
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void ClearContentTypeCache()
|
||||
{
|
||||
_contentTypeCache.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a list of aliases that correspond to the interfaces on the passed in type,
|
||||
/// which are attributed with the AliasAttribute.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The modelType is also used to ensure that the implementing class doesn't reference
|
||||
/// itself via its interface.
|
||||
/// </remarks>
|
||||
/// <param name="modelType">Type of the model to retrieve interface aliases from</param>
|
||||
/// <returns>An enumerable list of strings with aliases</returns>
|
||||
private static IEnumerable<Tuple<string, string, Type>> GetAliasesFromTypeInterfaces(Type modelType)
|
||||
{
|
||||
var interfaces = modelType.GetInterfaces().ToList().Distinct();
|
||||
var list = new List<Tuple<string, string, Type>>();
|
||||
|
||||
foreach (var interfaceType in interfaces)
|
||||
{
|
||||
var mixinAttribute = interfaceType.FirstAttribute<MixinAttribute>();
|
||||
if (mixinAttribute != null)
|
||||
{
|
||||
if(mixinAttribute.Type == modelType) continue;
|
||||
var contentTypeAttribute = mixinAttribute.Type.FirstAttribute<ContentTypeAttribute>();
|
||||
var contentTypeAlias = contentTypeAttribute == null ? mixinAttribute.Type.Name.ToUmbracoAlias() : contentTypeAttribute.Alias;
|
||||
var tuple = new Tuple<string, string, Type>(contentTypeAlias, mixinAttribute.Type.FullName, mixinAttribute.Type);
|
||||
list.Add(tuple);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention that converts a class decorated with the ContentTypeAttribute to an initial ContentType
|
||||
/// </summary>
|
||||
/// <param name="attribute"><see cref="ContentTypeAttribute"/> to use for mapping a <see cref="IContentType"/></param>
|
||||
/// <param name="modelType">Type of the current class</param>
|
||||
/// <param name="existing"> </param>
|
||||
/// <returns>A Lazy <see cref="IContentType"/></returns>
|
||||
private static Lazy<IContentType> ContentTypeConvention(ContentTypeAttribute attribute, Type modelType, IContentType existing)
|
||||
{
|
||||
var children = attribute.AllowedChildContentTypes == null
|
||||
? new List<ContentTypeSort>()
|
||||
: AllowedChildContentTypesConvention(
|
||||
attribute.AllowedChildContentTypes, modelType);
|
||||
|
||||
var templates = attribute.AllowedTemplates == null
|
||||
? new List<ITemplate>()
|
||||
: AllowedTemplatesConvention(attribute.AllowedTemplates);
|
||||
|
||||
if(existing != null)
|
||||
{
|
||||
if (children.Any())
|
||||
existing.AllowedContentTypes = children;
|
||||
|
||||
if (templates.Any())
|
||||
existing.AllowedTemplates = templates;
|
||||
|
||||
return new Lazy<IContentType>(() => existing);
|
||||
}
|
||||
|
||||
var contentType = new ContentType(-1)
|
||||
{
|
||||
Alias = attribute.Alias,
|
||||
Description = attribute.Description,
|
||||
Icon = attribute.IconUrl,
|
||||
Thumbnail = attribute.Thumbnail,
|
||||
Name = string.IsNullOrEmpty(attribute.Name)
|
||||
? modelType.Name.SplitPascalCasing()
|
||||
: attribute.Name,
|
||||
AllowedContentTypes = children,
|
||||
AllowedTemplates = templates
|
||||
};
|
||||
|
||||
return new Lazy<IContentType>(() => contentType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention to resolve referenced templates
|
||||
/// </summary>
|
||||
/// <param name="templateNames"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<ITemplate> AllowedTemplatesConvention(IEnumerable<string> templateNames)
|
||||
{
|
||||
var templates = new List<ITemplate>();
|
||||
var engine = UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine;
|
||||
foreach (var templateName in templateNames)
|
||||
{
|
||||
var @alias = engine == RenderingEngine.Mvc
|
||||
? templateName.Replace(".cshtml", "").Replace(".vbhtml", "")
|
||||
: templateName.Replace(".masterpage", "");
|
||||
|
||||
var template = ApplicationContext.Current.Services.FileService.GetTemplate(@alias);
|
||||
if(template == null)
|
||||
{
|
||||
var name = engine == RenderingEngine.Mvc
|
||||
? string.Concat(@alias, ".cshtml")
|
||||
: string.Concat(@alias, ".masterpage");
|
||||
|
||||
template = new Template(string.Empty, name, @alias) { CreatorId = 0, Content = string.Empty};
|
||||
ApplicationContext.Current.Services.FileService.SaveTemplate(template);
|
||||
}
|
||||
templates.Add(template);
|
||||
}
|
||||
return templates;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention to resolve referenced child content types
|
||||
/// </summary>
|
||||
/// <param name="types"></param>
|
||||
/// <param name="currentType"> </param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<ContentTypeSort> AllowedChildContentTypesConvention(IEnumerable<Type> types, Type currentType)
|
||||
{
|
||||
var contentTypeSorts = new List<ContentTypeSort>();
|
||||
int order = 0;
|
||||
foreach (var type in types)
|
||||
{
|
||||
if(type == currentType) continue;//If the referenced type is equal to the current type we skip it to avoid a circular dependency
|
||||
|
||||
var contentTypeSort = new ContentTypeSort();
|
||||
var isResolved = _contentTypeCache.ContainsKey(type.FullName);
|
||||
var lazy = isResolved ? _contentTypeCache[type.FullName].ContentType : GetContentTypeDefinition(type);
|
||||
contentTypeSort.Id = new Lazy<int>(() => lazy.Value.Id);
|
||||
contentTypeSort.Alias = lazy.Value.Alias;
|
||||
contentTypeSort.SortOrder = order;
|
||||
contentTypeSorts.Add(contentTypeSort);
|
||||
order++;
|
||||
}
|
||||
return contentTypeSorts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention that converts a simple POCO to an initial ContentType
|
||||
/// </summary>
|
||||
/// <param name="modelType">Type of the object to map to a <see cref="IContentType"/></param>
|
||||
/// <param name="existing"> </param>
|
||||
/// <returns>A Lazy <see cref="IContentType"/></returns>
|
||||
private static Lazy<IContentType> PlainPocoConvention(Type modelType, IContentType existing)
|
||||
{
|
||||
if(existing != null)
|
||||
return new Lazy<IContentType>(() => existing);
|
||||
|
||||
var contentType = new ContentType(-1)
|
||||
{
|
||||
Alias = modelType.Name.ToUmbracoAlias(),
|
||||
Description = string.Empty,
|
||||
Icon = "folder.gif",
|
||||
Thumbnail = "folder.png",
|
||||
Name = modelType.Name.SplitPascalCasing(),
|
||||
AllowedTemplates = new List<ITemplate>(),
|
||||
AllowedContentTypes = new List<ContentTypeSort>()
|
||||
};
|
||||
|
||||
return new Lazy<IContentType>(() => contentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Definitions
|
||||
{
|
||||
public static class Conventions
|
||||
{
|
||||
/// <summary>
|
||||
/// Convention to get a DataTypeDefinition from the PropertyTypeAttribute or the type of the property itself
|
||||
/// </summary>
|
||||
/// <param name="attribute"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static IDataTypeDefinition GetDataTypeDefinitionByAttributeOrType(PropertyTypeAttribute attribute, Type type)
|
||||
{
|
||||
if (attribute != null)
|
||||
{
|
||||
var instance = Activator.CreateInstance(attribute.Type);
|
||||
var dataType = instance as IDataType;
|
||||
var definition = GetDataTypeByControlId(dataType.Id);
|
||||
//If the DataTypeDefinition doesn't exist we create a new one
|
||||
if (definition == null)
|
||||
{
|
||||
definition = new DataTypeDefinition(-1, dataType.Id)
|
||||
{
|
||||
DatabaseType = attribute.DatabaseType,
|
||||
Name = dataType.DataTypeName
|
||||
};
|
||||
ApplicationContext.Current.Services.DataTypeService.Save(definition, 0);
|
||||
}
|
||||
return definition;
|
||||
}
|
||||
|
||||
return GetPredefinedDataTypeDefinitionByType(type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention to get predefined DataTypeDefinitions based on the Type of the property
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static IDataTypeDefinition GetPredefinedDataTypeDefinitionByType(Type type)
|
||||
{
|
||||
if (type == typeof(bool))
|
||||
{
|
||||
return GetDataTypeByControlId(new Guid(Constants.PropertyEditors.TrueFalse));// Yes/No DataType
|
||||
}
|
||||
if (type == typeof(int))
|
||||
{
|
||||
return GetDataTypeByControlId(new Guid(Constants.PropertyEditors.Integer));// Number DataType
|
||||
}
|
||||
if (type == typeof(DateTime))
|
||||
{
|
||||
return GetDataTypeByControlId(new Guid(Constants.PropertyEditors.Date));// Date Picker DataType
|
||||
}
|
||||
|
||||
return GetDataTypeByControlId(new Guid(Constants.PropertyEditors.Textbox));// Standard textfield
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IDataTypeDefinition"/> from the DataTypeService by its control Id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static IDataTypeDefinition GetDataTypeByControlId(Guid id)
|
||||
{
|
||||
var definitions = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionByControlId(id);
|
||||
return definitions.FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new DataTypeDefinition based on the Type in the PropertyTypeAttribute
|
||||
/// </summary>
|
||||
/// <param name="attribute"></param>
|
||||
/// <param name="dataTypeDefinitionName"></param>
|
||||
/// <returns></returns>
|
||||
public static IDataTypeDefinition CreateDataTypeDefinitionFromAttribute(PropertyTypeAttribute attribute, string dataTypeDefinitionName)
|
||||
{
|
||||
var instance = Activator.CreateInstance(attribute.Type);
|
||||
var dataType = instance as IDataType;
|
||||
|
||||
var definition = new DataTypeDefinition(-1, dataType.Id)
|
||||
{
|
||||
DatabaseType = attribute.DatabaseType,
|
||||
Name = dataTypeDefinitionName
|
||||
};
|
||||
ApplicationContext.Current.Services.DataTypeService.Save(definition, 0);
|
||||
return definition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a PreValue for a <see cref="IDataTypeDefinition"/>
|
||||
/// </summary>
|
||||
/// <param name="dataTypeDefinitionId"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="sortOrder"></param>
|
||||
/// <param name="alias"></param>
|
||||
public static void CreatePrevalueForDataTypeDefinition(int dataTypeDefinitionId, string value, int sortOrder, string alias)
|
||||
{
|
||||
var poco = new DataTypePreValueDto
|
||||
{
|
||||
Alias = alias,
|
||||
DataTypeNodeId = dataTypeDefinitionId,
|
||||
SortOrder = sortOrder,
|
||||
Value = value
|
||||
};
|
||||
|
||||
ApplicationContext.Current.DatabaseContext.Database.Insert(poco);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention to get the Alias of the PropertyType from the AliasAttribute or the property itself
|
||||
/// </summary>
|
||||
/// <param name="attribute"></param>
|
||||
/// <param name="propertyName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetPropertyTypeAlias(AliasAttribute attribute, string propertyName)
|
||||
{
|
||||
return attribute == null ? propertyName.ToUmbracoAlias() : attribute.Alias;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convention to get the Name of the PropertyType from the AliasAttribute or the property itself
|
||||
/// </summary>
|
||||
/// <param name="attribute"></param>
|
||||
/// <param name="propertyName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetPropertyTypeName(AliasAttribute attribute, string propertyName)
|
||||
{
|
||||
if (attribute == null)
|
||||
return propertyName.SplitPascalCasing();
|
||||
|
||||
return string.IsNullOrEmpty(attribute.Name) ? propertyName.SplitPascalCasing() : attribute.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Definitions
|
||||
{
|
||||
public class DependencyField
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
public string[] DependsOn { get; set; }
|
||||
public Lazy<IContentType> ContentType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Definitions
|
||||
{
|
||||
public class PropertyDefinition
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public int Order { get; set; }
|
||||
|
||||
public IDataTypeDefinition DataTypeDefinition { get; set; }
|
||||
|
||||
public string PropertyGroup { get; set; }
|
||||
|
||||
public bool Mandatory { get; set; }
|
||||
|
||||
public string ValidationRegExp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Mvc
|
||||
{
|
||||
public abstract class UmbracoTemplatePage<T> : UmbracoTemplatePage where T : class
|
||||
{
|
||||
protected override void InitializePage()
|
||||
{
|
||||
base.InitializePage();
|
||||
|
||||
//set the model to the current node if it is not set, this is generally not the case
|
||||
if (Model != null)
|
||||
{
|
||||
//Map CurrentContent here
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the a strongly typed model
|
||||
/// </summary>
|
||||
public T CurrentContent { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
/// <summary>
|
||||
/// Used for TypeInheritanceTest and CodeFirstTests
|
||||
/// </summary>
|
||||
internal static class PluginManagerExtensions
|
||||
{
|
||||
public static IEnumerable<Type> ResolveContentTypeBaseTypes(this PluginManager resolver)
|
||||
{
|
||||
return resolver.ResolveTypes<ContentTypeBase>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Tests.CodeFirst.TestModels;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
[DatabaseTestBehavior(DatabaseBehavior.NoDatabasePerFixture)]
|
||||
[TestFixture]
|
||||
public class StronglyTypedMapperTest : PublishedContentTestBase
|
||||
{
|
||||
[Test]
|
||||
public void Type_Test()
|
||||
{
|
||||
var doc = GetNode(1);
|
||||
var currentContent = ContentTypeMapper.Map<Home>(doc);
|
||||
|
||||
Assert.That(currentContent.SiteName, Is.EqualTo("Test site"));
|
||||
Assert.That(currentContent.SiteDescription, Is.EqualTo("this is a test site"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Children_Of_Type_Test()
|
||||
{
|
||||
var doc = GetNode(1);
|
||||
var currentContent = ContentTypeMapper.Map<Home>(doc);
|
||||
var result = currentContent.ChildrenOfType<NewsLandingPage>().ToArray();
|
||||
Assert.AreEqual("page2/alias, 2ndpagealias", result[0].PageTitle);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Descendants_Of_Type_Test()
|
||||
{
|
||||
var doc = GetNode(1);
|
||||
var currentContent = ContentTypeMapper.Map<Home>(doc);
|
||||
var result = currentContent.Descendants<NewsArticle>().ToArray();
|
||||
|
||||
Assert.AreEqual("John doe", result[0].ArticleAuthor);
|
||||
Assert.AreEqual("John Smith", result[1].ArticleAuthor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Split_Pascal_Casing()
|
||||
{
|
||||
string name = "SiteName";
|
||||
string result = Regex.Replace(name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
|
||||
Assert.That(result, Is.EqualTo("Site Name"));
|
||||
|
||||
string name2 = "MySiteDefinitionCase";
|
||||
string result2 = Regex.Replace(name2, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
|
||||
Assert.That(result2, Is.EqualTo("My Site Definition Case"));
|
||||
}
|
||||
|
||||
#region Test setup
|
||||
public override void Initialize()
|
||||
{
|
||||
// required so we can access property.Value
|
||||
//PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver();
|
||||
|
||||
base.Initialize();
|
||||
|
||||
// need to specify a custom callback for unit tests
|
||||
// AutoPublishedContentTypes generates properties automatically
|
||||
// when they are requested, but we must declare those that we
|
||||
// explicitely want to be here...
|
||||
|
||||
var propertyTypes = new[]
|
||||
{
|
||||
// AutoPublishedContentType will auto-generate other properties
|
||||
new PublishedPropertyType("siteDescription", 0, "?"),
|
||||
new PublishedPropertyType("siteName", 0, "?"),
|
||||
new PublishedPropertyType("articleContent", 0, "?"),
|
||||
new PublishedPropertyType("articleAuthor", 0, "?"),
|
||||
new PublishedPropertyType("articleDate", 0, "?"),
|
||||
new PublishedPropertyType("pageTitle", 0, "?"),
|
||||
};
|
||||
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
|
||||
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;
|
||||
Console.WriteLine("INIT STRONG {0}",
|
||||
PublishedContentType.Get(PublishedItemType.Content, "anything")
|
||||
.PropertyTypes.Count());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
TestHelper.CleanUmbracoSettingsConfig();
|
||||
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
protected override string GetXmlContent(int templateId)
|
||||
{
|
||||
return @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<!DOCTYPE root[
|
||||
<!ELEMENT Home ANY>
|
||||
<!ATTLIST Home id ID #REQUIRED>
|
||||
<!ELEMENT NewsArticle ANY>
|
||||
<!ATTLIST NewsArticle id ID #REQUIRED>
|
||||
<!ELEMENT NewsLandingPage ANY>
|
||||
<!ATTLIST NewsLandingPage id ID #REQUIRED>
|
||||
<!ELEMENT ContentPage ANY>
|
||||
<!ATTLIST ContentPage id ID #REQUIRED>
|
||||
]>
|
||||
<root id=""-1"">
|
||||
<Home id=""1"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""10"" template=""" + templateId + @""" sortOrder=""1"" createDate=""2012-06-12T14:13:17"" updateDate=""2012-07-20T18:50:43"" nodeName=""Home"" urlName=""home"" writerName=""admin"" creatorName=""admin"" path=""-1,1"" isDoc="""">
|
||||
<siteName><![CDATA[Test site]]></siteName>
|
||||
<siteDescription><![CDATA[this is a test site]]></siteDescription>
|
||||
<bodyContent><![CDATA[This is some body content on the home page]]></bodyContent>
|
||||
<NewsLandingPage id=""2"" parentID=""1"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""11"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-20T18:06:45"" updateDate=""2012-07-20T19:07:31"" nodeName=""news"" urlName=""news"" writerName=""admin"" creatorName=""admin"" path=""-1,1,2"" isDoc="""">
|
||||
<bodyContent><![CDATA[This is some body content on the news landing page]]></bodyContent>
|
||||
<pageTitle><![CDATA[page2/alias, 2ndpagealias]]></pageTitle>
|
||||
<NewsArticle id=""3"" parentID=""2"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""12"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-20T18:07:54"" updateDate=""2012-07-20T19:10:27"" nodeName=""Something happened"" urlName=""something-happened"" writerName=""admin"" creatorName=""admin"" path=""-1,1,2,3"" isDoc="""">
|
||||
<articleContent><![CDATA[Some cool stuff happened today]]></articleContent>
|
||||
<articleDate><![CDATA[2012-01-02 12:33:44]]></articleDate>
|
||||
<articleAuthor><![CDATA[John doe]]></articleAuthor>
|
||||
</NewsArticle>
|
||||
<NewsArticle id=""4"" parentID=""2"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""12"" template=""" + templateId + @""" sortOrder=""3"" createDate=""2012-07-20T18:08:08"" updateDate=""2012-07-20T19:10:52"" nodeName=""Then another thing"" urlName=""then-another-thing"" writerName=""admin"" creatorName=""admin"" path=""-1,1,2,4"" isDoc="""">
|
||||
<articleContent><![CDATA[Today, other cool things occurred]]></articleContent>
|
||||
<articleDate><![CDATA[2012-01-03 15:33:44]]></articleDate>
|
||||
<articleAuthor><![CDATA[John Smith]]></articleAuthor>
|
||||
</NewsArticle>
|
||||
</NewsLandingPage>
|
||||
<ContentPage id=""5"" parentID=""1"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""13"" template=""" + templateId + @""" sortOrder=""4"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""First Content Page"" urlName=""content-page-1"" writerName=""admin"" creatorName=""admin"" path=""-1,1,5"" isDoc="""">
|
||||
<bodyContent><![CDATA[This is some body content on the first content page]]></bodyContent>
|
||||
</ContentPage>
|
||||
<ContentPage id=""6"" parentID=""1"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""13"" template=""" + templateId + @""" sortOrder=""4"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-16T14:23:35"" nodeName=""Second Content Page"" urlName=""content-page-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1,6"" isDoc="""">
|
||||
<bodyContent><![CDATA[This is some body content on the second content page]]></bodyContent>
|
||||
</ContentPage>
|
||||
</Home>
|
||||
</root>";
|
||||
}
|
||||
|
||||
internal IPublishedContent GetNode(int id)
|
||||
{
|
||||
var ctx = UmbracoContext.Current;
|
||||
var doc = ctx.ContentCache.GetById(id);
|
||||
Assert.IsNotNull(doc);
|
||||
return doc;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class AdvancedContentPage : SimpleContentPage
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Author { get; set; }
|
||||
|
||||
public DateTime PublishDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels.Composition
|
||||
{
|
||||
public class Base : ContentTypeBase, IBase
|
||||
{
|
||||
[Richtext(PropertyGroup = "Content")]
|
||||
public string BodyContent { get; set; }
|
||||
}
|
||||
|
||||
[Mixin(typeof(Base))]
|
||||
public interface IBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels.Composition
|
||||
{
|
||||
public class Meta : ContentTypeBase, IMeta
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string MetaKeywords { get; set; }
|
||||
|
||||
[PropertyType(typeof(MultipleTextStringPropertyEditor))]
|
||||
public string MetaDescription { get; set; }
|
||||
}
|
||||
|
||||
[Mixin(typeof(Meta))]
|
||||
public interface IMeta
|
||||
{}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels.Composition
|
||||
{
|
||||
public class MetaSeo : ContentTypeBase, IMetaSeo
|
||||
{
|
||||
[PropertyType(typeof(MultipleTextStringPropertyEditor))]
|
||||
public string FriendlySeoStuff { get; set; }
|
||||
}
|
||||
|
||||
[Mixin(typeof(MetaSeo))]
|
||||
public interface IMetaSeo
|
||||
{}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels.Composition
|
||||
{
|
||||
/// <summary>
|
||||
/// Deriving class is parent, interfaces are compositions
|
||||
/// </summary>
|
||||
public class News : Base, IMetaSeo, IMeta
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Author { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class ContentPage : ContentTypeBase
|
||||
{
|
||||
[Richtext(PropertyGroup = "Content")]
|
||||
public string BodyContent { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
[ContentType("modelPage",
|
||||
AllowedChildContentTypes = new[] { typeof(ContentPage) },
|
||||
AllowedTemplates = new[]{"umbMaster"})]
|
||||
public class DecoratedModelPage : ContentTypeBase
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Author { get; set; }
|
||||
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Richtext(PropertyGroup = "Content")]
|
||||
[Description("Richtext field to enter the main content of the page")]
|
||||
public string BodyContent { get; set; }
|
||||
|
||||
[Alias("publishedDate", Name = "Publish Date")]
|
||||
public DateTime PublishDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
[ContentType("home", AllowedChildContentTypes = new[] { typeof(ContentPage) })]
|
||||
public class Home : ContentTypeBase
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor))]
|
||||
public string SiteName { get; set; }
|
||||
|
||||
[Alias("umbSiteDescription", Name = "Site Description")] // ignored by the mapper at the moment
|
||||
[PropertyType(typeof(MultipleTextStringPropertyEditor))]
|
||||
public string SiteDescription { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class ModelWithNewDataType : ContentTypeBase
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[PropertyType(typeof(RichTextPropertyEditor), PropertyGroup = "Content")]
|
||||
public string BodyContent { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class NewsArticle : ContentTypeBase
|
||||
{
|
||||
public string ArticleContent { get; set; }
|
||||
public DateTime ArticleDate { get; set; }
|
||||
public string ArticleAuthor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class NewsLandingPage : ContentPage
|
||||
{
|
||||
public string PageTitle { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class NumericModel : ContentTypeBase
|
||||
{
|
||||
[Numeric("Number DataType", PreValue = "5", PropertyGroup = "Content")]
|
||||
public int Number { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
//Name: Plain Poco Type - Alias: plainPocoType
|
||||
public class PlainPocoType : ContentTypeBase
|
||||
{
|
||||
//Name: Title, Alias: title, DataType: Text Field
|
||||
public string Title { get; set; }
|
||||
|
||||
//Name: Author, Alias: author, DataType: Text Field
|
||||
public string Author { get; set; }
|
||||
|
||||
//Name: Is Finished, Alias: isFinished, DataType: Yes/No
|
||||
public bool IsFinished { get; set; }
|
||||
|
||||
//Name: Weight, Alias: weight, DataType: Number
|
||||
public int Weight { get; set; }
|
||||
|
||||
//Name: Publish Date, Alias: publishDate, DataType: Datepicker
|
||||
public DateTime PublishDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class SimpleContentPage : ContentTypeBase
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Richtext(PropertyGroup = "Content")]
|
||||
public string BodyContent { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class TextPage : ContentTypeBase
|
||||
{
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Author { get; set; }
|
||||
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Title { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
public class TopologicalSorter
|
||||
{
|
||||
#region - Private Members -
|
||||
|
||||
private readonly int[] _vertices; // list of vertices
|
||||
private readonly int[,] _matrix; // adjacency matrix
|
||||
private int _numVerts; // current number of vertices
|
||||
private readonly int[] _sortedArray;
|
||||
|
||||
#endregion
|
||||
|
||||
#region - CTors -
|
||||
|
||||
public TopologicalSorter(int size)
|
||||
{
|
||||
_vertices = new int[size];
|
||||
_matrix = new int[size, size];
|
||||
_numVerts = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int j = 0; j < size; j++)
|
||||
_matrix[i, j] = 0;
|
||||
_sortedArray = new int[size]; // sorted vert labels
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region - Public Methods -
|
||||
|
||||
public int AddVertex(int vertex)
|
||||
{
|
||||
_vertices[_numVerts++] = vertex;
|
||||
return _numVerts - 1;
|
||||
}
|
||||
|
||||
public void AddEdge(int start, int end)
|
||||
{
|
||||
_matrix[start, end] = 1;
|
||||
}
|
||||
|
||||
public int[] Sort() // toplogical sort
|
||||
{
|
||||
while (_numVerts > 0) // while vertices remain,
|
||||
{
|
||||
// get a vertex with no successors, or -1
|
||||
int currentVertex = noSuccessors();
|
||||
if (currentVertex == -1) // must be a cycle
|
||||
throw new Exception("Graph has cycles");
|
||||
|
||||
// insert vertex label in sorted array (start at end)
|
||||
_sortedArray[_numVerts - 1] = _vertices[currentVertex];
|
||||
|
||||
deleteVertex(currentVertex); // delete vertex
|
||||
}
|
||||
|
||||
// vertices all gone; return sortedArray
|
||||
return _sortedArray;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region - Private Helper Methods -
|
||||
|
||||
// returns vert with no successors (or -1 if no such verts)
|
||||
private int noSuccessors()
|
||||
{
|
||||
for (int row = 0; row < _numVerts; row++)
|
||||
{
|
||||
bool isEdge = false; // edge from row to column in adjMat
|
||||
for (int col = 0; col < _numVerts; col++)
|
||||
{
|
||||
if (_matrix[row, col] > 0) // if edge to another,
|
||||
{
|
||||
isEdge = true;
|
||||
break; // this vertex has a successor try another
|
||||
}
|
||||
}
|
||||
if (!isEdge) // if no edges, has no successors
|
||||
return row;
|
||||
}
|
||||
return -1; // no
|
||||
}
|
||||
|
||||
private void deleteVertex(int delVert)
|
||||
{
|
||||
// if not last vertex, delete from vertexList
|
||||
if (delVert != _numVerts - 1)
|
||||
{
|
||||
for (int j = delVert; j < _numVerts - 1; j++)
|
||||
_vertices[j] = _vertices[j + 1];
|
||||
|
||||
for (int row = delVert; row < _numVerts - 1; row++)
|
||||
moveRowUp(row, _numVerts);
|
||||
|
||||
for (int col = delVert; col < _numVerts - 1; col++)
|
||||
moveColLeft(col, _numVerts - 1);
|
||||
}
|
||||
_numVerts--; // one less vertex
|
||||
}
|
||||
|
||||
private void moveRowUp(int row, int length)
|
||||
{
|
||||
for (int col = 0; col < length; col++)
|
||||
_matrix[row, col] = _matrix[row + 1, col];
|
||||
}
|
||||
|
||||
private void moveColLeft(int col, int length)
|
||||
{
|
||||
for (int row = 0; row < length; row++)
|
||||
_matrix[row, col] = _matrix[row, col + 1];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using Umbraco.Tests.CodeFirst.Definitions;
|
||||
using Umbraco.Tests.CodeFirst.TestModels.Composition;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst
|
||||
{
|
||||
[TestFixture]
|
||||
public class TypeInheritanceTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
|
||||
//this ensures its reset
|
||||
PluginManager.Current = new PluginManager(false);
|
||||
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
{
|
||||
typeof (ContentTypeBase).Assembly
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Get_Interfaces_From_Type()
|
||||
{
|
||||
var type = typeof (News);
|
||||
var interfaces = type.GetInterfaces().ToList();
|
||||
|
||||
bool hasSeo = interfaces.Any(x => x.Name == typeof(IMetaSeo).Name);
|
||||
bool hasMeta = interfaces.Any(x => x.Name == typeof(IMeta).Name);
|
||||
|
||||
Assert.That(hasSeo, Is.True);
|
||||
Assert.That(hasMeta, Is.True);
|
||||
Assert.That(interfaces.Count, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Get_MixinAttribute_From_Types()
|
||||
{
|
||||
var type = typeof(News);
|
||||
var interfaces = type.GetInterfaces().ToList();
|
||||
|
||||
var list = new List<string>();
|
||||
|
||||
foreach (var interfaceType in interfaces)
|
||||
{
|
||||
var mixinAttribute = interfaceType.FirstAttribute<MixinAttribute>();
|
||||
if(mixinAttribute != null)
|
||||
{
|
||||
var modelType = mixinAttribute.Type;
|
||||
var contentTypeAttribute = modelType.FirstAttribute<ContentTypeAttribute>();
|
||||
var contentTypeAlias = contentTypeAttribute == null ? modelType.Name.ToUmbracoAlias() : contentTypeAttribute.Alias;
|
||||
list.Add(contentTypeAlias);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.That(list.Count, Is.EqualTo(3));
|
||||
Assert.Contains("Meta", list);
|
||||
Assert.Contains("MetaSeo", list);
|
||||
Assert.Contains("Base", list);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Only_One_Type_List_Created()
|
||||
{
|
||||
var foundTypes = PluginManager.Current.ResolveContentTypeBaseTypes();
|
||||
|
||||
Assert.That(foundTypes.Count(), Is.EqualTo(15));
|
||||
Assert.AreEqual(1,
|
||||
PluginManager.Current.GetTypeLists()
|
||||
.Count(x => x.IsTypeList<ContentTypeBase>(PluginManager.TypeResolutionKind.FindAllTypes)));
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
PluginManager.Current = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Umbraco.Tests.Models
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var dtd = new DataTypeDefinition(9, Guid.NewGuid())
|
||||
var dtd = new DataTypeDefinition(9, Guid.NewGuid().ToString())
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CreatorId = 5,
|
||||
@@ -57,7 +57,7 @@ namespace Umbraco.Tests.Models
|
||||
{
|
||||
var ss = new SerializationService(new JsonNetSerializer());
|
||||
|
||||
var dtd = new DataTypeDefinition(9, Guid.NewGuid())
|
||||
var dtd = new DataTypeDefinition(9, Guid.NewGuid().ToString())
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CreatorId = 5,
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
int id;
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) {Name = "test"};
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
|
||||
repository.AddOrUpdate(dataTypeDefinition);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
int id;
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) { Name = "test" };
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
repository.AddOrUpdate(dataTypeDefinition);
|
||||
unitOfWork.Commit();
|
||||
id = dataTypeDefinition.Id;
|
||||
@@ -78,7 +78,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
}
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) { Name = "test" };
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
repository.AddOrUpdate(dataTypeDefinition);
|
||||
|
||||
Assert.Throws<DuplicateNameException>(unitOfWork.Commit);
|
||||
@@ -318,7 +318,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
int dtid;
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) { Name = "test" };
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
repository.AddOrUpdate(dataTypeDefinition);
|
||||
unitOfWork.Commit();
|
||||
dtid = dataTypeDefinition.Id;
|
||||
@@ -343,7 +343,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
int dtid;
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) { Name = "test" };
|
||||
var dataTypeDefinition = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
repository.AddOrUpdate(dataTypeDefinition);
|
||||
unitOfWork.Commit();
|
||||
dtid = dataTypeDefinition.Id;
|
||||
@@ -375,7 +375,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
DataTypeDefinition dtd;
|
||||
using (var repository = creator())
|
||||
{
|
||||
dtd = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) { Name = "test" };
|
||||
dtd = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
repository.AddOrUpdate(dtd);
|
||||
unitOfWork.Commit();
|
||||
}
|
||||
@@ -412,7 +412,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
DataTypeDefinition dtd;
|
||||
using (var repository = creator())
|
||||
{
|
||||
dtd = new DataTypeDefinition(-1, new Guid(Constants.PropertyEditors.RadioButtonList)) { Name = "test" };
|
||||
dtd = new DataTypeDefinition(-1, Constants.PropertyEditors.RadioButtonListAlias) { Name = "test" };
|
||||
repository.AddOrUpdate(dtd);
|
||||
unitOfWork.Commit();
|
||||
}
|
||||
|
||||
@@ -301,20 +301,7 @@ namespace Umbraco.Tests.Plugins
|
||||
Assert.AreEqual(7, apps.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_DataTypes()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveDataTypes();
|
||||
Assert.AreEqual(35, types.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_RestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRestExtensions();
|
||||
Assert.AreEqual(3, types.Count());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Resolves_XsltExtensions()
|
||||
{
|
||||
@@ -351,13 +338,6 @@ namespace Umbraco.Tests.Plugins
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Umbraco.Web.BaseRest.RestExtension("Blah")]
|
||||
public class MyRestExtesion
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public interface IFindMe
|
||||
{
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ using umbraco.DataLayer;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using umbraco.uicontrols;
|
||||
using Umbraco.Web.BaseRest;
|
||||
|
||||
namespace Umbraco.Tests.Plugins
|
||||
{
|
||||
@@ -85,7 +84,8 @@ namespace Umbraco.Tests.Plugins
|
||||
[Test]
|
||||
public void Find_Classes_With_Attribute()
|
||||
{
|
||||
var typesFound = TypeFinder.FindClassesWithAttribute<RestExtensionAttribute>(_assemblies);
|
||||
var typesFound = TypeFinder.FindClassesWithAttribute<Umbraco.Web.Trees.TreeAttribute>(_assemblies);
|
||||
//TODO: Fix this with the correct count
|
||||
Assert.AreEqual(1, typesFound.Count());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Web.Routing;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
|
||||
namespace Umbraco.Tests.Routing
|
||||
{
|
||||
[DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)]
|
||||
[TestFixture]
|
||||
public class uQueryGetNodeIdByUrlTests : BaseRoutingTest
|
||||
{
|
||||
|
||||
private IUmbracoSettingsSection _umbracoSettings;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var url = "/test";
|
||||
|
||||
var lookup = new Umbraco.Web.Routing.ContentFinderByNiceUrl();
|
||||
var lookups = new Umbraco.Web.Routing.IContentFinder[] { lookup };
|
||||
|
||||
var t = Template.MakeNew("test", new User(0));
|
||||
|
||||
var umbracoContext = GetUmbracoContext(url, t.Id);
|
||||
var urlProvider = new UrlProvider(umbracoContext, new IUrlProvider[] { new DefaultUrlProvider() });
|
||||
var routingContext = new RoutingContext(
|
||||
umbracoContext,
|
||||
lookups,
|
||||
new FakeLastChanceFinder(),
|
||||
urlProvider);
|
||||
|
||||
//assign the routing context back to the umbraco context
|
||||
umbracoContext.RoutingContext = routingContext;
|
||||
|
||||
////assign the routing context back to the umbraco context
|
||||
//umbracoContext.RoutingContext = routingContext;
|
||||
Umbraco.Web.UmbracoContext.Current = routingContext.UmbracoContext;
|
||||
|
||||
//generate new mock settings and assign so we can configure in individual tests
|
||||
_umbracoSettings = SettingsForTests.GenerateMockSettings();
|
||||
SettingsForTests.ConfigureSettings(_umbracoSettings);
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
Umbraco.Web.UmbracoContext.Current = null;
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
[TestCase(1046, "/home")]
|
||||
[TestCase(1173, "/home/sub1")]
|
||||
[TestCase(1174, "/home/sub1/sub2")]
|
||||
[TestCase(1176, "/home/sub1/sub-3")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/home/sub-2")]
|
||||
[TestCase(1172, "/test-page")]
|
||||
|
||||
public void GetNodeIdByUrl_Not_Hiding_Top_Level_Absolute(int nodeId, string url)
|
||||
{
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
var requestMock = Mock.Get(_umbracoSettings.RequestHandler);
|
||||
requestMock.Setup(x => x.UseDomainPrefixes).Returns(false);
|
||||
|
||||
Assert.AreEqual(nodeId, global::umbraco.uQuery.GetNodeIdByUrl("http://example.com" + url));
|
||||
}
|
||||
|
||||
[TestCase(1046, "/home")]
|
||||
[TestCase(1173, "/home/sub1")]
|
||||
[TestCase(1174, "/home/sub1/sub2")]
|
||||
[TestCase(1176, "/home/sub1/sub-3")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/home/sub-2")]
|
||||
[TestCase(1172, "/test-page")]
|
||||
|
||||
public void GetNodeIdByUrl_Not_Hiding_Top_Level_Relative(int nodeId, string url)
|
||||
{
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
var requestMock = Mock.Get(_umbracoSettings.RequestHandler);
|
||||
requestMock.Setup(x => x.UseDomainPrefixes).Returns(false);
|
||||
|
||||
Assert.AreEqual(nodeId, global::umbraco.uQuery.GetNodeIdByUrl(url));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
@@ -73,10 +74,10 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var dataTypeService = ServiceContext.DataTypeService;
|
||||
var textfieldId = new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea");
|
||||
var textBoxAlias = Constants.PropertyEditors.TextboxAlias;
|
||||
|
||||
// Act
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textfieldId) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textBoxAlias) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
dataTypeService.Save(dataTypeDefinition);
|
||||
dataTypeService.SavePreValues(dataTypeDefinition, new Dictionary<string, PreValue>
|
||||
{
|
||||
@@ -103,10 +104,10 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var dataTypeService = ServiceContext.DataTypeService;
|
||||
var textfieldId = new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea");
|
||||
var textBoxAlias = Constants.PropertyEditors.TextboxAlias;
|
||||
|
||||
// Act
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textfieldId) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textBoxAlias) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
dataTypeService.SaveDataTypeAndPreValues(dataTypeDefinition, new Dictionary<string, PreValue>
|
||||
{
|
||||
{"preVal1", new PreValue("Hello")},
|
||||
@@ -132,10 +133,10 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var dataTypeService = ServiceContext.DataTypeService;
|
||||
var textfieldId = new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea");
|
||||
var textBoxAlias = Constants.PropertyEditors.TextboxAlias;
|
||||
|
||||
// Act
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textfieldId) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textBoxAlias) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
dataTypeService.SaveDataTypeAndPreValues(dataTypeDefinition, new Dictionary<string, PreValue>
|
||||
{
|
||||
{"preVal1", new PreValue("Hello")},
|
||||
@@ -169,10 +170,10 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var dataTypeService = ServiceContext.DataTypeService;
|
||||
var textfieldId = new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea");
|
||||
var textBoxAlias = Constants.PropertyEditors.TextboxAlias;
|
||||
|
||||
// Act
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textfieldId) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textBoxAlias) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
dataTypeService.SaveDataTypeAndPreValues(dataTypeDefinition, new Dictionary<string, PreValue>
|
||||
{
|
||||
{"preVal1", new PreValue("Hello")},
|
||||
@@ -203,10 +204,10 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var dataTypeService = ServiceContext.DataTypeService;
|
||||
var textfieldId = new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea");
|
||||
var textBoxAlias = Constants.PropertyEditors.TextboxAlias;
|
||||
|
||||
// Act
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textfieldId) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
IDataTypeDefinition dataTypeDefinition = new DataTypeDefinition(-1, textBoxAlias) { Name = "Testing prevals", DatabaseType = DataTypeDatabaseType.Ntext };
|
||||
dataTypeService.Save(dataTypeDefinition);
|
||||
dataTypeService.SavePreValues(dataTypeDefinition.Id, new[] {"preVal1", "preVal2"});
|
||||
|
||||
|
||||
@@ -192,8 +192,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
PropertyEditorResolver.Current = new PropertyEditorResolver(
|
||||
() => PluginManager.Current.ResolvePropertyEditors());
|
||||
|
||||
DataTypesResolver.Current = new DataTypesResolver(
|
||||
() => PluginManager.Current.ResolveDataTypes());
|
||||
|
||||
RepositoryResolver.Current = new RepositoryResolver(
|
||||
new RepositoryFactory(true)); //disable all repo caches for tests!
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
using NUnit.Framework;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
|
||||
namespace Umbraco.Tests.TreesAndSections
|
||||
{
|
||||
[TestFixture]
|
||||
public class BaseMediaTreeTests
|
||||
{
|
||||
|
||||
[TearDown]
|
||||
public void TestTearDown()
|
||||
{
|
||||
BaseTree.AfterTreeRender -= EventHandler;
|
||||
BaseTree.BeforeTreeRender -= EventHandler;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Run_Optimized()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
Assert.IsTrue(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_AfterRender()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
BaseTree.AfterTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_BeforeRender()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
BaseTree.BeforeTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
private void EventHandler(object sender, TreeEventArgs treeEventArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class MyOptimizedMediaTree : BaseMediaTree
|
||||
{
|
||||
public MyOptimizedMediaTree(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ namespace Umbraco.Tests.UI
|
||||
|
||||
[TestCase(typeof(UserTypeTasks), DefaultApps.users)]
|
||||
[TestCase(typeof(contentItemTypeTasks), DefaultApps.member)]
|
||||
[TestCase(typeof(contentItemTasks), DefaultApps.member)]
|
||||
[TestCase(typeof(XsltTasks), DefaultApps.developer)]
|
||||
[TestCase(typeof(userTasks), DefaultApps.users)]
|
||||
[TestCase(typeof(templateTasks), DefaultApps.settings)]
|
||||
@@ -44,7 +43,6 @@ namespace Umbraco.Tests.UI
|
||||
[TestCase(typeof(dictionaryTasks), DefaultApps.settings)]
|
||||
[TestCase(typeof(macroTasks), DefaultApps.developer)]
|
||||
[TestCase(typeof(languageTasks), DefaultApps.settings)]
|
||||
[TestCase(typeof(DataTypeTasks), DefaultApps.developer)]
|
||||
[TestCase(typeof(CreatedPackageTasks), DefaultApps.developer)]
|
||||
[TestCase(typeof(PartialViewTasks), DefaultApps.settings)]
|
||||
public void Check_Assigned_Apps_For_Tasks(Type taskType, DefaultApps app)
|
||||
|
||||
@@ -211,42 +211,6 @@
|
||||
<Compile Include="Cache\HttpRequestCacheProviderTests.cs" />
|
||||
<Compile Include="Cache\HttpRuntimeCacheProviderTests.cs" />
|
||||
<Compile Include="Cache\RuntimeCacheProviderTests.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\AliasAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\ContentTypeAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\DescriptionAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\MixinAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\Numeric.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\PropertyTypeAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\PropertyTypeConventionAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\RichtextAttribute.cs" />
|
||||
<Compile Include="CodeFirst\Attributes\SortOrderAttribute.cs" />
|
||||
<Compile Include="CodeFirst\CodeFirstTests.cs" />
|
||||
<Compile Include="CodeFirst\ContentTypeBase.cs" />
|
||||
<Compile Include="CodeFirst\ContentTypeMapper.cs" />
|
||||
<Compile Include="CodeFirst\Definitions\ContentTypeDefinitionFactory.cs" />
|
||||
<Compile Include="CodeFirst\Definitions\Conventions.cs" />
|
||||
<Compile Include="CodeFirst\Definitions\DependencyField.cs" />
|
||||
<Compile Include="CodeFirst\Definitions\PropertyDefinition.cs" />
|
||||
<Compile Include="CodeFirst\Mvc\UmbracoTemplatePage`T.cs" />
|
||||
<Compile Include="CodeFirst\PluginManagerExtensions.cs" />
|
||||
<Compile Include="CodeFirst\StronglyTypedMapperTest.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\AdvancedContentPage.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\Composition\Base.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\Composition\Meta.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\Composition\News.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\Composition\MetaSeo.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\ContentPage.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\DecoratedModelPage.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\Home.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\ModelWithNewDataType.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\NewsArticle.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\NewsLandingPage.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\NumericModel.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\PlainPocoType.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\SimpleContentPage.cs" />
|
||||
<Compile Include="CodeFirst\TestModels\TextPage.cs" />
|
||||
<Compile Include="CodeFirst\TopologicalSorter.cs" />
|
||||
<Compile Include="CodeFirst\TypeInheritanceTest.cs" />
|
||||
<Compile Include="Configurations\DashboardSettings\DashboardSettingsTests.cs" />
|
||||
<Compile Include="Configurations\FileSystemProviderTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ContentElementDefaultTests.cs" />
|
||||
@@ -453,7 +417,6 @@
|
||||
<Compile Include="Routing\DomainsAndCulturesTests.cs" />
|
||||
<Compile Include="Routing\NiceUrlsProviderWithDomainsTests.cs" />
|
||||
<Compile Include="Routing\SiteDomainHelperTests.cs" />
|
||||
<Compile Include="Routing\uQueryGetNodeIdByUrlTests.cs" />
|
||||
<Compile Include="Routing\UrlsWithNestedDomains.cs" />
|
||||
<Compile Include="Services\BaseServiceTest.cs" />
|
||||
<Compile Include="Services\ContentServicePerformanceTest.cs" />
|
||||
@@ -495,7 +458,6 @@
|
||||
<Compile Include="TestHelpers\Entities\MockedMedia.cs" />
|
||||
<Compile Include="TestHelpers\DisposableUmbracoTest.cs" />
|
||||
<Compile Include="TreesAndSections\BaseContentTreeTests.cs" />
|
||||
<Compile Include="TreesAndSections\BaseMediaTreeTests.cs" />
|
||||
<Compile Include="UmbracoExamine\ContentServiceTest.cs" />
|
||||
<Compile Include="UmbracoExamine\EventsTest.cs" />
|
||||
<Compile Include="Plugins\TypeHelperTests.cs" />
|
||||
|
||||
@@ -321,18 +321,10 @@
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Controls\ContentTypeControlNew.ascx.cs">
|
||||
<DependentUpon>ContentTypeControlNew.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Controls\ContentTypeControlNew.ascx.designer.cs">
|
||||
<DependentUpon>ContentTypeControlNew.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Controls\Images\ImageViewer.ascx.cs">
|
||||
<DependentUpon>ImageViewer.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Controls\Images\ImageViewer.ascx.designer.cs">
|
||||
<DependentUpon>ImageViewer.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Controls\PasswordChanger.ascx.cs">
|
||||
<DependentUpon>passwordChanger.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -467,7 +459,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Settings\EditNodeTypeNew.aspx.cs">
|
||||
<DependentUpon>EditNodeTypeNew.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Settings\EditNodeTypeNew.aspx.designer.cs">
|
||||
<DependentUpon>EditNodeTypeNew.aspx</DependentUpon>
|
||||
@@ -1060,15 +1051,9 @@
|
||||
<Content Include="Umbraco_Client\DateTimePicker\datetimepicker.css" />
|
||||
<Content Include="Umbraco_Client\DateTimePicker\timepicker.js" />
|
||||
<Content Include="Umbraco\Controls\ContentTypeControlNew.ascx" />
|
||||
<Content Include="Umbraco\Controls\GenericProperties\GenericProperty.ascx" />
|
||||
<Content Include="Umbraco\Images\Umbraco\developerScript.gif" />
|
||||
<Content Include="Umbraco_Client\Tree\sprites.png" />
|
||||
<Content Include="Umbraco_Client\Tree\sprites_ie6.gif" />
|
||||
<Content Include="Umbraco\Controls\Images\ImageViewer.ascx" />
|
||||
<Content Include="Umbraco\Controls\Images\ImageViewer.js" />
|
||||
<Content Include="Umbraco\Controls\Images\ImageViewerUpdater.asmx" />
|
||||
<Content Include="Umbraco\Controls\Images\UploadMediaImage.ascx" />
|
||||
<Content Include="Umbraco\Controls\Images\UploadMediaImage.js" />
|
||||
<Content Include="Umbraco\Controls\Tree\TreeControl.ascx" />
|
||||
<Content Include="Umbraco\Images\throbber.gif" />
|
||||
<Content Include="Umbraco\Images\Umbraco\bin.png" />
|
||||
@@ -1217,7 +1202,6 @@
|
||||
<Content Include="Umbraco\Dialogs\cruds.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\emptyTrashcan.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\exportDocumenttype.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\imageViewer.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\importDocumenttype.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\insertMacro.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\insertTable.aspx" />
|
||||
|
||||
15
src/Umbraco.Web.UI/js/config.js
Normal file
15
src/Umbraco.Web.UI/js/config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
TXT 2.0 by HTML5 UP
|
||||
html5up.net | @n33co
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
*/
|
||||
|
||||
window._skel_config = {
|
||||
preset: 'standard',
|
||||
prefix: '/css/style',
|
||||
resetCSS: true
|
||||
};
|
||||
|
||||
window._skel_panels_config = {
|
||||
preset: 'standard'
|
||||
};
|
||||
8
src/Umbraco.Web.UI/js/html5shiv.js
vendored
Normal file
8
src/Umbraco.Web.UI/js/html5shiv.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
|
||||
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
|
||||
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
|
||||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
|
||||
for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
|
||||
6
src/Umbraco.Web.UI/js/jquery.min.js
vendored
Normal file
6
src/Umbraco.Web.UI/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
33
src/Umbraco.Web.UI/js/skel-panels.min.js
vendored
Normal file
33
src/Umbraco.Web.UI/js/skel-panels.min.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/* skelJS v0.4 | (c) n33 | skeljs.org | MIT licensed */
|
||||
skel.registerPlugin("panels",function(){var b={config:{baseZIndex:1E4,useTransform:!0,transformBreakpoints:null,speed:250,panels:{},overlays:{}},cache:{panels:{},overlays:{},body:null,window:null,pageWrapper:null,defaultWrapper:null,fixedWrapper:null,activePanel:null},eventType:"click",positions:{panels:{top:["top","left"],right:["top","right"],bottom:["bottom","left"],left:["top","left"]},overlays:{"top-left":{top:0,left:0},"top-right":{top:0,right:0},top:{top:0,left:"50%"},"top-center":{top:0,left:"50%"},
|
||||
"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},bottom:{bottom:0,left:"50%"},"bottom-center":{bottom:0,left:"50%"},left:{top:"50%",left:0},"middle-left":{top:"50%",left:0},right:{top:"50%",right:0},"middle-right":{top:"50%",right:0}}},presets:{standard:{panels:{navPanel:{breakpoints:"mobile",position:"left",style:"push",size:"80%",html:'<div data-action="navList" data-args="nav"></div>'}},overlays:{titleBar:{breakpoints:"mobile",position:"top-left",width:"100%",height:44,html:'<span class="toggle" data-action="togglePanel" data-args="navPanel"></span><span class="title" data-action="copyHTML" data-args="logo"></span>'}}}},
|
||||
defaults:{config:{panel:{breakpoints:"",position:null,style:null,size:"80%",html:"",resetScroll:!0,resetForms:!0,swipeToClose:!0},overlay:{breakpoints:"",position:null,width:0,height:0,html:""}}},recalcW:function(b){var c=parseInt(b);"string"==typeof b&&"%"==b.charAt(b.length-1)&&(c=Math.floor(jQuery(window).width()*(c/100)));return c},recalcH:function(b){var c=parseInt(b);"string"==typeof b&&"%"==b.charAt(b.length-1)&&(c=Math.floor(jQuery(window).height()*(c/100)));return c},getHalf:function(b){var c=
|
||||
parseInt(b);return"string"==typeof b&&"%"==b.charAt(b.length-1)?Math.floor(c/2)+"%":Math.floor(c/2)+"px"},parseSuspend:function(b){b=b.get(0);b._skel_panels_suspend&&b._skel_panels_suspend()},parseResume:function(b){b=b.get(0);b._skel_panels_resume&&b._skel_panels_resume()},parseInit:function(e){var c,d;c=e.get(0);var h=e.attr("data-action"),f=e.attr("data-args"),g,l;h&&f&&(f=f.split(","));switch(h){case "togglePanel":case "panelToggle":e.css("-webkit-tap-highlight-color","rgba(0,0,0,0)").css("cursor",
|
||||
"pointer");c=function(c){c.preventDefault();c.stopPropagation();if(b.cache.activePanel)return b.cache.activePanel._skel_panels_close(),!1;jQuery(this);c=b.cache.panels[f[0]];c.is(":visible")?c._skel_panels_close():c._skel_panels_open()};"android"==b._.vars.deviceType?e.bind("click",c):e.bind(b.eventType,c);break;case "navList":g=jQuery("#"+f[0]);c=g.find("a");d=[];c.each(function(){var b=jQuery(this),c;c=Math.max(0,b.parents("li").length-1);d.push('<a class="link depth-'+c+'" href="'+b.attr("href")+
|
||||
'"><span class="indent-'+c+'"></span>'+b.text()+"</a>")});0<d.length&&e.html("<nav>"+d.join("")+"</nav>");e.find(".link").css("cursor","pointer").css("display","block");break;case "copyText":g=jQuery("#"+f[0]);e.html(g.text());break;case "copyHTML":g=jQuery("#"+f[0]);e.html(g.html());break;case "moveElementContents":g=jQuery("#"+f[0]);c._skel_panels_resume=function(){g.children().each(function(){e.append(jQuery(this))})};c._skel_panels_suspend=function(){e.children().each(function(){g.append(jQuery(this))})};
|
||||
c._skel_panels_resume();break;case "moveElement":g=jQuery("#"+f[0]);c._skel_panels_resume=function(){jQuery('<div id="skel-panels-tmp-'+g.attr("id")+'" />').insertBefore(g);e.append(g)};c._skel_panels_suspend=function(){jQuery("#skel-panels-tmp-"+g.attr("id")).replaceWith(g)};c._skel_panels_resume();break;case "moveCell":g=jQuery("#"+f[0]),l=jQuery("#"+f[1]),c._skel_panels_resume=function(){jQuery('<div id="skel-panels-tmp-'+g.attr("id")+'" />').insertBefore(g);e.append(g);g.css("width","auto");l&&
|
||||
l._skel_panels_expandCell()},c._skel_panels_suspend=function(){jQuery("#skel-panels-tmp-"+g.attr("id")).replaceWith(g);g.css("width","");l&&l.css("width","")},c._skel_panels_resume()}},lockView:function(e){b.cache.window._skel_panels_scrollPos=b.cache.window.scrollTop();b._.vars.isTouch&&b.cache.body.css("overflow-"+e,"hidden");b.cache.pageWrapper.bind("touchstart.lock",function(c){c.preventDefault();c.stopPropagation();b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b.cache.pageWrapper.bind("click.lock",
|
||||
function(c){c.preventDefault();c.stopPropagation();b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b.cache.pageWrapper.bind("scroll.lock",function(c){c.preventDefault();c.stopPropagation();b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b.cache.window.bind("orientationchange.lock",function(c){b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b._.vars.isTouch||(b.cache.window.bind("resize.lock",function(c){b.cache.activePanel&&b.cache.activePanel._skel_panels_close()}),
|
||||
b.cache.window.bind("scroll.lock",function(c){b.cache.activePanel&&b.cache.activePanel._skel_panels_close()}))},unlockView:function(e){b._.vars.isTouch&&b.cache.body.css("overflow-"+e,"visible");b.cache.pageWrapper.unbind("touchstart.lock");b.cache.pageWrapper.unbind("click.lock");b.cache.pageWrapper.unbind("scroll.lock");b.cache.window.unbind("orientationchange.lock");b._.vars.isTouch||(b.cache.window.unbind("resize.lock"),b.cache.window.unbind("scroll.lock"))},resumeElement:function(e){b.cache[e.type+
|
||||
"s"][e.id].find("*").each(function(){b.parseResume(jQuery(this))})},suspendElement:function(e){e=b.cache[e.type+"s"][e.id];e._skel_panels_translateOrigin();e.find("*").each(function(){b.parseSuspend(jQuery(this))})},initElement:function(e){var c=e.config,d=jQuery(e.object),h;b.cache[e.type+"s"][e.id]=d;d._skel_panels_init();d.find("*").each(function(){b.parseInit(jQuery(this))});switch(e.type){case "panel":d.addClass("skel-panels-panel").css("z-index",b.config.baseZIndex).css("position","fixed").hide();
|
||||
d.find("a").css("-webkit-tap-highlight-color","rgba(0,0,0,0)").bind("click.skel-panels",function(c){if(b.cache.activePanel){c.preventDefault();c.stopPropagation();c=jQuery(this);var d=c.attr("href");b.cache.activePanel._skel_panels_close();c.hasClass("skel-panels-ignoreHref")||window.setTimeout(function(){window.location.href=d},b.config.speed+10)}});"ios"==b._.vars.deviceType&&d.find("input,select,textarea").focus(function(c){var d=jQuery(this);c.preventDefault();c.stopPropagation();window.setTimeout(function(){var c=
|
||||
b.cache.window._skel_panels_scrollPos,g=b.cache.window.scrollTop()-c;b.cache.window.scrollTop(c);b.cache.activePanel.scrollTop(b.cache.activePanel.scrollTop()+g);d.hide();window.setTimeout(function(){d.show()},0)},100)});switch(c.position){case "top":case "bottom":var f="bottom"==c.position?"-":"";d.addClass("skel-panels-panel-"+c.position).data("skel-panels-panel-position",c.position).css("height",b.recalcH(c.size)).scrollTop(0);b._.vars.isTouch?d.css("overflow-y","scroll").css("-webkit-overflow-scrolling",
|
||||
"touch").bind("touchstart",function(b){d._posY=b.originalEvent.touches[0].pageY;d._posX=b.originalEvent.touches[0].pageX}).bind("touchmove",function(b){b=d._posY-b.originalEvent.touches[0].pageY;var c=d.outerHeight(),e=d.get(0).scrollHeight-d.scrollTop();if(0==d.scrollTop()&&0>b||e>c-2&&e<c+2&&0<b)return!1}):d.css("overflow-y","auto");switch(c.style){default:d._skel_panels_open=function(){d._skel_panels_promote().scrollTop(0).css("left","0px").css(c.position,"-"+b.recalcH(c.size)+"px").css("height",
|
||||
b.recalcH(c.size)).css("width","100%").show();c.resetScroll&&d.scrollTop(0);c.resetForms&&d._skel_panels_resetForms();b.lockView("y");window.setTimeout(function(){d.add(b.cache.fixedWrapper.children()).add(b.cache.pageWrapper)._skel_panels_translate(0,f+b.recalcH(c.size));b.cache.activePanel=d},100)},d._skel_panels_close=function(){d.find("*").blur();d.add(b.cache.pageWrapper).add(b.cache.fixedWrapper.children())._skel_panels_translateOrigin();window.setTimeout(function(){b.unlockView("y");d._skel_panels_demote().hide();
|
||||
b.cache.activePanel=null},b.config.speed+50)}}break;case "left":case "right":switch(f="right"==c.position?"-":"",d.addClass("skel-panels-panel-"+c.position).data("skel-panels-panel-position",c.position).css("width",b.recalcW(c.size)).scrollTop(0),b._.vars.isTouch?d.css("overflow-y","scroll").css("-webkit-overflow-scrolling","touch").bind("touchstart",function(b){d._posY=b.originalEvent.touches[0].pageY;d._posX=b.originalEvent.touches[0].pageX}).bind("touchmove",function(b){var e=d._posX-b.originalEvent.touches[0].pageX;
|
||||
b=d._posY-b.originalEvent.touches[0].pageY;var f=d.outerHeight(),h=d.get(0).scrollHeight-d.scrollTop();if(c.swipeToClose&&20>b&&-20<b&&("left"==c.position&&50<e||"right"==c.position&&-50>e))return d._skel_panels_close(),!1;if(0==d.scrollTop()&&0>b||h>f-2&&h<f+2&&0<b)return!1}):d.css("overflow-y","auto"),c.style){default:d._skel_panels_open=function(){d._skel_panels_promote().scrollTop(0).css("top","0px").css(c.position,"-"+b.recalcW(c.size)+"px").css("width",b.recalcW(c.size)).css("height","100%").show();
|
||||
c.resetScroll&&d.scrollTop(0);c.resetForms&&d._skel_panels_resetForms();b.lockView("x");window.setTimeout(function(){d.add(b.cache.fixedWrapper.children()).add(b.cache.pageWrapper)._skel_panels_translate(f+b.recalcW(c.size),0);b.cache.activePanel=d},100)};d._skel_panels_close=function(){d.find("*").blur();d.add(b.cache.fixedWrapper.children()).add(b.cache.pageWrapper)._skel_panels_translateOrigin();window.setTimeout(function(){b.unlockView("x");d._skel_panels_demote().hide();b.cache.activePanel=null},
|
||||
b.config.speed+50)};break;case "reveal":d._skel_panels_open=function(){b.cache.fixedWrapper._skel_panels_promote(2);b.cache.pageWrapper._skel_panels_promote(1);d.scrollTop(0).css("top","0px").css(c.position,"0px").css("width",b.recalcW(c.size)).css("height","100%").show();c.resetScroll&&d.scrollTop(0);c.resetForms&&d._skel_panels_resetForms();b.lockView("x");window.setTimeout(function(){b.cache.pageWrapper.add(b.cache.fixedWrapper.children())._skel_panels_translate(f+b.recalcW(c.size),0);b.cache.activePanel=
|
||||
d},100)},d._skel_panels_close=function(){d.find("*").blur();b.cache.pageWrapper.add(b.cache.fixedWrapper.children())._skel_panels_translateOrigin();window.setTimeout(function(){b.unlockView("x");d.hide();b.cache.pageWrapper._skel_panels_demote();b.cache.pageWrapper._skel_panels_demote();b.cache.activePanel=null},b.config.speed+50)}}}break;case "overlay":d.css("z-index",b.config.baseZIndex).css("position","fixed").addClass("skel-panels-overlay"),d.css("width",c.width).css("height",c.height),(h=b.positions.overlays[c.position])||
|
||||
(c.position="top-left",h=b.positions.overlays[c.position]),d.addClass("skel-panels-overlay-"+c.position).data("skel-panels-overlay-position",c.position),b._.iterate(h,function(e){d.css(e,h[e]);"50%"==h[e]&&("top"==e?d.css("margin-top","-"+b.getHalf(c.height)):"left"==e&&d.css("margin-left","-"+b.getHalf(c.width)))})}},initElements:function(e){var c,d,h,f=[];b._.iterate(b.config[e+"s"],function(g){c={};b._.extend(c,b.defaults.config[e]);b._.extend(c,b.config[e+"s"][g]);b.config[e+"s"][g]=c;d=b._.newDiv(c.html);
|
||||
d.id=g;d.className="skel-panels-"+e;c.html||(f[g]=d);h=c.breakpoints?c.breakpoints.split(","):b._.breakpointList;b._.iterate(h,function(f){f=b._.cacheBreakpointElement(h[f],g,d,"overlay"==e?"skel_panels_fixedWrapper":"skel_panels_defaultWrapper",2);f.config=c;f.initialized=!1;f.type=e;f.onAttach=function(){this.initialized?b.resumeElement(this):(b.initElement(this),this.initialized=!0)};f.onDetach=function(){b.suspendElement(this)}})});b._.DOMReady(function(){var c,d;b._.iterate(f,function(b){c=jQuery("#"+
|
||||
b);d=jQuery(f[b]);c.children().appendTo(d);c.remove()})})},initJQueryUtilityFuncs:function(){jQuery.fn._skel_panels_promote=function(c){this._zIndex=this.css("z-index");this.css("z-index",b.config.baseZIndex+(c?c:1));return this};jQuery.fn._skel_panels_demote=function(){this._zIndex&&(this.css("z-index",this._zIndex),this._zIndex=null);return this};jQuery.fn._skel_panels_xcssValue=function(b,d){return jQuery(this).css(b,"-moz-"+d).css(b,"-webkit-"+d).css(b,"-o-"+d).css(b,"-ms-"+d).css(b,d)};jQuery.fn._skel_panels_xcssProperty=
|
||||
function(b,d){return jQuery(this).css("-moz-"+b,d).css("-webkit-"+b,d).css("-o-"+b,d).css("-ms-"+b,d).css(b,d)};jQuery.fn._skel_panels_xcss=function(b,d){return jQuery(this).css("-moz-"+b,"-moz-"+d).css("-webkit-"+b,"-webkit-"+d).css("-o-"+b,"-o-"+d).css("-ms-"+b,"-ms-"+d).css(b,d)};jQuery.fn._skel_panels_resetForms=function(){var b=jQuery(this);jQuery(this).find("form").each(function(){this.reset()});return b};jQuery.fn._skel_panels_initializeCell=function(){var b=jQuery(this);b.attr("class").match(/(\s+|^)([0-9]+)u(\s+|$)/)&&
|
||||
b.data("cell-size",parseInt(RegExp.$2))};jQuery.fn._skel_panels_expandCell=function(){var b=jQuery(this),d=12;b.parent().children().each(function(){var b=jQuery(this).attr("class");b&&b.match(/(\s+|^)([0-9]+)u(\s+|$)/)&&(d-=parseInt(RegExp.$2))});0<d&&(b._skel_panels_initializeCell(),b.css("width",100*((b.data("cell-size")+d)/12)+"%"))};if(b.config.useTransform&&10<=b._.vars.IEVersion&&(!b.config.transformBreakpoints||b._.hasActive(b.config.transformBreakpoints.split(","))))jQuery.fn._skel_panels_translateOrigin=
|
||||
function(){return jQuery(this)._skel_panels_translate(0,0)},jQuery.fn._skel_panels_translate=function(b,d){return jQuery(this).css("transform","translate("+b+"px, "+d+"px)")},jQuery.fn._skel_panels_init=function(){return jQuery(this).css("backface-visibility","hidden").css("perspective","500")._skel_panels_xcss("transition","transform "+b.config.speed/1E3+"s ease-in-out")};else{var e=[];b.cache.window.resize(function(){if(0!=b.config.speed){var c=b.config.speed;b.config.speed=0;window.setTimeout(function(){b.config.speed=
|
||||
c;e=[]},c)}});jQuery.fn._skel_panels_translateOrigin=function(){for(var c=0;c<this.length;c++){var d=this[c],h=jQuery(d);e[d.id]&&h.animate(e[d.id],b.config.speed,"swing",function(){b._.iterate(e[d.id],function(b){h.css(b,e[d.id][b])});b.cache.body.css("overflow-x","visible");b.cache.pageWrapper.css("width","auto").css("padding-bottom",0)})}return jQuery(this)};jQuery.fn._skel_panels_translate=function(c,d){var h,f,g,l;c=parseInt(c);d=parseInt(d);0!=c?(b.cache.body.css("overflow-x","hidden"),b.cache.pageWrapper.css("width",
|
||||
b.cache.window.width())):g=function(){b.cache.body.css("overflow-x","visible");b.cache.pageWrapper.css("width","auto")};0>d?b.cache.pageWrapper.css("padding-bottom",Math.abs(d)):l=function(){b.cache.pageWrapper.css("padding-bottom",0)};for(h=0;h<this.length;h++){var k=this[h],n=jQuery(k),m;if(!e[k.id])if(m=b.positions.overlays[n.data("skel-panels-overlay-position")])e[k.id]=m;else if(m=b.positions.panels[n.data("skel-panels-panel-position")])for(e[k.id]={},f=0;m[f];f++)e[k.id][m[f]]=parseInt(n.css(m[f]));
|
||||
else m=n.position(),e[k.id]={top:m.top,left:m.left};a={};b._.iterate(e[k.id],function(f){var g;switch(f){case "top":g=b.recalcH(e[k.id][f])+d;break;case "bottom":g=b.recalcH(e[k.id][f])-d;break;case "left":g=b.recalcW(e[k.id][f])+c;break;case "right":g=b.recalcW(e[k.id][f])-c}a[f]=g});n.animate(a,b.config.speed,"swing",function(){g&&g();l&&l()})}return jQuery(this)};jQuery.fn._skel_panels_init=function(){return jQuery(this).css("position","absolute")}}},initObjects:function(){b.cache.window=jQuery(window);
|
||||
b.cache.window.load(function(){0==b.cache.window.scrollTop()&&window.scrollTo(0,1)});b._.DOMReady(function(){b.cache.body=jQuery("body");b.cache.body.wrapInner('<div id="skel-panels-pageWrapper" />');b.cache.pageWrapper=jQuery("#skel-panels-pageWrapper");b.cache.pageWrapper.css("position","relative").css("left","0").css("right","0").css("top","0")._skel_panels_init();b.cache.defaultWrapper=jQuery('<div id="skel-panels-defaultWrapper" />').appendTo(b.cache.body);b.cache.defaultWrapper.css("height",
|
||||
"100%");b.cache.fixedWrapper=jQuery('<div id="skel-panels-fixedWrapper" />').appendTo(b.cache.body);b.cache.fixedWrapper.css("position","relative");jQuery(".skel-panels-fixed").appendTo(b.cache.fixedWrapper);b._.registerLocation("skel_panels_defaultWrapper",b.cache.defaultWrapper[0]);b._.registerLocation("skel_panels_fixedWrapper",b.cache.fixedWrapper[0]);b._.registerLocation("skel_panels_pageWrapper",b.cache.pageWrapper[0])})},initIncludes:function(){b._.DOMReady(function(){jQuery(".skel-panels-include").each(function(){b.parseInit(jQuery(this))})})},
|
||||
init:function(){b.eventType=b._.vars.isTouch?"touchend":"click";b.initObjects();b.initJQueryUtilityFuncs();b.initElements("overlay");b.initElements("panel");b.initIncludes();b._.updateState()}};return b}());
|
||||
35
src/Umbraco.Web.UI/js/skel.min.js
vendored
Normal file
35
src/Umbraco.Web.UI/js/skel.min.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/* skelJS v0.4 | (c) n33 | skeljs.org | MIT licensed */
|
||||
var skel=function(){var a={config:{prefix:null,preloadStyleSheets:!1,pollOnce:!1,resetCSS:!1,normalizeCSS:!1,boxModel:null,useOrientation:!1,useRTL:!1,pollOnLock:!1,containers:960,grid:{collapse:!1,gutters:40},breakpoints:{all:{range:"*",hasStyleSheet:!1}},events:{}},isConfigured:!1,isInit:!1,lockState:null,stateId:"",me:null,breakpoints:[],breakpointList:[],events:[],plugins:{},cache:{elements:{},states:{}},locations:{html:null,head:null,body:null},vars:{},lsc:"_skel_lock",sd:" ",css:{r:"html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}body{-webkit-text-size-adjust:none}",
|
||||
n:'article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{background:#fff;color:#000;font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\u0081C" "\u0081D" "\u00818" "\u00819"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}',
|
||||
g:".\\31 2u{width:100%}.\\31 1u{width:91.6666666667%}.\\31 0u{width:83.3333333333%}.\\39 u{width:75%}.\\38 u{width:66.6666666667%}.\\37 u{width:58.3333333333%}.\\36 u{width:50%}.\\35 u{width:41.6666666667%}.\\34 u{width:33.3333333333%}.\\33 u{width:25%}.\\32 u{width:16.6666666667%}.\\31 u{width:8.3333333333%}.\\31 u,.\\32 u,.\\33 u,.\\34 u,.\\35 u,.\\36 u,.\\37 u,.\\38 u,.\\39 u,.\\31 0u,.\\31 1u,.\\31 2u{float:left;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.\\-11u{margin-left:91.6666666667%}.\\-10u{margin-left:83.3333333333%}.\\-9u{margin-left:75%}.\\-8u{margin-left:66.6666666667%}.\\-7u{margin-left:58.3333333333%}.\\-6u{margin-left:50%}.\\-5u{margin-left:41.6666666667%}.\\-4u{margin-left:33.3333333333%}.\\-3u{margin-left:25%}.\\-2u{margin-left:16.6666666667%}.\\-1u{margin-left:8.3333333333%}",
|
||||
gF:".row.flush{margin-left:0}.row.flush>*{padding:0!important}",gR:".row:after{content:'';display:block;clear:both;height:0}.row:first-child>*{padding-top:0}.row>*{padding-top:0}",gC:".row@{overflow-x:hidden;margin-left:0}.row@>*{float:none!important;width:100%!important;padding:10px 0 10px 0!important;margin-left:0!important}"},presets:{"default":{},standard:{breakpoints:{mobile:{range:"-480",lockViewport:!0,containers:"fluid",grid:{collapse:1}},desktop:{range:"481-",containers:1200},"1000px":{range:"481-1200",
|
||||
containers:960}}}},defaults:{breakpoint:{test:null,config:null,elements:null},config_breakpoint:{range:"",containers:960,lockViewport:!1,viewportWidth:!1,hasStyleSheet:!0,grid:{}}},DOMReady:null,getElementsByClassName:null,indexOf:null,iterate:null,extend:function(b,c){a.iterate(c,function(d){"object"==typeof c[d]?("object"!=typeof b[d]&&(b[d]={}),a.extend(b[d],c[d])):b[d]=c[d]})},parseMeasurement:function(a){var c;"string"!==typeof a?a=[a,"px"]:"fluid"==a?a=[100,"%"]:(c=a.match(/([0-9\.]+)([^\s]*)/),
|
||||
a=3>c.length||!c[2]?[parseFloat(a),"px"]:[parseFloat(c[1]),c[2]]);return a},getDevicePixelRatio:function(){var b=navigator.userAgent;if("ios"==a.vars.deviceType||"mac"==a.vars.deviceType||"android"==a.vars.deviceType&&b.match(/Safari\/([0-9]+)/)&&537<=parseInt(RegExp.$1))return 1;if(void 0!==window.devicePixelRatio&&!b.match(/(Firefox; Mobile)/))return window.devicePixelRatio;if(window.matchMedia){if(window.matchMedia("(-webkit-min-device-pixel-ratio: 2),(min--moz-device-pixel-ratio: 2),(-o-min-device-pixel-ratio: 2/1),(min-resolution: 2dppx)").matches)return 2;
|
||||
if(window.matchMedia("(-webkit-min-device-pixel-ratio: 1.5),(min--moz-device-pixel-ratio: 1.5),(-o-min-device-pixel-ratio: 3/2),(min-resolution: 1.5dppx)").matches)return 1.5}return 1},getViewportWidth:function(){var b,c,d;b=document.documentElement.clientWidth;c=void 0!==window.orientation?Math.abs(window.orientation):!1;d=a.getDevicePixelRatio();screen.width<b&&(b=screen.width);!1!==c&&(b=a.config.useOrientation?90===c?Math.max(screen.width,screen.height):Math.min(screen.width,screen.height):Math.min(screen.width,
|
||||
screen.height));return b/d},unlock:function(){a.lockState=null;document.cookie=a.lsc+"=;expires=Thu, 1 Jan 1970 12:00:00 UTC; path="+window.location.pathname;a.config.pollOnLock?a.poll():window.location.reload()},lock:function(b){a.lockState=b;document.cookie=a.lsc+"="+b+";expires=Thu, 1 Jan 2077 12:00:00 UTC; path="+window.location.pathname;a.config.pollOnLock?a.poll():window.location.reload()},getLock:function(){return a.lockState},isLocked:function(){return!!a.lockState},hasActive:function(b){var c=
|
||||
!1;a.iterate(b,function(d){c=c||a.isActive(b[d])});return c},isActive:function(b){return-1!==a.indexOf(a.stateId,a.sd+b)},wasActive:function(b){return-1!==a.indexOf(a.vars.lastStateId,a.sd+b)},canUse:function(b){return a.breakpoints[b]&&a.breakpoints[b].test(a.getViewportWidth())},unreverseRows:function(){var b=a.getElementsByClassName("row");a.iterate(b,function(a){if("length"!==a&&(a=b[a],a._skel_isReversed)){var d=a.children,e;for(e=1;e<d.length;e++)a.insertBefore(d[e],d[0]);a._skel_isReversed=
|
||||
!1}})},reverseRows:function(b){var c=a.getElementsByClassName("row");a.iterate(c,function(a){if("length"!==a&&(a=c[a],!(a._skel_isReversed||b&&a.className.match(/\bno-collapse-([0-9])\b/)&&parseInt(RegExp.$1)>=parseInt(b)))){var e=a.children,g;for(g=1;g<e.length;g++)a.insertBefore(e[g],e[0]);a._skel_isReversed=!0}})},bind:function(b,c){a.events[b]||(a.events[b]=[]);a.events[b].push(c)},trigger:function(b){a.events[b]&&0!=a.events[b].length&&a.iterate(a.events[b],function(c){a.events[b][c]()})},onStateChange:function(b){a.bind("stateChange",
|
||||
b);a.isInit&&b()},registerLocation:function(b,c){c._skel_attach="head"==b?function(b){this.insertBefore(b,a.me)}:function(a){this.appendChild(a)};a.locations[b]=c},cacheElement:function(b,c,d,e){return a.cache.elements[b]={id:b,object:c,location:d,priority:e}},cacheBreakpointElement:function(b,c,d,e,g){var f=a.getCachedElement(c);f||(f=a.cacheElement(c,d,e,g));a.breakpoints[b]&&a.breakpoints[b].elements.push(f);return f},getCachedElement:function(b){return a.cache.elements[b]?a.cache.elements[b]:
|
||||
null},detachAllElements:function(){var b;a.iterate(a.cache.elements,function(c){b=a.cache.elements[c].object;if(b.parentNode&&(!b.parentNode||b.parentNode.tagName)&&(b.parentNode.removeChild(b),a.cache.elements[c].onDetach))a.cache.elements[c].onDetach()})},attachElements:function(b){var c=[],d=[],e;a.iterate(b,function(a){c[b[a].priority]||(c[b[a].priority]=[]);c[b[a].priority].push(b[a])});a.iterate(c,function(b){0!=c[b].length&&a.iterate(c[b],function(f){if(e=a.locations[c[b][f].location]){if(e._skel_attach(c[b][f].object),
|
||||
c[b][f].onAttach)c[b][f].onAttach()}else d.push(c[b][f])})});0<d.length&&a.DOMReady(function(){a.iterate(d,function(b){if(e=a.locations[d[b].location])if(e._skel_attach(d[b].object),d[b].onAttach)d[b].onAttach()})})},poll:function(){var b,c="";b=a.lockState?a.lockState:a.getViewportWidth();a.vars.viewportWidth=b;a.vars.devicePixelRatio=a.getDevicePixelRatio();a.iterate(a.breakpoints,function(d){a.breakpoints[d].test(b)&&(c+=a.sd+d)});""===c&&(c=a.sd);c!==a.stateId&&(a.locations.html.className=a.locations.html.className.replace(a.stateId,
|
||||
""),a.changeState(c),a.locations.html.className+=a.stateId)},updateState:function(){var b,c=[],d=a.stateId.substring(1).split(a.sd);a.iterate(d,function(e){b=a.breakpoints[d[e]];0!=b.elements.length&&a.iterate(b.elements,function(d){a.cache.states[a.stateId].elements.push(b.elements[d]);c.push(b.elements[d])})});0<c.length&&a.attachElements(c)},changeState:function(b){var c,d,e,g,f,k,h;a.vars.lastStateId=a.stateId;a.stateId=b;if(a.cache.states[a.stateId])d=a.cache.states[a.stateId];else{a.cache.states[a.stateId]=
|
||||
{config:{},elements:[],values:{}};d=a.cache.states[a.stateId];c=a.stateId===a.sd?[]:a.stateId.substring(1).split(a.sd);a.extend(d.config,a.defaults.config_breakpoint);a.iterate(c,function(b){a.extend(d.config,a.breakpoints[c[b]].config)});a.config.boxModel&&(f="iBM",(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newInline("*,*:before,*:after{-moz-@;-webkit-@;-o-@;-ms-@;@}".replace(/@/g,"box-sizing:"+a.config.boxModel+"-box")),"head",3)),d.elements.push(g));a.config.resetCSS?(f="iR",(g=a.getCachedElement(f))||
|
||||
(g=a.cacheElement(f,a.newInline(a.css.r),"head",2)),d.elements.push(g)):a.config.normalizeCSS&&(f="iN",(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newInline(a.css.n),"head",2)),d.elements.push(g));a.config.prefix&&(f="ssB",(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newStyleSheet(a.config.prefix+".css"),"head",4)),d.elements.push(g));d.config.lockViewport?(f="mVL"+a.stateId,(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newMeta("viewport","width="+(d.config.viewportWidth?d.config.viewportWidth:
|
||||
"device-width")+",initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"),"head",1)),d.elements.push(g)):d.config.viewportWidth&&(f="mV"+a.stateId,(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newMeta("viewport","width="+d.config.viewportWidth),"head",1)),d.elements.push(g));e=a.parseMeasurement(d.config.containers);b=e[0];e=e[1];d.values.containers=b+e;f="iC"+b+e;if(!(g=a.getCachedElement(f))){var l;l=b+e;g=a.cacheElement(f,a.newInline("body{min-width:"+l+"}.container{margin:0 auto;width:"+
|
||||
l+"}.container.small{width:"+(0.75*b+e)+"}.container.big{width:100%;max-width:"+(1.25*b+e)+";min-width:"+l+"}"),"head",3)}d.elements.push(g);f="iG";(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newInline(a.css.g+a.css.gF),"head",3));d.elements.push(g);f="iGG"+d.config.grid.gutters;if(!(g=a.getCachedElement(f))){var m,n,p;e=a.parseMeasurement(d.config.grid.gutters);b=e[0];m=e[1];e=b+m;l=b/2+m;n=b/4+m;p=1.5*b+m;b=2*b+m;g=a.cacheElement("iGG"+d.config.grid.gutters,a.newInline(".row>*{padding:"+e+
|
||||
" 0 0 "+e+"}.row+.row>*{padding-top:"+e+"}.row{margin-left:-"+e+"}.row.half>*{padding:"+l+" 0 0 "+l+"}.row.half+.row.half>*{padding-top:"+l+"}.row.half{margin-left:-"+l+"}.row.quarter>*{padding:"+n+" 0 0 "+n+"}.row.quarter+.row.quarter>*{padding-top:"+n+"}.row.quarter{margin-left:-"+n+"}.row.oneandhalf>*{padding:"+p+" 0 0 "+p+"}.row.oneandhalf+.row.oneandhalf>*{padding-top:"+p+"}.row.oneandhalf{margin-left:-"+p+"}.row.double>*{padding:"+b+" 0 0 "+b+"}.row.double+.row.double>*{padding-top:"+b+"}.row.double{margin-left:-"+
|
||||
b+"}"),"head",3)}d.elements.push(g);if(d.config.grid.collapse){if(b=parseInt(d.config.grid.collapse),isNaN(b)&&(b=1),f="iGC"+b,!(g=a.getCachedElement(f))){k=a.css.gR+a.css.gC;h=":not(.no-collapse)";switch(b){case 4:break;case 3:h+=":not(.no-collapse-3)";break;case 2:h+=":not(.no-collapse-2):not(.no-collapse-3)";break;default:h+=":not(.no-collapse-1):not(.no-collapse-2):not(.no-collapse-3)"}k=k.replace(/@/g,h);g=a.cacheElement(f,a.newInline(k+".container{max-width:none!important;min-width:0!important;width:"+
|
||||
d.values.containers+"!important}"),"head",3)}}else f="iGNoCo",(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newInline(a.css.gR),"head",3));d.elements.push(g);f="iCd"+a.stateId;(g=a.getCachedElement(f))||(k=[],h=[],a.iterate(a.breakpoints,function(b){-1!==a.indexOf(c,b)?k.push(".not-"+b):h.push(".only-"+b)}),b=(0<k.length?k.join(",")+"{display:none!important}":"")+(0<h.length?h.join(",")+"{display:none!important}":""),g=a.cacheElement(f,a.newInline(b.replace(/\.([0-9])/,".\\3$1 ")),"head",3),d.elements.push(g));
|
||||
a.iterate(c,function(b){a.breakpoints[c[b]].config.hasStyleSheet&&a.config.prefix&&(f="ss"+c[b],(g=a.getCachedElement(f))||(g=a.cacheElement(f,a.newStyleSheet(a.config.prefix+"-"+c[b]+".css"),"head",5)),d.elements.push(g));0<a.breakpoints[c[b]].elements.length&&a.iterate(a.breakpoints[c[b]].elements,function(e){d.elements.push(a.breakpoints[c[b]].elements[e])})})}a.detachAllElements();a.attachElements(d.elements);a.DOMReady(function(){var b,c;a.config.useRTL&&(a.unreverseRows(),d.config.grid.collapse&&
|
||||
a.reverseRows(d.config.grid.collapse));if((b=a.getElementsByClassName("skel-cell-mainContent"))&&0<b.length)if(b=b[0],d.config.grid.collapse)c=document.createElement("div"),c.innerHTML="",c.id="skel-cell-mainContent-placeholder",c.style="display:none",b.parentNode.insertBefore(c,b.nextSibling),b.parentNode.insertBefore(b,b.parentNode.firstChild);else if(c=document.getElementById("skel-cell-mainContent-placeholder"))b.parentNode.insertBefore(b,c),b.parentNode.removeChild(c)});a.vars.state=a.cache.states[a.stateId];
|
||||
a.vars.stateId=a.stateId;a.trigger("stateChange")},newMeta:function(a,c){var d=document.createElement("meta");d.name=a;d.content=c;return d},newStyleSheet:function(a){var c=document.createElement("link");c.rel="stylesheet";c.type="text/css";c.href=a;return c},newInline:function(b){var c;8>=a.vars.IEVersion?(c=document.createElement("span"),c.innerHTML=' <style type="text/css">'+b+"</style>"):(c=document.createElement("style"),c.type="text/css",c.innerHTML=b);return c},newDiv:function(a){var c=
|
||||
document.createElement("div");c.innerHTML=a;return c},registerPlugin:function(b,c){a.plugins[b]=c;c._=this;a.isConfigured&&(a.initPluginConfig(b,a.plugins[b]),c.init())},initPluginConfig:function(b,c){var d;d="_skel_"+b+"_config";window[d]?d=window[d]:(d=document.getElementsByTagName("script"),(d=d[d.length-1].innerHTML.replace(/^\s+|\s+$/g,""))&&(d=eval("("+d+")")));"object"==typeof d&&(d.preset&&c.presets[d.preset]&&a.extend(c.config,c.presets[d.preset]),a.extend(c.config,d))},initConfig:function(){function b(b,
|
||||
c){var d;"string"!=typeof c&&(d=function(a){return!1});"*"==c?d=function(a){return!0}:"-"==c.charAt(0)?(g[b]=parseInt(c.substring(1)),d=function(a){return a<=g[b]}):"-"==c.charAt(c.length-1)?(g[b]=parseInt(c.substring(0,c.length-1)),d=function(a){return a>=g[b]}):-1!=a.indexOf(c,"-")?(c=c.split("-"),g[b]=[parseInt(c[0]),parseInt(c[1])],d=function(a){return a>=g[b][0]&&a<=g[b][1]}):(g[b]=parseInt(c),d=function(a){return a==g[b]});return d}var c,d,e,g=[],f=[];window._skel_config?e=window._skel_config:
|
||||
(e=a.me.innerHTML.replace(/^\s+|\s+$/g,""))&&(e=eval("("+e+")"));"object"==typeof e&&(e.preset&&a.presets[e.preset]?(a.config.breakpoints={},a.extend(a.config,a.presets[e.preset])):e.breakpoints&&(a.config.breakpoints={}),a.extend(a.config,e));a.extend(a.defaults.config_breakpoint.grid,a.config.grid);a.defaults.config_breakpoint.containers=a.config.containers;a.iterate(a.config.breakpoints,function(e){"object"!=typeof a.config.breakpoints[e]&&(a.config.breakpoints[e]={range:a.config.breakpoints[e]});
|
||||
c={};a.extend(c,a.defaults.config_breakpoint);a.extend(c,a.config.breakpoints[e]);a.config.breakpoints[e]=c;d={};a.extend(d,a.defaults.breakpoint);d.config=a.config.breakpoints[e];d.test=b(e,d.config.range);d.elements=[];a.breakpoints[e]=d;a.config.preloadStyleSheets&&d.config.hasStyleSheet&&f.push(a.config.prefix+"-"+e+".css");a.breakpointList.push(e)});a.iterate(a.config.events,function(b){a.bind(b,a.config.events[b])});0<f.length&&"file:"!=window.location.protocol&&a.DOMReady(function(){document.getElementsByTagName("head");
|
||||
var b=new XMLHttpRequest;a.iterate(f,function(a){b.open("GET",f[a],!1);b.send("")})})},initEvents:function(){a.config.pollOnce||(window.onresize=function(){a.poll()},a.config.useOrientation&&(window.onorientationchange=function(){a.poll()}))},initUtilityMethods:function(){(function(){var b=window,c=function(a){e=!1;c.isReady=!1;"function"===typeof a&&g.push(a);a=!1;if(!e)if(e=!0,"loading"!==d.readyState&&k(),d.addEventListener)d.addEventListener("DOMContentLoaded",f,!1),b.addEventListener("load",
|
||||
f,!1);else if(d.attachEvent){d.attachEvent("onreadystatechange",f);b.attachEvent("onload",f);try{a=null==b.frameElement}catch(m){}d.documentElement.doScroll&&a&&h()}},d=b.document,e=!1,g=[],f=function(){d.addEventListener?d.removeEventListener("DOMContentLoaded",f,!1):d.detachEvent("onreadystatechange",f);k()},k=function(){if(!c.isReady){if(!d.body)return setTimeout(k,1);c.isReady=!0;a.iterate(g,function(a){g[a]()});g=[]}},h=function(){if(!c.isReady){try{d.documentElement.doScroll("left")}catch(a){setTimeout(h,
|
||||
1);return}k()}};c.isReady=!1;a.DOMReady=c})();a.getElementsByClassName=document.getElementsByClassName?function(a){return document.getElementsByClassName(a)}:function(a){var c=document;return c.querySelectorAll?c.querySelectorAll(("."+a.replace(" "," .")).replace(/\.([0-9])/,".\\3$1 ")):[]};a.indexOf=Array.prototype.indexOf?function(a,c){return a.indexOf(c)}:function(a,c){"string"==typeof a&&(a=a.split(""));var d=a.length>>>0,e=Number(c)||0,e=0>e?Math.ceil(e):Math.floor(e);for(0>e&&(e+=d);e<d;e++)if(a instanceof
|
||||
Array&&e in a&&a[e]===c)return e;return-1};a.iterate=Object.keys?function(a,c){if(!a)return[];var d,e=Object.keys(a);for(d=0;e[d];d++)c(e[d])}:function(a,c){if(!a)return[];for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&c(d)}},initAPI:function(){var b,c,d=navigator.userAgent;a.vars.IEVersion=d.match(/MSIE ([0-9]+)\./)?RegExp.$1:99;a.vars.isTouch=!!("ontouchstart"in window);a.vars.deviceType="other";c={ios:"(iPad|iPhone|iPod)",android:"Android",mac:"Macintosh"};a.iterate(c,function(b){d.match(RegExp(c[b],
|
||||
"g"))&&(a.vars.deviceType=b)});b=document.cookie.split(";");a.iterate(b,function(c){c=b[c].split("=");c[0]==a.lsc&&(a.lockState=c[1])})},init:function(b,c){a.initUtilityMethods();a.initAPI();b&&(window._skel_config=b);c&&a.iterate(c,function(a){window["_skel_"+a+"_config"]=c[a]});a.initConfig();a.registerLocation("html",document.getElementsByTagName("html")[0]);a.registerLocation("head",document.getElementsByTagName("head")[0]);a.DOMReady(function(){a.registerLocation("body",document.getElementsByTagName("body")[0])});
|
||||
a.initEvents();a.poll();a.iterate(a.plugins,function(b){a.initPluginConfig(b,a.plugins[b]);a.plugins[b].init()});a.isInit=!0},preInit:function(){var b=document.getElementsByTagName("script");a.me=b[b.length-1];if(window._skel_config)a.isConfigured=!0;else if(s=document.getElementsByTagName("script"),s=s[s.length-1].innerHTML.replace(/^\s+|\s+$/g,""))a.isConfigured=!0;a.isConfigured&&a.init()}};a.preInit();return a}();
|
||||
@@ -1,33 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
//TODO: This needs to be rebuild in angular and then removed
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Controls
|
||||
{
|
||||
public partial class ContentTypeControlNew : global::umbraco.controls.ContentTypeControlNew
|
||||
{
|
||||
protected string DataTypeControllerUrl { get; private set; }
|
||||
protected string ContentTypeControllerUrl { get; private set; }
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.ComponentModel.DataAnnotations;
|
||||
//using System.Linq;
|
||||
//using System.Web;
|
||||
//using System.Web.UI.WebControls;
|
||||
//using AutoMapper;
|
||||
//using Umbraco.Core;
|
||||
//using Umbraco.Core.Models;
|
||||
//using Umbraco.Web.Editors;
|
||||
//using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data. </param>
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
//namespace Umbraco.Web.UI.Umbraco.Controls
|
||||
//{
|
||||
// public partial class ContentTypeControlNew : global::umbraco.controls.ContentTypeControlNew
|
||||
// {
|
||||
// protected string DataTypeControllerUrl { get; private set; }
|
||||
// protected string ContentTypeControllerUrl { get; private set; }
|
||||
|
||||
DataTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl<DataTypeController>(x => x.GetById(0));
|
||||
ContentTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl<ContentTypeController>(x => x.GetAssignedListViewDataType(0));
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
|
||||
// /// </summary>
|
||||
// /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data. </param>
|
||||
// protected override void OnLoad(EventArgs e)
|
||||
// {
|
||||
// base.OnLoad(e);
|
||||
|
||||
// DataTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl<DataTypeController>(x => x.GetById(0));
|
||||
// ContentTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl<ContentTypeController>(x => x.GetAssignedListViewDataType(0));
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
@@ -1,80 +0,0 @@
|
||||
<%@ Control Language="c#" AutoEventWireup="True" Inherits="umbraco.controls.GenericProperties.GenericProperty" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
<li id="<%=this.FullId%>" onmousedown="activeDragId = this.id;">
|
||||
<div class="propertyForm" id="<%=this.FullId%>_form">
|
||||
<div id="desc<%=this.ClientID%>" ondblclick="expandCollapse('<%=this.ClientID%>'); document.getElementById('<%=this.ClientID%>_tbName').focus();">
|
||||
<div class="header">
|
||||
<i class="icon-navigation handle"></i>
|
||||
|
||||
<asp:LinkButton ID="DeleteButton2" runat="server">
|
||||
<i class="btn btn-mini icon-delete"></i>
|
||||
</asp:LinkButton>
|
||||
|
||||
<a href="javascript:expandCollapse('<%=this.ClientID%>');">
|
||||
|
||||
|
||||
<i class="toggle-button btn btn-mini icon-navigation-down"></i>
|
||||
<asp:Literal ID="FullHeader" runat="server"></asp:Literal>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="edit<%=this.ClientID%>" style="DISPLAY: none;">
|
||||
<div class="header">
|
||||
<i class="icon-navigation handle"></i>
|
||||
<asp:LinkButton ID="DeleteButton" runat="server">
|
||||
<i class="btn btn-mini icon-delete"></i>
|
||||
</asp:LinkButton>
|
||||
<a href="javascript:expandCollapse('<%=this.ClientID%>');">
|
||||
<i class="toggle-button btn btn-mini icon-navigation-up"></i>
|
||||
Edit "<asp:Literal ID="Header" runat="server"></asp:Literal>"
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<cc1:Pane ID="Pane1" runat="server">
|
||||
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Name">
|
||||
<asp:TextBox ID="tbName" runat="server" CssClass="propertyFormInput prop-name"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel2" runat="server" Text="Alias">
|
||||
<asp:TextBox ID="tbAlias" runat="server" CssClass="propertyFormInput prop-alias"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel3" runat="server" Text="Type">
|
||||
<asp:DropDownList ID="ddlTypes" runat="server" CssClass="propertyFormInput"></asp:DropDownList>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel4" runat="server" Text="Tab">
|
||||
<asp:DropDownList ID="ddlTab" runat="server" CssClass="propertyFormInput"></asp:DropDownList>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel5" runat="server" Text="Mandatory" >
|
||||
<asp:CheckBox ID="checkMandatory" runat="server"></asp:CheckBox>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel6" runat="server" Text="Validation">
|
||||
<asp:TextBox ID="tbValidation" runat="server" TextMode="MultiLine" CssClass="propertyFormInput"></asp:TextBox><br />
|
||||
<asp:CustomValidator runat="server" ID="cvValidation" ControlToValidate="tbValidation" ErrorMessage="Invalid expression" ClientValidationFunction="ValidateValidation" /><br />
|
||||
<small>
|
||||
<asp:HyperLink ID="validationLink" runat="server">Search for a regular expression</asp:HyperLink></small>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel7" runat="server" Text="Description">
|
||||
<asp:TextBox ID="tbDescription" runat="server" CssClass="propertyFormInput" TextMode="MultiLine"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<script type="text/javascript">
|
||||
function ValidateValidation(sender, args) {
|
||||
try {
|
||||
var patt = new RegExp(args.Value);
|
||||
args.IsValid = true;
|
||||
|
||||
} catch (e) {
|
||||
args.IsValid = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,49 +0,0 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="ImageViewer.ascx.cs" Inherits="Umbraco.Web.UI.Umbraco.Controls.Images.ImageViewer" %>
|
||||
<%@ Import Namespace="Umbraco.Core.IO" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="controls/Images/ImageViewer.js" PathNameAlias="UmbracoRoot" />
|
||||
<div id="<%# ClientID %>" class="imageViewer" >
|
||||
|
||||
<asp:MultiView ID="MultiView" runat="server">
|
||||
<asp:View ID="Basic" runat="server">
|
||||
<img src="<%#MediaItemThumbnailPath%>" alt="<%#AltText%>" border="0" class='<%#ImageFound ? "" : "noimage" %>' />
|
||||
</asp:View>
|
||||
<asp:View ID="ImageLink" runat="server">
|
||||
<a href="<%#MediaItemPath%>" title="<%#AltText%>" target="<%#LinkTarget%>">
|
||||
<img src="<%#MediaItemThumbnailPath%>" alt="<%#AltText%>" border="0" class='<%#ImageFound ? "" : "noimage" %>' />
|
||||
</a>
|
||||
</asp:View>
|
||||
<asp:View ID="ThumbnailPreview" runat="server">
|
||||
<div class="bgImage"
|
||||
style="width: 105px; height: 105px; background: #fff center center no-repeat;border: 1px solid #ccc; background-image: url('<%#MediaItemThumbnailPath.Replace(" ", "%20")%>');">
|
||||
</div>
|
||||
</asp:View>
|
||||
</asp:MultiView>
|
||||
|
||||
|
||||
<%--Register the javascript callback method if any.--%>
|
||||
|
||||
<script type="text/javascript">
|
||||
<%#string.IsNullOrEmpty(ClientCallbackMethod) ? "" : ClientCallbackMethod + "('" + MediaItemPath + "','" + AltText + "','" + FileWidth + "','" + FileHeight + "');" %>
|
||||
</script>
|
||||
</div>
|
||||
<%--Ensure that the client API is registered for the image.--%>
|
||||
|
||||
<script type="text/javascript">
|
||||
var opts = {
|
||||
umbPath: "<%# IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>",
|
||||
style: "<%#ViewerStyle.ToString()%>",
|
||||
linkTarget: "<%#LinkTarget%>"
|
||||
};
|
||||
|
||||
if (jQuery.isReady) {
|
||||
//because this may be rendered with AJAX, the doc may already be ready! so just wire it up.
|
||||
jQuery("#<%# ClientID %>").UmbracoImageViewer(opts);
|
||||
}
|
||||
else {
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#<%# ClientID %>").UmbracoImageViewer(opts);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Controls.Images
|
||||
{
|
||||
public partial class ImageViewer : global::umbraco.controls.Images.ImageViewer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Controls.Images {
|
||||
|
||||
|
||||
public partial class ImageViewer {
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
/// <reference path="/umbraco_client/ui/jquery.js" />
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
(function($) {
|
||||
//jQuery plugin for Umbraco image viewer control
|
||||
$.fn.UmbracoImageViewer = function(opts) {
|
||||
//all options must be specified
|
||||
var conf = $.extend({
|
||||
style: false,
|
||||
linkTarget: "_blank",
|
||||
umbPath: ""
|
||||
}, opts);
|
||||
return this.each(function() {
|
||||
new Umbraco.Controls.ImageViewer().init($(this), conf);
|
||||
});
|
||||
}
|
||||
$.fn.UmbracoImageViewerAPI = function() {
|
||||
/// <summary>exposes the Umbraco Image Viewer api for the selected object</summary>
|
||||
//if there's more than item in the selector, throw exception
|
||||
if ($(this).length != 1) {
|
||||
throw "UmbracoImageViewerAPI selector requires that there be exactly one control selected";
|
||||
};
|
||||
return Umbraco.Controls.ImageViewer.inst[$(this).attr("id")] || null;
|
||||
};
|
||||
Umbraco.Controls.ImageViewer = function() {
|
||||
return {
|
||||
_cntr: ++Umbraco.Controls.ImageViewer.cntr,
|
||||
_containerId: null,
|
||||
_context: null,
|
||||
_serviceUrl: "",
|
||||
_umbPath: "",
|
||||
_style: false,
|
||||
_linkTarget: "",
|
||||
|
||||
init: function(jItem, opts) {
|
||||
//this is stored so that we search the current document/iframe for this object
|
||||
//when calling _getContainer. Before this was not required but for some reason inside the
|
||||
//TinyMCE popup, when doing an ajax call, the context is lost to the jquery item!
|
||||
this._context = jItem.get(0).ownerDocument;
|
||||
|
||||
//store a reference to this api by the id and the counter
|
||||
Umbraco.Controls.ImageViewer.inst[this._cntr] = this;
|
||||
if (!jItem.attr("id")) jItem.attr("id", "UmbImageViewer_" + this._cntr);
|
||||
Umbraco.Controls.ImageViewer.inst[jItem.attr("id")] = Umbraco.Controls.ImageViewer.inst[this._cntr];
|
||||
|
||||
this._containerId = jItem.attr("id");
|
||||
|
||||
this._umbPath = opts.umbPath;
|
||||
this._serviceUrl = this._umbPath + "/controls/Images/ImageViewerUpdater.asmx";
|
||||
this._style = opts.style;
|
||||
this._linkTarget = opts.linkTarget;
|
||||
|
||||
},
|
||||
|
||||
updateImage: function(mediaId, callback) {
|
||||
/// <summary>Updates the image to show the mediaId parameter using AJAX</summary>
|
||||
|
||||
this._showThrobber();
|
||||
|
||||
var _this = this;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: _this._serviceUrl + "/UpdateImage",
|
||||
data: '{ "mediaId": ' + parseInt(mediaId) + ', "style": "' + _this._style + '", "linkTarget": "' + _this._linkTarget + '"}',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function(msg) {
|
||||
var rHtml = $("<div>").append(msg.d.html); //get the full html response wrapped in temp div
|
||||
_this._updateImageFromAjax(rHtml);
|
||||
if (typeof callback == "function") {
|
||||
//build the parameters to pass back to the callback method
|
||||
var params = {
|
||||
hasImage: _this._getContainer().find("img.noimage").length == 0,
|
||||
mediaId: msg.d.mediaId,
|
||||
width: msg.d.width,
|
||||
height: msg.d.height,
|
||||
url: msg.d.url,
|
||||
alt: msg.d.alt
|
||||
};
|
||||
//call the callback method
|
||||
callback.call(_this, params);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showImage: function(path) {
|
||||
/// <summary>This will force the image to show the path passed in </summary>
|
||||
if (this._style != "ThumbnailPreview") {
|
||||
this._getContainer().find("img").attr("src", path);
|
||||
}
|
||||
else {
|
||||
c = this._getContainer().find(".bgImage");
|
||||
c.css("background-image", "url('" + path + "')");
|
||||
}
|
||||
},
|
||||
|
||||
_getContainer: function() {
|
||||
return $("#" + this._containerId, this._context);
|
||||
},
|
||||
|
||||
_updateImageFromAjax: function(rHtml) {
|
||||
this._getContainer().html(rHtml.find(".imageViewer").html()); //replace the html with the inner html of the image viewer response
|
||||
},
|
||||
|
||||
_showThrobber: function() {
|
||||
var c = null;
|
||||
if (this._style != "ThumbnailPreview") {
|
||||
c = this._getContainer().find("img");
|
||||
c.attr("src", this._umbPath + "/images/throbber.gif");
|
||||
c.css("margin-top", ((c.height() - 15) / 2) + "px");
|
||||
c.css("margin-left", ((c.width() - 15) / 2) + "px");
|
||||
}
|
||||
else {
|
||||
c = this._getContainer().find(".bgImage");
|
||||
c.css("background-image", "");
|
||||
c.html("<img id='throbber'/>");
|
||||
var img = c.find("img");
|
||||
img.attr("src", this._umbPath + "/images/throbber.gif");
|
||||
img.css("margin-top", "45px");
|
||||
img.css("margin-left", "45px");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// instance manager
|
||||
Umbraco.Controls.ImageViewer.cntr = 0;
|
||||
Umbraco.Controls.ImageViewer.inst = {};
|
||||
|
||||
})(jQuery);
|
||||
@@ -1 +0,0 @@
|
||||
<%@ WebService Language="C#" CodeBehind="ImageViewerUpdater.asmx.cs" Class="umbraco.controls.Images.ImageViewerUpdater" %>
|
||||
@@ -1,28 +0,0 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UploadMediaImage.ascx.cs"
|
||||
Inherits="umbraco.controls.Images.UploadMediaImage" %>
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
<%@ Register TagPrefix="ctl" Namespace="umbraco.controls" Assembly="umbraco" %>
|
||||
|
||||
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="controls/Images/UploadMediaImage.js" PathNameAlias="UmbracoRoot" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var uploader_<%=this.ClientID%> = new Umbraco.Controls.UploadMediaImage("<%=TextBoxTitle.ClientID%>", "<%=SubmitButton.ClientID%>", "<%=((Control)UploadField.DataEditor).ClientID%>");
|
||||
</script>
|
||||
|
||||
<cc1:pane id="pane_upload" runat="server">
|
||||
<cc1:PropertyPanel ID="pp_name" runat="server" Text="Name">
|
||||
<asp:TextBox id="TextBoxTitle" runat="server"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_file" runat="server" Text="File">
|
||||
<asp:PlaceHolder id="UploadControl" runat="server"></asp:PlaceHolder>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_target" runat="server" Text="Save at...">
|
||||
<ctl:ContentPicker runat="server" ID="MediaPickerControl" AppAlias="media" TreeAlias="media"
|
||||
ModalHeight="200" ShowDelete="false" ShowHeader="false" Text='<%#umbraco.BasePages.BasePage.Current.getUser().StartMediaId.ToString()%>' />
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_button" runat="server" Text=" ">
|
||||
<asp:Button id="SubmitButton" runat="server" Text='<%#umbraco.ui.Text("save")%>' Enabled="false" OnClick="SubmitButton_Click"></asp:Button>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:pane>
|
||||
<cc1:feedback id="feedback" runat="server" />
|
||||
@@ -1,52 +0,0 @@
|
||||
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
(function($) {
|
||||
Umbraco.Controls.UploadMediaImage = function(txtBoxTitleID, btnID, uploadFileID) {
|
||||
return {
|
||||
_txtBoxTitleID: txtBoxTitleID,
|
||||
_btnID: btnID,
|
||||
_uplaodFileID: uploadFileID,
|
||||
|
||||
validateImage: function() {
|
||||
// Disable save button
|
||||
var imageTypes = ",jpeg,jpg,gif,bmp,png,tiff,tif,";
|
||||
var tb_title = document.getElementById(this._txtBoxTitleID);
|
||||
var bt_submit = $("#" + this._btnID);
|
||||
var tb_image = document.getElementById(this._uplaodFileID);
|
||||
|
||||
bt_submit.attr("disabled","disabled").css("color", "gray");
|
||||
|
||||
var imageName = tb_image.value;
|
||||
if (imageName.length > 0) {
|
||||
var extension = imageName.substring(imageName.lastIndexOf(".") + 1, imageName.length);
|
||||
if (imageTypes.indexOf(',' + extension.toLowerCase() + ',') > -1) {
|
||||
bt_submit.removeAttr("disabled").css("color", "#000");
|
||||
if (tb_title.value == "") {
|
||||
var curName = imageName.substring(imageName.lastIndexOf("\\") + 1, imageName.length).replace("." + extension, "");
|
||||
var curNameLength = curName.length;
|
||||
var friendlyName = "";
|
||||
for (var i = 0; i < curNameLength; i++) {
|
||||
currentChar = curName.substring(i, i + 1);
|
||||
if (friendlyName.length == 0)
|
||||
currentChar = currentChar.toUpperCase();
|
||||
|
||||
if (i < curNameLength - 1 && friendlyName != '' && curName.substring(i - 1, i) == ' ')
|
||||
currentChar = currentChar.toUpperCase();
|
||||
else if (currentChar != " " && i < curNameLength - 1 && friendlyName != ''
|
||||
&& curName.substring(i-1, i).toUpperCase() != curName.substring(i-1, i)
|
||||
&& currentChar.toUpperCase() == currentChar)
|
||||
friendlyName += " ";
|
||||
|
||||
friendlyName += currentChar;
|
||||
|
||||
}
|
||||
tb_title.value = friendlyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
})(jQuery);
|
||||
@@ -1,14 +0,0 @@
|
||||
<%@ Page Language="c#" CodeBehind="imageViewer.aspx.cs" AutoEventWireup="True" Inherits="umbraco.dialogs.imageViewer" %>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
|
||||
<html>
|
||||
<head>
|
||||
<title>imageViewer</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="Form1" method="post" runat="server">
|
||||
<asp:PlaceHolder ID="image" runat="server">
|
||||
</asp:PlaceHolder>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
//TODO: This needs to be rebuild in angular and then removed
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Settings
|
||||
{
|
||||
public partial class EditNodeTypeNew : global::umbraco.settings.EditContentTypeNew
|
||||
{
|
||||
}
|
||||
}
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Web;
|
||||
|
||||
//namespace Umbraco.Web.UI.Umbraco.Settings
|
||||
//{
|
||||
// public partial class EditNodeTypeNew : global::umbraco.settings.EditContentTypeNew
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
@@ -1,123 +0,0 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.BaseRest;
|
||||
|
||||
namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
[Obsolete("Umbraco /base is obsoleted, use WebApi (UmbracoApiController) instead for all REST based logic")]
|
||||
internal class BaseRestHandler : IHttpHandler, IRequiresSessionState
|
||||
{
|
||||
static readonly string BaseUrl;
|
||||
|
||||
static BaseRestHandler()
|
||||
{
|
||||
BaseUrl = UriUtility.ToAbsolute(Core.IO.SystemDirectories.Base).ToLower();
|
||||
if (!BaseUrl.EndsWith("/"))
|
||||
BaseUrl += "/";
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether a specified Uri should be routed to the BaseRestHandler.
|
||||
/// </summary>
|
||||
/// <param name="uri">The specified Uri.</param>
|
||||
/// <returns>A value indicating whether the specified Uri should be routed to the BaseRestHandler.</returns>
|
||||
public static bool IsBaseRestRequest(Uri uri)
|
||||
{
|
||||
return UmbracoConfig.For.BaseRestExtensions().Enabled
|
||||
&& uri.AbsolutePath.ToLowerInvariant().StartsWith(BaseUrl);
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
string url = context.Request.RawUrl;
|
||||
|
||||
// sanitize and split the url
|
||||
url = url.Substring(BaseUrl.Length);
|
||||
if (url.ToLower().Contains(".aspx"))
|
||||
url = url.Substring(0, url.IndexOf(".aspx", StringComparison.OrdinalIgnoreCase));
|
||||
if (url.ToLower().Contains("?"))
|
||||
url = url.Substring(0, url.IndexOf("?", StringComparison.OrdinalIgnoreCase));
|
||||
var urlParts = url.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// by default, return xml content
|
||||
context.Response.ContentType = "text/xml";
|
||||
|
||||
// ensure that we have a valid request ie /base/library/method/[parameters].aspx
|
||||
if (urlParts.Length < 2)
|
||||
{
|
||||
context.Response.Write("<error>Invalid request, missing parts.</error>");
|
||||
context.Response.StatusCode = 400;
|
||||
context.Response.StatusDescription = "Bad Request";
|
||||
context.Response.End();
|
||||
return;
|
||||
}
|
||||
|
||||
var extensionAlias = urlParts[0];
|
||||
var methodName = urlParts[1];
|
||||
var paramsCount = urlParts.Length - 2;
|
||||
|
||||
var method = RestExtensionMethodInfo.GetMethod(extensionAlias, methodName, paramsCount);
|
||||
|
||||
if (!method.Exists)
|
||||
{
|
||||
context.Response.StatusCode = 500;
|
||||
context.Response.StatusDescription = "Internal Server Error";
|
||||
context.Response.Output.Write("<error>Extension or method not found.</error>");
|
||||
}
|
||||
else if (!method.CanBeInvokedByCurrentMember)
|
||||
{
|
||||
context.Response.StatusCode = 500;
|
||||
context.Response.StatusDescription = "Internal Server Error";
|
||||
context.Response.Output.Write("<error>Permission denied.</error>");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!method.ReturnXml)
|
||||
context.Response.ContentType = "text/html";
|
||||
|
||||
TrySetCulture();
|
||||
|
||||
var result = method.Invoke(urlParts.Skip(2).ToArray());
|
||||
if (result.Length >= 7 && result.Substring(0, 7) == "<error>")
|
||||
{
|
||||
context.Response.StatusCode = 500;
|
||||
context.Response.StatusDescription = "Internal Server Error";
|
||||
}
|
||||
context.Response.Output.Write(result);
|
||||
}
|
||||
|
||||
context.Response.End();
|
||||
}
|
||||
|
||||
#region from baseHttpModule.cs
|
||||
|
||||
// note - is this ok?
|
||||
|
||||
private static void TrySetCulture()
|
||||
{
|
||||
var domain = HttpContext.Current.Request.Url.Host; // host only
|
||||
if (TrySetCulture(domain)) return;
|
||||
|
||||
domain = HttpContext.Current.Request.Url.Authority; // host with port
|
||||
TrySetCulture(domain);
|
||||
}
|
||||
|
||||
private static bool TrySetCulture(string domain)
|
||||
{
|
||||
var uDomain = global::umbraco.cms.businesslogic.web.Domain.GetDomain(domain);
|
||||
if (uDomain == null) return false;
|
||||
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(uDomain.Language.CultureAlias);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.cms.businesslogic.property;
|
||||
|
||||
namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
[Obsolete("Umbraco /base is obsoleted, use WebApi (UmbracoApiController) instead for all REST based logic")]
|
||||
public static class MemberRest
|
||||
{
|
||||
public static int GetCurrentMemberId()
|
||||
{
|
||||
return Member.CurrentMemberId();
|
||||
}
|
||||
|
||||
public static Member GetCurrentMember()
|
||||
{
|
||||
return Member.GetCurrentMember();
|
||||
}
|
||||
|
||||
public static int Login(string login, string password)
|
||||
{
|
||||
Member m = Member.GetMemberFromLoginNameAndPassword(login, password);
|
||||
var id = GetCurrentMemberId();
|
||||
if (id == 0)
|
||||
{
|
||||
if (m == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Member.AddMemberToCache(m);
|
||||
return m.Id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public static int Logout()
|
||||
{
|
||||
var currentId = GetCurrentMemberId();
|
||||
if (currentId > 0)
|
||||
{
|
||||
Member.RemoveMemberFromCache(currentId);
|
||||
Member.ClearMemberFromClient(currentId);
|
||||
return currentId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static XPathNodeIterator GetCurrentMemberAsXml()
|
||||
{
|
||||
var m = GetCurrentMember();
|
||||
if (m != null)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(m.ToXml(doc, false).OuterXml);
|
||||
XPathNavigator nav = doc.CreateNavigator();
|
||||
return nav.Select("/node");
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static string SetProperty(string alias, object value)
|
||||
{
|
||||
string ret = "False";
|
||||
|
||||
try
|
||||
{
|
||||
var m = GetCurrentMember();
|
||||
|
||||
if (m != null)
|
||||
{
|
||||
var prop = m.getProperty(alias);
|
||||
|
||||
if (m.ContentType != null && MemberType.GetByAlias(m.ContentType.Alias).MemberCanEdit(prop.PropertyType))
|
||||
{
|
||||
|
||||
if (prop.PropertyType.ValidationRegExp.Trim() != "")
|
||||
{
|
||||
Regex regex = new Regex(m.getProperty(alias).PropertyType.ValidationRegExp);
|
||||
|
||||
if (regex.IsMatch(value.ToString()))
|
||||
{
|
||||
prop.Value = value;
|
||||
ret = "True";
|
||||
m.Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prop.Value = value;
|
||||
ret = "True";
|
||||
m.Save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ret = e.Message;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
[Obsolete("Umbraco /base is obsoleted, use WebApi (UmbracoApiController) instead for all REST based logic")]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public sealed class RestExtensionAttribute : Attribute
|
||||
{
|
||||
public string Alias { get; private set; }
|
||||
|
||||
public RestExtensionAttribute(string alias)
|
||||
{
|
||||
this.Alias = alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
[Obsolete("Umbraco /base is obsoleted, use WebApi (UmbracoApiController) instead for all REST based logic")]
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
||||
public sealed class RestExtensionMethodAttribute : Attribute
|
||||
{
|
||||
public bool AllowAll { get; set; }
|
||||
public string AllowGroup { get; set; }
|
||||
public string AllowType { get; set; }
|
||||
public string AllowMember { get; set; }
|
||||
public bool ReturnXml { get; set; }
|
||||
|
||||
public RestExtensionMethodAttribute()
|
||||
{
|
||||
this.AllowAll = true;
|
||||
this.ReturnXml = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,323 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.BaseRest;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
|
||||
namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
[Obsolete("Umbraco /base is obsoleted, use WebApi (UmbracoApiController) instead for all REST based logic")]
|
||||
class RestExtensionMethodInfo
|
||||
{
|
||||
#region Utilities
|
||||
|
||||
static readonly char[] Split = new[] { ',' };
|
||||
|
||||
static string[] SplitString(string s)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(s)
|
||||
? new string[] { }
|
||||
: s.ToLower().Split(Split, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private RestExtensionMethodInfo()
|
||||
{
|
||||
Exists = false;
|
||||
}
|
||||
|
||||
private RestExtensionMethodInfo(bool allowAll, string allowGroup, string allowType, string allowMember, bool returnXml, MethodInfo method)
|
||||
{
|
||||
Exists = true;
|
||||
_allowAll = allowAll;
|
||||
_allowGroups = SplitString(allowGroup);
|
||||
_allowTypes = SplitString(allowType);
|
||||
_allowMembers = SplitString(allowMember);
|
||||
ReturnXml = returnXml;
|
||||
_method = method;
|
||||
}
|
||||
|
||||
static readonly RestExtensionMethodInfo MissingMethod = new RestExtensionMethodInfo();
|
||||
static readonly Dictionary<string, RestExtensionMethodInfo> Cache = new Dictionary<string, RestExtensionMethodInfo>();
|
||||
|
||||
readonly bool _allowAll;
|
||||
readonly string[] _allowGroups;
|
||||
readonly string[] _allowTypes;
|
||||
readonly string[] _allowMembers;
|
||||
readonly MethodInfo _method;
|
||||
|
||||
public bool Exists { get; private set; }
|
||||
public bool ReturnXml { get; private set; }
|
||||
|
||||
#region Discovery
|
||||
|
||||
// gets a RestExtensionMethodInfo matching extensionAlias and methodName
|
||||
// by looking everywhere (configuration, attributes, legacy attributes)
|
||||
// returns MissingMethod (ie .Exists == false) if not found
|
||||
//
|
||||
public static RestExtensionMethodInfo GetMethod(string extensionAlias, string methodName, int paramsCount)
|
||||
{
|
||||
// note - legacy does not support paramsCount
|
||||
|
||||
return GetFromConfiguration(extensionAlias, methodName, paramsCount)
|
||||
?? GetFromAttribute(extensionAlias, methodName, paramsCount)
|
||||
?? MissingMethod;
|
||||
}
|
||||
|
||||
// gets a RestExtensionMethodInfo matching extensionAlias and methodName
|
||||
// by looking at the configuration file
|
||||
// returns null if not found
|
||||
//
|
||||
static RestExtensionMethodInfo GetFromConfiguration(string extensionAlias, string methodName, int paramsCount)
|
||||
{
|
||||
var config = UmbracoConfig.For.BaseRestExtensions();
|
||||
|
||||
var configExtension = config.Items[extensionAlias];
|
||||
if (configExtension == null)
|
||||
return null; // does not exist
|
||||
|
||||
var configMethod = configExtension[methodName];
|
||||
if (configMethod == null)
|
||||
return null; // does not exist
|
||||
|
||||
MethodInfo method = null;
|
||||
try
|
||||
{
|
||||
var parts = configExtension.Type.Split(',');
|
||||
if (parts.Length > 2)
|
||||
throw new Exception(string.Format("Failed to load extension '{0}', invalid type.", configExtension.Type));
|
||||
|
||||
var assembly = parts.Length == 1 ? Assembly.GetExecutingAssembly() : Assembly.Load(parts[1]);
|
||||
var type = assembly.GetType(parts[0]);
|
||||
|
||||
if (type == null)
|
||||
throw new Exception(string.Format("Could not get type \"{0}\".", parts[0]));
|
||||
|
||||
var methods = type.GetMethods()
|
||||
.Where(m => m.Name == methodName)
|
||||
.Where(m => m.GetParameters().Count() == paramsCount)
|
||||
.ToArray();
|
||||
|
||||
if (methods.Length > 1)
|
||||
throw new Exception(string.Format("Method \"{0}\" has many overloads with same number of parameters.", methodName));
|
||||
|
||||
if (methods.Length > 0)
|
||||
{
|
||||
method = methods[0];
|
||||
if (!method.IsPublic || !method.IsStatic)
|
||||
throw new Exception(string.Format("Method \"{0}\" has to be public and static.", methodName));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(string.Format("Failed to load extension '{0}', see inner exception.", configExtension.Type), e);
|
||||
}
|
||||
|
||||
if (method == null)
|
||||
return null; // does not exist
|
||||
|
||||
var info = new RestExtensionMethodInfo(configMethod.AllowAll,
|
||||
configMethod.AllowGroup, configMethod.AllowType, configMethod.AllowMember,
|
||||
configMethod.ReturnXml,
|
||||
method);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
// gets a RestExtensionMethodInfo matching extensionAlias and methodName
|
||||
// by looking for the attributes
|
||||
// returns null if not found
|
||||
//
|
||||
static RestExtensionMethodInfo GetFromAttribute(string extensionAlias, string methodName, int paramsCount)
|
||||
{
|
||||
// here we can cache because any change would trigger an app restart
|
||||
|
||||
var cacheKey = string.Format("{0}.{1}[{2}]", extensionAlias, methodName, paramsCount);
|
||||
lock (Cache)
|
||||
{
|
||||
// if it's in the cache, return
|
||||
if (Cache.ContainsKey(cacheKey))
|
||||
return Cache[cacheKey];
|
||||
}
|
||||
|
||||
// find an extension with that alias, then find a method with that name,
|
||||
// which has been properly marked with the attribute, and use the attribute
|
||||
// properties to setup a RestExtensionMethodInfo
|
||||
//
|
||||
// note: the extension may be implemented by more than one class
|
||||
|
||||
var extensions = PluginManager.Current.ResolveRestExtensions()
|
||||
.Where(type => type.GetCustomAttribute<RestExtensionAttribute>(false).Alias == extensionAlias);
|
||||
|
||||
RestExtensionMethodInfo info = null;
|
||||
|
||||
foreach (var extension in extensions) // foreach classes with extension alias
|
||||
{
|
||||
var methods = extension.GetMethods()
|
||||
.Where(m => m.Name == methodName)
|
||||
.Where(m => m.GetParameters().Count() == paramsCount)
|
||||
.ToArray();
|
||||
|
||||
if (methods.Length == 0) continue; // not implementing the method = ignore
|
||||
|
||||
if (methods.Length > 1)
|
||||
throw new Exception(string.Format("Method \"{0}\" has many overloads with same number of parameters.", methodName));
|
||||
|
||||
var method = methods[0];
|
||||
if (!method.IsPublic || !method.IsStatic)
|
||||
throw new Exception(string.Format("Method \"{0}\" has to be public and static.", methodName));
|
||||
|
||||
var attribute = method.GetCustomAttributes(typeof(RestExtensionMethodAttribute), false).Cast<RestExtensionMethodAttribute>().SingleOrDefault();
|
||||
if (attribute == null) continue; // method has not attribute = ignore
|
||||
|
||||
// got it!
|
||||
info = new RestExtensionMethodInfo(attribute.AllowAll,
|
||||
attribute.AllowGroup, attribute.AllowType, attribute.AllowMember,
|
||||
attribute.ReturnXml,
|
||||
method);
|
||||
|
||||
// cache
|
||||
lock (Cache)
|
||||
{
|
||||
Cache[cacheKey] = info;
|
||||
}
|
||||
|
||||
// got it, no need to look any further
|
||||
break;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Invoke
|
||||
|
||||
public bool CanBeInvokedByCurrentMember
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_allowAll)
|
||||
return true;
|
||||
|
||||
var member = Member.GetCurrentMember();
|
||||
|
||||
if (member == null)
|
||||
return false;
|
||||
|
||||
var allowed = false;
|
||||
|
||||
if (_allowGroups.Length > 0)
|
||||
{
|
||||
// note - assuming these are equivalent
|
||||
//var groups = member.Groups.Values.Cast<MemberGroup>().Select(group => group.Text);
|
||||
var groups = System.Web.Security.Roles.GetRolesForUser(member.LoginName);
|
||||
allowed = groups.Select(s => s.ToLower()).Intersect(_allowGroups).Any();
|
||||
}
|
||||
|
||||
if (!allowed && _allowTypes.Length > 0)
|
||||
{
|
||||
allowed = _allowTypes.Contains(member.ContentType.Alias);
|
||||
}
|
||||
|
||||
if (!allowed && _allowMembers.Length > 0)
|
||||
{
|
||||
allowed = _allowMembers.Contains(member.Id.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return allowed;
|
||||
}
|
||||
}
|
||||
|
||||
public string Invoke(string[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_method.IsPublic || !_method.IsStatic)
|
||||
{
|
||||
// ensure that method is static public
|
||||
return "<error>Method has to be public and static</error>";
|
||||
}
|
||||
|
||||
// ensure we have the right number of parameters
|
||||
if (_method.GetParameters().Length != parameters.Length)
|
||||
{
|
||||
return "<error>Not Enough parameters in url</error>";
|
||||
}
|
||||
|
||||
// invoke
|
||||
|
||||
object response;
|
||||
|
||||
if (_method.GetParameters().Length == 0)
|
||||
{
|
||||
response = _method.Invoke(null, null); // invoke with null as parameters as there are none
|
||||
}
|
||||
else
|
||||
{
|
||||
var methodParams = new object[parameters.Length];
|
||||
|
||||
var i = 0;
|
||||
|
||||
foreach (var pInfo in _method.GetParameters())
|
||||
{
|
||||
var myType = Type.GetType(pInfo.ParameterType.ToString());
|
||||
if (myType == null) throw new Exception("Failed to get type.");
|
||||
methodParams[(i)] = Convert.ChangeType(parameters[i], myType);
|
||||
i++;
|
||||
}
|
||||
|
||||
response = _method.Invoke(null, methodParams);
|
||||
}
|
||||
|
||||
// this is legacy and could probably be improved
|
||||
if (response != null)
|
||||
{
|
||||
switch (_method.ReturnType.ToString())
|
||||
{
|
||||
case "System.Xml.XPath.XPathNodeIterator":
|
||||
return ((System.Xml.XPath.XPathNodeIterator)response).Current.OuterXml;
|
||||
case "System.Xml.Linq.XDocument":
|
||||
return response.ToString();
|
||||
case "System.Xml.XmlDocument":
|
||||
var xmlDoc = (XmlDocument)response;
|
||||
var sw = new StringWriter();
|
||||
var xw = new XmlTextWriter(sw);
|
||||
xmlDoc.WriteTo(xw);
|
||||
return sw.ToString();
|
||||
default:
|
||||
var strResponse = response.ToString();
|
||||
|
||||
if (ReturnXml)
|
||||
{
|
||||
// do a quick "is this html?" check... if it is add CDATA...
|
||||
if (strResponse.Contains("<") || strResponse.Contains(">"))
|
||||
strResponse = "<![CDATA[" + strResponse + "]]>";
|
||||
return "<value>" + strResponse + "</value>";
|
||||
}
|
||||
|
||||
return strResponse;
|
||||
}
|
||||
}
|
||||
|
||||
return ReturnXml ? "<error>Null value returned</error>" : string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Overall exception handling...
|
||||
return "<error><![CDATA[MESSAGE:\n" + ex.Message + "\n\nSTACKTRACE:\n" + ex.StackTrace + "\n\nINNEREXCEPTION:\n" + ex.InnerException + "]]></error>";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -56,9 +56,6 @@ namespace Umbraco.Web.Cache
|
||||
|
||||
//Bind to data type events
|
||||
//NOTE: we need to bind to legacy and new API events currently: http://issues.umbraco.org/issue/U4-1979
|
||||
|
||||
global::umbraco.cms.businesslogic.datatype.DataTypeDefinition.AfterDelete += DataTypeDefinitionDeleting;
|
||||
global::umbraco.cms.businesslogic.datatype.DataTypeDefinition.Saving += DataTypeDefinitionSaving;
|
||||
DataTypeService.Deleted += DataTypeServiceDeleted;
|
||||
DataTypeService.Saved += DataTypeServiceSaved;
|
||||
|
||||
@@ -339,15 +336,6 @@ namespace Umbraco.Web.Cache
|
||||
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveDataTypeCache(x));
|
||||
}
|
||||
|
||||
static void DataTypeDefinitionSaving(global::umbraco.cms.businesslogic.datatype.DataTypeDefinition sender, System.EventArgs e)
|
||||
{
|
||||
DistributedCache.Instance.RefreshDataTypeCache(sender);
|
||||
}
|
||||
|
||||
static void DataTypeDefinitionDeleting(global::umbraco.cms.businesslogic.datatype.DataTypeDefinition sender, System.EventArgs e)
|
||||
{
|
||||
DistributedCache.Instance.RemoveDataTypeCache(sender);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Stylesheet and stylesheet property event handlers
|
||||
|
||||
@@ -29,19 +29,6 @@ namespace Umbraco.Web.Cache
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the custom Json payload used to refresh cache amongst the servers
|
||||
/// </summary>
|
||||
/// <param name="dataTypes"></param>
|
||||
/// <returns></returns>
|
||||
internal static string SerializeToJsonPayload(params global::umbraco.cms.businesslogic.datatype.DataTypeDefinition[] dataTypes)
|
||||
{
|
||||
var serializer = new JavaScriptSerializer();
|
||||
var items = dataTypes.Select(FromDataTypeDefinition).ToArray();
|
||||
var json = serializer.Serialize(items);
|
||||
return json;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the custom Json payload used to refresh cache amongst the servers
|
||||
/// </summary>
|
||||
@@ -55,20 +42,6 @@ namespace Umbraco.Web.Cache
|
||||
return json;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a macro to a jsonPayload object
|
||||
/// </summary>
|
||||
/// <param name="dataType"></param>
|
||||
/// <returns></returns>
|
||||
private static JsonPayload FromDataTypeDefinition(global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
|
||||
{
|
||||
var payload = new JsonPayload
|
||||
{
|
||||
UniqueId = dataType.UniqueId,
|
||||
Id = dataType.Id
|
||||
};
|
||||
return payload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a macro to a jsonPayload object
|
||||
|
||||
@@ -138,33 +138,7 @@ namespace Umbraco.Web.Cache
|
||||
#endregion
|
||||
|
||||
#region Data type cache
|
||||
/// <summary>
|
||||
/// Refreshes the cache amongst servers for a data type
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <param name="dataType"></param>
|
||||
public static void RefreshDataTypeCache(this DistributedCache dc, global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
|
||||
{
|
||||
if (dataType != null)
|
||||
{
|
||||
dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
|
||||
DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cache amongst servers for a data type
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <param name="dataType"></param>
|
||||
public static void RemoveDataTypeCache(this DistributedCache dc, global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
|
||||
{
|
||||
if (dataType != null)
|
||||
{
|
||||
dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
|
||||
DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the cache amongst servers for a data type
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(definition => definition.PropertyEditorAlias, expression => expression.MapFrom(save => save.SelectedEditor))
|
||||
.ForMember(definition => definition.ParentId, expression => expression.MapFrom(save => -1))
|
||||
.ForMember(definition => definition.DatabaseType, expression => expression.ResolveUsing<DatabaseTypeResolver>())
|
||||
.ForMember(x => x.ControlId, expression => expression.Ignore())
|
||||
.ForMember(x => x.CreatorId, expression => expression.Ignore())
|
||||
.ForMember(x => x.Level, expression => expression.Ignore())
|
||||
.ForMember(x => x.SortOrder, expression => expression.Ignore())
|
||||
|
||||
@@ -48,15 +48,6 @@ namespace Umbraco.Web
|
||||
return resolver.ResolveTypes<ITree>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all classes attributed with RestExtensionAttribute attribute
|
||||
/// </summary>
|
||||
/// <param name="resolver"></param>
|
||||
/// <returns></returns>
|
||||
internal static IEnumerable<Type> ResolveRestExtensions(this PluginManager resolver)
|
||||
{
|
||||
return resolver.ResolveAttributedTypes<Umbraco.Web.BaseRest.RestExtensionAttribute>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all classes attributed with XsltExtensionAttribute attribute
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace Umbraco.Web.Routing
|
||||
var url = NotFoundHandlerHelper.GetLegacyUrlForNotFoundHandlers();
|
||||
LogHelper.Debug<ContentFinderByNotFoundHandler<THandler>>("Running for legacy url='{0}'.", () => url);
|
||||
|
||||
if (handler.Execute(url) && handler.redirectID > 0)
|
||||
if (handler.Execute(url) && handler.RedirectId > 0)
|
||||
{
|
||||
LogHelper.Debug<ContentFinderByNotFoundHandler<THandler>>("Handler '{0}' returned id={1}.", () => type.FullName, () => handler.redirectID);
|
||||
LogHelper.Debug<ContentFinderByNotFoundHandler<THandler>>("Handler '{0}' returned id={1}.", () => type.FullName, () => handler.RedirectId);
|
||||
|
||||
var content = pcr.RoutingContext.UmbracoContext.ContentCache.GetById(handler.redirectID);
|
||||
var content = pcr.RoutingContext.UmbracoContext.ContentCache.GetById(handler.RedirectId);
|
||||
|
||||
LogHelper.Debug<ContentFinderByNotFoundHandler<THandler>>(content == null
|
||||
? "Could not find content with that id."
|
||||
|
||||
@@ -68,11 +68,11 @@ namespace Umbraco.Web.Routing
|
||||
// else it's a legacy handler: run
|
||||
|
||||
// can't find a document => continue with other handlers
|
||||
if (handler.Execute(url) == false || handler.redirectID <= 0)
|
||||
if (handler.Execute(url) == false || handler.RedirectId <= 0)
|
||||
continue;
|
||||
|
||||
// found a document ID => ensure it's a valid document
|
||||
var redirectId = handler.redirectID;
|
||||
var redirectId = handler.RedirectId;
|
||||
docRequest.PublishedContent = docRequest.RoutingContext.UmbracoContext.ContentCache.GetById(redirectId);
|
||||
|
||||
if (docRequest.HasPublishedContent == false)
|
||||
|
||||
@@ -69,11 +69,11 @@ namespace Umbraco.Web.Routing
|
||||
// else it's a legacy handler, run
|
||||
|
||||
// can't find a document => exit
|
||||
if (handler.Execute(url) == false || handler.redirectID <= 0)
|
||||
if (handler.Execute(url) == false || handler.RedirectId <= 0)
|
||||
return;
|
||||
|
||||
// found a document ID => ensure it's a valid document
|
||||
var redirectId = handler.redirectID;
|
||||
var redirectId = handler.RedirectId;
|
||||
docRequest.PublishedContent = docRequest.RoutingContext.UmbracoContext.ContentCache.GetById(redirectId);
|
||||
|
||||
if (docRequest.HasPublishedContent == false)
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace umbraco.interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for INotFoundHandler.
|
||||
/// </summary>
|
||||
public interface INotFoundHandler
|
||||
{
|
||||
bool Execute(string url);
|
||||
bool CacheUrl {get;}
|
||||
int redirectID {get;}
|
||||
}
|
||||
}
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for INotFoundHandler.
|
||||
/// </summary>
|
||||
public interface INotFoundHandler
|
||||
{
|
||||
bool Execute(string url);
|
||||
bool CacheUrl {get;}
|
||||
int RedirectId {get;}
|
||||
}
|
||||
}
|
||||
@@ -452,49 +452,7 @@ namespace Umbraco.Web.Search
|
||||
.Where(x => x.EnableDefaultEventHandler));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a content node to XDocument
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
/// <param name="cacheOnly">true if data is going to be returned from cache</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("This method is no longer used and will be removed from the core in future versions, the cacheOnly parameter has no effect. Use the other ToXDocument overload instead")]
|
||||
public static XDocument ToXDocument(Content node, bool cacheOnly)
|
||||
{
|
||||
return ToXDocument(node);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a content node to Xml
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
/// <returns></returns>
|
||||
private static XDocument ToXDocument(Content node)
|
||||
{
|
||||
if (TypeHelper.IsTypeAssignableFrom<Document>(node))
|
||||
{
|
||||
return new XDocument(((Document) node).Content.ToXml());
|
||||
}
|
||||
|
||||
if (TypeHelper.IsTypeAssignableFrom<global::umbraco.cms.businesslogic.media.Media>(node))
|
||||
{
|
||||
return new XDocument(((global::umbraco.cms.businesslogic.media.Media) node).MediaItem.ToXml());
|
||||
}
|
||||
|
||||
var xDoc = new XmlDocument();
|
||||
var xNode = xDoc.CreateNode(XmlNodeType.Element, "node", "");
|
||||
node.XmlPopulate(xDoc, ref xNode, false);
|
||||
|
||||
if (xNode.Attributes["nodeTypeAlias"] == null)
|
||||
{
|
||||
//we'll add the nodeTypeAlias ourselves
|
||||
XmlAttribute d = xDoc.CreateAttribute("nodeTypeAlias");
|
||||
d.Value = node.ContentType.Alias;
|
||||
xNode.Attributes.Append(d);
|
||||
}
|
||||
|
||||
return new XDocument(ExamineXmlExtensions.ToXElement(xNode));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,6 @@ namespace Umbraco.Web.Standalone
|
||||
|
||||
base.InitializeApplicationRootPath(_baseDirectory);
|
||||
|
||||
// this is only here to ensure references to the assemblies needed for
|
||||
// the DataTypesResolver otherwise they won't be loaded into the AppDomain.
|
||||
var interfacesAssemblyName = typeof(IDataType).Assembly.FullName;
|
||||
|
||||
// TODO there's also that one... but we don't use it in standalone?
|
||||
//using umbraco.editorControls;
|
||||
//var editorControlsAssemblyName = typeof(uploadField).Assembly.FullName;
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Strategies.DataTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Before Save Content/Media subscriber that checks for Upload fields and updates related fields accordingly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is an intermediate fix for the legacy DataTypeUploadField and the FileHandlerData, so that properties
|
||||
/// are saved correctly when using the Upload field on a (legacy) Document or Media class.
|
||||
/// </remarks>
|
||||
public class LegacyUploadFieldWorkaround : ApplicationEventHandler
|
||||
{
|
||||
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
|
||||
{
|
||||
global::umbraco.cms.businesslogic.media.Media.BeforeSave += MediaBeforeSave;
|
||||
global::umbraco.cms.businesslogic.web.Document.BeforeSave += DocumentBeforeSave;
|
||||
}
|
||||
|
||||
void DocumentBeforeSave(global::umbraco.cms.businesslogic.web.Document sender, global::umbraco.cms.businesslogic.SaveEventArgs e)
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.Any())
|
||||
{
|
||||
var property = sender.GenericProperties.FirstOrDefault(x =>x.PropertyType.DataTypeDefinition.DataType!=null && x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField));
|
||||
if (property == null)
|
||||
return;
|
||||
|
||||
|
||||
FillProperties(sender, property);
|
||||
}
|
||||
}
|
||||
|
||||
void MediaBeforeSave(global::umbraco.cms.businesslogic.media.Media sender, global::umbraco.cms.businesslogic.SaveEventArgs e)
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.Any())
|
||||
{
|
||||
var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField));
|
||||
if (property == null)
|
||||
return;
|
||||
|
||||
|
||||
FillProperties(sender, property);
|
||||
}
|
||||
}
|
||||
|
||||
private void FillProperties(global::umbraco.cms.businesslogic.Content content, global::umbraco.cms.businesslogic.property.Property property)
|
||||
{
|
||||
var uploadFieldConfigNode = UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties
|
||||
.FirstOrDefault(x => x.Alias == property.PropertyType.Alias);
|
||||
|
||||
if (uploadFieldConfigNode != null)
|
||||
{
|
||||
var fileSystem = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
|
||||
//Ensure that the Property has a Value before continuing
|
||||
if(property.Value == null)
|
||||
return;
|
||||
|
||||
var path = fileSystem.GetRelativePath(property.Value.ToString());
|
||||
|
||||
if (string.IsNullOrWhiteSpace(path) == false && fileSystem.FileExists(path))
|
||||
{
|
||||
long size;
|
||||
using (var fileStream = fileSystem.OpenFile(path))
|
||||
{
|
||||
size = fileStream.Length;
|
||||
}
|
||||
|
||||
var extension = fileSystem.GetExtension(path) != null
|
||||
? fileSystem.GetExtension(path).Substring(1).ToLowerInvariant()
|
||||
: "";
|
||||
|
||||
var isImageType = UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.InvariantContains(extension);
|
||||
|
||||
var dimensions = isImageType ? GetDimensions(path, fileSystem) : null;
|
||||
|
||||
|
||||
if (isImageType)
|
||||
{
|
||||
// only add dimensions to web images
|
||||
content.getProperty(uploadFieldConfigNode.WidthFieldAlias).Value = dimensions.Item1.ToString(CultureInfo.InvariantCulture);
|
||||
content.getProperty(uploadFieldConfigNode.HeightFieldAlias).Value = dimensions.Item2.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
content.getProperty(uploadFieldConfigNode.LengthFieldAlias).Value = size == default(long) ? string.Empty : size.ToString(CultureInfo.InvariantCulture);
|
||||
content.getProperty(uploadFieldConfigNode.ExtensionFieldAlias).Value = string.IsNullOrEmpty(extension) ? string.Empty : extension;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Tuple<int, int> GetDimensions(string path, IFileSystem fs)
|
||||
{
|
||||
|
||||
int fileWidth;
|
||||
int fileHeight;
|
||||
using (var stream = fs.OpenFile(path))
|
||||
{
|
||||
using (var image = Image.FromStream(stream))
|
||||
{
|
||||
fileWidth = image.Width;
|
||||
fileHeight = image.Height;
|
||||
}
|
||||
}
|
||||
|
||||
return new Tuple<int, int>(fileWidth, fileHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ namespace Umbraco.Web.Trees
|
||||
Constants.Applications.Settings,
|
||||
Constants.Applications.Developer,
|
||||
Constants.Applications.Members)]
|
||||
[LegacyBaseTree(typeof(loadMedia))]
|
||||
[Tree(Constants.Applications.Media, Constants.Trees.Media, "Media")]
|
||||
[PluginController("UmbracoTrees")]
|
||||
[CoreTree]
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace Umbraco.Web.Trees
|
||||
Constants.Applications.Content,
|
||||
Constants.Applications.Media,
|
||||
Constants.Applications.Members)]
|
||||
[LegacyBaseTree(typeof (loadMembers))]
|
||||
[Tree(Constants.Applications.Members, Constants.Trees.Members, "Members")]
|
||||
[PluginController("UmbracoTrees")]
|
||||
[CoreTree]
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
</Compile>
|
||||
<Compile Include="ApplicationContextExtensions.cs" />
|
||||
<Compile Include="AreaRegistrationContextExtensions.cs" />
|
||||
<Compile Include="Routing\INotFoundHandler.cs" />
|
||||
<Compile Include="Scheduling\BackgroundTaskRunner.cs" />
|
||||
<Compile Include="BatchedServerMessenger.cs" />
|
||||
<Compile Include="CacheHelperExtensions.cs" />
|
||||
@@ -512,9 +513,6 @@
|
||||
<Compile Include="UI\JavaScript\AssetInitialization.cs" />
|
||||
<Compile Include="UI\JavaScript\CssInitialization.cs" />
|
||||
<Compile Include="UI\JavaScript\DependencyPathRenderer.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\GenericProperties\GenericProperty.ascx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\create.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
@@ -687,11 +685,6 @@
|
||||
<Compile Include="Models\PartialViewMacroModel.cs" />
|
||||
<Compile Include="Models\PublishedContentBase.cs" />
|
||||
<Compile Include="Mvc\AreaRegistrationExtensions.cs" />
|
||||
<Compile Include="BaseRest\BaseRestHandler.cs" />
|
||||
<Compile Include="BaseRest\MemberRest.cs" />
|
||||
<Compile Include="BaseRest\RestExtensionAttribute.cs" />
|
||||
<Compile Include="BaseRest\RestExtensionMethodAttribute.cs" />
|
||||
<Compile Include="BaseRest\RestExtensionMethodInfo.cs" />
|
||||
<Compile Include="ContextualPublishedCacheExtensions.cs" />
|
||||
<Compile Include="Mvc\DefaultRenderMvcControllerResolver.cs" />
|
||||
<Compile Include="Mvc\QueryStringFilterAttribute.cs" />
|
||||
@@ -874,7 +867,6 @@
|
||||
<Compile Include="Routing\WebServicesRouteConstraint.cs" />
|
||||
<Compile Include="Search\ExamineSearcherModel.cs" />
|
||||
<Compile Include="Search\ExamineEvents.cs" />
|
||||
<Compile Include="Strategies\DataTypes\LegacyUploadFieldWorkaround.cs" />
|
||||
<Compile Include="Strategies\Migrations\PublishAfterUpgradeToVersionSixth.cs" />
|
||||
<Compile Include="Strategies\Publishing\UpdateCacheAfterPublish.cs" />
|
||||
<Compile Include="Strategies\Publishing\UpdateCacheAfterUnPublish.cs" />
|
||||
@@ -906,12 +898,6 @@
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\MacroCacheContent.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\wlwmanifest.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\rsd.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\moveOrCopy.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
@@ -977,7 +963,6 @@
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\templateControls\Image.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\IGetProperty.cs" />
|
||||
<Compile Include="umbraco.presentation\XsltExtensionAttribute.cs" />
|
||||
<Compile Include="UmbracoHelper.cs" />
|
||||
<Compile Include="Mvc\ViewContextExtensions.cs" />
|
||||
@@ -1117,33 +1102,10 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\actions\publish.aspx.designer.cs">
|
||||
<DependentUpon>publish.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\Blogger.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\config.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\DocumentDateComparer.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\MetaWeblog.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\api.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\remixWeblogApi.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\UmbracoMetaWeblogAPI.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\channels\wordApi.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\ContentControl.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\ContentPicker.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\ContentTypeControl.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\Images\ImageViewer.ascx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\Images\ImageViewerUpdater.asmx.cs">
|
||||
<DependentUpon>ImageViewerUpdater.asmx</DependentUpon>
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\Images\UploadMediaImage.ascx.cs">
|
||||
<DependentUpon>UploadMediaImage.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\Images\UploadMediaImage.ascx.designer.cs">
|
||||
<DependentUpon>UploadMediaImage.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\dualSelectBox.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\GenericProperties\GenericPropertyWrapper.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\GenericValidation.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\LabelButton.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\macroParameterControl.cs" />
|
||||
@@ -1166,10 +1128,8 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\controls\Tree\NodeInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\create\contentItemTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\create\contentItemTypeTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\create\CreatedPackageTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\create\DataTypeTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\create\dictionaryTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\create\macroTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\create\MediaTypeTasks.cs" />
|
||||
@@ -1249,13 +1209,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\insertMasterpagePlaceholder.aspx.designer.cs">
|
||||
<DependentUpon>insertMasterpagePlaceholder.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\mediaPicker.aspx.cs">
|
||||
<DependentUpon>mediaPicker.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\mediaPicker.aspx.designer.cs">
|
||||
<DependentUpon>mediaPicker.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\republish.aspx.cs">
|
||||
<DependentUpon>republish.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -1396,13 +1349,6 @@
|
||||
<DependentUpon>exportDocumenttype.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\imageViewer.aspx.cs">
|
||||
<DependentUpon>imageViewer.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\imageViewer.aspx.designer.cs">
|
||||
<DependentUpon>imageViewer.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\importDocumenttype.aspx.cs">
|
||||
<DependentUpon>importDocumenttype.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -1414,13 +1360,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\insertMacro.aspx.designer.cs">
|
||||
<DependentUpon>insertMacro.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\insertTable.aspx.cs">
|
||||
<DependentUpon>insertTable.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\insertTable.aspx.designer.cs">
|
||||
<DependentUpon>insertTable.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\notifications.aspx.cs">
|
||||
<DependentUpon>notifications.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -1449,13 +1388,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\sendToTranslation.aspx.designer.cs">
|
||||
<DependentUpon>sendToTranslation.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\uploadImage.aspx.cs">
|
||||
<DependentUpon>uploadImage.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\uploadImage.aspx.designer.cs">
|
||||
<DependentUpon>uploadImage.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\viewAuditTrail.aspx.cs">
|
||||
<DependentUpon>viewAuditTrail.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -1535,24 +1467,13 @@
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\templateControls\Script.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\BaseMediaTree.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\ITreeService.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadRelationTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\MediaRecycleBin.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\NodeActionsEventArgs.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeEventArgs.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeRequestParams.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\ContentExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\ContentTypeExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\DocumentExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\MediaExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\MemberExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\NodeExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\PreValueExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\RelationTypeExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\UmbracoObjectTypeExtensions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\webservices\MacroContainerService.asmx.cs">
|
||||
<DependentUpon>MacroContainerService.asmx</DependentUpon>
|
||||
<SubType>Component</SubType>
|
||||
@@ -1613,15 +1534,11 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\ContentRecycleBin.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\FileSystemTree.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadContent.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadcontentItemType.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadDataTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadDictionary.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadLanguages.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMacros.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMedia.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMediaTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMemberGroups.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMembers.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMemberTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadNodeTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadPackages.cs" />
|
||||
@@ -1734,34 +1651,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\Web\UI\ContentPage.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Content.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-DataTypes.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Dictionary.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Document.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Media.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Members.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Nodes.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-PreValues.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-UmbracoObjectType.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\viewstateMoverModule.cs" />
|
||||
<Compile Include="UmbracoApplication.cs" />
|
||||
<Compile Include="UmbracoContext.cs" />
|
||||
@@ -1821,17 +1710,12 @@
|
||||
<Content Include="umbraco.presentation\umbraco\controls\ProgressBar.ascx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\controls\Images\ImageViewerUpdater.asmx" />
|
||||
<Content Include="umbraco.presentation\umbraco\controls\Images\UploadMediaImage.ascx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\actions\delete.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\actions\editContent.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\actions\preview.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\actions\publish.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\mediaPicker.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\webservices\MacroContainerService.asmx" />
|
||||
<Content Include="umbraco.presentation\umbraco\developer\Xslt\xsltVisualize.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\empty.htm" />
|
||||
@@ -1862,12 +1746,10 @@
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\exportDocumenttype.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\imageViewer.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\importDocumenttype.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\insertMacro.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\insertTable.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\notifications.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
@@ -1876,7 +1758,6 @@
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\sendToTranslation.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\uploadImage.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\viewAuditTrail.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\members\ViewMembers.aspx" />
|
||||
<None Include="app.config" />
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user