Adding old client dependency as a wrapper class to the new client dependency framework. Please DO NOT use the attribute umbraco.cms.businesslogic.datatype.ClientDependencyAttribute, it's obsolete.
[TFS Changeset #65140]
This commit is contained in:
102
umbraco/cms/businesslogic/datatype/ClientDependencyAttribute.cs
Normal file
102
umbraco/cms/businesslogic/datatype/ClientDependencyAttribute.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using ClientDependency.Core.Controls;
|
||||
|
||||
namespace umbraco.cms.businesslogic.datatype
|
||||
{
|
||||
/// <summary>
|
||||
/// This attribute is used for data types that uses client assets like Javascript and CSS for liveediting.
|
||||
/// The Live Editing feature in umbraco will look for this attribute and preload all dependencies to the page
|
||||
/// to ensure that all client events and assets gets loaded
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
[Obsolete("Use the new ClientDependency framework. Priority and InvokeJavascriptMethodOnLoad are ignored. Documentation here: http://clientdependency.codeplex.com/documentation")]
|
||||
public class ClientDependencyAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
[Obsolete("This property is ignored")]
|
||||
public int Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the file path.
|
||||
/// </summary>
|
||||
/// <value>The file path.</value>
|
||||
public string FilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the dependency.
|
||||
/// </summary>
|
||||
/// <value>The type of the dependency.</value>
|
||||
public ClientDependencyType DependencyType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of an optional javascript method that should be called on load.
|
||||
/// </summary>
|
||||
/// <value>The name of the method.</value>
|
||||
[Obsolete("This property is ignored")]
|
||||
public string InvokeJavascriptMethodOnLoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="priority">The priority.</param>
|
||||
/// <param name="dependencyType">Type of the dependency.</param>
|
||||
/// <param name="filePath">The file path to the dependency.</param>
|
||||
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath)
|
||||
: this(priority, dependencyType, filePath, false, string.Empty)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="priority">The priority.</param>
|
||||
/// <param name="dependencyType">Type of the dependency.</param>
|
||||
/// <param name="filePath">The file path to the dependency.</param>
|
||||
/// <param name="invokeJavascriptMethodOnLoad">The name of the Javascript method to invoke when the dependency is loaded.</param>
|
||||
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath, string invokeJavascriptMethodOnLoad)
|
||||
: this(priority, dependencyType, filePath, false, invokeJavascriptMethodOnLoad)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="priority">The priority.</param>
|
||||
/// <param name="dependencyType">Type of the dependency.</param>
|
||||
/// <param name="filePath">The file path to the dependency.</param>
|
||||
/// <param name="appendUmbracoPath">if set to <c>true</c> the current umbraco path will be prefixed to the filePath.</param>
|
||||
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath, bool appendUmbracoPath)
|
||||
: this(priority, dependencyType, filePath, appendUmbracoPath, String.Empty)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ClientDependencyAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="priority">The priority.</param>
|
||||
/// <param name="dependencyType">Type of the dependency.</param>
|
||||
/// <param name="filePath">The file path to the dependency.</param>
|
||||
/// <param name="appendUmbracoPath">if set to <c>true</c> the current umbraco path will be prefixed to the filePath.</param>
|
||||
/// <param name="invokeJavascriptMethodOnLoad">The name of the Javascript method to invoke when the dependency is loaded.</param>
|
||||
public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string filePath, bool appendUmbracoPath, string invokeJavascriptMethodOnLoad)
|
||||
{
|
||||
if (String.IsNullOrEmpty(filePath))
|
||||
throw new ArgumentException("filePath");
|
||||
|
||||
Priority = priority;
|
||||
FilePath = appendUmbracoPath ? GlobalSettings.Path + "/" + filePath : filePath;
|
||||
DependencyType = dependencyType;
|
||||
InvokeJavascriptMethodOnLoad = invokeJavascriptMethodOnLoad ?? String.Empty;
|
||||
|
||||
ClientDependencyLoader.Instance.RegisterDependency(FilePath, DependencyType == ClientDependencyType.Css ? ClientDependency.Core.ClientDependencyType.Css : ClientDependency.Core.ClientDependencyType.Javascript);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of client file
|
||||
/// </summary>
|
||||
public enum ClientDependencyType
|
||||
{
|
||||
Javascript, Css
|
||||
}
|
||||
}
|
||||
@@ -87,10 +87,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\foreign dlls\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lucene.Net, Version=2.0.0.4, Culture=neutral">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\foreign dlls\Lucene.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
@@ -174,6 +170,7 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Actions\IActionHandler.cs" />
|
||||
<Compile Include="businesslogic\datatype\ClientDependencyAttribute.cs" />
|
||||
<Compile Include="businesslogic\Packager\FileResources\PackageFiles.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
Reference in New Issue
Block a user